@teardown/navigation-metro 2.0.65 → 2.0.67

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE;QACV,cAAc,CAAC,EAAE,CAChB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,KACnB;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QAC/C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACvB,CAAC;IACF,WAAW,CAAC,EAAE;QACb,4BAA4B,CAAC,EAAE,OAAO,CAAC;QACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACvB,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,yBAA8B,GAAG,WAAW,CAyDhH;AAED,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEp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QACb,4BAA4B,CAAC,EAAE,OAAO,CAAC;QACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACvB,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,yBAA8B,GAAG,WAAW,CAqEhH;AAED,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EACN,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -6,9 +6,37 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.stopRouteWatcher = exports.startRouteWatcher = exports.isWatcherRunning = exports.validateRoutes = exports.scanRoutesDirectory = exports.flattenRoutes = exports.filePathToScreenName = exports.extractParams = exports.buildUrlPath = exports.generateAllRouteFiles = void 0;
8
8
  exports.withTeardownNavigation = withTeardownNavigation;
9
+ const node_fs_1 = require("node:fs");
9
10
  const node_path_1 = require("node:path");
10
11
  const route_generator_1 = require("./generator/route-generator");
11
12
  const file_watcher_1 = require("./watcher/file-watcher");
13
+ /**
14
+ * Config file names to search for (in order of priority)
15
+ */
16
+ const CONFIG_FILE_NAMES = ["teardown.config.ts", "teardown.config.js", "teardown.config.mjs", "launchpad.config.ts"];
17
+ /**
18
+ * Read the slug from the Teardown config file
19
+ * This is a simple synchronous parser that extracts the slug value
20
+ */
21
+ function readSlugFromConfig(projectRoot) {
22
+ for (const fileName of CONFIG_FILE_NAMES) {
23
+ const configPath = (0, node_path_1.resolve)(projectRoot, fileName);
24
+ if ((0, node_fs_1.existsSync)(configPath)) {
25
+ try {
26
+ const content = (0, node_fs_1.readFileSync)(configPath, "utf-8");
27
+ // Extract slug using regex - handles both single and double quotes
28
+ const slugMatch = content.match(/slug:\s*['"]([^'"]+)['"]/);
29
+ if (slugMatch) {
30
+ return slugMatch[1];
31
+ }
32
+ }
33
+ catch {
34
+ // Ignore read errors and try next config file
35
+ }
36
+ }
37
+ }
38
+ return null;
39
+ }
12
40
  /**
13
41
  * Wraps a Metro configuration with Teardown Navigation support
14
42
  *
@@ -34,10 +62,21 @@ const file_watcher_1 = require("./watcher/file-watcher");
34
62
  * ```
35
63
  */
36
64
  function withTeardownNavigation(config, options = {}) {
37
- const { routesDir = "./src/routes", generatedDir = "./.teardown", prefixes = [], verbose = false } = options;
65
+ const { routesDir = "./src/routes", generatedDir = "./.teardown", verbose = false } = options;
38
66
  const projectRoot = config.projectRoot ?? process.cwd();
39
67
  const absoluteRoutesDir = (0, node_path_1.resolve)(projectRoot, routesDir);
40
68
  const absoluteGeneratedDir = (0, node_path_1.resolve)(projectRoot, generatedDir);
69
+ // If no prefixes provided, try to read slug from teardown config
70
+ let prefixes = options.prefixes ?? [];
71
+ if (prefixes.length === 0) {
72
+ const slug = readSlugFromConfig(projectRoot);
73
+ if (slug) {
74
+ prefixes = [`${slug}://`];
75
+ if (verbose) {
76
+ console.log(`[teardown/navigation] Using slug from config: ${slug}://`);
77
+ }
78
+ }
79
+ }
41
80
  // Generate types on startup
42
81
  try {
43
82
  (0, route_generator_1.generateAllRouteFiles)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teardown/navigation-metro",
3
- "version": "2.0.65",
3
+ "version": "2.0.67",
4
4
  "description": "Metro plugin for @teardown/navigation type generation",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@biomejs/biome": "2.3.11",
45
- "@teardown/tsconfig": "2.0.65",
45
+ "@teardown/tsconfig": "2.0.67",
46
46
  "@types/node": "24.10.1",
47
47
  "typescript": "5.9.3"
48
48
  }