react-native-intlayer 9.0.0-canary.10 → 9.0.0-canary.12

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,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let node_path = require("node:path");
3
- let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
4
3
  let _intlayer_config_node = require("@intlayer/config/node");
5
4
  let _intlayer_config_utils = require("@intlayer/config/utils");
5
+ let _intlayer_engine_build = require("@intlayer/engine/build");
6
6
 
7
7
  //#region src/configMetroIntlayer.ts
8
8
  const getMetroResolve = () => {
@@ -133,7 +133,7 @@ const configMetroIntlayerSync = (baseConfig) => {
133
133
  * > Note: `configMetroIntlayer` builds intlayer dictionaries on server start. Use `configMetroIntlayerSync` instead if you want to skip that.
134
134
  */
135
135
  const configMetroIntlayer = async (baseConfig) => {
136
- await (0, _intlayer_chokidar_build.prepareIntlayer)((0, _intlayer_config_node.getConfiguration)());
136
+ await (0, _intlayer_engine_build.prepareIntlayer)((0, _intlayer_config_node.getConfiguration)());
137
137
  return configMetroIntlayerSync(baseConfig);
138
138
  };
139
139
 
@@ -1 +1 @@
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 /**\n * Project root, used to force `react-intlayer` to resolve to a single copy.\n *\n * Metro does not deduplicate packages the way web bundlers do. When a\n * dependency (e.g. `react-native-intlayer`) pins a different patch of\n * `react-intlayer` than the app, npm/yarn keep two physical copies. The\n * provider would then create its React context from one copy while\n * `useLocale`/`useIntlayer` read the context from the other — two distinct\n * `IntlayerClientContext` instances. The provider's updates never reach the\n * consumers, so `setLocale()` silently does nothing on native.\n *\n * Resolving every `react-intlayer` request from the project root collapses\n * those copies to a single module instance (and therefore a single context).\n */\n const projectRoot = configuration.system.baseDir;\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 // Force a single `react-intlayer` instance regardless of which package\n // imports it (the app or a nested dependency). This prevents the\n // duplicate-context bug that silently breaks locale switching on native\n // when two `react-intlayer` copies are installed (see projectRoot doc).\n if (\n moduleName === 'react-intlayer' ||\n moduleName.startsWith('react-intlayer/')\n ) {\n try {\n return {\n filePath: require.resolve(moduleName, { paths: [projectRoot] }),\n type: 'sourceFile',\n };\n } catch {\n // Fall through to the default resolution below if the project root\n // copy cannot be resolved for some reason.\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/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AAE,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
+ {"version":3,"file":"configMetroIntlayer.cjs","names":["pathResolve"],"sources":["../../src/configMetroIntlayer.ts"],"sourcesContent":["import { resolve as pathResolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { prepareIntlayer } from '@intlayer/engine/build';\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 /**\n * Project root, used to force `react-intlayer` to resolve to a single copy.\n *\n * Metro does not deduplicate packages the way web bundlers do. When a\n * dependency (e.g. `react-native-intlayer`) pins a different patch of\n * `react-intlayer` than the app, npm/yarn keep two physical copies. The\n * provider would then create its React context from one copy while\n * `useLocale`/`useIntlayer` read the context from the other — two distinct\n * `IntlayerClientContext` instances. The provider's updates never reach the\n * consumers, so `setLocale()` silently does nothing on native.\n *\n * Resolving every `react-intlayer` request from the project root collapses\n * those copies to a single module instance (and therefore a single context).\n */\n const projectRoot = configuration.system.baseDir;\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 // Force a single `react-intlayer` instance regardless of which package\n // imports it (the app or a nested dependency). This prevents the\n // duplicate-context bug that silently breaks locale switching on native\n // when two `react-intlayer` copies are installed (see projectRoot doc).\n if (\n moduleName === 'react-intlayer' ||\n moduleName.startsWith('react-intlayer/')\n ) {\n try {\n return {\n filePath: require.resolve(moduleName, { paths: [projectRoot] }),\n type: 'sourceFile',\n };\n } catch {\n // Fall through to the default resolution below if the project root\n // copy cannot be resolved for some reason.\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;;;;;;;;;;;;;;;CAgBF,MAAM,cAAc,cAAc,OAAO;CAEzC,MAAM,oBAAoB,YAAY,UAAU;CAChD,MAAM,mBACJ,6BAA6B,SACzB,CAAC,kBAAkB,GAClB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AK,IAAI,QAAQ,OAAO,MAAM,CAAC,GAAG,CACvD,CACF;GACF;EAGU;;;;;;;;;;;;;;;;AAiBf,MAAa,sBAAsB,OACjC,eACyB;AAGzB,gGAAmC,CAAC;AAEpC,QAAO,wBAAwB,WAAW"}
@@ -43,7 +43,8 @@ const intlayerPolyfill = () => {
43
43
  if (typeof window.removeEventListener !== "function") window.removeEventListener = noop;
44
44
  if (typeof window.postMessage !== "function") window.postMessage = noop;
45
45
  }
46
- if (typeof document === "undefined") {
46
+ const isNativeReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
47
+ if (typeof document === "undefined" && isNativeReactNative) {
47
48
  let cookieJar = "";
48
49
  Object.defineProperty(global, "document", {
49
50
  configurable: true,
@@ -56,7 +57,13 @@ const intlayerPolyfill = () => {
56
57
  const [key, val] = pair?.split("=") ?? [];
57
58
  const name = key?.trim();
58
59
  cookieJar = [...cookieJar.split(";").filter((c) => !c.trim().startsWith(`${name}=`)).filter(Boolean), `${name}=${val ?? ""}`].join("; ");
59
- }
60
+ },
61
+ createElement: () => null,
62
+ getElementById: () => null,
63
+ querySelector: () => null,
64
+ querySelectorAll: () => [],
65
+ addEventListener: () => void 0,
66
+ removeEventListener: () => void 0
60
67
  })
61
68
  });
62
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerPolyfill.cjs","names":[],"sources":["../../src/intlayerPolyfill.ts"],"sourcesContent":["/**\n * Applies necessary polyfills for React Native to support Intlayer.\n *\n * This includes:\n * - Polyfilling `structuredClone` if it is missing.\n * - Providing no-op implementations for standard DOM `window` methods\n * (`addEventListener`, `removeEventListener`, `postMessage`).\n * - Providing in-memory stubs for `document.cookie`, `localStorage`, and\n * `sessionStorage` so that `@intlayer/core`'s locale-storage helpers work\n * without crashing in a React Native environment.\n *\n * Note: These stubs are in-memory only. The locale selection will survive\n * hot-reloads but not full app restarts. To persist across restarts, pass a\n * custom `setLocale` to `<IntlayerProvider>` backed by AsyncStorage.\n */\nconst createStorage = () => {\n const store: Record<string, string> = {};\n return {\n getItem: (key: string) => store[key] ?? null,\n setItem: (key: string, value: string) => {\n store[key] = String(value);\n },\n removeItem: (key: string) => {\n delete store[key];\n },\n clear: () => {\n for (const key in store) {\n delete store[key];\n }\n },\n get length() {\n return Object.keys(store).length;\n },\n key: (index: number) => Object.keys(store)[index] ?? null,\n };\n};\n\nexport const intlayerPolyfill = () => {\n if (typeof global.structuredClone !== 'function') {\n global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));\n }\n\n if (typeof window !== 'undefined') {\n const noop = () => null;\n if (typeof window.addEventListener !== 'function') {\n window.addEventListener = noop;\n }\n if (typeof window.removeEventListener !== 'function') {\n window.removeEventListener = noop;\n }\n if (typeof window.postMessage !== 'function') {\n window.postMessage = noop;\n }\n }\n\n // `@intlayer/core`'s localeStorageOptions accesses document.cookie directly.\n // In React Native, `document` is undefined — we provide a minimal in-memory\n // cookie jar so reads/writes work without throwing.\n if (typeof document === 'undefined') {\n let cookieJar = '';\n Object.defineProperty(global, 'document', {\n configurable: true,\n get: () => ({\n get cookie() {\n return cookieJar;\n },\n set cookie(value: string) {\n // Simplified cookie setter: just append/overwrite the key\n const [pair] = value.split(';');\n const [key, val] = pair?.split('=') ?? [];\n const name = key?.trim();\n const existing = cookieJar\n .split(';')\n .filter((c) => !c.trim().startsWith(`${name}=`))\n .filter(Boolean);\n cookieJar = [...existing, `${name}=${val ?? ''}`].join('; ');\n },\n }),\n });\n }\n\n if (typeof localStorage === 'undefined') {\n Object.defineProperty(global, 'localStorage', {\n configurable: true,\n value: createStorage(),\n });\n }\n\n if (typeof sessionStorage === 'undefined') {\n Object.defineProperty(global, 'sessionStorage', {\n configurable: true,\n value: createStorage(),\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAeA,MAAM,sBAAsB;CAC1B,MAAM,QAAgC,EAAE;AACxC,QAAO;EACL,UAAU,QAAgB,MAAM,QAAQ;EACxC,UAAU,KAAa,UAAkB;AACvC,SAAM,OAAO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OAAO,eAAe;EACvB,CAAC"}
1
+ {"version":3,"file":"intlayerPolyfill.cjs","names":[],"sources":["../../src/intlayerPolyfill.ts"],"sourcesContent":["/**\n * Applies necessary polyfills for React Native to support Intlayer.\n *\n * This includes:\n * - Polyfilling `structuredClone` if it is missing.\n * - Providing no-op implementations for standard DOM `window` methods\n * (`addEventListener`, `removeEventListener`, `postMessage`).\n * - Providing in-memory stubs for `document.cookie`, `localStorage`, and\n * `sessionStorage` so that `@intlayer/core`'s locale-storage helpers work\n * without crashing in a React Native environment.\n *\n * Note: These stubs are in-memory only. The locale selection will survive\n * hot-reloads but not full app restarts. To persist across restarts, pass a\n * custom `setLocale` to `<IntlayerProvider>` backed by AsyncStorage.\n */\nconst createStorage = () => {\n const store: Record<string, string> = {};\n return {\n getItem: (key: string) => store[key] ?? null,\n setItem: (key: string, value: string) => {\n store[key] = String(value);\n },\n removeItem: (key: string) => {\n delete store[key];\n },\n clear: () => {\n for (const key in store) {\n delete store[key];\n }\n },\n get length() {\n return Object.keys(store).length;\n },\n key: (index: number) => Object.keys(store)[index] ?? null,\n };\n};\n\nexport const intlayerPolyfill = () => {\n if (typeof global.structuredClone !== 'function') {\n global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));\n }\n\n if (typeof window !== 'undefined') {\n const noop = () => null;\n if (typeof window.addEventListener !== 'function') {\n window.addEventListener = noop;\n }\n if (typeof window.removeEventListener !== 'function') {\n window.removeEventListener = noop;\n }\n if (typeof window.postMessage !== 'function') {\n window.postMessage = noop;\n }\n }\n\n // `@intlayer/core`'s localeStorageOptions accesses document.cookie directly.\n // In React Native native, `document` is undefined — we provide a minimal\n // in-memory cookie jar so reads/writes work without throwing.\n //\n // We guard with `navigator.product === 'ReactNative'` to avoid installing\n // the stub in SSR / Expo Web pre-render contexts where `document` is also\n // undefined (Node.js) but browser code will later need the real DOM object\n // (e.g. document.createElement called by third-party RN libraries on web).\n const isNativeReactNative =\n typeof navigator !== 'undefined' &&\n (navigator as Navigator & { product?: string }).product === 'ReactNative';\n\n if (typeof document === 'undefined' && isNativeReactNative) {\n let cookieJar = '';\n Object.defineProperty(global, 'document', {\n configurable: true,\n get: () => ({\n get cookie() {\n return cookieJar;\n },\n set cookie(value: string) {\n // Simplified cookie setter: just append/overwrite the key\n const [pair] = value.split(';');\n const [key, val] = pair?.split('=') ?? [];\n const name = key?.trim();\n const existing = cookieJar\n .split(';')\n .filter((c) => !c.trim().startsWith(`${name}=`))\n .filter(Boolean);\n cookieJar = [...existing, `${name}=${val ?? ''}`].join('; ');\n },\n createElement: () => null,\n getElementById: () => null,\n querySelector: () => null,\n querySelectorAll: () => [],\n addEventListener: () => undefined,\n removeEventListener: () => undefined,\n }),\n });\n }\n\n if (typeof localStorage === 'undefined') {\n Object.defineProperty(global, 'localStorage', {\n configurable: true,\n value: createStorage(),\n });\n }\n\n if (typeof sessionStorage === 'undefined') {\n Object.defineProperty(global, 'sessionStorage', {\n configurable: true,\n value: createStorage(),\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAeA,MAAM,sBAAsB;CAC1B,MAAM,QAAgC,EAAE;AACxC,QAAO;EACL,UAAU,QAAgB,MAAM,QAAQ;EACxC,UAAU,KAAa,UAAkB;AACvC,SAAM,OAAO,OAAO,MAAM;;EAE5B,aAAa,QAAgB;AAC3B,UAAO,MAAM;;EAEf,aAAa;AACX,QAAK,MAAM,OAAO,MAChB,QAAO,MAAM;;EAGjB,IAAI,SAAS;AACX,UAAO,OAAO,KAAK,MAAM,CAAC;;EAE5B,MAAM,UAAkB,OAAO,KAAK,MAAM,CAAC,UAAU;EACtD;;AAGH,MAAa,yBAAyB;AACpC,KAAI,OAAO,OAAO,oBAAoB,WACpC,QAAO,mBAAmB,QAAQ,KAAK,MAAM,KAAK,UAAU,IAAI,CAAC;AAGnE,KAAI,OAAO,WAAW,aAAa;EACjC,MAAM,aAAa;AACnB,MAAI,OAAO,OAAO,qBAAqB,WACrC,QAAO,mBAAmB;AAE5B,MAAI,OAAO,OAAO,wBAAwB,WACxC,QAAO,sBAAsB;AAE/B,MAAI,OAAO,OAAO,gBAAgB,WAChC,QAAO,cAAc;;CAYzB,MAAM,sBACJ,OAAO,cAAc,eACpB,UAA+C,YAAY;AAE9D,KAAI,OAAO,aAAa,eAAe,qBAAqB;EAC1D,IAAI,YAAY;AAChB,SAAO,eAAe,QAAQ,YAAY;GACxC,cAAc;GACd,YAAY;IACV,IAAI,SAAS;AACX,YAAO;;IAET,IAAI,OAAO,OAAe;KAExB,MAAM,CAAC,QAAQ,MAAM,MAAM,IAAI;KAC/B,MAAM,CAAC,KAAK,OAAO,MAAM,MAAM,IAAI,IAAI,EAAE;KACzC,MAAM,OAAO,KAAK,MAAM;AAKxB,iBAAY,CAAC,GAJI,UACd,MAAM,IAAI,CACV,QAAQ,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,KAAK,GAAG,CAAC,CAC/C,OAAO,QACc,EAAE,GAAG,KAAK,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK;;IAE9D,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;IACrB,wBAAwB,EAAE;IAC1B,wBAAwB;IACxB,2BAA2B;IAC5B;GACF,CAAC;;AAGJ,KAAI,OAAO,iBAAiB,YAC1B,QAAO,eAAe,QAAQ,gBAAgB;EAC5C,cAAc;EACd,OAAO,eAAe;EACvB,CAAC;AAGJ,KAAI,OAAO,mBAAmB,YAC5B,QAAO,eAAe,QAAQ,kBAAkB;EAC9C,cAAc;EACd,OAAO,eAAe;EACvB,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { __require } from "./_virtual/_rolldown/runtime.mjs";
2
2
  import { resolve } from "node:path";
3
- import { prepareIntlayer } from "@intlayer/chokidar/build";
4
3
  import { getConfiguration } from "@intlayer/config/node";
5
4
  import { getAlias } from "@intlayer/config/utils";
5
+ import { prepareIntlayer } from "@intlayer/engine/build";
6
6
 
7
7
  //#region src/configMetroIntlayer.ts
8
8
  const getMetroResolve = () => {
@@ -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';\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 /**\n * Project root, used to force `react-intlayer` to resolve to a single copy.\n *\n * Metro does not deduplicate packages the way web bundlers do. When a\n * dependency (e.g. `react-native-intlayer`) pins a different patch of\n * `react-intlayer` than the app, npm/yarn keep two physical copies. The\n * provider would then create its React context from one copy while\n * `useLocale`/`useIntlayer` read the context from the other — two distinct\n * `IntlayerClientContext` instances. The provider's updates never reach the\n * consumers, so `setLocale()` silently does nothing on native.\n *\n * Resolving every `react-intlayer` request from the project root collapses\n * those copies to a single module instance (and therefore a single context).\n */\n const projectRoot = configuration.system.baseDir;\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 // Force a single `react-intlayer` instance regardless of which package\n // imports it (the app or a nested dependency). This prevents the\n // duplicate-context bug that silently breaks locale switching on native\n // when two `react-intlayer` copies are installed (see projectRoot doc).\n if (\n moduleName === 'react-intlayer' ||\n moduleName.startsWith('react-intlayer/')\n ) {\n try {\n return {\n filePath: require.resolve(moduleName, { paths: [projectRoot] }),\n type: 'sourceFile',\n };\n } catch {\n // Fall through to the default resolution below if the project root\n // copy cannot be resolved for some reason.\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;;;;;;;;;;;;;;;CAgBF,MAAM,cAAc,cAAc,OAAO;CAEzC,MAAM,oBAAoB,YAAY,UAAU;CAChD,MAAM,mBACJ,6BAA6B,SACzB,CAAC,kBAAkB,GAClB,qBAAqB,EAAE;CAE9B,MAAM,yBAAyB,YAAY,UAAU;;;;;;;;;;;;;;;;;CAkBrD,MAAM,2CAA2B,IAAI,SAAiB;AAwGtD,QAAO;EArGL,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;AAOH,QACE,eAAe,oBACf,WAAW,WAAW,kBAAkB,CAExC,KAAI;AACF,YAAO;MACL,oBAAkB,QAAQ,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;MAC/D,MAAM;MACP;YACK;AASV,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
+ {"version":3,"file":"configMetroIntlayer.mjs","names":["pathResolve"],"sources":["../../src/configMetroIntlayer.ts"],"sourcesContent":["import { resolve as pathResolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { prepareIntlayer } from '@intlayer/engine/build';\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 /**\n * Project root, used to force `react-intlayer` to resolve to a single copy.\n *\n * Metro does not deduplicate packages the way web bundlers do. When a\n * dependency (e.g. `react-native-intlayer`) pins a different patch of\n * `react-intlayer` than the app, npm/yarn keep two physical copies. The\n * provider would then create its React context from one copy while\n * `useLocale`/`useIntlayer` read the context from the other — two distinct\n * `IntlayerClientContext` instances. The provider's updates never reach the\n * consumers, so `setLocale()` silently does nothing on native.\n *\n * Resolving every `react-intlayer` request from the project root collapses\n * those copies to a single module instance (and therefore a single context).\n */\n const projectRoot = configuration.system.baseDir;\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 // Force a single `react-intlayer` instance regardless of which package\n // imports it (the app or a nested dependency). This prevents the\n // duplicate-context bug that silently breaks locale switching on native\n // when two `react-intlayer` copies are installed (see projectRoot doc).\n if (\n moduleName === 'react-intlayer' ||\n moduleName.startsWith('react-intlayer/')\n ) {\n try {\n return {\n filePath: require.resolve(moduleName, { paths: [projectRoot] }),\n type: 'sourceFile',\n };\n } catch {\n // Fall through to the default resolution below if the project root\n // copy cannot be resolved for some reason.\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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ACD,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"}
@@ -41,7 +41,8 @@ const intlayerPolyfill = () => {
41
41
  if (typeof window.removeEventListener !== "function") window.removeEventListener = noop;
42
42
  if (typeof window.postMessage !== "function") window.postMessage = noop;
43
43
  }
44
- if (typeof document === "undefined") {
44
+ const isNativeReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
45
+ if (typeof document === "undefined" && isNativeReactNative) {
45
46
  let cookieJar = "";
46
47
  Object.defineProperty(global, "document", {
47
48
  configurable: true,
@@ -54,7 +55,13 @@ const intlayerPolyfill = () => {
54
55
  const [key, val] = pair?.split("=") ?? [];
55
56
  const name = key?.trim();
56
57
  cookieJar = [...cookieJar.split(";").filter((c) => !c.trim().startsWith(`${name}=`)).filter(Boolean), `${name}=${val ?? ""}`].join("; ");
57
- }
58
+ },
59
+ createElement: () => null,
60
+ getElementById: () => null,
61
+ querySelector: () => null,
62
+ querySelectorAll: () => [],
63
+ addEventListener: () => void 0,
64
+ removeEventListener: () => void 0
58
65
  })
59
66
  });
60
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerPolyfill.mjs","names":[],"sources":["../../src/intlayerPolyfill.ts"],"sourcesContent":["/**\n * Applies necessary polyfills for React Native to support Intlayer.\n *\n * This includes:\n * - Polyfilling `structuredClone` if it is missing.\n * - Providing no-op implementations for standard DOM `window` methods\n * (`addEventListener`, `removeEventListener`, `postMessage`).\n * - Providing in-memory stubs for `document.cookie`, `localStorage`, and\n * `sessionStorage` so that `@intlayer/core`'s locale-storage helpers work\n * without crashing in a React Native environment.\n *\n * Note: These stubs are in-memory only. The locale selection will survive\n * hot-reloads but not full app restarts. To persist across restarts, pass a\n * custom `setLocale` to `<IntlayerProvider>` backed by AsyncStorage.\n */\nconst createStorage = () => {\n const store: Record<string, string> = {};\n return {\n getItem: (key: string) => store[key] ?? null,\n setItem: (key: string, value: string) => {\n store[key] = String(value);\n },\n removeItem: (key: string) => {\n delete store[key];\n },\n clear: () => {\n for (const key in store) {\n delete store[key];\n }\n },\n get length() {\n return Object.keys(store).length;\n },\n key: (index: number) => Object.keys(store)[index] ?? null,\n };\n};\n\nexport const intlayerPolyfill = () => {\n if (typeof global.structuredClone !== 'function') {\n global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));\n }\n\n if (typeof window !== 'undefined') {\n const noop = () => null;\n if (typeof window.addEventListener !== 'function') {\n window.addEventListener = noop;\n }\n if (typeof window.removeEventListener !== 'function') {\n window.removeEventListener = noop;\n }\n if (typeof window.postMessage !== 'function') {\n window.postMessage = noop;\n }\n }\n\n // `@intlayer/core`'s localeStorageOptions accesses document.cookie directly.\n // In React Native, `document` is undefined — we provide a minimal in-memory\n // cookie jar so reads/writes work without throwing.\n if (typeof document === 'undefined') {\n let cookieJar = '';\n Object.defineProperty(global, 'document', {\n configurable: true,\n get: () => ({\n get cookie() {\n return cookieJar;\n },\n set cookie(value: string) {\n // Simplified cookie setter: just append/overwrite the key\n const [pair] = value.split(';');\n const [key, val] = pair?.split('=') ?? [];\n const name = key?.trim();\n const existing = cookieJar\n .split(';')\n .filter((c) => !c.trim().startsWith(`${name}=`))\n .filter(Boolean);\n cookieJar = [...existing, `${name}=${val ?? ''}`].join('; ');\n },\n }),\n });\n }\n\n if (typeof localStorage === 'undefined') {\n Object.defineProperty(global, 'localStorage', {\n configurable: true,\n value: createStorage(),\n });\n }\n\n if (typeof sessionStorage === 'undefined') {\n Object.defineProperty(global, 'sessionStorage', {\n configurable: true,\n value: createStorage(),\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,sBAAsB;CAC1B,MAAM,QAAgC,EAAE;AACxC,QAAO;EACL,UAAU,QAAgB,MAAM,QAAQ;EACxC,UAAU,KAAa,UAAkB;AACvC,SAAM,OAAO,OAAO,MAAM;;EAE5B,aAAa,QAAgB;AAC3B,UAAO,MAAM;;EAEf,aAAa;AACX,QAAK,MAAM,OAAO,MAChB,QAAO,MAAM;;EAGjB,IAAI,SAAS;AACX,UAAO,OAAO,KAAK,MAAM,CAAC;;EAE5B,MAAM,UAAkB,OAAO,KAAK,MAAM,CAAC,UAAU;EACtD;;AAGH,MAAa,yBAAyB;AACpC,KAAI,OAAO,OAAO,oBAAoB,WACpC,QAAO,mBAAmB,QAAQ,KAAK,MAAM,KAAK,UAAU,IAAI,CAAC;AAGnE,KAAI,OAAO,WAAW,aAAa;EACjC,MAAM,aAAa;AACnB,MAAI,OAAO,OAAO,qBAAqB,WACrC,QAAO,mBAAmB;AAE5B,MAAI,OAAO,OAAO,wBAAwB,WACxC,QAAO,sBAAsB;AAE/B,MAAI,OAAO,OAAO,gBAAgB,WAChC,QAAO,cAAc;;AAOzB,KAAI,OAAO,aAAa,aAAa;EACnC,IAAI,YAAY;AAChB,SAAO,eAAe,QAAQ,YAAY;GACxC,cAAc;GACd,YAAY;IACV,IAAI,SAAS;AACX,YAAO;;IAET,IAAI,OAAO,OAAe;KAExB,MAAM,CAAC,QAAQ,MAAM,MAAM,IAAI;KAC/B,MAAM,CAAC,KAAK,OAAO,MAAM,MAAM,IAAI,IAAI,EAAE;KACzC,MAAM,OAAO,KAAK,MAAM;AAKxB,iBAAY,CAAC,GAJI,UACd,MAAM,IAAI,CACV,QAAQ,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,KAAK,GAAG,CAAC,CAC/C,OAAO,QACc,EAAE,GAAG,KAAK,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK;;IAE/D;GACF,CAAC;;AAGJ,KAAI,OAAO,iBAAiB,YAC1B,QAAO,eAAe,QAAQ,gBAAgB;EAC5C,cAAc;EACd,OAAO,eAAe;EACvB,CAAC;AAGJ,KAAI,OAAO,mBAAmB,YAC5B,QAAO,eAAe,QAAQ,kBAAkB;EAC9C,cAAc;EACd,OAAO,eAAe;EACvB,CAAC"}
1
+ {"version":3,"file":"intlayerPolyfill.mjs","names":[],"sources":["../../src/intlayerPolyfill.ts"],"sourcesContent":["/**\n * Applies necessary polyfills for React Native to support Intlayer.\n *\n * This includes:\n * - Polyfilling `structuredClone` if it is missing.\n * - Providing no-op implementations for standard DOM `window` methods\n * (`addEventListener`, `removeEventListener`, `postMessage`).\n * - Providing in-memory stubs for `document.cookie`, `localStorage`, and\n * `sessionStorage` so that `@intlayer/core`'s locale-storage helpers work\n * without crashing in a React Native environment.\n *\n * Note: These stubs are in-memory only. The locale selection will survive\n * hot-reloads but not full app restarts. To persist across restarts, pass a\n * custom `setLocale` to `<IntlayerProvider>` backed by AsyncStorage.\n */\nconst createStorage = () => {\n const store: Record<string, string> = {};\n return {\n getItem: (key: string) => store[key] ?? null,\n setItem: (key: string, value: string) => {\n store[key] = String(value);\n },\n removeItem: (key: string) => {\n delete store[key];\n },\n clear: () => {\n for (const key in store) {\n delete store[key];\n }\n },\n get length() {\n return Object.keys(store).length;\n },\n key: (index: number) => Object.keys(store)[index] ?? null,\n };\n};\n\nexport const intlayerPolyfill = () => {\n if (typeof global.structuredClone !== 'function') {\n global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));\n }\n\n if (typeof window !== 'undefined') {\n const noop = () => null;\n if (typeof window.addEventListener !== 'function') {\n window.addEventListener = noop;\n }\n if (typeof window.removeEventListener !== 'function') {\n window.removeEventListener = noop;\n }\n if (typeof window.postMessage !== 'function') {\n window.postMessage = noop;\n }\n }\n\n // `@intlayer/core`'s localeStorageOptions accesses document.cookie directly.\n // In React Native native, `document` is undefined — we provide a minimal\n // in-memory cookie jar so reads/writes work without throwing.\n //\n // We guard with `navigator.product === 'ReactNative'` to avoid installing\n // the stub in SSR / Expo Web pre-render contexts where `document` is also\n // undefined (Node.js) but browser code will later need the real DOM object\n // (e.g. document.createElement called by third-party RN libraries on web).\n const isNativeReactNative =\n typeof navigator !== 'undefined' &&\n (navigator as Navigator & { product?: string }).product === 'ReactNative';\n\n if (typeof document === 'undefined' && isNativeReactNative) {\n let cookieJar = '';\n Object.defineProperty(global, 'document', {\n configurable: true,\n get: () => ({\n get cookie() {\n return cookieJar;\n },\n set cookie(value: string) {\n // Simplified cookie setter: just append/overwrite the key\n const [pair] = value.split(';');\n const [key, val] = pair?.split('=') ?? [];\n const name = key?.trim();\n const existing = cookieJar\n .split(';')\n .filter((c) => !c.trim().startsWith(`${name}=`))\n .filter(Boolean);\n cookieJar = [...existing, `${name}=${val ?? ''}`].join('; ');\n },\n createElement: () => null,\n getElementById: () => null,\n querySelector: () => null,\n querySelectorAll: () => [],\n addEventListener: () => undefined,\n removeEventListener: () => undefined,\n }),\n });\n }\n\n if (typeof localStorage === 'undefined') {\n Object.defineProperty(global, 'localStorage', {\n configurable: true,\n value: createStorage(),\n });\n }\n\n if (typeof sessionStorage === 'undefined') {\n Object.defineProperty(global, 'sessionStorage', {\n configurable: true,\n value: createStorage(),\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,sBAAsB;CAC1B,MAAM,QAAgC,EAAE;AACxC,QAAO;EACL,UAAU,QAAgB,MAAM,QAAQ;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;GACF,CAAC;;AAGJ,KAAI,OAAO,iBAAiB,YAC1B,QAAO,eAAe,QAAQ,gBAAgB;EAC5C,cAAc;EACd,OAAO,eAAe;EACvB,CAAC;AAGJ,KAAI,OAAO,mBAAmB,YAC5B,QAAO,eAAe,QAAQ,kBAAkB;EAC9C,cAAc;EACd,OAAO,eAAe;EACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-intlayer",
3
- "version": "9.0.0-canary.10",
3
+ "version": "9.0.0-canary.12",
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": [
@@ -110,11 +110,11 @@
110
110
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
111
111
  },
112
112
  "dependencies": {
113
- "@intlayer/chokidar": "9.0.0-canary.10",
114
- "@intlayer/config": "9.0.0-canary.10",
115
- "@intlayer/core": "9.0.0-canary.10",
116
- "@intlayer/types": "9.0.0-canary.10",
117
- "react-intlayer": "9.0.0-canary.10"
113
+ "@intlayer/config": "9.0.0-canary.12",
114
+ "@intlayer/core": "9.0.0-canary.12",
115
+ "@intlayer/engine": "9.0.0-canary.12",
116
+ "@intlayer/types": "9.0.0-canary.12",
117
+ "react-intlayer": "9.0.0-canary.12"
118
118
  },
119
119
  "devDependencies": {
120
120
  "@types/node": "25.9.4",