react-native-intlayer 9.0.0-canary.3 → 9.0.0-canary.5

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,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_exclusionList = require('./exclusionList.cjs');
3
2
  let node_path = require("node:path");
4
3
  let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
5
4
  let _intlayer_config_node = require("@intlayer/config/node");
@@ -28,8 +27,9 @@ const getMetroResolve = () => {
28
27
  * > Note: `configMetroIntlayerSync` does not build intlayer dictionaries on server start. Use `configMetroIntlayer` for that.
29
28
  */
30
29
  const configMetroIntlayerSync = (baseConfig) => {
30
+ const configuration = (0, _intlayer_config_node.getConfiguration)();
31
31
  const alias = (0, _intlayer_config_utils.getAlias)({
32
- configuration: (0, _intlayer_config_node.getConfiguration)(),
32
+ configuration,
33
33
  formatter: node_path.resolve
34
34
  });
35
35
  const existingBlockList = baseConfig?.resolver?.blockList;
@@ -69,6 +69,18 @@ const configMetroIntlayerSync = (baseConfig) => {
69
69
  filePath: require.resolve("@intlayer/core/file/browser"),
70
70
  type: "sourceFile"
71
71
  };
72
+ if (moduleName.startsWith("@formatjs/")) {
73
+ inflightFallbackContexts.add(context);
74
+ try {
75
+ const cleanContext = {
76
+ ...context,
77
+ unstable_enablePackageExports: false
78
+ };
79
+ return getMetroResolve()(cleanContext, moduleName, ...args);
80
+ } finally {
81
+ inflightFallbackContexts.delete(context);
82
+ }
83
+ }
72
84
  if (existingResolveRequest) return existingResolveRequest(context, moduleName, ...args);
73
85
  if (inflightFallbackContexts.has(context)) {
74
86
  const { resolveRequest: _r, ...pureContext } = context;
@@ -81,7 +93,7 @@ const configMetroIntlayerSync = (baseConfig) => {
81
93
  inflightFallbackContexts.delete(context);
82
94
  }
83
95
  },
84
- blockList: require_exclusionList.exclusionList([...existingPatterns, /.*\.content\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/])
96
+ blockList: [...existingPatterns, ...configuration.content.fileExtensions.map((ext) => new RegExp(`.*${ext.replace(/\./g, "\\.")}$`))]
85
97
  }
86
98
  };
87
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"configMetroIntlayer.cjs","names":["pathResolve","exclusionList"],"sources":["../../src/configMetroIntlayer.ts"],"sourcesContent":["import { resolve as pathResolve } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport type { getDefaultConfig } from 'expo/metro-config';\nimport { exclusionList } from './exclusionList';\n\n/**\n * Returns the `resolve` function from metro-resolver, preferring the copy\n * bundled inside Metro itself. Loading from Metro's own package directory\n * ensures we use the same resolver instance that Metro uses internally,\n * which prevents the cross-version recursion described in\n * https://github.com/aymericzip/intlayer/issues/457.\n */\ntype AnyResolver = (context: any, moduleName: string, ...args: any[]) => any;\n\nconst getMetroResolve = (): AnyResolver => {\n try {\n const metroPackageDir = pathResolve(\n require.resolve('metro/package.json'),\n '..'\n );\n return (\n require(\n pathResolve(metroPackageDir, 'node_modules', 'metro-resolver')\n ) as typeof import('metro-resolver')\n ).resolve as AnyResolver;\n } catch {\n return (require('metro-resolver') as typeof import('metro-resolver'))\n .resolve as AnyResolver;\n }\n};\n\ntype MetroConfig = ReturnType<typeof getDefaultConfig>;\n\n/**\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { configMetroIntlayerSync } = require(\"react-native-intlayer/metro\");\n *\n *\n * const defaultConfig = getDefaultConfig(__dirname);\n *\n * return configMetroIntlayerSync(defaultConfig);\n * ```\n *\n * > Note: `configMetroIntlayerSync` does not build intlayer dictionaries on server start. Use `configMetroIntlayer` for that.\n */\nexport const configMetroIntlayerSync = (\n baseConfig?: MetroConfig\n): MetroConfig => {\n const configuration = getConfiguration();\n\n const alias = getAlias({\n configuration,\n formatter: pathResolve, // get absolute path\n });\n\n const existingBlockList = baseConfig?.resolver?.blockList;\n const existingPatterns: RegExp[] =\n existingBlockList instanceof RegExp\n ? [existingBlockList]\n : (existingBlockList ?? []);\n\n const existingResolveRequest = baseConfig?.resolver?.resolveRequest;\n\n /**\n * Tracks resolution contexts that are currently executing inside the\n * metro-resolver fallback call. When metro-resolver cannot find a module it\n * may call back through `context.resolveRequest` (the outermost resolver in\n * the chain, e.g. Sentry → NativeWind → ours). That callback eventually\n * reaches our resolver again. Without a guard we would recurse indefinitely\n * (see issue #457).\n *\n * On the second entry we break the cycle by stripping `resolveRequest` from\n * the context so metro-resolver finishes with its built-in logic only\n * (alias, extraNodeModules, …) rather than calling back a third time.\n *\n * Metro creates a fresh context object per module resolution, so using a\n * WeakSet keyed on context is safe and causes no cross-resolution\n * interference.\n */\n const inflightFallbackContexts = new WeakSet<object>();\n\n const config = {\n ...baseConfig,\n\n resolver: {\n ...baseConfig?.resolver,\n resolveRequest: (context, moduleName, ...args) => {\n if (Object.keys(alias).includes(moduleName)) {\n return {\n filePath: alias[moduleName as keyof typeof alias],\n type: 'sourceFile',\n };\n }\n\n // Because metro does not resolve submodules, we need to resolve the path manually\n if (moduleName === '@intlayer/config/client') {\n return {\n filePath: require.resolve('@intlayer/config/client'),\n type: 'sourceFile',\n };\n }\n\n // Because metro does not resolve submodules, we need to resolve the path manually\n if (moduleName === '@intlayer/core/file') {\n // Force React Native to use the correct transpiled version\n return {\n filePath: require.resolve('@intlayer/core/file/browser'),\n type: 'sourceFile',\n };\n }\n\n // Delegate to the user-provided resolver if present\n if (existingResolveRequest) {\n return existingResolveRequest(context, moduleName, ...args);\n }\n\n // Re-entry guard: metro-resolver has already been invoked for this\n // context and is now calling back through context.resolveRequest (the\n // outer chain) which has bubbled back to us. Strip resolveRequest so\n // metro-resolver resolves the module with only its built-in rules\n // (alias, extraNodeModules, etc.) and does not recurse again.\n if (inflightFallbackContexts.has(context)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { resolveRequest: _r, ...pureContext } = context as any;\n return getMetroResolve()(pureContext, moduleName, ...args);\n }\n\n // First pass: call metro-resolver while preserving context.resolveRequest\n // so outer wrappers (NativeWind, Sentry, …) still get a chance to\n // handle modules that metro-resolver cannot locate on its own (e.g. @/\n // tsconfig path aliases that a wrapper resolves via its own logic).\n inflightFallbackContexts.add(context);\n try {\n return getMetroResolve()(context, moduleName, ...args);\n } finally {\n inflightFallbackContexts.delete(context);\n }\n },\n blockList: exclusionList([\n ...existingPatterns,\n // the following instruction should be replaced by a pattern derived from configuration.content.fileExtensions\n // but generating the pattern from fileExtensions does not exclude the files properly for now\n /.*\\.content\\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/,\n ]),\n },\n } as MetroConfig;\n\n return config;\n};\n\n/**\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { configMetroIntlayer } = require(\"react-native-intlayer/metro\");\n *\n * module.exports = (async () => {\n * const defaultConfig = getDefaultConfig(__dirname);\n *\n * return await configMetroIntlayer(defaultConfig);\n * })();\n * ```\n *\n * > Note: `configMetroIntlayer` builds intlayer dictionaries on server start. Use `configMetroIntlayerSync` instead if you want to skip that.\n */\nexport const configMetroIntlayer = async (\n baseConfig?: MetroConfig\n): Promise<MetroConfig> => {\n const configuration = getConfiguration();\n\n await prepareIntlayer(configuration);\n\n return configMetroIntlayerSync(baseConfig);\n};\n"],"mappings":";;;;;;;;AAgBA,MAAM,wBAAqC;AACzC,KAAI;EACF,MAAM,yCACJ,QAAQ,QAAQ,qBAAqB,EACrC,KACD;AACD,SACE,+BACc,iBAAiB,gBAAgB,iBAAiB,CAC/D,CACD;SACI;AACN,SAAQ,QAAQ,iBAAiB,CAC9B;;;;;;;;;;;;;;;;AAmBP,MAAa,2BACX,eACgB;CAGhB,MAAM,6CAAiB;EACrB,4DAAa;EACb,WAAWA;EACZ,CAAC;CAEF,MAAM,oBAAoB,YAAY,UAAU;CAChD,MAAM,mBACJ,6BAA6B,SACzB,CAAC,kBAAkB,GAClB,qBAAqB,EAAE;CAE9B,MAAM,yBAAyB,YAAY,UAAU;;;;;;;;;;;;;;;;;CAkBrD,MAAM,2CAA2B,IAAI,SAAiB;AAoEtD,QAAO;EAjEL,GAAG;EAEH,UAAU;GACR,GAAG,YAAY;GACf,iBAAiB,SAAS,YAAY,GAAG,SAAS;AAChD,QAAI,OAAO,KAAK,MAAM,CAAC,SAAS,WAAW,CACzC,QAAO;KACL,UAAU,MAAM;KAChB,MAAM;KACP;AAIH,QAAI,eAAe,0BACjB,QAAO;KACL,UAAU,QAAQ,QAAQ,0BAA0B;KACpD,MAAM;KACP;AAIH,QAAI,eAAe,sBAEjB,QAAO;KACL,UAAU,QAAQ,QAAQ,8BAA8B;KACxD,MAAM;KACP;AAIH,QAAI,uBACF,QAAO,uBAAuB,SAAS,YAAY,GAAG,KAAK;AAQ7D,QAAI,yBAAyB,IAAI,QAAQ,EAAE;KAEzC,MAAM,EAAE,gBAAgB,IAAI,GAAG,gBAAgB;AAC/C,YAAO,iBAAiB,CAAC,aAAa,YAAY,GAAG,KAAK;;AAO5D,6BAAyB,IAAI,QAAQ;AACrC,QAAI;AACF,YAAO,iBAAiB,CAAC,SAAS,YAAY,GAAG,KAAK;cAC9C;AACR,8BAAyB,OAAO,QAAQ;;;GAG5C,WAAWC,oCAAc,CACvB,GAAG,kBAGH,uDACD,CAAC;GACH;EAGU;;;;;;;;;;;;;;;;AAiBf,MAAa,sBAAsB,OACjC,eACyB;AAGzB,kGAAmC,CAAC;AAEpC,QAAO,wBAAwB,WAAW"}
1
+ {"version":3,"file":"configMetroIntlayer.cjs","names":["pathResolve"],"sources":["../../src/configMetroIntlayer.ts"],"sourcesContent":["import { resolve as pathResolve } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport type { getDefaultConfig } from 'expo/metro-config';\n\n/**\n * Returns the `resolve` function from metro-resolver, preferring the copy\n * bundled inside Metro itself. Loading from Metro's own package directory\n * ensures we use the same resolver instance that Metro uses internally,\n * which prevents the cross-version recursion described in\n * https://github.com/aymericzip/intlayer/issues/457.\n */\ntype AnyResolver = (context: any, moduleName: string, ...args: any[]) => any;\n\nconst getMetroResolve = (): AnyResolver => {\n try {\n const metroPackageDir = pathResolve(\n require.resolve('metro/package.json'),\n '..'\n );\n return (\n require(\n pathResolve(metroPackageDir, 'node_modules', 'metro-resolver')\n ) as typeof import('metro-resolver')\n ).resolve as AnyResolver;\n } catch {\n return (require('metro-resolver') as typeof import('metro-resolver'))\n .resolve as AnyResolver;\n }\n};\n\ntype MetroConfig = ReturnType<typeof getDefaultConfig>;\n\n/**\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { configMetroIntlayerSync } = require(\"react-native-intlayer/metro\");\n *\n *\n * const defaultConfig = getDefaultConfig(__dirname);\n *\n * return configMetroIntlayerSync(defaultConfig);\n * ```\n *\n * > Note: `configMetroIntlayerSync` does not build intlayer dictionaries on server start. Use `configMetroIntlayer` for that.\n */\nexport const configMetroIntlayerSync = (\n baseConfig?: MetroConfig\n): MetroConfig => {\n const configuration = getConfiguration();\n\n const alias = getAlias({\n configuration,\n formatter: pathResolve, // get absolute path\n });\n\n const existingBlockList = baseConfig?.resolver?.blockList;\n const existingPatterns: RegExp[] =\n existingBlockList instanceof RegExp\n ? [existingBlockList]\n : (existingBlockList ?? []);\n\n const existingResolveRequest = baseConfig?.resolver?.resolveRequest;\n\n /**\n * Tracks resolution contexts that are currently executing inside the\n * metro-resolver fallback call. When metro-resolver cannot find a module it\n * may call back through `context.resolveRequest` (the outermost resolver in\n * the chain, e.g. Sentry → NativeWind → ours). That callback eventually\n * reaches our resolver again. Without a guard we would recurse indefinitely\n * (see issue #457).\n *\n * On the second entry we break the cycle by stripping `resolveRequest` from\n * the context so metro-resolver finishes with its built-in logic only\n * (alias, extraNodeModules, …) rather than calling back a third time.\n *\n * Metro creates a fresh context object per module resolution, so using a\n * WeakSet keyed on context is safe and causes no cross-resolution\n * interference.\n */\n const inflightFallbackContexts = new WeakSet<object>();\n\n const config = {\n ...baseConfig,\n\n resolver: {\n ...baseConfig?.resolver,\n resolveRequest: (context, moduleName, ...args) => {\n if (Object.keys(alias).includes(moduleName)) {\n return {\n filePath: alias[moduleName as keyof typeof alias],\n type: 'sourceFile',\n };\n }\n\n // Because metro does not resolve submodules, we need to resolve the path manually\n if (moduleName === '@intlayer/config/client') {\n return {\n filePath: require.resolve('@intlayer/config/client'),\n type: 'sourceFile',\n };\n }\n\n // Because metro does not resolve submodules, we need to resolve the path manually\n if (moduleName === '@intlayer/core/file') {\n // Force React Native to use the correct transpiled version\n return {\n filePath: require.resolve('@intlayer/core/file/browser'),\n type: 'sourceFile',\n };\n }\n\n // @formatjs packages have invalid exports configuration or missing exports for polyfills\n // By disabling package exports for these modules, we avoid the Metro warnings and let it\n // fall back cleanly to file-based resolution.\n if (moduleName.startsWith('@formatjs/')) {\n inflightFallbackContexts.add(context);\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const cleanContext = {\n ...(context as any),\n unstable_enablePackageExports: false,\n };\n return getMetroResolve()(cleanContext, moduleName, ...args);\n } finally {\n inflightFallbackContexts.delete(context);\n }\n }\n\n // Delegate to the user-provided resolver if present\n if (existingResolveRequest) {\n return existingResolveRequest(context, moduleName, ...args);\n }\n\n // Re-entry guard: metro-resolver has already been invoked for this\n // context and is now calling back through context.resolveRequest (the\n // outer chain) which has bubbled back to us. Strip resolveRequest so\n // metro-resolver resolves the module with only its built-in rules\n // (alias, extraNodeModules, etc.) and does not recurse again.\n if (inflightFallbackContexts.has(context)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { resolveRequest: _r, ...pureContext } = context as any;\n return getMetroResolve()(pureContext, moduleName, ...args);\n }\n\n // First pass: call metro-resolver while preserving context.resolveRequest\n // so outer wrappers (NativeWind, Sentry, …) still get a chance to\n // handle modules that metro-resolver cannot locate on its own (e.g. @/\n // tsconfig path aliases that a wrapper resolves via its own logic).\n inflightFallbackContexts.add(context);\n try {\n return getMetroResolve()(context, moduleName, ...args);\n } finally {\n inflightFallbackContexts.delete(context);\n }\n },\n blockList: [\n ...existingPatterns,\n ...configuration.content.fileExtensions.map(\n (ext) => new RegExp(`.*${ext.replace(/\\./g, '\\\\.')}$`)\n ),\n ],\n },\n } as MetroConfig;\n\n return config;\n};\n\n/**\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { configMetroIntlayer } = require(\"react-native-intlayer/metro\");\n *\n * module.exports = (async () => {\n * const defaultConfig = getDefaultConfig(__dirname);\n *\n * return await configMetroIntlayer(defaultConfig);\n * })();\n * ```\n *\n * > Note: `configMetroIntlayer` builds intlayer dictionaries on server start. Use `configMetroIntlayerSync` instead if you want to skip that.\n */\nexport const configMetroIntlayer = async (\n baseConfig?: MetroConfig\n): Promise<MetroConfig> => {\n const configuration = getConfiguration();\n\n await prepareIntlayer(configuration);\n\n return configMetroIntlayerSync(baseConfig);\n};\n"],"mappings":";;;;;;;AAeA,MAAM,wBAAqC;AACzC,KAAI;EACF,MAAM,yCACJ,QAAQ,QAAQ,qBAAqB,EACrC,KACD;AACD,SACE,+BACc,iBAAiB,gBAAgB,iBAAiB,CAC/D,CACD;SACI;AACN,SAAQ,QAAQ,iBAAiB,CAC9B;;;;;;;;;;;;;;;;AAmBP,MAAa,2BACX,eACgB;CAChB,MAAM,6DAAkC;CAExC,MAAM,6CAAiB;EACrB;EACA,WAAWA;EACZ,CAAC;CAEF,MAAM,oBAAoB,YAAY,UAAU;CAChD,MAAM,mBACJ,6BAA6B,SACzB,CAAC,kBAAkB,GAClB,qBAAqB,EAAE;CAE9B,MAAM,yBAAyB,YAAY,UAAU;;;;;;;;;;;;;;;;;CAkBrD,MAAM,2CAA2B,IAAI,SAAiB;AAqFtD,QAAO;EAlFL,GAAG;EAEH,UAAU;GACR,GAAG,YAAY;GACf,iBAAiB,SAAS,YAAY,GAAG,SAAS;AAChD,QAAI,OAAO,KAAK,MAAM,CAAC,SAAS,WAAW,CACzC,QAAO;KACL,UAAU,MAAM;KAChB,MAAM;KACP;AAIH,QAAI,eAAe,0BACjB,QAAO;KACL,UAAU,QAAQ,QAAQ,0BAA0B;KACpD,MAAM;KACP;AAIH,QAAI,eAAe,sBAEjB,QAAO;KACL,UAAU,QAAQ,QAAQ,8BAA8B;KACxD,MAAM;KACP;AAMH,QAAI,WAAW,WAAW,aAAa,EAAE;AACvC,8BAAyB,IAAI,QAAQ;AACrC,SAAI;MAEF,MAAM,eAAe;OACnB,GAAI;OACJ,+BAA+B;OAChC;AACD,aAAO,iBAAiB,CAAC,cAAc,YAAY,GAAG,KAAK;eACnD;AACR,+BAAyB,OAAO,QAAQ;;;AAK5C,QAAI,uBACF,QAAO,uBAAuB,SAAS,YAAY,GAAG,KAAK;AAQ7D,QAAI,yBAAyB,IAAI,QAAQ,EAAE;KAEzC,MAAM,EAAE,gBAAgB,IAAI,GAAG,gBAAgB;AAC/C,YAAO,iBAAiB,CAAC,aAAa,YAAY,GAAG,KAAK;;AAO5D,6BAAyB,IAAI,QAAQ;AACrC,QAAI;AACF,YAAO,iBAAiB,CAAC,SAAS,YAAY,GAAG,KAAK;cAC9C;AACR,8BAAyB,OAAO,QAAQ;;;GAG5C,WAAW,CACT,GAAG,kBACH,GAAG,cAAc,QAAQ,eAAe,KACrC,QAAQ,IAAI,OAAO,KAAK,IAAI,QAAQ,OAAO,MAAM,CAAC,GAAG,CACvD,CACF;GACF;EAGU;;;;;;;;;;;;;;;;AAiBf,MAAa,sBAAsB,OACjC,eACyB;AAGzB,kGAAmC,CAAC;AAEpC,QAAO,wBAAwB,WAAW"}
@@ -1,5 +1,4 @@
1
1
  import { __require } from "./_virtual/_rolldown/runtime.mjs";
2
- import { exclusionList } from "./exclusionList.mjs";
3
2
  import { resolve } from "node:path";
4
3
  import { prepareIntlayer } from "@intlayer/chokidar/build";
5
4
  import { getConfiguration } from "@intlayer/config/node";
@@ -28,8 +27,9 @@ const getMetroResolve = () => {
28
27
  * > Note: `configMetroIntlayerSync` does not build intlayer dictionaries on server start. Use `configMetroIntlayer` for that.
29
28
  */
30
29
  const configMetroIntlayerSync = (baseConfig) => {
30
+ const configuration = getConfiguration();
31
31
  const alias = getAlias({
32
- configuration: getConfiguration(),
32
+ configuration,
33
33
  formatter: resolve
34
34
  });
35
35
  const existingBlockList = baseConfig?.resolver?.blockList;
@@ -69,6 +69,18 @@ const configMetroIntlayerSync = (baseConfig) => {
69
69
  filePath: __require.resolve("@intlayer/core/file/browser"),
70
70
  type: "sourceFile"
71
71
  };
72
+ if (moduleName.startsWith("@formatjs/")) {
73
+ inflightFallbackContexts.add(context);
74
+ try {
75
+ const cleanContext = {
76
+ ...context,
77
+ unstable_enablePackageExports: false
78
+ };
79
+ return getMetroResolve()(cleanContext, moduleName, ...args);
80
+ } finally {
81
+ inflightFallbackContexts.delete(context);
82
+ }
83
+ }
72
84
  if (existingResolveRequest) return existingResolveRequest(context, moduleName, ...args);
73
85
  if (inflightFallbackContexts.has(context)) {
74
86
  const { resolveRequest: _r, ...pureContext } = context;
@@ -81,7 +93,7 @@ const configMetroIntlayerSync = (baseConfig) => {
81
93
  inflightFallbackContexts.delete(context);
82
94
  }
83
95
  },
84
- blockList: exclusionList([...existingPatterns, /.*\.content\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/])
96
+ blockList: [...existingPatterns, ...configuration.content.fileExtensions.map((ext) => new RegExp(`.*${ext.replace(/\./g, "\\.")}$`))]
85
97
  }
86
98
  };
87
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"configMetroIntlayer.mjs","names":["pathResolve"],"sources":["../../src/configMetroIntlayer.ts"],"sourcesContent":["import { resolve as pathResolve } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport type { getDefaultConfig } from 'expo/metro-config';\nimport { exclusionList } from './exclusionList';\n\n/**\n * Returns the `resolve` function from metro-resolver, preferring the copy\n * bundled inside Metro itself. Loading from Metro's own package directory\n * ensures we use the same resolver instance that Metro uses internally,\n * which prevents the cross-version recursion described in\n * https://github.com/aymericzip/intlayer/issues/457.\n */\ntype AnyResolver = (context: any, moduleName: string, ...args: any[]) => any;\n\nconst getMetroResolve = (): AnyResolver => {\n try {\n const metroPackageDir = pathResolve(\n require.resolve('metro/package.json'),\n '..'\n );\n return (\n require(\n pathResolve(metroPackageDir, 'node_modules', 'metro-resolver')\n ) as typeof import('metro-resolver')\n ).resolve as AnyResolver;\n } catch {\n return (require('metro-resolver') as typeof import('metro-resolver'))\n .resolve as AnyResolver;\n }\n};\n\ntype MetroConfig = ReturnType<typeof getDefaultConfig>;\n\n/**\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { configMetroIntlayerSync } = require(\"react-native-intlayer/metro\");\n *\n *\n * const defaultConfig = getDefaultConfig(__dirname);\n *\n * return configMetroIntlayerSync(defaultConfig);\n * ```\n *\n * > Note: `configMetroIntlayerSync` does not build intlayer dictionaries on server start. Use `configMetroIntlayer` for that.\n */\nexport const configMetroIntlayerSync = (\n baseConfig?: MetroConfig\n): MetroConfig => {\n const configuration = getConfiguration();\n\n const alias = getAlias({\n configuration,\n formatter: pathResolve, // get absolute path\n });\n\n const existingBlockList = baseConfig?.resolver?.blockList;\n const existingPatterns: RegExp[] =\n existingBlockList instanceof RegExp\n ? [existingBlockList]\n : (existingBlockList ?? []);\n\n const existingResolveRequest = baseConfig?.resolver?.resolveRequest;\n\n /**\n * Tracks resolution contexts that are currently executing inside the\n * metro-resolver fallback call. When metro-resolver cannot find a module it\n * may call back through `context.resolveRequest` (the outermost resolver in\n * the chain, e.g. Sentry → NativeWind → ours). That callback eventually\n * reaches our resolver again. Without a guard we would recurse indefinitely\n * (see issue #457).\n *\n * On the second entry we break the cycle by stripping `resolveRequest` from\n * the context so metro-resolver finishes with its built-in logic only\n * (alias, extraNodeModules, …) rather than calling back a third time.\n *\n * Metro creates a fresh context object per module resolution, so using a\n * WeakSet keyed on context is safe and causes no cross-resolution\n * interference.\n */\n const inflightFallbackContexts = new WeakSet<object>();\n\n const config = {\n ...baseConfig,\n\n resolver: {\n ...baseConfig?.resolver,\n resolveRequest: (context, moduleName, ...args) => {\n if (Object.keys(alias).includes(moduleName)) {\n return {\n filePath: alias[moduleName as keyof typeof alias],\n type: 'sourceFile',\n };\n }\n\n // Because metro does not resolve submodules, we need to resolve the path manually\n if (moduleName === '@intlayer/config/client') {\n return {\n filePath: require.resolve('@intlayer/config/client'),\n type: 'sourceFile',\n };\n }\n\n // Because metro does not resolve submodules, we need to resolve the path manually\n if (moduleName === '@intlayer/core/file') {\n // Force React Native to use the correct transpiled version\n return {\n filePath: require.resolve('@intlayer/core/file/browser'),\n type: 'sourceFile',\n };\n }\n\n // Delegate to the user-provided resolver if present\n if (existingResolveRequest) {\n return existingResolveRequest(context, moduleName, ...args);\n }\n\n // Re-entry guard: metro-resolver has already been invoked for this\n // context and is now calling back through context.resolveRequest (the\n // outer chain) which has bubbled back to us. Strip resolveRequest so\n // metro-resolver resolves the module with only its built-in rules\n // (alias, extraNodeModules, etc.) and does not recurse again.\n if (inflightFallbackContexts.has(context)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { resolveRequest: _r, ...pureContext } = context as any;\n return getMetroResolve()(pureContext, moduleName, ...args);\n }\n\n // First pass: call metro-resolver while preserving context.resolveRequest\n // so outer wrappers (NativeWind, Sentry, …) still get a chance to\n // handle modules that metro-resolver cannot locate on its own (e.g. @/\n // tsconfig path aliases that a wrapper resolves via its own logic).\n inflightFallbackContexts.add(context);\n try {\n return getMetroResolve()(context, moduleName, ...args);\n } finally {\n inflightFallbackContexts.delete(context);\n }\n },\n blockList: exclusionList([\n ...existingPatterns,\n // the following instruction should be replaced by a pattern derived from configuration.content.fileExtensions\n // but generating the pattern from fileExtensions does not exclude the files properly for now\n /.*\\.content\\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/,\n ]),\n },\n } as MetroConfig;\n\n return config;\n};\n\n/**\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { configMetroIntlayer } = require(\"react-native-intlayer/metro\");\n *\n * module.exports = (async () => {\n * const defaultConfig = getDefaultConfig(__dirname);\n *\n * return await configMetroIntlayer(defaultConfig);\n * })();\n * ```\n *\n * > Note: `configMetroIntlayer` builds intlayer dictionaries on server start. Use `configMetroIntlayerSync` instead if you want to skip that.\n */\nexport const configMetroIntlayer = async (\n baseConfig?: MetroConfig\n): Promise<MetroConfig> => {\n const configuration = getConfiguration();\n\n await prepareIntlayer(configuration);\n\n return configMetroIntlayerSync(baseConfig);\n};\n"],"mappings":";;;;;;;;AAgBA,MAAM,wBAAqC;AACzC,KAAI;EACF,MAAM,kBAAkBA,kBACd,QAAQ,qBAAqB,EACrC,KACD;AACD,mBAEIA,QAAY,iBAAiB,gBAAgB,iBAAiB,CAC/D,CACD;SACI;AACN,mBAAgB,iBAAiB,CAC9B;;;;;;;;;;;;;;;;AAmBP,MAAa,2BACX,eACgB;CAGhB,MAAM,QAAQ,SAAS;EACrB,eAHoB,kBAGP;EACb,WAAWA;EACZ,CAAC;CAEF,MAAM,oBAAoB,YAAY,UAAU;CAChD,MAAM,mBACJ,6BAA6B,SACzB,CAAC,kBAAkB,GAClB,qBAAqB,EAAE;CAE9B,MAAM,yBAAyB,YAAY,UAAU;;;;;;;;;;;;;;;;;CAkBrD,MAAM,2CAA2B,IAAI,SAAiB;AAoEtD,QAAO;EAjEL,GAAG;EAEH,UAAU;GACR,GAAG,YAAY;GACf,iBAAiB,SAAS,YAAY,GAAG,SAAS;AAChD,QAAI,OAAO,KAAK,MAAM,CAAC,SAAS,WAAW,CACzC,QAAO;KACL,UAAU,MAAM;KAChB,MAAM;KACP;AAIH,QAAI,eAAe,0BACjB,QAAO;KACL,oBAAkB,QAAQ,0BAA0B;KACpD,MAAM;KACP;AAIH,QAAI,eAAe,sBAEjB,QAAO;KACL,oBAAkB,QAAQ,8BAA8B;KACxD,MAAM;KACP;AAIH,QAAI,uBACF,QAAO,uBAAuB,SAAS,YAAY,GAAG,KAAK;AAQ7D,QAAI,yBAAyB,IAAI,QAAQ,EAAE;KAEzC,MAAM,EAAE,gBAAgB,IAAI,GAAG,gBAAgB;AAC/C,YAAO,iBAAiB,CAAC,aAAa,YAAY,GAAG,KAAK;;AAO5D,6BAAyB,IAAI,QAAQ;AACrC,QAAI;AACF,YAAO,iBAAiB,CAAC,SAAS,YAAY,GAAG,KAAK;cAC9C;AACR,8BAAyB,OAAO,QAAQ;;;GAG5C,WAAW,cAAc,CACvB,GAAG,kBAGH,uDACD,CAAC;GACH;EAGU;;;;;;;;;;;;;;;;AAiBf,MAAa,sBAAsB,OACjC,eACyB;AAGzB,OAAM,gBAFgB,kBAEa,CAAC;AAEpC,QAAO,wBAAwB,WAAW"}
1
+ {"version":3,"file":"configMetroIntlayer.mjs","names":["pathResolve"],"sources":["../../src/configMetroIntlayer.ts"],"sourcesContent":["import { resolve as pathResolve } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport type { getDefaultConfig } from 'expo/metro-config';\n\n/**\n * Returns the `resolve` function from metro-resolver, preferring the copy\n * bundled inside Metro itself. Loading from Metro's own package directory\n * ensures we use the same resolver instance that Metro uses internally,\n * which prevents the cross-version recursion described in\n * https://github.com/aymericzip/intlayer/issues/457.\n */\ntype AnyResolver = (context: any, moduleName: string, ...args: any[]) => any;\n\nconst getMetroResolve = (): AnyResolver => {\n try {\n const metroPackageDir = pathResolve(\n require.resolve('metro/package.json'),\n '..'\n );\n return (\n require(\n pathResolve(metroPackageDir, 'node_modules', 'metro-resolver')\n ) as typeof import('metro-resolver')\n ).resolve as AnyResolver;\n } catch {\n return (require('metro-resolver') as typeof import('metro-resolver'))\n .resolve as AnyResolver;\n }\n};\n\ntype MetroConfig = ReturnType<typeof getDefaultConfig>;\n\n/**\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { configMetroIntlayerSync } = require(\"react-native-intlayer/metro\");\n *\n *\n * const defaultConfig = getDefaultConfig(__dirname);\n *\n * return configMetroIntlayerSync(defaultConfig);\n * ```\n *\n * > Note: `configMetroIntlayerSync` does not build intlayer dictionaries on server start. Use `configMetroIntlayer` for that.\n */\nexport const configMetroIntlayerSync = (\n baseConfig?: MetroConfig\n): MetroConfig => {\n const configuration = getConfiguration();\n\n const alias = getAlias({\n configuration,\n formatter: pathResolve, // get absolute path\n });\n\n const existingBlockList = baseConfig?.resolver?.blockList;\n const existingPatterns: RegExp[] =\n existingBlockList instanceof RegExp\n ? [existingBlockList]\n : (existingBlockList ?? []);\n\n const existingResolveRequest = baseConfig?.resolver?.resolveRequest;\n\n /**\n * Tracks resolution contexts that are currently executing inside the\n * metro-resolver fallback call. When metro-resolver cannot find a module it\n * may call back through `context.resolveRequest` (the outermost resolver in\n * the chain, e.g. Sentry → NativeWind → ours). That callback eventually\n * reaches our resolver again. Without a guard we would recurse indefinitely\n * (see issue #457).\n *\n * On the second entry we break the cycle by stripping `resolveRequest` from\n * the context so metro-resolver finishes with its built-in logic only\n * (alias, extraNodeModules, …) rather than calling back a third time.\n *\n * Metro creates a fresh context object per module resolution, so using a\n * WeakSet keyed on context is safe and causes no cross-resolution\n * interference.\n */\n const inflightFallbackContexts = new WeakSet<object>();\n\n const config = {\n ...baseConfig,\n\n resolver: {\n ...baseConfig?.resolver,\n resolveRequest: (context, moduleName, ...args) => {\n if (Object.keys(alias).includes(moduleName)) {\n return {\n filePath: alias[moduleName as keyof typeof alias],\n type: 'sourceFile',\n };\n }\n\n // Because metro does not resolve submodules, we need to resolve the path manually\n if (moduleName === '@intlayer/config/client') {\n return {\n filePath: require.resolve('@intlayer/config/client'),\n type: 'sourceFile',\n };\n }\n\n // Because metro does not resolve submodules, we need to resolve the path manually\n if (moduleName === '@intlayer/core/file') {\n // Force React Native to use the correct transpiled version\n return {\n filePath: require.resolve('@intlayer/core/file/browser'),\n type: 'sourceFile',\n };\n }\n\n // @formatjs packages have invalid exports configuration or missing exports for polyfills\n // By disabling package exports for these modules, we avoid the Metro warnings and let it\n // fall back cleanly to file-based resolution.\n if (moduleName.startsWith('@formatjs/')) {\n inflightFallbackContexts.add(context);\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const cleanContext = {\n ...(context as any),\n unstable_enablePackageExports: false,\n };\n return getMetroResolve()(cleanContext, moduleName, ...args);\n } finally {\n inflightFallbackContexts.delete(context);\n }\n }\n\n // Delegate to the user-provided resolver if present\n if (existingResolveRequest) {\n return existingResolveRequest(context, moduleName, ...args);\n }\n\n // Re-entry guard: metro-resolver has already been invoked for this\n // context and is now calling back through context.resolveRequest (the\n // outer chain) which has bubbled back to us. Strip resolveRequest so\n // metro-resolver resolves the module with only its built-in rules\n // (alias, extraNodeModules, etc.) and does not recurse again.\n if (inflightFallbackContexts.has(context)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { resolveRequest: _r, ...pureContext } = context as any;\n return getMetroResolve()(pureContext, moduleName, ...args);\n }\n\n // First pass: call metro-resolver while preserving context.resolveRequest\n // so outer wrappers (NativeWind, Sentry, …) still get a chance to\n // handle modules that metro-resolver cannot locate on its own (e.g. @/\n // tsconfig path aliases that a wrapper resolves via its own logic).\n inflightFallbackContexts.add(context);\n try {\n return getMetroResolve()(context, moduleName, ...args);\n } finally {\n inflightFallbackContexts.delete(context);\n }\n },\n blockList: [\n ...existingPatterns,\n ...configuration.content.fileExtensions.map(\n (ext) => new RegExp(`.*${ext.replace(/\\./g, '\\\\.')}$`)\n ),\n ],\n },\n } as MetroConfig;\n\n return config;\n};\n\n/**\n * // metro.config.js\n * const { getDefaultConfig } = require(\"expo/metro-config\");\n * const { configMetroIntlayer } = require(\"react-native-intlayer/metro\");\n *\n * module.exports = (async () => {\n * const defaultConfig = getDefaultConfig(__dirname);\n *\n * return await configMetroIntlayer(defaultConfig);\n * })();\n * ```\n *\n * > Note: `configMetroIntlayer` builds intlayer dictionaries on server start. Use `configMetroIntlayerSync` instead if you want to skip that.\n */\nexport const configMetroIntlayer = async (\n baseConfig?: MetroConfig\n): Promise<MetroConfig> => {\n const configuration = getConfiguration();\n\n await prepareIntlayer(configuration);\n\n return configMetroIntlayerSync(baseConfig);\n};\n"],"mappings":";;;;;;;AAeA,MAAM,wBAAqC;AACzC,KAAI;EACF,MAAM,kBAAkBA,kBACd,QAAQ,qBAAqB,EACrC,KACD;AACD,mBAEIA,QAAY,iBAAiB,gBAAgB,iBAAiB,CAC/D,CACD;SACI;AACN,mBAAgB,iBAAiB,CAC9B;;;;;;;;;;;;;;;;AAmBP,MAAa,2BACX,eACgB;CAChB,MAAM,gBAAgB,kBAAkB;CAExC,MAAM,QAAQ,SAAS;EACrB;EACA,WAAWA;EACZ,CAAC;CAEF,MAAM,oBAAoB,YAAY,UAAU;CAChD,MAAM,mBACJ,6BAA6B,SACzB,CAAC,kBAAkB,GAClB,qBAAqB,EAAE;CAE9B,MAAM,yBAAyB,YAAY,UAAU;;;;;;;;;;;;;;;;;CAkBrD,MAAM,2CAA2B,IAAI,SAAiB;AAqFtD,QAAO;EAlFL,GAAG;EAEH,UAAU;GACR,GAAG,YAAY;GACf,iBAAiB,SAAS,YAAY,GAAG,SAAS;AAChD,QAAI,OAAO,KAAK,MAAM,CAAC,SAAS,WAAW,CACzC,QAAO;KACL,UAAU,MAAM;KAChB,MAAM;KACP;AAIH,QAAI,eAAe,0BACjB,QAAO;KACL,oBAAkB,QAAQ,0BAA0B;KACpD,MAAM;KACP;AAIH,QAAI,eAAe,sBAEjB,QAAO;KACL,oBAAkB,QAAQ,8BAA8B;KACxD,MAAM;KACP;AAMH,QAAI,WAAW,WAAW,aAAa,EAAE;AACvC,8BAAyB,IAAI,QAAQ;AACrC,SAAI;MAEF,MAAM,eAAe;OACnB,GAAI;OACJ,+BAA+B;OAChC;AACD,aAAO,iBAAiB,CAAC,cAAc,YAAY,GAAG,KAAK;eACnD;AACR,+BAAyB,OAAO,QAAQ;;;AAK5C,QAAI,uBACF,QAAO,uBAAuB,SAAS,YAAY,GAAG,KAAK;AAQ7D,QAAI,yBAAyB,IAAI,QAAQ,EAAE;KAEzC,MAAM,EAAE,gBAAgB,IAAI,GAAG,gBAAgB;AAC/C,YAAO,iBAAiB,CAAC,aAAa,YAAY,GAAG,KAAK;;AAO5D,6BAAyB,IAAI,QAAQ;AACrC,QAAI;AACF,YAAO,iBAAiB,CAAC,SAAS,YAAY,GAAG,KAAK;cAC9C;AACR,8BAAyB,OAAO,QAAQ;;;GAG5C,WAAW,CACT,GAAG,kBACH,GAAG,cAAc,QAAQ,eAAe,KACrC,QAAQ,IAAI,OAAO,KAAK,IAAI,QAAQ,OAAO,MAAM,CAAC,GAAG,CACvD,CACF;GACF;EAGU;;;;;;;;;;;;;;;;AAiBf,MAAa,sBAAsB,OACjC,eACyB;AAGzB,OAAM,gBAFgB,kBAEa,CAAC;AAEpC,QAAO,wBAAwB,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"configMetroIntlayer.d.ts","names":[],"sources":["../../src/configMetroIntlayer.ts"],"mappings":";;;KAiCK,WAAA,GAAc,UAAA,QAAkB,gBAAA;;AA7BqB;;;;;AA4C1D;;;;;;;cAAa,uBAAA,GACX,UAAA,GAAa,WAAA,KACZ,WAAA;;AAqHH;;;;;;;;;;;;;cAAa,mBAAA,GACX,UAAA,GAAa,WAAA,KACZ,OAAA,CAAQ,WAAA"}
1
+ {"version":3,"file":"configMetroIntlayer.d.ts","names":[],"sources":["../../src/configMetroIntlayer.ts"],"mappings":";;;KAgCK,WAAA,GAAc,UAAA,QAAkB,gBAAA;;AA5BqB;;;;;AA2C1D;;;;;;;cAAa,uBAAA,GACX,UAAA,GAAa,WAAA,KACZ,WAAA;;AAsIH;;;;;;;;;;;;;cAAa,mBAAA,GACX,UAAA,GAAa,WAAA,KACZ,OAAA,CAAQ,WAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-intlayer",
3
- "version": "9.0.0-canary.3",
3
+ "version": "9.0.0-canary.5",
4
4
  "private": false,
5
5
  "description": "A React Native plugin for seamless internationalization (i18n), providing locale detection, redirection, and environment-based configuration",
6
6
  "keywords": [
@@ -86,14 +86,14 @@
86
86
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
87
87
  },
88
88
  "dependencies": {
89
- "@intlayer/chokidar": "9.0.0-canary.3",
90
- "@intlayer/config": "9.0.0-canary.3",
91
- "@intlayer/core": "9.0.0-canary.3",
92
- "@intlayer/types": "9.0.0-canary.3",
93
- "react-intlayer": "9.0.0-canary.3"
89
+ "@intlayer/chokidar": "9.0.0-canary.5",
90
+ "@intlayer/config": "9.0.0-canary.5",
91
+ "@intlayer/core": "9.0.0-canary.5",
92
+ "@intlayer/types": "9.0.0-canary.5",
93
+ "react-intlayer": "9.0.0-canary.5"
94
94
  },
95
95
  "devDependencies": {
96
- "@types/node": "25.9.3",
96
+ "@types/node": "25.9.4",
97
97
  "@types/react": ">=18.0.0",
98
98
  "@utils/ts-config": "1.0.4",
99
99
  "@utils/ts-config-types": "1.0.4",
@@ -109,7 +109,7 @@
109
109
  "peerDependencies": {
110
110
  "expo": ">=52",
111
111
  "react": ">=18.0.0",
112
- "react-intlayer": "9.0.0-canary.3"
112
+ "react-intlayer": "9.0.0-canary.5"
113
113
  },
114
114
  "engines": {
115
115
  "node": ">=14.18"
@@ -1,15 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- let node_path = require("node:path");
3
-
4
- //#region src/exclusionList.ts
5
- const normalizePattern = (pattern) => {
6
- const separators = node_path.sep === "\\" ? "\\\\" : "/";
7
- if (pattern instanceof RegExp) return pattern.source.replace(/\//g, separators);
8
- if (typeof pattern === "string") return pattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/\//g, separators);
9
- throw new Error(`Unexpected exclusion pattern: ${pattern}`);
10
- };
11
- const exclusionList = (additionalExclusions) => [new RegExp(`(${additionalExclusions.map(normalizePattern).join("|")})$`)];
12
-
13
- //#endregion
14
- exports.exclusionList = exclusionList;
15
- //# sourceMappingURL=exclusionList.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exclusionList.cjs","names":["sep"],"sources":["../../src/exclusionList.ts"],"sourcesContent":["import { sep } from 'node:path';\n\nconst normalizePattern = (pattern: RegExp | string): string => {\n // On Windows, path separators are backslashes; double-escape for use inside a RegExp source string\n const separators = sep === '\\\\' ? '\\\\\\\\' : '/';\n\n if (pattern instanceof RegExp) {\n return pattern.source.replace(/\\//g, separators);\n }\n\n if (typeof pattern === 'string') {\n const escaped = pattern.replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&');\n return escaped.replace(/\\//g, separators);\n }\n\n throw new Error(`Unexpected exclusion pattern: ${pattern}`);\n};\n\nexport const exclusionList = (\n additionalExclusions: (RegExp | string)[]\n): RegExp[] => [\n new RegExp(`(${additionalExclusions.map(normalizePattern).join('|')})$`),\n];\n"],"mappings":";;;;AAEA,MAAM,oBAAoB,YAAqC;CAE7D,MAAM,aAAaA,kBAAQ,OAAO,SAAS;AAE3C,KAAI,mBAAmB,OACrB,QAAO,QAAQ,OAAO,QAAQ,OAAO,WAAW;AAGlD,KAAI,OAAO,YAAY,SAErB,QADgB,QAAQ,QAAQ,uBAAuB,OACzC,CAAC,QAAQ,OAAO,WAAW;AAG3C,OAAM,IAAI,MAAM,iCAAiC,UAAU;;AAG7D,MAAa,iBACX,yBACa,CACb,IAAI,OAAO,IAAI,qBAAqB,IAAI,iBAAiB,CAAC,KAAK,IAAI,CAAC,IAAI,CACzE"}
@@ -1,14 +0,0 @@
1
- import { sep } from "node:path";
2
-
3
- //#region src/exclusionList.ts
4
- const normalizePattern = (pattern) => {
5
- const separators = sep === "\\" ? "\\\\" : "/";
6
- if (pattern instanceof RegExp) return pattern.source.replace(/\//g, separators);
7
- if (typeof pattern === "string") return pattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/\//g, separators);
8
- throw new Error(`Unexpected exclusion pattern: ${pattern}`);
9
- };
10
- const exclusionList = (additionalExclusions) => [new RegExp(`(${additionalExclusions.map(normalizePattern).join("|")})$`)];
11
-
12
- //#endregion
13
- export { exclusionList };
14
- //# sourceMappingURL=exclusionList.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exclusionList.mjs","names":[],"sources":["../../src/exclusionList.ts"],"sourcesContent":["import { sep } from 'node:path';\n\nconst normalizePattern = (pattern: RegExp | string): string => {\n // On Windows, path separators are backslashes; double-escape for use inside a RegExp source string\n const separators = sep === '\\\\' ? '\\\\\\\\' : '/';\n\n if (pattern instanceof RegExp) {\n return pattern.source.replace(/\\//g, separators);\n }\n\n if (typeof pattern === 'string') {\n const escaped = pattern.replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&');\n return escaped.replace(/\\//g, separators);\n }\n\n throw new Error(`Unexpected exclusion pattern: ${pattern}`);\n};\n\nexport const exclusionList = (\n additionalExclusions: (RegExp | string)[]\n): RegExp[] => [\n new RegExp(`(${additionalExclusions.map(normalizePattern).join('|')})$`),\n];\n"],"mappings":";;;AAEA,MAAM,oBAAoB,YAAqC;CAE7D,MAAM,aAAa,QAAQ,OAAO,SAAS;AAE3C,KAAI,mBAAmB,OACrB,QAAO,QAAQ,OAAO,QAAQ,OAAO,WAAW;AAGlD,KAAI,OAAO,YAAY,SAErB,QADgB,QAAQ,QAAQ,uBAAuB,OACzC,CAAC,QAAQ,OAAO,WAAW;AAG3C,OAAM,IAAI,MAAM,iCAAiC,UAAU;;AAG7D,MAAa,iBACX,yBACa,CACb,IAAI,OAAO,IAAI,qBAAqB,IAAI,iBAAiB,CAAC,KAAK,IAAI,CAAC,IAAI,CACzE"}
@@ -1,5 +0,0 @@
1
- //#region src/exclusionList.d.ts
2
- declare const exclusionList: (additionalExclusions: (RegExp | string)[]) => RegExp[];
3
- //#endregion
4
- export { exclusionList };
5
- //# sourceMappingURL=exclusionList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exclusionList.d.ts","names":[],"sources":["../../src/exclusionList.ts"],"mappings":";cAkBa,aAAA,GACX,oBAAA,GAAuB,MAAA,iBACtB,MAAA"}