@defold-typescript/cli 0.5.0 → 0.5.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/bin.js CHANGED
@@ -650,6 +650,8 @@ function materializeApiSurface(opts) {
650
650
  const overloads = ["msg-overloads.d.ts", "go-overloads.d.ts"].filter((file) => existsSync3(path7.join(srcDir, file)));
651
651
  const coreTypesSrc = path7.join(srcDir, "core-types.ts");
652
652
  const includeCoreTypes = overloads.length > 0 && existsSync3(coreTypesSrc);
653
+ const engineGlobalsSrc = path7.join(srcDir, "engine-globals.d.ts");
654
+ const includeEngineGlobals = includeCoreTypes && existsSync3(engineGlobalsSrc);
653
655
  const wanted = new Set(sources);
654
656
  for (const file of overloads) {
655
657
  wanted.add(file);
@@ -657,6 +659,9 @@ function materializeApiSurface(opts) {
657
659
  if (includeCoreTypes) {
658
660
  wanted.add("core-types.d.ts");
659
661
  }
662
+ if (includeEngineGlobals) {
663
+ wanted.add("engine-globals.d.ts");
664
+ }
660
665
  for (const existing of readdirSync2(absDir)) {
661
666
  if (existing.endsWith(".d.ts") && existing !== "index.d.ts" && !wanted.has(existing)) {
662
667
  rmSync(path7.join(absDir, existing));
@@ -668,10 +673,16 @@ function materializeApiSurface(opts) {
668
673
  if (includeCoreTypes) {
669
674
  writeFileSync3(path7.join(absDir, "core-types.d.ts"), readFileSync6(coreTypesSrc, "utf8"));
670
675
  }
676
+ if (includeEngineGlobals) {
677
+ writeFileSync3(path7.join(absDir, "engine-globals.d.ts"), readFileSync6(engineGlobalsSrc, "utf8"));
678
+ }
671
679
  for (const file of overloads) {
672
680
  writeFileSync3(path7.join(absDir, file), readFileSync6(path7.join(srcDir, file), "utf8"));
673
681
  }
674
682
  const modules = [...sources, ...overloads].map((file) => file.replace(/\.d\.ts$/, ""));
683
+ if (includeEngineGlobals) {
684
+ modules.push("engine-globals");
685
+ }
675
686
  const imports = modules.map((mod) => `import "./${mod}";`).join(`
676
687
  `);
677
688
  writeFileSync3(path7.join(absDir, "index.d.ts"), `${imports}
@@ -747,6 +758,10 @@ async function materializeRefDocSurface(opts) {
747
758
  ...excludeModules.length > 0 ? { excludeModules } : {}
748
759
  });
749
760
  copyFileSync(path7.join(root, "src", "core-types.ts"), path7.join(absDir, "core-types.d.ts"));
761
+ copyFileSync(path7.join(root, "src", "engine-globals.d.ts"), path7.join(absDir, "engine-globals.d.ts"));
762
+ const indexPath = path7.join(absDir, "index.d.ts");
763
+ writeFileSync3(indexPath, `import "./engine-globals";
764
+ ${readFileSync6(indexPath, "utf8")}`);
750
765
  } catch {
751
766
  rmSync(absDir, { recursive: true, force: true });
752
767
  return { materializedDir: null, active: null };
package/dist/index.js CHANGED
@@ -714,6 +714,8 @@ function materializeApiSurface(opts) {
714
714
  const overloads = ["msg-overloads.d.ts", "go-overloads.d.ts"].filter((file) => existsSync3(path8.join(srcDir, file)));
715
715
  const coreTypesSrc = path8.join(srcDir, "core-types.ts");
716
716
  const includeCoreTypes = overloads.length > 0 && existsSync3(coreTypesSrc);
717
+ const engineGlobalsSrc = path8.join(srcDir, "engine-globals.d.ts");
718
+ const includeEngineGlobals = includeCoreTypes && existsSync3(engineGlobalsSrc);
717
719
  const wanted = new Set(sources);
718
720
  for (const file of overloads) {
719
721
  wanted.add(file);
@@ -721,6 +723,9 @@ function materializeApiSurface(opts) {
721
723
  if (includeCoreTypes) {
722
724
  wanted.add("core-types.d.ts");
723
725
  }
726
+ if (includeEngineGlobals) {
727
+ wanted.add("engine-globals.d.ts");
728
+ }
724
729
  for (const existing of readdirSync2(absDir)) {
725
730
  if (existing.endsWith(".d.ts") && existing !== "index.d.ts" && !wanted.has(existing)) {
726
731
  rmSync2(path8.join(absDir, existing));
@@ -732,10 +737,16 @@ function materializeApiSurface(opts) {
732
737
  if (includeCoreTypes) {
733
738
  writeFileSync3(path8.join(absDir, "core-types.d.ts"), readFileSync7(coreTypesSrc, "utf8"));
734
739
  }
740
+ if (includeEngineGlobals) {
741
+ writeFileSync3(path8.join(absDir, "engine-globals.d.ts"), readFileSync7(engineGlobalsSrc, "utf8"));
742
+ }
735
743
  for (const file of overloads) {
736
744
  writeFileSync3(path8.join(absDir, file), readFileSync7(path8.join(srcDir, file), "utf8"));
737
745
  }
738
746
  const modules = [...sources, ...overloads].map((file) => file.replace(/\.d\.ts$/, ""));
747
+ if (includeEngineGlobals) {
748
+ modules.push("engine-globals");
749
+ }
739
750
  const imports = modules.map((mod) => `import "./${mod}";`).join(`
740
751
  `);
741
752
  writeFileSync3(path8.join(absDir, "index.d.ts"), `${imports}
@@ -811,6 +822,10 @@ async function materializeRefDocSurface(opts) {
811
822
  ...excludeModules.length > 0 ? { excludeModules } : {}
812
823
  });
813
824
  copyFileSync(path8.join(root, "src", "core-types.ts"), path8.join(absDir, "core-types.d.ts"));
825
+ copyFileSync(path8.join(root, "src", "engine-globals.d.ts"), path8.join(absDir, "engine-globals.d.ts"));
826
+ const indexPath = path8.join(absDir, "index.d.ts");
827
+ writeFileSync3(indexPath, `import "./engine-globals";
828
+ ${readFileSync7(indexPath, "utf8")}`);
814
829
  } catch {
815
830
  rmSync2(absDir, { recursive: true, force: true });
816
831
  return { materializedDir: null, active: null };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defold-typescript/cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "End-user CLI for scaffolding and building Defold projects written in TypeScript.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "test": "bun test"
32
32
  },
33
33
  "dependencies": {
34
- "@defold-typescript/transpiler": "0.5.0",
35
- "@defold-typescript/types": "0.5.0"
34
+ "@defold-typescript/transpiler": "0.5.1",
35
+ "@defold-typescript/types": "0.5.1"
36
36
  }
37
37
  }
@@ -70,6 +70,8 @@ export function materializeApiSurface(
70
70
  );
71
71
  const coreTypesSrc = path.join(srcDir, "core-types.ts");
72
72
  const includeCoreTypes = overloads.length > 0 && existsSync(coreTypesSrc);
73
+ const engineGlobalsSrc = path.join(srcDir, "engine-globals.d.ts");
74
+ const includeEngineGlobals = includeCoreTypes && existsSync(engineGlobalsSrc);
73
75
 
74
76
  const wanted = new Set(sources);
75
77
  for (const file of overloads) {
@@ -78,6 +80,9 @@ export function materializeApiSurface(
78
80
  if (includeCoreTypes) {
79
81
  wanted.add("core-types.d.ts");
80
82
  }
83
+ if (includeEngineGlobals) {
84
+ wanted.add("engine-globals.d.ts");
85
+ }
81
86
 
82
87
  for (const existing of readdirSync(absDir)) {
83
88
  if (existing.endsWith(".d.ts") && existing !== "index.d.ts" && !wanted.has(existing)) {
@@ -94,11 +99,17 @@ export function materializeApiSurface(
94
99
  if (includeCoreTypes) {
95
100
  writeFileSync(path.join(absDir, "core-types.d.ts"), readFileSync(coreTypesSrc, "utf8"));
96
101
  }
102
+ if (includeEngineGlobals) {
103
+ writeFileSync(path.join(absDir, "engine-globals.d.ts"), readFileSync(engineGlobalsSrc, "utf8"));
104
+ }
97
105
  for (const file of overloads) {
98
106
  writeFileSync(path.join(absDir, file), readFileSync(path.join(srcDir, file), "utf8"));
99
107
  }
100
108
 
101
109
  const modules = [...sources, ...overloads].map((file) => file.replace(/\.d\.ts$/, ""));
110
+ if (includeEngineGlobals) {
111
+ modules.push("engine-globals");
112
+ }
102
113
  const imports = modules.map((mod) => `import "./${mod}";`).join("\n");
103
114
  writeFileSync(path.join(absDir, "index.d.ts"), `${imports}\n\nexport {};\n`);
104
115
 
@@ -216,6 +227,12 @@ export async function materializeRefDocSurface(
216
227
  ...(excludeModules.length > 0 ? { excludeModules } : {}),
217
228
  });
218
229
  copyFileSync(path.join(root, "src", "core-types.ts"), path.join(absDir, "core-types.d.ts"));
230
+ copyFileSync(
231
+ path.join(root, "src", "engine-globals.d.ts"),
232
+ path.join(absDir, "engine-globals.d.ts"),
233
+ );
234
+ const indexPath = path.join(absDir, "index.d.ts");
235
+ writeFileSync(indexPath, `import "./engine-globals";\n${readFileSync(indexPath, "utf8")}`);
219
236
  } catch {
220
237
  rmSync(absDir, { recursive: true, force: true });
221
238
  return { materializedDir: null, active: null };