@bscotch/gamemaker-project 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +29 -0
- package/README.md +138 -2
- package/dist/asset.d.ts +114 -0
- package/dist/asset.d.ts.map +1 -0
- package/dist/asset.js +259 -0
- package/dist/asset.js.map +1 -0
- package/dist/discovery.d.ts +25 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +33 -0
- package/dist/discovery.js.map +1 -0
- package/dist/import.d.ts +90 -0
- package/dist/import.d.ts.map +1 -0
- package/dist/import.js +197 -0
- package/dist/import.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/objectEvents.d.ts +36 -0
- package/dist/objectEvents.d.ts.map +1 -0
- package/dist/objectEvents.js +140 -0
- package/dist/objectEvents.js.map +1 -0
- package/dist/project.d.ts +187 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +732 -0
- package/dist/project.js.map +1 -0
- package/dist/project.state.d.ts +220 -0
- package/dist/project.state.d.ts.map +1 -0
- package/dist/project.state.js +718 -0
- package/dist/project.state.js.map +1 -0
- package/dist/refs.d.ts +20 -0
- package/dist/refs.d.ts.map +1 -0
- package/dist/refs.js +53 -0
- package/dist/refs.js.map +1 -0
- package/dist/shaderDefaults.d.ts +3 -0
- package/dist/shaderDefaults.d.ts.map +1 -0
- package/dist/shaderDefaults.js +32 -0
- package/dist/shaderDefaults.js.map +1 -0
- package/dist/spine.d.ts +20 -0
- package/dist/spine.d.ts.map +1 -0
- package/dist/spine.js +47 -0
- package/dist/spine.js.map +1 -0
- package/dist/spine.types.d.ts +89 -0
- package/dist/spine.types.d.ts.map +1 -0
- package/dist/spine.types.js +2 -0
- package/dist/spine.types.js.map +1 -0
- package/dist/transaction.d.ts +91 -0
- package/dist/transaction.d.ts.map +1 -0
- package/dist/transaction.js +203 -0
- package/dist/transaction.js.map +1 -0
- package/dist/util.d.ts +56 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +163 -0
- package/dist/util.js.map +1 -0
- package/package.json +45 -3
package/dist/import.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Asset, AssetKind } from './asset.ts';
|
|
2
|
+
import type { GameMakerProject } from './project.ts';
|
|
3
|
+
export interface AssetDependency {
|
|
4
|
+
/**
|
|
5
|
+
* - `parent`: an object's parent object
|
|
6
|
+
* - `ref`: any other reference in the yy file (an object's sprite, a room's objects, ...)
|
|
7
|
+
* - `code`: a reference in GML code (provided by a code-aware layer)
|
|
8
|
+
*/
|
|
9
|
+
relationship: 'parent' | 'ref' | 'code';
|
|
10
|
+
requiredBy: {
|
|
11
|
+
name: string;
|
|
12
|
+
kind: AssetKind;
|
|
13
|
+
};
|
|
14
|
+
requirement: {
|
|
15
|
+
name: string;
|
|
16
|
+
kind: AssetKind;
|
|
17
|
+
};
|
|
18
|
+
/** For `code` dependencies, the referenced symbol */
|
|
19
|
+
symbol?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ImportOptions {
|
|
22
|
+
/** Import the assets in this folder (and its subfolders) of the source project */
|
|
23
|
+
sourceFolder?: string;
|
|
24
|
+
/** Import just this asset */
|
|
25
|
+
sourceAsset?: string;
|
|
26
|
+
/** The folder to import into. Defaults to `sourceFolder`. */
|
|
27
|
+
targetFolder?: string;
|
|
28
|
+
/** Only import assets of these kinds */
|
|
29
|
+
kinds?: AssetKind[];
|
|
30
|
+
/**
|
|
31
|
+
* What to do about dependencies of the imported assets that are in neither
|
|
32
|
+
* the import nor the target project:
|
|
33
|
+
* - `error` (default): abort the import
|
|
34
|
+
* - `skip`: import anyway
|
|
35
|
+
* - `include`: import them too (recursively)
|
|
36
|
+
*/
|
|
37
|
+
onMissingDependency?: 'error' | 'skip' | 'include';
|
|
38
|
+
/**
|
|
39
|
+
* Extra dependencies, such as code dependencies found by a code-aware
|
|
40
|
+
* layer. Dependencies found in yy files are added automatically.
|
|
41
|
+
*/
|
|
42
|
+
dependencies?: AssetDependency[];
|
|
43
|
+
/**
|
|
44
|
+
* For `code` dependencies: whether the target project already defines a
|
|
45
|
+
* symbol (so the dependency isn't missing). By default, only assets count.
|
|
46
|
+
*/
|
|
47
|
+
targetHasSymbol?: (name: string) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Called for each target asset that would be replaced by an imported one.
|
|
50
|
+
* Return a reason to block the import (e.g. because other code in the
|
|
51
|
+
* target needs something only the old version defines).
|
|
52
|
+
*/
|
|
53
|
+
checkReplacement?: (source: Asset, target: Asset) => string | undefined;
|
|
54
|
+
}
|
|
55
|
+
export interface ImportConflict {
|
|
56
|
+
asset: string;
|
|
57
|
+
reason: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ImportResult {
|
|
60
|
+
created: string[];
|
|
61
|
+
replaced: string[];
|
|
62
|
+
/** Missing dependencies that were not imported (with `onMissingDependency: 'skip'`) */
|
|
63
|
+
missing: AssetDependency[];
|
|
64
|
+
}
|
|
65
|
+
export declare class ImportError extends Error {
|
|
66
|
+
readonly conflicts: ImportConflict[];
|
|
67
|
+
readonly missing: AssetDependency[];
|
|
68
|
+
constructor(message: string, details: {
|
|
69
|
+
conflicts?: ImportConflict[];
|
|
70
|
+
missing?: AssetDependency[];
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** List the dependencies between a project's assets found in their yy files */
|
|
74
|
+
export declare function listYyDependencies(project: GameMakerProject): AssetDependency[];
|
|
75
|
+
/**
|
|
76
|
+
* Plan an import: which assets would be imported, and what's missing or in
|
|
77
|
+
* conflict. Doesn't change anything.
|
|
78
|
+
*/
|
|
79
|
+
export declare function planImport(source: GameMakerProject, target: GameMakerProject, options?: ImportOptions): {
|
|
80
|
+
assets: Asset[];
|
|
81
|
+
missing: AssetDependency[];
|
|
82
|
+
conflicts: ImportConflict[];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Import assets from one project into another, as one transaction. Assets
|
|
86
|
+
* that already exist in the target (with the same name and kind) are
|
|
87
|
+
* replaced.
|
|
88
|
+
*/
|
|
89
|
+
export declare function importAssets(source: GameMakerProject, target: GameMakerProject, options?: ImportOptions): Promise<ImportResult>;
|
|
90
|
+
//# sourceMappingURL=import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../src/import.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIrD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,YAAY,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACxC,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;IAC9C,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;IAC/C,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACnD;;;OAGG;IACH,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C;;;;OA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{ Yy } from '@bscotch/yy';
|
|
5
|
+
import fs from 'node:fs/promises';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { listReferencedPaths } from "./refs.js";
|
|
8
|
+
import { assert, folderPathToPosix, key } from "./util.js";
|
|
9
|
+
export class ImportError extends Error {
|
|
10
|
+
conflicts;
|
|
11
|
+
missing;
|
|
12
|
+
constructor(message, details) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'ImportError';
|
|
15
|
+
this.conflicts = details.conflicts || [];
|
|
16
|
+
this.missing = details.missing || [];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** List the dependencies between a project's assets found in their yy files */
|
|
20
|
+
export function listYyDependencies(project) {
|
|
21
|
+
const byPath = new Map(project.listAssets().map((a) => [key(a.id.path), a]));
|
|
22
|
+
const deps = [];
|
|
23
|
+
for (const asset of project.assets) {
|
|
24
|
+
const parent = asset.parentName && project.getAsset(asset.parentName);
|
|
25
|
+
for (const refPath of listReferencedPaths(asset.yy)) {
|
|
26
|
+
const requirement = byPath.get(refPath);
|
|
27
|
+
if (!requirement || requirement === asset)
|
|
28
|
+
continue;
|
|
29
|
+
deps.push({
|
|
30
|
+
relationship: requirement === parent ? 'parent' : 'ref',
|
|
31
|
+
requiredBy: { name: asset.name, kind: asset.kind },
|
|
32
|
+
requirement: { name: requirement.name, kind: requirement.kind },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return deps;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Plan an import: which assets would be imported, and what's missing or in
|
|
40
|
+
* conflict. Doesn't change anything.
|
|
41
|
+
*/
|
|
42
|
+
export function planImport(source, target, options = {}) {
|
|
43
|
+
assert(!(options.sourceFolder && options.sourceAsset), 'Specify sourceFolder or sourceAsset, not both');
|
|
44
|
+
const intended = new Map();
|
|
45
|
+
if (options.sourceAsset) {
|
|
46
|
+
const asset = source.requireAsset(options.sourceAsset);
|
|
47
|
+
intended.set(key(asset.name), asset);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
for (const asset of source.assets) {
|
|
51
|
+
if (!options.sourceFolder || asset.isInFolder(options.sourceFolder)) {
|
|
52
|
+
intended.set(key(asset.name), asset);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (options.kinds?.length) {
|
|
57
|
+
for (const [name, asset] of intended) {
|
|
58
|
+
if (!options.kinds.includes(asset.kind))
|
|
59
|
+
intended.delete(name);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const depsByAsset = new Map();
|
|
63
|
+
for (const dep of [
|
|
64
|
+
...listYyDependencies(source),
|
|
65
|
+
...(options.dependencies || []),
|
|
66
|
+
]) {
|
|
67
|
+
const k = key(dep.requiredBy.name);
|
|
68
|
+
if (!depsByAsset.has(k))
|
|
69
|
+
depsByAsset.set(k, []);
|
|
70
|
+
depsByAsset.get(k).push(dep);
|
|
71
|
+
}
|
|
72
|
+
const toImport = new Map(intended);
|
|
73
|
+
const missing = [];
|
|
74
|
+
const conflicts = [];
|
|
75
|
+
const queue = [...intended.values()];
|
|
76
|
+
while (queue.length) {
|
|
77
|
+
const asset = queue.pop();
|
|
78
|
+
for (const dep of depsByAsset.get(key(asset.name)) || []) {
|
|
79
|
+
const name = dep.requirement.name;
|
|
80
|
+
if (toImport.has(key(name)))
|
|
81
|
+
continue;
|
|
82
|
+
const inTarget = target.getAsset(name);
|
|
83
|
+
if (inTarget) {
|
|
84
|
+
if (dep.relationship !== 'code' &&
|
|
85
|
+
inTarget.kind !== dep.requirement.kind) {
|
|
86
|
+
conflicts.push({
|
|
87
|
+
asset: name,
|
|
88
|
+
reason: `"${asset.name}" needs ${dep.requirement.kind} "${name}", but the target's "${name}" is ${inTarget.kind}`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (dep.relationship === 'code' &&
|
|
94
|
+
dep.symbol &&
|
|
95
|
+
options.targetHasSymbol?.(dep.symbol)) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
missing.push(dep);
|
|
99
|
+
const required = source.getAsset(name);
|
|
100
|
+
if (options.onMissingDependency === 'include' && required) {
|
|
101
|
+
toImport.set(key(name), required);
|
|
102
|
+
queue.push(required);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (const asset of toImport.values()) {
|
|
107
|
+
const existing = target.getAsset(asset.name);
|
|
108
|
+
if (!existing)
|
|
109
|
+
continue;
|
|
110
|
+
if (existing.kind !== asset.kind) {
|
|
111
|
+
conflicts.push({
|
|
112
|
+
asset: asset.name,
|
|
113
|
+
reason: `The target already has a ${existing.kind} named "${existing.name}"`,
|
|
114
|
+
});
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const reason = options.checkReplacement?.(asset, existing);
|
|
118
|
+
if (reason)
|
|
119
|
+
conflicts.push({ asset: asset.name, reason });
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
assets: [...toImport.values()],
|
|
123
|
+
missing: options.onMissingDependency === 'include' ? [] : missing,
|
|
124
|
+
conflicts,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Import assets from one project into another, as one transaction. Assets
|
|
129
|
+
* that already exist in the target (with the same name and kind) are
|
|
130
|
+
* replaced.
|
|
131
|
+
*/
|
|
132
|
+
export async function importAssets(source, target, options = {}) {
|
|
133
|
+
const plan = planImport(source, target, options);
|
|
134
|
+
if (plan.conflicts.length) {
|
|
135
|
+
throw new ImportError(`Cannot import: ${plan.conflicts.length} conflict(s). ${plan.conflicts
|
|
136
|
+
.map((c) => `${c.asset}: ${c.reason}`)
|
|
137
|
+
.join('; ')}`, { conflicts: plan.conflicts });
|
|
138
|
+
}
|
|
139
|
+
const onMissing = options.onMissingDependency || 'error';
|
|
140
|
+
if (plan.missing.length && onMissing === 'error') {
|
|
141
|
+
throw new ImportError(`Cannot import: missing dependencies: ${[
|
|
142
|
+
...new Set(plan.missing.map((d) => d.requirement.name)),
|
|
143
|
+
].join(', ')}`, { missing: plan.missing });
|
|
144
|
+
}
|
|
145
|
+
const sourceFolder = folderPathToPosix(options.sourceFolder || '');
|
|
146
|
+
const targetFolder = folderPathToPosix(options.targetFolder || sourceFolder);
|
|
147
|
+
const result = {
|
|
148
|
+
created: [],
|
|
149
|
+
replaced: [],
|
|
150
|
+
missing: plan.missing,
|
|
151
|
+
};
|
|
152
|
+
await target.transaction(async (tx) => {
|
|
153
|
+
const yyp = await tx.yyp();
|
|
154
|
+
for (const asset of plan.assets) {
|
|
155
|
+
let folder = asset.folder;
|
|
156
|
+
if (sourceFolder && key(folder) === key(sourceFolder)) {
|
|
157
|
+
folder = targetFolder;
|
|
158
|
+
}
|
|
159
|
+
else if (sourceFolder &&
|
|
160
|
+
key(folder).startsWith(key(`${sourceFolder}/`))) {
|
|
161
|
+
folder = `${targetFolder}/${folder.slice(sourceFolder.length + 1)}`;
|
|
162
|
+
}
|
|
163
|
+
const existing = target.getAsset(asset.name);
|
|
164
|
+
const dir = path.join(target.dir, asset.kind, asset.name);
|
|
165
|
+
if (existing) {
|
|
166
|
+
// Keep the old version until the import succeeds
|
|
167
|
+
const backup = `${existing.dir}.stitch-backup`;
|
|
168
|
+
await fs.rm(backup, { recursive: true, force: true });
|
|
169
|
+
await tx.rename(existing.dir, backup);
|
|
170
|
+
tx.deleteOnCommit(backup);
|
|
171
|
+
result.replaced.push(asset.name);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
result.created.push(asset.name);
|
|
175
|
+
}
|
|
176
|
+
await tx.copyDir(asset.dir, dir);
|
|
177
|
+
const yy = Yy.parse(await fs.readFile(asset.yyPath, 'utf8'));
|
|
178
|
+
yy.parent = await tx.ensureFolder(folder);
|
|
179
|
+
tx.stageYy(path.join(dir, path.basename(asset.yyPath)), asset.kind, yy);
|
|
180
|
+
const id = {
|
|
181
|
+
name: asset.name,
|
|
182
|
+
path: `${asset.kind}/${asset.name}/${path.basename(asset.yyPath)}`,
|
|
183
|
+
};
|
|
184
|
+
const listed = yyp.resources.find((r) => key(r.id.name) === key(asset.name));
|
|
185
|
+
if (listed)
|
|
186
|
+
listed.id = id;
|
|
187
|
+
else
|
|
188
|
+
yyp.resources.push({ id });
|
|
189
|
+
if (asset.kind === 'rooms' &&
|
|
190
|
+
!yyp.RoomOrderNodes.some((n) => key(n.roomId.name) === key(asset.name))) {
|
|
191
|
+
yyp.RoomOrderNodes.push({ roomId: { ...id } });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../src/import.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AA8D3D,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,SAAS,CAAmB;IAC5B,OAAO,CAAoB;IACpC,YACE,OAAe,EACf,OAAsE;QAEtE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACvC,CAAC;CACF;AAED,+EAA+E;AAC/E,MAAM,UAAU,kBAAkB,CAChC,OAAyB;IAEzB,MAAM,MAAM,GAAG,IAAI,GAAG,CACp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,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EACvE,CAAC;gBACD,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Asset, instanceLayers, type AssetKind, type AssetRef, type ObjectEventFile, type RoomInstanceInfo, } from './asset.ts';
|
|
2
|
+
export * from './discovery.ts';
|
|
3
|
+
export * from './import.ts';
|
|
4
|
+
export * from './objectEvents.ts';
|
|
5
|
+
export { GameMakerProject, type DeleteAssetResult } from './project.ts';
|
|
6
|
+
export type { AssetChange, GameMakerProjectOptions, ProjectEventMap, ProjectEventName, } from './project.state.ts';
|
|
7
|
+
export { listReferencedPaths, referencesPath, replaceRefs } from './refs.ts';
|
|
8
|
+
export * from './spine.ts';
|
|
9
|
+
export { ProjectTransaction, type ParentRef } from './transaction.ts';
|
|
10
|
+
export { folderPathToPosix, folderPathToYy, GameMakerProjectError, getPngSize, isValidIdentifier, } from './util.ts';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,cAAc,EACd,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,YAAY,CAAC;AACpB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxE,YAAY,EACV,WAAW,EACX,uBAAuB,EACvB,eAAe,EACf,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7E,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,iBAAiB,GAClB,MAAM,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Asset, instanceLayers, } from "./asset.js";
|
|
2
|
+
export * from "./discovery.js";
|
|
3
|
+
export * from "./import.js";
|
|
4
|
+
export * from "./objectEvents.js";
|
|
5
|
+
export { GameMakerProject } from "./project.js";
|
|
6
|
+
export { listReferencedPaths, referencesPath, replaceRefs } from "./refs.js";
|
|
7
|
+
export * from "./spine.js";
|
|
8
|
+
export { ProjectTransaction } from "./transaction.js";
|
|
9
|
+
export { folderPathToPosix, folderPathToYy, GameMakerProjectError, getPngSize, isValidIdentifier, } from "./util.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,cAAc,GAKf,MAAM,YAAY,CAAC;AACpB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAA0B,MAAM,cAAc,CAAC;AAOxE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7E,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAkB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,iBAAiB,GAClB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GameMaker object events: how they are identified in an object's yy file
|
|
3
|
+
* (`eventType` + `eventNum`), the names of their GML files, and
|
|
4
|
+
* human-friendly labels.
|
|
5
|
+
*/
|
|
6
|
+
export interface ObjectEvent {
|
|
7
|
+
/** Human-friendly name, e.g. `Draw GUI` */
|
|
8
|
+
label: string;
|
|
9
|
+
/** The event's GML file name, without extension, e.g. `Draw_64` */
|
|
10
|
+
name: string;
|
|
11
|
+
eventType: number;
|
|
12
|
+
eventNum: number;
|
|
13
|
+
/** Category, for grouping in UIs */
|
|
14
|
+
group: string;
|
|
15
|
+
/** For collision events, the name of the other object */
|
|
16
|
+
collisionObject?: string;
|
|
17
|
+
}
|
|
18
|
+
/** The file-name prefix for each yy `eventType` */
|
|
19
|
+
export declare const eventTypeNames: readonly ["Create", "Destroy", "Alarm", "Step", "Collision", "Keyboard", "Mouse", "Other", "Draw", "KeyPress", "KeyRelease", "Trigger", "CleanUp", "Gesture", "PreCreate"];
|
|
20
|
+
export type EventTypeName = (typeof eventTypeNames)[number];
|
|
21
|
+
/**
|
|
22
|
+
* The commonly used events, with labels matching the GameMaker IDE.
|
|
23
|
+
* Events not listed here (e.g. keyboard events) are still supported,
|
|
24
|
+
* with generated labels.
|
|
25
|
+
*/
|
|
26
|
+
export declare const objectEvents: readonly ObjectEvent[];
|
|
27
|
+
/**
|
|
28
|
+
* Get the event info for a given yy `eventType`/`eventNum`. Collision events
|
|
29
|
+
* need the name of the other object, since their files are named after it.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getEvent(eventType: number, eventNum: number, collisionObject?: string): ObjectEvent | undefined;
|
|
32
|
+
/** Get the event info from its GML file name (with or without `.gml`) */
|
|
33
|
+
export declare function getEventFromFilename(filename: string): ObjectEvent | undefined;
|
|
34
|
+
/** Get the event info from its human-friendly label */
|
|
35
|
+
export declare function getEventFromLabel(label: string): ObjectEvent | undefined;
|
|
36
|
+
//# sourceMappingURL=objectEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectEvents.d.ts","sourceRoot":"","sources":["../src/objectEvents.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,mDAAmD;AACnD,eAAO,MAAM,cAAc,4KAgBjB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAmB5D;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,WAAW,EA8C7C,CAAC;AAKH;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,MAAM,GACvB,WAAW,GAAG,SAAS,CAiBzB;AAED,yEAAyE;AACzE,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,GACf,WAAW,GAAG,SAAS,CAWzB;AAED,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAIxE"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GameMaker object events: how they are identified in an object's yy file
|
|
3
|
+
* (`eventType` + `eventNum`), the names of their GML files, and
|
|
4
|
+
* human-friendly labels.
|
|
5
|
+
*/
|
|
6
|
+
/** The file-name prefix for each yy `eventType` */
|
|
7
|
+
export const eventTypeNames = [
|
|
8
|
+
'Create',
|
|
9
|
+
'Destroy',
|
|
10
|
+
'Alarm',
|
|
11
|
+
'Step',
|
|
12
|
+
'Collision',
|
|
13
|
+
'Keyboard',
|
|
14
|
+
'Mouse',
|
|
15
|
+
'Other',
|
|
16
|
+
'Draw',
|
|
17
|
+
'KeyPress',
|
|
18
|
+
'KeyRelease',
|
|
19
|
+
'Trigger',
|
|
20
|
+
'CleanUp',
|
|
21
|
+
'Gesture',
|
|
22
|
+
'PreCreate',
|
|
23
|
+
];
|
|
24
|
+
const COLLISION = 4;
|
|
25
|
+
function event(label, eventType, eventNum, group) {
|
|
26
|
+
return {
|
|
27
|
+
label,
|
|
28
|
+
name: `${eventTypeNames[eventType]}_${eventNum}`,
|
|
29
|
+
eventType,
|
|
30
|
+
eventNum,
|
|
31
|
+
group,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The commonly used events, with labels matching the GameMaker IDE.
|
|
36
|
+
* Events not listed here (e.g. keyboard events) are still supported,
|
|
37
|
+
* with generated labels.
|
|
38
|
+
*/
|
|
39
|
+
export const objectEvents = Object.freeze([
|
|
40
|
+
event('Create', 0, 0, 'main'),
|
|
41
|
+
event('Destroy', 1, 0, 'cleanup'),
|
|
42
|
+
event('CleanUp', 12, 0, 'cleanup'),
|
|
43
|
+
event('Room Start', 7, 4, 'other'),
|
|
44
|
+
event('Room End', 7, 5, 'other'),
|
|
45
|
+
event('Game Start', 7, 2, 'other'),
|
|
46
|
+
event('Game End', 7, 3, 'other'),
|
|
47
|
+
event('Pre-Draw', 8, 76, 'draw'),
|
|
48
|
+
event('Draw Begin', 8, 72, 'draw'),
|
|
49
|
+
event('Draw', 8, 0, 'draw'),
|
|
50
|
+
event('Draw End', 8, 73, 'draw'),
|
|
51
|
+
event('Post-Draw', 8, 77, 'draw'),
|
|
52
|
+
event('Draw GUI Begin', 8, 74, 'draw-gui'),
|
|
53
|
+
event('Draw GUI', 8, 64, 'draw-gui'),
|
|
54
|
+
event('Draw GUI End', 8, 75, 'draw-gui'),
|
|
55
|
+
event('Begin Step', 3, 1, 'step'),
|
|
56
|
+
event('Step', 3, 0, 'step'),
|
|
57
|
+
event('End Step', 3, 2, 'step'),
|
|
58
|
+
...Array.from({ length: 16 }, (_, i) => event(`User Event ${i}`, 7, i + 10, 'user')),
|
|
59
|
+
event('Outside Room', 7, 0, 'other'),
|
|
60
|
+
event('Intersect Boundary', 7, 1, 'other'),
|
|
61
|
+
event('Animation End', 7, 7, 'other'),
|
|
62
|
+
event('Path Ended', 7, 8, 'other'),
|
|
63
|
+
event('Animation Update', 7, 58, 'animation'),
|
|
64
|
+
event('Animation Event', 7, 59, 'animation'),
|
|
65
|
+
event('Async - Image Loaded', 7, 60, 'async'),
|
|
66
|
+
event('Async - HTTP', 7, 62, 'async'),
|
|
67
|
+
event('Async - Dialog', 7, 63, 'async'),
|
|
68
|
+
event('Async - IAP', 7, 66, 'async'),
|
|
69
|
+
event('Async - Cloud', 7, 67, 'async'),
|
|
70
|
+
event('Async - Networking', 7, 68, 'async'),
|
|
71
|
+
event('Async - Steam', 7, 69, 'async'),
|
|
72
|
+
event('Async - Social', 7, 70, 'async'),
|
|
73
|
+
event('Async - Push Notification', 7, 71, 'async'),
|
|
74
|
+
event('Async - Save/Load', 7, 72, 'async'),
|
|
75
|
+
event('Async - Audio Recording', 7, 73, 'async'),
|
|
76
|
+
event('Async - Audio Playback', 7, 74, 'async'),
|
|
77
|
+
event('Async - System', 7, 75, 'async'),
|
|
78
|
+
event('Broadcast Message', 7, 76, 'broadcast message'),
|
|
79
|
+
event('Global Left Released', 6, 56, 'mouse'),
|
|
80
|
+
event('Global Right Released', 6, 57, 'mouse'),
|
|
81
|
+
event('Global Middle Released', 6, 58, 'mouse'),
|
|
82
|
+
...Array.from({ length: 12 }, (_, i) => event(`Alarm ${i}`, 2, i, 'alarm')),
|
|
83
|
+
]);
|
|
84
|
+
const byName = new Map(objectEvents.map((e) => [e.name.toLowerCase(), e]));
|
|
85
|
+
const byLabel = new Map(objectEvents.map((e) => [e.label.toLowerCase(), e]));
|
|
86
|
+
/**
|
|
87
|
+
* Get the event info for a given yy `eventType`/`eventNum`. Collision events
|
|
88
|
+
* need the name of the other object, since their files are named after it.
|
|
89
|
+
*/
|
|
90
|
+
export function getEvent(eventType, eventNum, collisionObject) {
|
|
91
|
+
if (eventType === COLLISION) {
|
|
92
|
+
if (!collisionObject)
|
|
93
|
+
return undefined;
|
|
94
|
+
return collisionEvent(collisionObject);
|
|
95
|
+
}
|
|
96
|
+
const typeName = eventTypeNames[eventType];
|
|
97
|
+
if (!typeName)
|
|
98
|
+
return undefined;
|
|
99
|
+
const name = `${typeName}_${eventNum}`;
|
|
100
|
+
return (byName.get(name.toLowerCase()) || {
|
|
101
|
+
label: `${typeName} ${eventNum}`,
|
|
102
|
+
name,
|
|
103
|
+
eventType,
|
|
104
|
+
eventNum,
|
|
105
|
+
group: typeName.toLowerCase(),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/** Get the event info from its GML file name (with or without `.gml`) */
|
|
109
|
+
export function getEventFromFilename(filename) {
|
|
110
|
+
const name = filename.replace(/^.*[/\\]/, '').replace(/\.gml$/i, '');
|
|
111
|
+
const match = name.match(/^(?<type>[a-zA-Z]+)_(?<rest>.+)$/);
|
|
112
|
+
if (!match)
|
|
113
|
+
return undefined;
|
|
114
|
+
const typeIndex = eventTypeNames.findIndex((t) => t.toLowerCase() === match.groups.type.toLowerCase());
|
|
115
|
+
if (typeIndex < 0)
|
|
116
|
+
return undefined;
|
|
117
|
+
if (typeIndex === COLLISION)
|
|
118
|
+
return collisionEvent(match.groups.rest);
|
|
119
|
+
if (!/^\d+$/.test(match.groups.rest))
|
|
120
|
+
return undefined;
|
|
121
|
+
return getEvent(typeIndex, Number(match.groups.rest));
|
|
122
|
+
}
|
|
123
|
+
/** Get the event info from its human-friendly label */
|
|
124
|
+
export function getEventFromLabel(label) {
|
|
125
|
+
const collision = label.match(/^Collision \((?<name>.+)\)$/);
|
|
126
|
+
if (collision)
|
|
127
|
+
return collisionEvent(collision.groups.name);
|
|
128
|
+
return byLabel.get(label.toLowerCase());
|
|
129
|
+
}
|
|
130
|
+
function collisionEvent(objectName) {
|
|
131
|
+
return {
|
|
132
|
+
label: `Collision (${objectName})`,
|
|
133
|
+
name: `Collision_${objectName}`,
|
|
134
|
+
eventType: COLLISION,
|
|
135
|
+
eventNum: 0,
|
|
136
|
+
group: 'collision',
|
|
137
|
+
collisionObject: objectName,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=objectEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectEvents.js","sourceRoot":"","sources":["../src/objectEvents.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,mDAAmD;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,QAAQ;IACR,SAAS;IACT,OAAO;IACP,MAAM;IACN,WAAW;IACX,UAAU;IACV,OAAO;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,YAAY;IACZ,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;CACH,CAAC;AAGX,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,SAAS,KAAK,CACZ,KAAa,EACb,SAAiB,EACjB,QAAgB,EAChB,KAAa;IAEb,OAAO;QACL,KAAK;QACL,IAAI,EAAE,GAAG,cAAc,CAAC,SAAS,CAAC,IAAI,QAAQ,EAAE;QAChD,SAAS;QACT,QAAQ;QACR,KAAK;KACN,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAA2B,MAAM,CAAC,MAAM,CAAC;IAChE,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC;IACjC,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,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