@defold-typescript/transpiler 0.41.0 → 0.42.0

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.d.ts CHANGED
@@ -15,7 +15,7 @@ export { findMainEntryFactoryImports } from "./main-entry-factory-imports";
15
15
  export type { BuildConfig, ScriptKind, SourceOutputKind } from "./output-paths";
16
16
  export { computeOutputRel, DEFAULT_INCLUDE, parseBuildConfig, projectRelativeBase, requirePathForRel, SCRIPT_SUFFIX_BY_KIND, stripIncludeBase, } from "./output-paths";
17
17
  export { getProgramDiagnostics } from "./program-diagnostics";
18
- export { isDefignoredPath, SCAFFOLDED_DEFIGNORE_LINES } from "./project-resources";
18
+ export { isDefignoredPath, parseDefignore, SCAFFOLDED_DEFIGNORE_LINES, } from "./project-resources";
19
19
  export { rewriteEmittedRequires } from "./require-rewrite";
20
20
  export { buildSceneAddressDeclaration } from "./scene-address-declaration";
21
21
  export type { SceneCollectionRoles, SceneCollectionRolesInput } from "./scene-collection-roles";
package/dist/index.js CHANGED
@@ -1688,9 +1688,13 @@ function buildInputActionIndex(documents) {
1688
1688
  }
1689
1689
  // src/project-resources.ts
1690
1690
  var SCAFFOLDED_DEFIGNORE_LINES = ["/node_modules", "/.defold-types", "/.vscode"];
1691
- function isDefignoredPath(displayPath) {
1691
+ function parseDefignore(text) {
1692
+ return text.split(`
1693
+ `).map((line) => line.trim()).filter((line) => line !== "").map((line) => line.startsWith("/") ? line : `/${line}`);
1694
+ }
1695
+ function isDefignoredPath(displayPath, lines = SCAFFOLDED_DEFIGNORE_LINES) {
1692
1696
  const rooted = `/${displayPath.replace(/^\/+/, "")}`;
1693
- return SCAFFOLDED_DEFIGNORE_LINES.some((line) => rooted === line || rooted.startsWith(`${line}/`));
1697
+ return lines.some((line) => rooted === line || rooted.startsWith(`${line}/`));
1694
1698
  }
1695
1699
 
1696
1700
  // src/scene-documents.ts
@@ -4100,6 +4104,7 @@ export {
4100
4104
  libraryIncludedEntries,
4101
4105
  listProjectResourcePaths,
4102
4106
  parseBuildConfig,
4107
+ parseDefignore,
4103
4108
  parseSceneTextFormat,
4104
4109
  projectRelativeBase,
4105
4110
  readGameProjectDependencies,
@@ -1,2 +1,3 @@
1
1
  export declare const SCAFFOLDED_DEFIGNORE_LINES: string[];
2
- export declare function isDefignoredPath(displayPath: string): boolean;
2
+ export declare function parseDefignore(text: string): string[];
3
+ export declare function isDefignoredPath(displayPath: string, lines?: readonly string[]): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defold-typescript/transpiler",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
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.41.0",
38
+ "@defold-typescript/types": "0.42.0",
39
39
  "@typescript-to-lua/language-extensions": "1.19.0",
40
40
  "typescript-to-lua": "^1.36.0"
41
41
  }
package/src/index.ts CHANGED
@@ -48,7 +48,11 @@ export {
48
48
  stripIncludeBase,
49
49
  } from "./output-paths";
50
50
  export { getProgramDiagnostics } from "./program-diagnostics";
51
- export { isDefignoredPath, SCAFFOLDED_DEFIGNORE_LINES } from "./project-resources";
51
+ export {
52
+ isDefignoredPath,
53
+ parseDefignore,
54
+ SCAFFOLDED_DEFIGNORE_LINES,
55
+ } from "./project-resources";
52
56
  export { rewriteEmittedRequires } from "./require-rewrite";
53
57
  export { buildSceneAddressDeclaration } from "./scene-address-declaration";
54
58
  export type { SceneCollectionRoles, SceneCollectionRolesInput } from "./scene-collection-roles";
@@ -9,12 +9,25 @@
9
9
  // `.vscode`).
10
10
  export const SCAFFOLDED_DEFIGNORE_LINES = ["/node_modules", "/.defold-types", "/.vscode"];
11
11
 
12
- // Whether a project-relative display path lies under one of the lines `init`
13
- // scaffolds. Root-anchored, because a `.defignore` line is a root-relative
14
- // path: `assets/node_modules/tiles.atlas` is a resource Defold loads.
15
- export function isDefignoredPath(displayPath: string): boolean {
12
+ // A project's own `.defignore` text as root-anchored lines, the shape
13
+ // `isDefignoredPath` matches against. A line without its leading `/` names the
14
+ // same root-relative path.
15
+ export function parseDefignore(text: string): string[] {
16
+ return text
17
+ .split("\n")
18
+ .map((line) => line.trim())
19
+ .filter((line) => line !== "")
20
+ .map((line) => (line.startsWith("/") ? line : `/${line}`));
21
+ }
22
+
23
+ // Whether a project-relative display path lies under one of `lines`, by
24
+ // default the ones `init` scaffolds. Root-anchored, because a `.defignore` line
25
+ // is a root-relative path: `assets/node_modules/tiles.atlas` is a resource
26
+ // Defold loads.
27
+ export function isDefignoredPath(
28
+ displayPath: string,
29
+ lines: readonly string[] = SCAFFOLDED_DEFIGNORE_LINES,
30
+ ): boolean {
16
31
  const rooted = `/${displayPath.replace(/^\/+/, "")}`;
17
- return SCAFFOLDED_DEFIGNORE_LINES.some(
18
- (line) => rooted === line || rooted.startsWith(`${line}/`),
19
- );
32
+ return lines.some((line) => rooted === line || rooted.startsWith(`${line}/`));
20
33
  }