@galacean/cli 0.0.1-alpha.10 → 0.0.1-alpha.11

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.
@@ -89903,7 +89903,7 @@ var init_cli_ktx2_encoder = __esm({
89903
89903
  let width;
89904
89904
  let height;
89905
89905
  if (rawInfo) {
89906
- data = buffer2 instanceof ArrayBuffer ? new Uint8Array(buffer2) : new Uint8Array(buffer2);
89906
+ data = new Uint8Array(buffer2);
89907
89907
  width = rawInfo.width;
89908
89908
  height = rawInfo.height;
89909
89909
  } else {
@@ -91070,6 +91070,50 @@ var init_asset_types = __esm({
91070
91070
  }
91071
91071
  });
91072
91072
 
91073
+ // src/utils/ref-converter.ts
91074
+ function convertRefs(obj, keyMap, resolve4) {
91075
+ if (obj == null || typeof obj !== "object")
91076
+ return obj;
91077
+ if (Array.isArray(obj)) {
91078
+ return obj.map((item) => convertRefs(item, keyMap, resolve4));
91079
+ }
91080
+ const result = {};
91081
+ for (const [key, value] of Object.entries(obj)) {
91082
+ if (keyMap[key] && typeof value === "string") {
91083
+ const resolved = resolve4(value);
91084
+ if (resolved !== void 0) {
91085
+ result[keyMap[key]] = resolved;
91086
+ } else {
91087
+ result[key] = value;
91088
+ }
91089
+ } else {
91090
+ result[key] = convertRefs(value, keyMap, resolve4);
91091
+ }
91092
+ }
91093
+ return result;
91094
+ }
91095
+ function exportRefs(obj, resolve4) {
91096
+ return convertRefs(obj, EXPORT_KEY_MAP, resolve4);
91097
+ }
91098
+ async function exportBlobRefs(blob, resolve4) {
91099
+ try {
91100
+ const text = await blob.text();
91101
+ const converted = JSON.stringify(exportRefs(JSON.parse(text), resolve4));
91102
+ if (converted === text)
91103
+ return null;
91104
+ return new Blob([converted], { type: "application/json" });
91105
+ } catch {
91106
+ return null;
91107
+ }
91108
+ }
91109
+ var EXPORT_KEY_MAP;
91110
+ var init_ref_converter = __esm({
91111
+ "src/utils/ref-converter.ts"() {
91112
+ "use strict";
91113
+ EXPORT_KEY_MAP = { refId: "url", assetRefId: "assetUrl" };
91114
+ }
91115
+ });
91116
+
91073
91117
  // src/cli-builder.ts
91074
91118
  var cli_builder_exports = {};
91075
91119
  __export(cli_builder_exports, {
@@ -91398,6 +91442,27 @@ async function cliCompile(vfs, config2, options) {
91398
91442
  }
91399
91443
  idMd5Map.set(file2.id, cacheKey);
91400
91444
  }
91445
+ {
91446
+ const resolve4 = (refId) => {
91447
+ const f = vfs.fileMap.get(refId);
91448
+ return f ? f.exportPath ?? f.path : void 0;
91449
+ };
91450
+ const processedKeys = /* @__PURE__ */ new Set();
91451
+ for (const [, file2] of vfs.fileMap) {
91452
+ if (file2.meta?.type === "Folder")
91453
+ continue;
91454
+ const md5Key = idMd5Map.get(file2.id);
91455
+ if (!md5Key || processedKeys.has(md5Key))
91456
+ continue;
91457
+ processedKeys.add(md5Key);
91458
+ const blob = cacheMap.get(md5Key);
91459
+ if (!blob)
91460
+ continue;
91461
+ const converted = await exportBlobRefs(blob, resolve4);
91462
+ if (converted)
91463
+ cacheMap.set(md5Key, converted);
91464
+ }
91465
+ }
91401
91466
  const projectFiles = [];
91402
91467
  for (const vfile of files) {
91403
91468
  const md52 = idMd5Map.get(vfile.id);
@@ -91505,6 +91570,7 @@ var init_cli_builder = __esm({
91505
91570
  init_domain_bridge();
91506
91571
  init_local_project();
91507
91572
  init_asset_types();
91573
+ init_ref_converter();
91508
91574
  }
91509
91575
  });
91510
91576
 
@@ -136256,7 +136322,7 @@ function readCliVersionFromPackageJson() {
136256
136322
  const parsed = JSON.parse(raw);
136257
136323
  return typeof parsed.version === "string" && parsed.version.length > 0 ? parsed.version : "0.0.0";
136258
136324
  }
136259
- var CLI_VERSION = "0.0.1-alpha.10".length > 0 ? "0.0.1-alpha.10" : readCliVersionFromPackageJson();
136325
+ var CLI_VERSION = "0.0.1-alpha.11".length > 0 ? "0.0.1-alpha.11" : readCliVersionFromPackageJson();
136260
136326
 
136261
136327
  // src/push-output.ts
136262
136328
  function printPushResult(result, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/cli",
3
- "version": "0.0.1-alpha.10",
3
+ "version": "0.0.1-alpha.11",
4
4
  "main": "dist/cli.bundle.cjs",
5
5
  "bin": {
6
6
  "galacean": "bin/galacean.js"
@@ -28,12 +28,12 @@
28
28
  "vitest": "^2.0.0",
29
29
  "@editor/builder": "1.0.0",
30
30
  "@editor/constants": "2.0.3",
31
- "@editor/editor-api": "1.0.0",
32
31
  "@editor/model": "2.0.3",
33
32
  "@editor/storage": "0.0.1",
33
+ "@editor/editor-api": "1.0.0",
34
34
  "@editor/vfs": "1.0.0",
35
- "tsconfig": "1.0.1",
36
- "config": "1.0.1"
35
+ "config": "1.0.1",
36
+ "tsconfig": "1.0.1"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node build.mjs",