@openfairygui/backend 0.2.0-alpha.15 → 0.2.0-alpha.16
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/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +1 -1
- package/dist/{runtime-CxH7aT_v.mjs → runtime-B017UgBl.mjs} +28 -13
- package/dist/{runtime-C5N7GLsG.cjs → runtime-P0Nhxk2f.cjs} +28 -13
- package/package.json +3 -3
- package/src/services/authoring-service.ts +24 -7
- package/src/services/context.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_runtime = require("./runtime-
|
|
2
|
+
const require_runtime = require("./runtime-P0Nhxk2f.cjs");
|
|
3
3
|
//#region src/storage.ts
|
|
4
4
|
var StorageFileStat = class {
|
|
5
5
|
constructor(kind) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as BACKEND_CONTRACT_VERSION, n as BACKEND_CAPABILITY_SCHEMA_VERSION, r as BACKEND_COMPATIBILITY_POLICY, t as BackendRuntime } from "./runtime-
|
|
1
|
+
import { i as BACKEND_CONTRACT_VERSION, n as BACKEND_CAPABILITY_SCHEMA_VERSION, r as BACKEND_COMPATIBILITY_POLICY, t as BackendRuntime } from "./runtime-B017UgBl.mjs";
|
|
2
2
|
//#region src/storage.ts
|
|
3
3
|
var StorageFileStat = class {
|
|
4
4
|
constructor(kind) {
|
package/dist/node.cjs
CHANGED
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_runtime = require("./runtime-
|
|
24
|
+
const require_runtime = require("./runtime-P0Nhxk2f.cjs");
|
|
25
25
|
let node_fs_promises = require("node:fs/promises");
|
|
26
26
|
node_fs_promises = __toESM(node_fs_promises);
|
|
27
27
|
let node_path = require("node:path");
|
package/dist/node.mjs
CHANGED
|
@@ -258,17 +258,32 @@ function createWriterFileSystem(fileSystem, committedPaths, failedPaths) {
|
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function projectSourceFiles(project) {
|
|
262
262
|
const result = /* @__PURE__ */ new Map();
|
|
263
|
-
for (const pkg of project.packages)
|
|
264
|
-
|
|
265
|
-
const fileName = resource.fileName ?? resource.file ?? "";
|
|
266
|
-
if (!fileName) continue;
|
|
267
|
-
result.set(`${pkg.id}/${resource.id}`, {
|
|
263
|
+
for (const pkg of project.packages) {
|
|
264
|
+
result.set(`${pkg.id}/package.xml`, {
|
|
268
265
|
packageName: pkg.name,
|
|
269
|
-
branch:
|
|
270
|
-
path:
|
|
271
|
-
fileName
|
|
266
|
+
branch: "",
|
|
267
|
+
path: "",
|
|
268
|
+
fileName: "package.xml"
|
|
269
|
+
});
|
|
270
|
+
const branches = /* @__PURE__ */ new Set();
|
|
271
|
+
for (const resource of pkg.resources) {
|
|
272
|
+
if (resource.branch) branches.add(resource.branch);
|
|
273
|
+
const fileName = resource.kind === "component" ? `${resource.name}.xml` : resource.fileName ?? resource.file ?? "";
|
|
274
|
+
if (!fileName) continue;
|
|
275
|
+
result.set(`${pkg.id}/${resource.id}`, {
|
|
276
|
+
packageName: pkg.name,
|
|
277
|
+
branch: resource.branch,
|
|
278
|
+
path: resource.path,
|
|
279
|
+
fileName
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
for (const branch of branches) result.set(`${pkg.id}/branch/${branch}`, {
|
|
283
|
+
packageName: pkg.name,
|
|
284
|
+
branch,
|
|
285
|
+
path: "",
|
|
286
|
+
fileName: "package_branch.xml"
|
|
272
287
|
});
|
|
273
288
|
}
|
|
274
289
|
return result;
|
|
@@ -281,10 +296,10 @@ function sourceFileKey(source) {
|
|
|
281
296
|
source.fileName
|
|
282
297
|
].join("\0");
|
|
283
298
|
}
|
|
284
|
-
function
|
|
299
|
+
function recordStaleProjectFiles(session, previousProject, nextProject) {
|
|
285
300
|
if (!session.fileSystem) return;
|
|
286
|
-
const previousSources =
|
|
287
|
-
const nextSourceKeys = new Set([...
|
|
301
|
+
const previousSources = projectSourceFiles(previousProject);
|
|
302
|
+
const nextSourceKeys = new Set([...projectSourceFiles(nextProject).values()].map(sourceFileKey));
|
|
288
303
|
for (const source of previousSources.values()) {
|
|
289
304
|
const key = sourceFileKey(source);
|
|
290
305
|
if (!nextSourceKeys.has(key)) session.pendingStaleSourceFiles.set(key, source);
|
|
@@ -408,7 +423,7 @@ var AuthoringService = class {
|
|
|
408
423
|
diagnostics
|
|
409
424
|
});
|
|
410
425
|
}
|
|
411
|
-
|
|
426
|
+
recordStaleProjectFiles(session, session.project, result.project);
|
|
412
427
|
session.project = result.project;
|
|
413
428
|
session.revision += 1;
|
|
414
429
|
session.dirty = true;
|
|
@@ -259,17 +259,32 @@ function createWriterFileSystem(fileSystem, committedPaths, failedPaths) {
|
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function projectSourceFiles(project) {
|
|
263
263
|
const result = /* @__PURE__ */ new Map();
|
|
264
|
-
for (const pkg of project.packages)
|
|
265
|
-
|
|
266
|
-
const fileName = resource.fileName ?? resource.file ?? "";
|
|
267
|
-
if (!fileName) continue;
|
|
268
|
-
result.set(`${pkg.id}/${resource.id}`, {
|
|
264
|
+
for (const pkg of project.packages) {
|
|
265
|
+
result.set(`${pkg.id}/package.xml`, {
|
|
269
266
|
packageName: pkg.name,
|
|
270
|
-
branch:
|
|
271
|
-
path:
|
|
272
|
-
fileName
|
|
267
|
+
branch: "",
|
|
268
|
+
path: "",
|
|
269
|
+
fileName: "package.xml"
|
|
270
|
+
});
|
|
271
|
+
const branches = /* @__PURE__ */ new Set();
|
|
272
|
+
for (const resource of pkg.resources) {
|
|
273
|
+
if (resource.branch) branches.add(resource.branch);
|
|
274
|
+
const fileName = resource.kind === "component" ? `${resource.name}.xml` : resource.fileName ?? resource.file ?? "";
|
|
275
|
+
if (!fileName) continue;
|
|
276
|
+
result.set(`${pkg.id}/${resource.id}`, {
|
|
277
|
+
packageName: pkg.name,
|
|
278
|
+
branch: resource.branch,
|
|
279
|
+
path: resource.path,
|
|
280
|
+
fileName
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
for (const branch of branches) result.set(`${pkg.id}/branch/${branch}`, {
|
|
284
|
+
packageName: pkg.name,
|
|
285
|
+
branch,
|
|
286
|
+
path: "",
|
|
287
|
+
fileName: "package_branch.xml"
|
|
273
288
|
});
|
|
274
289
|
}
|
|
275
290
|
return result;
|
|
@@ -282,10 +297,10 @@ function sourceFileKey(source) {
|
|
|
282
297
|
source.fileName
|
|
283
298
|
].join("\0");
|
|
284
299
|
}
|
|
285
|
-
function
|
|
300
|
+
function recordStaleProjectFiles(session, previousProject, nextProject) {
|
|
286
301
|
if (!session.fileSystem) return;
|
|
287
|
-
const previousSources =
|
|
288
|
-
const nextSourceKeys = new Set([...
|
|
302
|
+
const previousSources = projectSourceFiles(previousProject);
|
|
303
|
+
const nextSourceKeys = new Set([...projectSourceFiles(nextProject).values()].map(sourceFileKey));
|
|
289
304
|
for (const source of previousSources.values()) {
|
|
290
305
|
const key = sourceFileKey(source);
|
|
291
306
|
if (!nextSourceKeys.has(key)) session.pendingStaleSourceFiles.set(key, source);
|
|
@@ -409,7 +424,7 @@ var AuthoringService = class {
|
|
|
409
424
|
diagnostics
|
|
410
425
|
});
|
|
411
426
|
}
|
|
412
|
-
|
|
427
|
+
recordStaleProjectFiles(session, session.project, result.project);
|
|
413
428
|
session.project = result.project;
|
|
414
429
|
session.revision += 1;
|
|
415
430
|
session.dirty = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfairygui/backend",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.16",
|
|
4
4
|
"description": "FairyGUI Headless Authoring SDK — stateful backend runtime and session services.",
|
|
5
5
|
"author": "OpenFairyGUI Contributors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"runtime"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@openfairygui/
|
|
56
|
-
"@openfairygui/
|
|
55
|
+
"@openfairygui/functions": "0.2.0-alpha.16",
|
|
56
|
+
"@openfairygui/core": "0.2.0-alpha.16"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"ava": "^7.0.0",
|
|
@@ -91,12 +91,21 @@ function createWriterFileSystem(
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
function
|
|
94
|
+
function projectSourceFiles(project: UamProject): Map<string, ProjectSourceFile> {
|
|
95
95
|
const result = new Map<string, ProjectSourceFile>();
|
|
96
96
|
for (const pkg of project.packages) {
|
|
97
|
+
result.set(`${pkg.id}/package.xml`, {
|
|
98
|
+
packageName: pkg.name,
|
|
99
|
+
branch: '',
|
|
100
|
+
path: '',
|
|
101
|
+
fileName: 'package.xml',
|
|
102
|
+
});
|
|
103
|
+
const branches = new Set<string>();
|
|
97
104
|
for (const resource of pkg.resources) {
|
|
98
|
-
if (resource.
|
|
99
|
-
const fileName = resource.
|
|
105
|
+
if (resource.branch) branches.add(resource.branch);
|
|
106
|
+
const fileName = resource.kind === 'component'
|
|
107
|
+
? `${resource.name}.xml`
|
|
108
|
+
: resource.fileName ?? resource.file ?? '';
|
|
100
109
|
if (!fileName) continue;
|
|
101
110
|
result.set(`${pkg.id}/${resource.id}`, {
|
|
102
111
|
packageName: pkg.name,
|
|
@@ -105,6 +114,14 @@ function projectAssetSourceFiles(project: UamProject): Map<string, ProjectSource
|
|
|
105
114
|
fileName,
|
|
106
115
|
});
|
|
107
116
|
}
|
|
117
|
+
for (const branch of branches) {
|
|
118
|
+
result.set(`${pkg.id}/branch/${branch}`, {
|
|
119
|
+
packageName: pkg.name,
|
|
120
|
+
branch,
|
|
121
|
+
path: '',
|
|
122
|
+
fileName: 'package_branch.xml',
|
|
123
|
+
});
|
|
124
|
+
}
|
|
108
125
|
}
|
|
109
126
|
return result;
|
|
110
127
|
}
|
|
@@ -113,14 +130,14 @@ function sourceFileKey(source: ProjectSourceFile): string {
|
|
|
113
130
|
return [source.branch, source.packageName, source.path, source.fileName].join('\0');
|
|
114
131
|
}
|
|
115
132
|
|
|
116
|
-
function
|
|
133
|
+
function recordStaleProjectFiles(
|
|
117
134
|
session: Parameters<typeof toSessionSnapshot>[0],
|
|
118
135
|
previousProject: UamProject,
|
|
119
136
|
nextProject: UamProject,
|
|
120
137
|
): void {
|
|
121
138
|
if (!session.fileSystem) return;
|
|
122
|
-
const previousSources =
|
|
123
|
-
const nextSourceKeys = new Set([...
|
|
139
|
+
const previousSources = projectSourceFiles(previousProject);
|
|
140
|
+
const nextSourceKeys = new Set([...projectSourceFiles(nextProject).values()].map(sourceFileKey));
|
|
124
141
|
for (const source of previousSources.values()) {
|
|
125
142
|
const key = sourceFileKey(source);
|
|
126
143
|
if (!nextSourceKeys.has(key)) session.pendingStaleSourceFiles.set(key, source);
|
|
@@ -308,7 +325,7 @@ export class AuthoringService {
|
|
|
308
325
|
);
|
|
309
326
|
}
|
|
310
327
|
|
|
311
|
-
|
|
328
|
+
recordStaleProjectFiles(session, session.project, result.project);
|
|
312
329
|
session.project = result.project;
|
|
313
330
|
session.revision += 1;
|
|
314
331
|
session.dirty = true;
|
package/src/services/context.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface BackendSessionState {
|
|
|
30
30
|
uamFidelity: 'full' | 'unsupported';
|
|
31
31
|
revision: number;
|
|
32
32
|
lastSavedRevision: number;
|
|
33
|
-
/**
|
|
33
|
+
/** Package-controlled files deferred until a successful replacement project write. */
|
|
34
34
|
pendingStaleSourceFiles: Map<string, import('@openfairygui/core/project-io').ProjectSourceFile>;
|
|
35
35
|
dirty: boolean;
|
|
36
36
|
lockHeld: boolean;
|