@teardown/metro-config 2.0.60 → 2.0.62

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/bun.d.ts CHANGED
@@ -16,9 +16,12 @@ export declare const BUN_BLOCK_PATTERN: RegExp;
16
16
  * This resolver provides an additional layer of protection by finding alternative
17
17
  * paths when a resolution from an existing custom resolver points to .bun.
18
18
  *
19
+ * IMPORTANT: This resolver returns null when it doesn't handle resolution, signaling
20
+ * Metro to use its default resolution. Do NOT call context.resolveRequest as that
21
+ * points to the outermost resolver (e.g., Uniwind) and creates infinite loops.
22
+ *
19
23
  * @param projectRoot - The project root directory
20
24
  * @param existingResolver - Optional existing resolver from the config that should be preserved.
21
- * If not provided, returns null to signal Metro's default resolution.
22
25
  */
23
26
  export declare function createBunAwareResolver(projectRoot: string, existingResolver?: ResolveRequestFn): ResolveRequestFn;
24
27
  /**
package/dist/bun.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../src/bun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAwB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAkCjH;AAmCD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAQ5E"}
1
+ {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../src/bun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAwB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAkCjH;AAmCD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAQ5E"}
package/dist/bun.js CHANGED
@@ -26,20 +26,23 @@ exports.BUN_BLOCK_PATTERN = /.*[/\\]\.bun[/\\].*/;
26
26
  * This resolver provides an additional layer of protection by finding alternative
27
27
  * paths when a resolution from an existing custom resolver points to .bun.
28
28
  *
29
+ * IMPORTANT: This resolver returns null when it doesn't handle resolution, signaling
30
+ * Metro to use its default resolution. Do NOT call context.resolveRequest as that
31
+ * points to the outermost resolver (e.g., Uniwind) and creates infinite loops.
32
+ *
29
33
  * @param projectRoot - The project root directory
30
34
  * @param existingResolver - Optional existing resolver from the config that should be preserved.
31
- * If not provided, returns null to signal Metro's default resolution.
32
35
  */
33
36
  function createBunAwareResolver(projectRoot, existingResolver) {
34
37
  const modulesPaths = (0, workspace_1.getModulesPaths)(projectRoot);
35
- // If no existing resolver, just return a pass-through that defers to Metro's default
36
- if (!existingResolver) {
37
- return (_context, _moduleName, _platform) => null;
38
- }
39
38
  return (context, moduleName, platform) => {
40
- // Call the existing resolver
41
- const result = existingResolver(context, moduleName, platform);
42
- // If no result, defer to Metro's default
39
+ // If there's an existing resolver, try it first
40
+ let result = null;
41
+ if (existingResolver) {
42
+ result = existingResolver(context, moduleName, platform);
43
+ }
44
+ // If no result from existing resolver, return null to let Metro use its default
45
+ // Do NOT call context.resolveRequest - it points to the outermost resolver
43
46
  if (!result) {
44
47
  return null;
45
48
  }
@@ -29,9 +29,12 @@ export declare function resolveWithTsConfigPaths(moduleName: string, mappings: P
29
29
  /**
30
30
  * Create a resolver that handles tsconfig paths.
31
31
  *
32
+ * IMPORTANT: This resolver returns null when it doesn't handle resolution, signaling
33
+ * Metro to use its default resolution. Do NOT call context.resolveRequest as that
34
+ * points to the outermost resolver (e.g., Uniwind) and creates infinite loops.
35
+ *
32
36
  * @param projectRoot - The project root directory
33
- * @param nextResolver - Optional next resolver in the chain. If not provided or returns null,
34
- * Metro will use its default resolution.
37
+ * @param nextResolver - Optional next resolver in the chain.
35
38
  * @param verbose - Whether to log debug information
36
39
  */
37
40
  export declare function createTsConfigPathsResolver(projectRoot: string, nextResolver?: ResolveRequestFn, verbose?: boolean): ResolveRequestFn;
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig-paths.d.ts","sourceRoot":"","sources":["../src/tsconfig-paths.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,UAAU,aAAa;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACjC;AAED,UAAU,WAAW;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;CACvB;AAoGD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAqB5E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,WAAW,EAAE,CAsB3F;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,GAAG,IAAI,CA0CnG;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAC1C,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,gBAAgB,EAC/B,OAAO,UAAQ,GACb,gBAAgB,CAuClB"}
1
+ {"version":3,"file":"tsconfig-paths.d.ts","sourceRoot":"","sources":["../src/tsconfig-paths.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,UAAU,aAAa;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACjC;AAED,UAAU,WAAW;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;CACvB;AAoGD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAqB5E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,WAAW,EAAE,CAsB3F;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,GAAG,IAAI,CA0CnG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAC1C,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,gBAAgB,EAC/B,OAAO,UAAQ,GACb,gBAAgB,CAyClB"}
@@ -194,9 +194,12 @@ function resolveWithTsConfigPaths(moduleName, mappings) {
194
194
  /**
195
195
  * Create a resolver that handles tsconfig paths.
196
196
  *
197
+ * IMPORTANT: This resolver returns null when it doesn't handle resolution, signaling
198
+ * Metro to use its default resolution. Do NOT call context.resolveRequest as that
199
+ * points to the outermost resolver (e.g., Uniwind) and creates infinite loops.
200
+ *
197
201
  * @param projectRoot - The project root directory
198
- * @param nextResolver - Optional next resolver in the chain. If not provided or returns null,
199
- * Metro will use its default resolution.
202
+ * @param nextResolver - Optional next resolver in the chain.
200
203
  * @param verbose - Whether to log debug information
201
204
  */
202
205
  function createTsConfigPathsResolver(projectRoot, nextResolver, verbose = false) {
@@ -205,7 +208,8 @@ function createTsConfigPathsResolver(projectRoot, nextResolver, verbose = false)
205
208
  if (verbose) {
206
209
  console.log("[teardown/metro-config] No tsconfig paths found, skipping path resolution");
207
210
  }
208
- // Return null to signal Metro should use default resolution
211
+ // Pass through to next resolver or return null for Metro's default
212
+ // Do NOT call context.resolveRequest - it points to the outermost resolver
209
213
  return nextResolver ?? ((_context, _moduleName, _platform) => null);
210
214
  }
211
215
  const mappings = buildPathMappings(projectRoot, config);
@@ -224,11 +228,12 @@ function createTsConfigPathsResolver(projectRoot, nextResolver, verbose = false)
224
228
  }
225
229
  return { type: "sourceFile", filePath: resolvedPath };
226
230
  }
227
- // Fall back to next resolver in chain, or return null for Metro's default
231
+ // Fall back to next resolver in chain
228
232
  if (nextResolver) {
229
233
  return nextResolver(context, moduleName, platform);
230
234
  }
231
- // Return null to signal Metro should use its default resolution
235
+ // Return null to let Metro use its default resolution
236
+ // Do NOT call context.resolveRequest - it points to the outermost resolver
232
237
  return null;
233
238
  };
234
239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teardown/metro-config",
3
- "version": "2.0.60",
3
+ "version": "2.0.62",
4
4
  "description": "Metro configuration for Teardown - Rust-powered transforms via Facetpack",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -45,7 +45,7 @@
45
45
  "resolve-workspace-root": "^2.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@teardown/tsconfig": "2.0.60",
48
+ "@teardown/tsconfig": "2.0.62",
49
49
  "@types/bun": "1.3.5",
50
50
  "typescript": "5.9.3"
51
51
  },