@bscotch/stitch
Version:
Stitch: The GameMaker Studio 2 Asset Pipeline Development Kit.
42 lines • 1.21 kB
JavaScript
/** Information about a GML token, including where its references are. */
export class GmlTokenSummary {
token;
project;
_references = [];
constructor(token, project, options) {
this.token = token;
this.project = project;
this._references = [
...this.findRefsInScripts(options),
...this.findRefsInObjects(options),
];
}
get references() {
return [...this._references];
}
findRefsInScripts(options) {
const refs = [];
this.project.resources.scripts.forEach((script) => {
refs.push(...script.findTokenReferences(this.token, {
suffix: options?.versionSuffix,
}));
});
return refs;
}
findRefsInObjects(options) {
const refs = [];
this.project.resources.objects.forEach((object) => {
refs.push(...object.findTokenReferences(this.token, {
suffix: options?.versionSuffix,
}));
});
return refs;
}
toJSON() {
return {
token: this.token,
references: this.references,
};
}
}
//# sourceMappingURL=GmlTokenSummary.js.map