@defold-typescript/transpiler 0.31.0 → 0.32.1

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.js CHANGED
@@ -1687,7 +1687,7 @@ function buildSceneObjectPathIndex(documents, roles) {
1687
1687
  if (document === undefined)
1688
1688
  return new Map;
1689
1689
  inProgress.add(displayPath);
1690
- const paths2 = new Map;
1690
+ const paths = new Map;
1691
1691
  for (const blockName of LEAF_BLOCKS) {
1692
1692
  for (const block of childrenOf3(document, blockName)) {
1693
1693
  const id = firstField2(block, "id");
@@ -1714,7 +1714,7 @@ function buildSceneObjectPathIndex(documents, roles) {
1714
1714
  incomplete.push(`${displayPath}: the instance "${id}" names ${prototype}, which is not among the project's readable scene documents`);
1715
1715
  }
1716
1716
  }
1717
- paths2.set(`/${id}`, { declarer: displayPath, components, resources });
1717
+ paths.set(`/${id}`, { declarer: displayPath, components, resources });
1718
1718
  }
1719
1719
  }
1720
1720
  for (const block of childrenOf3(document, "collection_instances")) {
@@ -1728,12 +1728,12 @@ function buildSceneObjectPathIndex(documents, roles) {
1728
1728
  continue;
1729
1729
  }
1730
1730
  for (const [nested, leaf] of pathsOf(key)) {
1731
- paths2.set(`/${id}${nested}`, leaf);
1731
+ paths.set(`/${id}${nested}`, leaf);
1732
1732
  }
1733
1733
  }
1734
1734
  inProgress.delete(displayPath);
1735
- composed.set(displayPath, paths2);
1736
- return paths2;
1735
+ composed.set(displayPath, paths);
1736
+ return paths;
1737
1737
  }
1738
1738
  for (const displayPath of parsed.keys())
1739
1739
  pathsOf(displayPath);
@@ -1748,8 +1748,8 @@ function buildSceneObjectPathIndex(documents, roles) {
1748
1748
  const componentResourcesOf = new Map;
1749
1749
  const withheld = new Set;
1750
1750
  for (const [prefix, displayPath] of worlds) {
1751
- for (const [path2, leaf] of pathsOf(displayPath)) {
1752
- const key = `${prefix}${path2}`;
1751
+ for (const [path, leaf] of pathsOf(displayPath)) {
1752
+ const key = `${prefix}${path}`;
1753
1753
  paths.add(key);
1754
1754
  const declarers = declaredIn.get(key);
1755
1755
  if (declarers === undefined) {
@@ -1808,9 +1808,9 @@ var BANNER = `// Generated from this project's scenes by \`defold-typescript sce
1808
1808
  `;
1809
1809
  function componentAddressesOf(documents, paths) {
1810
1810
  const keys = [...buildSceneComponentIndex(documents).ids].map((id) => `#${id}`);
1811
- for (const [path2, ids] of paths.componentsOf) {
1811
+ for (const [path, ids] of paths.componentsOf) {
1812
1812
  for (const id of ids)
1813
- keys.push(`${path2}#${id}`);
1813
+ keys.push(`${path}#${id}`);
1814
1814
  }
1815
1815
  return keys;
1816
1816
  }
@@ -2208,6 +2208,7 @@ function buildAmbientFiles() {
2208
2208
  "node_modules/@defold-typescript/types/src/core-types.ts": readAmbient("src/core-types.ts"),
2209
2209
  "node_modules/@defold-typescript/types/src/engine-globals.d.ts": readAmbient("src/engine-globals.d.ts"),
2210
2210
  "node_modules/@defold-typescript/types/src/go-overloads.d.ts": readAmbient("src/go-overloads.d.ts"),
2211
+ "node_modules/@defold-typescript/types/src/custom-messages.d.ts": readAmbient("src/custom-messages.d.ts"),
2211
2212
  "node_modules/@defold-typescript/types/src/msg-overloads.d.ts": readAmbient("src/msg-overloads.d.ts"),
2212
2213
  "node_modules/@defold-typescript/types/src/message-guard.d.ts": readAmbient("src/message-guard.d.ts"),
2213
2214
  "node_modules/@defold-typescript/types/src/window-event-guard.d.ts": readAmbient("src/window-event-guard.d.ts"),
@@ -2733,20 +2734,20 @@ function pathOfKey(key) {
2733
2734
  const socket = socketOfAddress(key);
2734
2735
  return socket === undefined ? key : key.slice(socket.length + 1);
2735
2736
  }
2736
- function declaredComponentsOf(objects, path4) {
2737
- if (objects === undefined || path4 === "")
2737
+ function declaredComponentsOf(objects, path) {
2738
+ if (objects === undefined || path === "")
2738
2739
  return;
2739
2740
  if (objects.incomplete.length > 0)
2740
2741
  return;
2741
- if (socketOfAddress(path4) !== undefined) {
2742
- return objects.paths.has(path4) ? objects.componentsOf.get(path4) : undefined;
2742
+ if (socketOfAddress(path) !== undefined) {
2743
+ return objects.paths.has(path) ? objects.componentsOf.get(path) : undefined;
2743
2744
  }
2744
- if (!path4.startsWith("/"))
2745
+ if (!path.startsWith("/"))
2745
2746
  return;
2746
2747
  const declared = new Set;
2747
2748
  let known = false;
2748
2749
  for (const key of objects.paths) {
2749
- if (pathOfKey(key) !== path4)
2750
+ if (pathOfKey(key) !== path)
2750
2751
  continue;
2751
2752
  const owned = objects.componentsOf.get(key);
2752
2753
  if (owned === undefined)
@@ -2781,13 +2782,13 @@ function checkUrlFragmentReachability(input) {
2781
2782
  const declared = fragment === "" ? undefined : declaredComponentsOf(objects, text.slice(0, hash));
2782
2783
  const reachable = declared === undefined ? index.ids.has(fragment) : declared.includes(fragment);
2783
2784
  if (fragment !== "" && !reachable) {
2784
- const path4 = text.slice(0, hash);
2785
+ const path = text.slice(0, hash);
2785
2786
  findings.push({
2786
2787
  fileName: sourceFile.fileName,
2787
2788
  start: node.getStart(sourceFile),
2788
2789
  length: node.getWidth(sourceFile),
2789
2790
  fragment,
2790
- message: declared === undefined ? `no \`.go\` or \`.collection\` in this project declares a component with the id ` + `"${fragment}", so this address cannot resolve at runtime` : `the game object "${path4}" declares no component with the id "${fragment}" ` + `(${declaredPhrase(declared)}), so this address cannot resolve at runtime`
2791
+ message: declared === undefined ? `no \`.go\` or \`.collection\` in this project declares a component with the id ` + `"${fragment}", so this address cannot resolve at runtime` : `the game object "${path}" declares no component with the id "${fragment}" ` + `(${declaredPhrase(declared)}), so this address cannot resolve at runtime`
2791
2792
  });
2792
2793
  }
2793
2794
  }
@@ -2799,62 +2800,62 @@ function checkUrlFragmentReachability(input) {
2799
2800
  return { kind: "checked", findings };
2800
2801
  }
2801
2802
  export {
2802
- transpileProject,
2803
- transpile,
2804
- stripIncludeBase,
2805
- socketOfAddress,
2806
- slotRejectsForeignSocket,
2807
- resolveClassifiedSlotAtPosition,
2808
- relativeAddressesFrom,
2809
- readSceneDocuments,
2810
- readLibrarySceneDocuments,
2811
- readGameProjectSetting,
2812
- readGameProjectDependencies,
2813
- parseSceneTextFormat,
2814
- parseBuildConfig,
2815
- listProjectResourcePaths,
2816
- libraryIncludedEntries,
2817
- isFragmentCaret,
2818
- isExcludedProjectPath,
2819
- isDefignoredPath,
2820
- isContainedResourcePath,
2821
- isAddressClass,
2822
- guiScriptResourcesOf,
2823
- guiScriptResourceOf,
2824
- getProgramDiagnostics,
2825
- findMainEntryFactoryImports,
2826
- displayPathOf,
2827
- createTranspileSession,
2828
- computeOutputRel,
2829
- componentIdOfSameObjectAddress,
2830
- collectComponentIds,
2831
- collectComponentDeclarations,
2832
- checkUrlFragmentReachability,
2833
- checkCrossWorldAddresses,
2834
- buildScriptNamingContexts,
2835
- buildSceneObjectPathIndex,
2836
- buildSceneComponentIndex,
2837
- buildSceneCollectionRoles,
2838
- buildSceneAddressDeclaration,
2839
- buildInputActionIndex,
2840
- buildGuiNodeIndex,
2841
- buildGuiFlipbookIndex,
2842
- buildConfigKeyIndex,
2843
- buildComponentAnimationIndex,
2844
- archiveWrapperOf,
2845
- addressEntryOfArgument,
2846
- addressClassOfArgument,
2847
- SceneTextFormatError,
2848
- SCRIPT_SUFFIX_BY_KIND,
2849
- SCENE_EXTENSIONS,
2850
- SCAFFOLDED_DEFIGNORE_LINES,
2851
- PROJECT_EXTENSIONS,
2852
- LIBRARY_SCENE_EXTENSIONS,
2853
- LIBRARY_DEPENDENCY_ROOT,
2854
- INPUT_BINDING_EXTENSIONS,
2855
- GUI_EXTENSIONS,
2856
- GAME_PROJECT_DOCUMENT,
2857
- DEFAULT_INCLUDE,
2803
+ ANIMATION_ASSET_EXTENSIONS,
2858
2804
  COLLECTION_REFERENCE_EXTENSIONS,
2859
- ANIMATION_ASSET_EXTENSIONS
2805
+ DEFAULT_INCLUDE,
2806
+ GAME_PROJECT_DOCUMENT,
2807
+ GUI_EXTENSIONS,
2808
+ INPUT_BINDING_EXTENSIONS,
2809
+ LIBRARY_DEPENDENCY_ROOT,
2810
+ LIBRARY_SCENE_EXTENSIONS,
2811
+ PROJECT_EXTENSIONS,
2812
+ SCAFFOLDED_DEFIGNORE_LINES,
2813
+ SCENE_EXTENSIONS,
2814
+ SCRIPT_SUFFIX_BY_KIND,
2815
+ SceneTextFormatError,
2816
+ addressClassOfArgument,
2817
+ addressEntryOfArgument,
2818
+ archiveWrapperOf,
2819
+ buildComponentAnimationIndex,
2820
+ buildConfigKeyIndex,
2821
+ buildGuiFlipbookIndex,
2822
+ buildGuiNodeIndex,
2823
+ buildInputActionIndex,
2824
+ buildSceneAddressDeclaration,
2825
+ buildSceneCollectionRoles,
2826
+ buildSceneComponentIndex,
2827
+ buildSceneObjectPathIndex,
2828
+ buildScriptNamingContexts,
2829
+ checkCrossWorldAddresses,
2830
+ checkUrlFragmentReachability,
2831
+ collectComponentDeclarations,
2832
+ collectComponentIds,
2833
+ componentIdOfSameObjectAddress,
2834
+ computeOutputRel,
2835
+ createTranspileSession,
2836
+ displayPathOf,
2837
+ findMainEntryFactoryImports,
2838
+ getProgramDiagnostics,
2839
+ guiScriptResourceOf,
2840
+ guiScriptResourcesOf,
2841
+ isAddressClass,
2842
+ isContainedResourcePath,
2843
+ isDefignoredPath,
2844
+ isExcludedProjectPath,
2845
+ isFragmentCaret,
2846
+ libraryIncludedEntries,
2847
+ listProjectResourcePaths,
2848
+ parseBuildConfig,
2849
+ parseSceneTextFormat,
2850
+ readGameProjectDependencies,
2851
+ readGameProjectSetting,
2852
+ readLibrarySceneDocuments,
2853
+ readSceneDocuments,
2854
+ relativeAddressesFrom,
2855
+ resolveClassifiedSlotAtPosition,
2856
+ slotRejectsForeignSocket,
2857
+ socketOfAddress,
2858
+ stripIncludeBase,
2859
+ transpile,
2860
+ transpileProject
2860
2861
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defold-typescript/transpiler",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "description": "TypeScript-to-Lua build pipeline tuned for Defold's runtime.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@defold-typescript/types": "0.31.0",
38
+ "@defold-typescript/types": "0.32.1",
39
39
  "@typescript-to-lua/language-extensions": "1.19.0",
40
40
  "typescript-to-lua": "^1.36.0"
41
41
  }
package/src/transpile.ts CHANGED
@@ -118,6 +118,9 @@ function buildAmbientFiles(): Record<string, string> {
118
118
  readAmbient("src/engine-globals.d.ts"),
119
119
  "node_modules/@defold-typescript/types/src/go-overloads.d.ts":
120
120
  readAmbient("src/go-overloads.d.ts"),
121
+ "node_modules/@defold-typescript/types/src/custom-messages.d.ts": readAmbient(
122
+ "src/custom-messages.d.ts",
123
+ ),
121
124
  "node_modules/@defold-typescript/types/src/msg-overloads.d.ts":
122
125
  readAmbient("src/msg-overloads.d.ts"),
123
126
  "node_modules/@defold-typescript/types/src/message-guard.d.ts":