@openfairygui/backend 0.2.0-alpha.15 → 0.2.0-alpha.17

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_runtime = require("./runtime-C5N7GLsG.cjs");
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-CxH7aT_v.mjs";
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-C5N7GLsG.cjs");
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
@@ -1,4 +1,4 @@
1
- import { t as BackendRuntime } from "./runtime-CxH7aT_v.mjs";
1
+ import { t as BackendRuntime } from "./runtime-B017UgBl.mjs";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  //#region src/node.ts
@@ -258,17 +258,32 @@ function createWriterFileSystem(fileSystem, committedPaths, failedPaths) {
258
258
  }
259
259
  };
260
260
  }
261
- function projectAssetSourceFiles(project) {
261
+ function projectSourceFiles(project) {
262
262
  const result = /* @__PURE__ */ new Map();
263
- for (const pkg of project.packages) for (const resource of pkg.resources) {
264
- if (resource.kind === "component") continue;
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: resource.branch,
270
- path: resource.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 recordStaleResourceSources(session, previousProject, nextProject) {
299
+ function recordStaleProjectFiles(session, previousProject, nextProject) {
285
300
  if (!session.fileSystem) return;
286
- const previousSources = projectAssetSourceFiles(previousProject);
287
- const nextSourceKeys = new Set([...projectAssetSourceFiles(nextProject).values()].map(sourceFileKey));
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
- recordStaleResourceSources(session, session.project, result.project);
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 projectAssetSourceFiles(project) {
262
+ function projectSourceFiles(project) {
263
263
  const result = /* @__PURE__ */ new Map();
264
- for (const pkg of project.packages) for (const resource of pkg.resources) {
265
- if (resource.kind === "component") continue;
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: resource.branch,
271
- path: resource.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 recordStaleResourceSources(session, previousProject, nextProject) {
300
+ function recordStaleProjectFiles(session, previousProject, nextProject) {
286
301
  if (!session.fileSystem) return;
287
- const previousSources = projectAssetSourceFiles(previousProject);
288
- const nextSourceKeys = new Set([...projectAssetSourceFiles(nextProject).values()].map(sourceFileKey));
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
- recordStaleResourceSources(session, session.project, result.project);
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.15",
3
+ "version": "0.2.0-alpha.17",
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/core": "0.2.0-alpha.15",
56
- "@openfairygui/functions": "0.2.0-alpha.15"
55
+ "@openfairygui/core": "0.2.0-alpha.17",
56
+ "@openfairygui/functions": "0.2.0-alpha.17"
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 projectAssetSourceFiles(project: UamProject): Map<string, ProjectSourceFile> {
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.kind === 'component') continue;
99
- const fileName = resource.fileName ?? resource.file ?? '';
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 recordStaleResourceSources(
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 = projectAssetSourceFiles(previousProject);
123
- const nextSourceKeys = new Set([...projectAssetSourceFiles(nextProject).values()].map(sourceFileKey));
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
- recordStaleResourceSources(session, session.project, result.project);
328
+ recordStaleProjectFiles(session, session.project, result.project);
312
329
  session.project = result.project;
313
330
  session.revision += 1;
314
331
  session.dirty = true;
@@ -30,7 +30,7 @@ export interface BackendSessionState {
30
30
  uamFidelity: 'full' | 'unsupported';
31
31
  revision: number;
32
32
  lastSavedRevision: number;
33
- /** Source files deferred until a successful replacement project write. */
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;