react-native-intlayer 8.3.4 → 8.4.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./exclusionList.cjs`);let t=require(`node:path`),n=require(`@intlayer/chokidar/build`),r=require(`@intlayer/config/node`),i=require(`@intlayer/config/utils`),a=require(`metro-resolver`);const o=n=>{let o=(0,i.getAlias)({configuration:(0,r.getConfiguration)(),formatter:t.resolve});return{...n,resolver:{...n?.resolver,resolveRequest:(e,t,...n)=>Object.keys(o).includes(t)?{filePath:o[t],type:`sourceFile`}:t===`@intlayer/config/client`?{filePath:require.resolve(`@intlayer/config/client`),type:`sourceFile`}:t===`@intlayer/core/file`?{filePath:require.resolve(`@intlayer/core/file/browser`),type:`sourceFile`}:typeof e.resolveRequest==`function`?e.resolveRequest(e,t,...n):(0,a.resolve)(e,t,...n),blockList:e.exclusionList([...[n?.resolver?.blockList??[]].flat(),/.*\.content\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/])}}},s=async e=>(await(0,n.prepareIntlayer)((0,r.getConfiguration)()),o(e));exports.configMetroIntlayer=s,exports.configMetroIntlayerSync=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./exclusionList.cjs`);let t=require(`node:path`),n=require(`@intlayer/chokidar/build`),r=require(`@intlayer/config/node`),i=require(`@intlayer/config/utils`),a=require(`metro-resolver`);const o=n=>{let o=(0,i.getAlias)({configuration:(0,r.getConfiguration)(),formatter:t.resolve}),s=n?.resolver?.blockList,c=s instanceof RegExp?[s]:s??[],l=n?.resolver?.resolveRequest;return{...n,resolver:{...n?.resolver,resolveRequest:(e,t,...n)=>Object.keys(o).includes(t)?{filePath:o[t],type:`sourceFile`}:t===`@intlayer/config/client`?{filePath:require.resolve(`@intlayer/config/client`),type:`sourceFile`}:t===`@intlayer/core/file`?{filePath:require.resolve(`@intlayer/core/file/browser`),type:`sourceFile`}:l?l(e,t,...n):(0,a.resolve)(e,t,...n),blockList:e.exclusionList([...c,/.*\.content\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/])}}},s=async e=>(await(0,n.prepareIntlayer)((0,r.getConfiguration)()),o(e));exports.configMetroIntlayer=s,exports.configMetroIntlayerSync=o;
2
2
  //# sourceMappingURL=configMetroIntlayer.cjs.map
@@ -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 { resolve } from 'metro-resolver';\nimport { exclusionList } from './exclusionList';\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` allow to build intlayer dictionaries on server start\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 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 subodules, 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 default resolver to prevent infinite recursion\n if (typeof (context as any).resolveRequest === 'function') {\n return (context as any).resolveRequest(context, moduleName, ...args);\n }\n\n // Fallback to metro-resolver when no default resolver is present\n return resolve(context as any, moduleName, ...args);\n },\n blockList: exclusionList([\n ...[baseConfig?.resolver?.blockList ?? []].flat(),\n // the following instruction should be replaced configuration.content.watchedFilesPattern\n // but using watchedFilesPattern does not exclude the files properly for now\n /.*\\.content\\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/,\n ]),\n },\n } satisfies 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` is a promise function. Use `configMetroIntlayerSync` instead if you want to use it synchronously.\n * > Note: `configMetroIntlayerSync` do not allow to build intlayer dictionaries on server start\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":"0TAuBA,MAAa,EACX,GACgB,CAGhB,IAAM,GAAA,EAAA,EAAA,UAAiB,CACrB,eAAA,EAAA,EAAA,mBAHsC,CAItC,UAAWA,EAAAA,QACZ,CAAC,CAiDF,MA/Ce,CACb,GAAG,EAEH,SAAU,CACR,GAAG,GAAY,SACf,gBAAiB,EAAS,EAAY,GAAG,IACnC,OAAO,KAAK,EAAM,CAAC,SAAS,EAAW,CAClC,CACL,SAAU,EAAM,GAChB,KAAM,aACP,CAIC,IAAe,0BACV,CACL,SAAU,QAAQ,QAAQ,0BAA0B,CACpD,KAAM,aACP,CAIC,IAAe,sBAEV,CACL,SAAU,QAAQ,QAAQ,8BAA8B,CACxD,KAAM,aACP,CAIC,OAAQ,EAAgB,gBAAmB,WACrC,EAAgB,eAAe,EAAS,EAAY,GAAG,EAAK,EAItE,EAAA,EAAA,SAAe,EAAgB,EAAY,GAAG,EAAK,CAErD,UAAWC,EAAAA,cAAc,CACvB,GAAG,CAAC,GAAY,UAAU,WAAa,EAAE,CAAC,CAAC,MAAM,CAGjD,uDACD,CAAC,CACH,CACF,EAoBU,EAAsB,KACjC,KAIA,MAAA,EAAA,EAAA,kBAAA,EAAA,EAAA,mBAFwC,CAEJ,CAE7B,EAAwB,EAAW"}
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 { resolve } from 'metro-resolver';\nimport { exclusionList } from './exclusionList';\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 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 // Fallback to metro-resolver\n return resolve(context as any, moduleName, ...args);\n },\n blockList: exclusionList([\n ...existingPatterns,\n // the following instruction should be replaced configuration.content.watchedFilesPattern\n // but using watchedFilesPattern 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":"8QAuBA,MAAa,EACX,GACgB,CAGhB,IAAM,GAAA,EAAA,EAAA,UAAiB,CACrB,eAAA,EAAA,EAAA,mBAHsC,CAItC,UAAWA,EAAAA,QACZ,CAAC,CAEI,EAAoB,GAAY,UAAU,UAC1C,EACJ,aAA6B,OACzB,CAAC,EAAkB,CAClB,GAAqB,EAAE,CAExB,EAAyB,GAAY,UAAU,eAiDrD,MA/Ce,CACb,GAAG,EAEH,SAAU,CACR,GAAG,GAAY,SACf,gBAAiB,EAAS,EAAY,GAAG,IACnC,OAAO,KAAK,EAAM,CAAC,SAAS,EAAW,CAClC,CACL,SAAU,EAAM,GAChB,KAAM,aACP,CAIC,IAAe,0BACV,CACL,SAAU,QAAQ,QAAQ,0BAA0B,CACpD,KAAM,aACP,CAIC,IAAe,sBAEV,CACL,SAAU,QAAQ,QAAQ,8BAA8B,CACxD,KAAM,aACP,CAIC,EACK,EAAuB,EAAS,EAAY,GAAG,EAAK,EAI7D,EAAA,EAAA,SAAe,EAAgB,EAAY,GAAG,EAAK,CAErD,UAAWC,EAAAA,cAAc,CACvB,GAAG,EAGH,uDACD,CAAC,CACH,CACF,EAmBU,EAAsB,KACjC,KAIA,MAAA,EAAA,EAAA,kBAAA,EAAA,EAAA,mBAFwC,CAEJ,CAE7B,EAAwB,EAAW"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`node:path`);t=e.__toESM(t);const n=e=>{if(Object.prototype.toString.call(e)===`[object RegExp]`)return e.source.replace(/\/|\\\//g,`\\${t.default.sep}`);if(typeof e==`string`)return e.replace(/[-[\]{}()*+?.\\^$|]/g,`\\$&`).replaceAll(`/`,`\\${t.default.sep}`);throw Error(`Unexpected exclusion pattern: ${e}`)},r=e=>RegExp(`(${(e||[]).map(n).join(`|`)})$`);exports.exclusionList=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`node:path`);const t=t=>{let n=e.sep===`\\`?`\\\\`:`/`;if(t instanceof RegExp)return t.source.replace(/\//g,n);if(typeof t==`string`)return t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`).replace(/\//g,n);throw Error(`Unexpected exclusion pattern: ${t}`)},n=e=>[RegExp(`(${e.map(t).join(`|`)})$`)];exports.exclusionList=n;
2
2
  //# sourceMappingURL=exclusionList.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exclusionList.cjs","names":["path"],"sources":["../../src/exclusionList.ts"],"sourcesContent":["import path from 'node:path';\n\nconst escapeRegExp = (pattern: RegExp | string) => {\n if (Object.prototype.toString.call(pattern) === '[object RegExp]') {\n return (pattern as RegExp).source.replace(/\\/|\\\\\\//g, `\\\\${path.sep}`);\n } else if (typeof pattern === 'string') {\n var escaped = pattern.replace(/[-[\\]{}()*+?.\\\\^$|]/g, '\\\\$&');\n return escaped.replaceAll('/', `\\\\${path.sep}`);\n } else {\n throw new Error(`Unexpected exclusion pattern: ${pattern}`);\n }\n};\n\nexport const exclusionList = (additionalExclusions?: (RegExp | string)[]) =>\n new RegExp(`(${(additionalExclusions || []).map(escapeRegExp).join('|')})$`);\n"],"mappings":"iKAEA,MAAM,EAAgB,GAA6B,CACjD,GAAI,OAAO,UAAU,SAAS,KAAK,EAAQ,GAAK,kBAC9C,OAAQ,EAAmB,OAAO,QAAQ,WAAY,KAAKA,EAAAA,QAAK,MAAM,IAC7D,OAAO,GAAY,SAE5B,OADc,EAAQ,QAAQ,uBAAwB,OAAO,CAC9C,WAAW,IAAK,KAAKA,EAAAA,QAAK,MAAM,CAE/C,MAAU,MAAM,iCAAiC,IAAU,EAIlD,EAAiB,GACxB,OAAO,KAAK,GAAwB,EAAE,EAAE,IAAI,EAAa,CAAC,KAAK,IAAI,CAAC,IAAI"}
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":"8FAEA,MAAM,EAAoB,GAAqC,CAE7D,IAAM,EAAaA,EAAAA,MAAQ,KAAO,OAAS,IAE3C,GAAI,aAAmB,OACrB,OAAO,EAAQ,OAAO,QAAQ,MAAO,EAAW,CAGlD,GAAI,OAAO,GAAY,SAErB,OADgB,EAAQ,QAAQ,sBAAuB,OAAO,CAC/C,QAAQ,MAAO,EAAW,CAG3C,MAAU,MAAM,iCAAiC,IAAU,EAGhD,EACX,GACa,CACT,OAAO,IAAI,EAAqB,IAAI,EAAiB,CAAC,KAAK,IAAI,CAAC,IAAI,CACzE"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./intlayerPolyfill.cjs`);let t=require(`react-intlayer`),n=require(`react/jsx-runtime`);e.intlayerPolyfill();const r=({children:e,...r})=>(0,n.jsx)(t.IntlayerProviderContent,{...r,children:e});exports.IntlayerProvider=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./intlayerPolyfill.cjs`);let t=require(`react-intlayer`),n=require(`react/jsx-runtime`);e.intlayerPolyfill();const r=({children:e,...r})=>(0,n.jsx)(t.IntlayerProviderContent,{...r,children:e});exports.IntlayerProvider=r;
2
2
  //# sourceMappingURL=intlayerProvider.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerProvider.cjs","names":["intlayerPolyfill","IntlayerProviderContent"],"sources":["../../src/intlayerProvider.tsx"],"sourcesContent":["import {\n IntlayerProviderContent,\n type IntlayerProviderProps as IntlayerProviderPropsBase,\n} from 'react-intlayer';\nimport { intlayerPolyfill } from './intlayerPolyfill';\n\nintlayerPolyfill();\n\ntype IntlayerProviderProps = Omit<\n IntlayerProviderPropsBase,\n 'disableEditor' | 'isCookieEnabled'\n>;\n\n/**\n * Provider component that wraps your application and provides the Intlayer context.\n *\n * This provider also automatically applies necessary polyfills for React Native.\n *\n * @param props - The provider props, excluding editor-specific and cookie-specific options which are not applicable in React Native.\n * @returns The provider component.\n *\n * @example\n * ```tsx\n * import { IntlayerProvider } from 'react-native-intlayer';\n *\n * const App = () => (\n * <IntlayerProvider>\n * <MyComponent />\n * </IntlayerProvider>\n * );\n * ```\n */\nexport const IntlayerProvider = ({\n children,\n ...props\n}: IntlayerProviderProps) => (\n <IntlayerProviderContent {...props}>{children}</IntlayerProviderContent>\n);\n"],"mappings":"wNAMAA,EAAAA,kBAAkB,CA0BlB,MAAa,GAAoB,CAC/B,WACA,GAAG,MAEH,EAAA,EAAA,KAACC,EAAAA,wBAAD,CAAyB,GAAI,EAAQ,WAAmC,CAAA"}
1
+ {"version":3,"file":"intlayerProvider.cjs","names":["intlayerPolyfill","IntlayerProviderContent"],"sources":["../../src/intlayerProvider.tsx"],"sourcesContent":["import {\n IntlayerProviderContent,\n type IntlayerProviderProps as IntlayerProviderPropsBase,\n} from 'react-intlayer';\nimport { intlayerPolyfill } from './intlayerPolyfill';\n\nintlayerPolyfill();\n\ntype IntlayerProviderProps = Omit<\n IntlayerProviderPropsBase,\n 'disableEditor' | 'isCookieEnabled'\n>;\n\n/**\n * Provider component that wraps your application and provides the Intlayer context.\n *\n * This provider also automatically applies necessary polyfills for React Native.\n *\n * @param props - The provider props, excluding editor-specific and cookie-specific options which are not applicable in React Native.\n * @returns The provider component.\n *\n * @example\n * ```tsx\n * import { IntlayerProvider } from 'react-native-intlayer';\n *\n * const App = () => (\n * <IntlayerProvider>\n * <MyComponent />\n * </IntlayerProvider>\n * );\n * ```\n */\nexport const IntlayerProvider = ({\n children,\n ...props\n}: IntlayerProviderProps) => (\n <IntlayerProviderContent {...props}>{children}</IntlayerProviderContent>\n);\n"],"mappings":"4KAMAA,EAAAA,kBAAkB,CA0BlB,MAAa,GAAoB,CAC/B,WACA,GAAG,MAEH,EAAA,EAAA,KAACC,EAAAA,wBAAD,CAAyB,GAAI,EAAQ,WAAmC,CAAA"}
@@ -1,2 +1,2 @@
1
- import{__require as e}from"./_virtual/_rolldown/runtime.mjs";import{exclusionList as t}from"./exclusionList.mjs";import{resolve as n}from"node:path";import{prepareIntlayer as r}from"@intlayer/chokidar/build";import{getConfiguration as i}from"@intlayer/config/node";import{getAlias as a}from"@intlayer/config/utils";import{resolve as o}from"metro-resolver";const s=r=>{let s=a({configuration:i(),formatter:n});return{...r,resolver:{...r?.resolver,resolveRequest:(t,n,...r)=>Object.keys(s).includes(n)?{filePath:s[n],type:`sourceFile`}:n===`@intlayer/config/client`?{filePath:e.resolve(`@intlayer/config/client`),type:`sourceFile`}:n===`@intlayer/core/file`?{filePath:e.resolve(`@intlayer/core/file/browser`),type:`sourceFile`}:typeof t.resolveRequest==`function`?t.resolveRequest(t,n,...r):o(t,n,...r),blockList:t([...[r?.resolver?.blockList??[]].flat(),/.*\.content\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/])}}},c=async e=>(await r(i()),s(e));export{c as configMetroIntlayer,s as configMetroIntlayerSync};
1
+ import{__require as e}from"./_virtual/_rolldown/runtime.mjs";import{exclusionList as t}from"./exclusionList.mjs";import{resolve as n}from"node:path";import{prepareIntlayer as r}from"@intlayer/chokidar/build";import{getConfiguration as i}from"@intlayer/config/node";import{getAlias as a}from"@intlayer/config/utils";import{resolve as o}from"metro-resolver";const s=r=>{let s=a({configuration:i(),formatter:n}),c=r?.resolver?.blockList,l=c instanceof RegExp?[c]:c??[],u=r?.resolver?.resolveRequest;return{...r,resolver:{...r?.resolver,resolveRequest:(t,n,...r)=>Object.keys(s).includes(n)?{filePath:s[n],type:`sourceFile`}:n===`@intlayer/config/client`?{filePath:e.resolve(`@intlayer/config/client`),type:`sourceFile`}:n===`@intlayer/core/file`?{filePath:e.resolve(`@intlayer/core/file/browser`),type:`sourceFile`}:u?u(t,n,...r):o(t,n,...r),blockList:t([...l,/.*\.content\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/])}}},c=async e=>(await r(i()),s(e));export{c as configMetroIntlayer,s as configMetroIntlayerSync};
2
2
  //# sourceMappingURL=configMetroIntlayer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"configMetroIntlayer.mjs","names":["pathResolve","resolve"],"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 { resolve } from 'metro-resolver';\nimport { exclusionList } from './exclusionList';\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` allow to build intlayer dictionaries on server start\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 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 subodules, 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 default resolver to prevent infinite recursion\n if (typeof (context as any).resolveRequest === 'function') {\n return (context as any).resolveRequest(context, moduleName, ...args);\n }\n\n // Fallback to metro-resolver when no default resolver is present\n return resolve(context as any, moduleName, ...args);\n },\n blockList: exclusionList([\n ...[baseConfig?.resolver?.blockList ?? []].flat(),\n // the following instruction should be replaced configuration.content.watchedFilesPattern\n // but using watchedFilesPattern does not exclude the files properly for now\n /.*\\.content\\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/,\n ]),\n },\n } satisfies 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` is a promise function. Use `configMetroIntlayerSync` instead if you want to use it synchronously.\n * > Note: `configMetroIntlayerSync` do not allow to build intlayer dictionaries on server start\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":"oWAuBA,MAAa,EACX,GACgB,CAGhB,IAAM,EAAQ,EAAS,CACrB,cAHoB,GAAkB,CAItC,UAAWA,EACZ,CAAC,CAiDF,MA/Ce,CACb,GAAG,EAEH,SAAU,CACR,GAAG,GAAY,SACf,gBAAiB,EAAS,EAAY,GAAG,IACnC,OAAO,KAAK,EAAM,CAAC,SAAS,EAAW,CAClC,CACL,SAAU,EAAM,GAChB,KAAM,aACP,CAIC,IAAe,0BACV,CACL,SAAA,EAAkB,QAAQ,0BAA0B,CACpD,KAAM,aACP,CAIC,IAAe,sBAEV,CACL,SAAA,EAAkB,QAAQ,8BAA8B,CACxD,KAAM,aACP,CAIC,OAAQ,EAAgB,gBAAmB,WACrC,EAAgB,eAAe,EAAS,EAAY,GAAG,EAAK,CAI/DC,EAAQ,EAAgB,EAAY,GAAG,EAAK,CAErD,UAAW,EAAc,CACvB,GAAG,CAAC,GAAY,UAAU,WAAa,EAAE,CAAC,CAAC,MAAM,CAGjD,uDACD,CAAC,CACH,CACF,EAoBU,EAAsB,KACjC,KAIA,MAAM,EAFgB,GAAkB,CAEJ,CAE7B,EAAwB,EAAW"}
1
+ {"version":3,"file":"configMetroIntlayer.mjs","names":["pathResolve","resolve"],"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 { resolve } from 'metro-resolver';\nimport { exclusionList } from './exclusionList';\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 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 // Fallback to metro-resolver\n return resolve(context as any, moduleName, ...args);\n },\n blockList: exclusionList([\n ...existingPatterns,\n // the following instruction should be replaced configuration.content.watchedFilesPattern\n // but using watchedFilesPattern 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":"oWAuBA,MAAa,EACX,GACgB,CAGhB,IAAM,EAAQ,EAAS,CACrB,cAHoB,GAAkB,CAItC,UAAWA,EACZ,CAAC,CAEI,EAAoB,GAAY,UAAU,UAC1C,EACJ,aAA6B,OACzB,CAAC,EAAkB,CAClB,GAAqB,EAAE,CAExB,EAAyB,GAAY,UAAU,eAiDrD,MA/Ce,CACb,GAAG,EAEH,SAAU,CACR,GAAG,GAAY,SACf,gBAAiB,EAAS,EAAY,GAAG,IACnC,OAAO,KAAK,EAAM,CAAC,SAAS,EAAW,CAClC,CACL,SAAU,EAAM,GAChB,KAAM,aACP,CAIC,IAAe,0BACV,CACL,SAAA,EAAkB,QAAQ,0BAA0B,CACpD,KAAM,aACP,CAIC,IAAe,sBAEV,CACL,SAAA,EAAkB,QAAQ,8BAA8B,CACxD,KAAM,aACP,CAIC,EACK,EAAuB,EAAS,EAAY,GAAG,EAAK,CAItDC,EAAQ,EAAgB,EAAY,GAAG,EAAK,CAErD,UAAW,EAAc,CACvB,GAAG,EAGH,uDACD,CAAC,CACH,CACF,EAmBU,EAAsB,KACjC,KAIA,MAAM,EAFgB,GAAkB,CAEJ,CAE7B,EAAwB,EAAW"}
@@ -1,2 +1,2 @@
1
- import e from"node:path";const t=t=>{if(Object.prototype.toString.call(t)===`[object RegExp]`)return t.source.replace(/\/|\\\//g,`\\${e.sep}`);if(typeof t==`string`)return t.replace(/[-[\]{}()*+?.\\^$|]/g,`\\$&`).replaceAll(`/`,`\\${e.sep}`);throw Error(`Unexpected exclusion pattern: ${t}`)},n=e=>RegExp(`(${(e||[]).map(t).join(`|`)})$`);export{n as exclusionList};
1
+ import{sep as e}from"node:path";const t=t=>{let n=e===`\\`?`\\\\`:`/`;if(t instanceof RegExp)return t.source.replace(/\//g,n);if(typeof t==`string`)return t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`).replace(/\//g,n);throw Error(`Unexpected exclusion pattern: ${t}`)},n=e=>[RegExp(`(${e.map(t).join(`|`)})$`)];export{n as exclusionList};
2
2
  //# sourceMappingURL=exclusionList.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exclusionList.mjs","names":[],"sources":["../../src/exclusionList.ts"],"sourcesContent":["import path from 'node:path';\n\nconst escapeRegExp = (pattern: RegExp | string) => {\n if (Object.prototype.toString.call(pattern) === '[object RegExp]') {\n return (pattern as RegExp).source.replace(/\\/|\\\\\\//g, `\\\\${path.sep}`);\n } else if (typeof pattern === 'string') {\n var escaped = pattern.replace(/[-[\\]{}()*+?.\\\\^$|]/g, '\\\\$&');\n return escaped.replaceAll('/', `\\\\${path.sep}`);\n } else {\n throw new Error(`Unexpected exclusion pattern: ${pattern}`);\n }\n};\n\nexport const exclusionList = (additionalExclusions?: (RegExp | string)[]) =>\n new RegExp(`(${(additionalExclusions || []).map(escapeRegExp).join('|')})$`);\n"],"mappings":"yBAEA,MAAM,EAAgB,GAA6B,CACjD,GAAI,OAAO,UAAU,SAAS,KAAK,EAAQ,GAAK,kBAC9C,OAAQ,EAAmB,OAAO,QAAQ,WAAY,KAAK,EAAK,MAAM,IAC7D,OAAO,GAAY,SAE5B,OADc,EAAQ,QAAQ,uBAAwB,OAAO,CAC9C,WAAW,IAAK,KAAK,EAAK,MAAM,CAE/C,MAAU,MAAM,iCAAiC,IAAU,EAIlD,EAAiB,GACxB,OAAO,KAAK,GAAwB,EAAE,EAAE,IAAI,EAAa,CAAC,KAAK,IAAI,CAAC,IAAI"}
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":"gCAEA,MAAM,EAAoB,GAAqC,CAE7D,IAAM,EAAa,IAAQ,KAAO,OAAS,IAE3C,GAAI,aAAmB,OACrB,OAAO,EAAQ,OAAO,QAAQ,MAAO,EAAW,CAGlD,GAAI,OAAO,GAAY,SAErB,OADgB,EAAQ,QAAQ,sBAAuB,OAAO,CAC/C,QAAQ,MAAO,EAAW,CAG3C,MAAU,MAAM,iCAAiC,IAAU,EAGhD,EACX,GACa,CACT,OAAO,IAAI,EAAqB,IAAI,EAAiB,CAAC,KAAK,IAAI,CAAC,IAAI,CACzE"}
@@ -13,7 +13,7 @@ type MetroConfig = ReturnType<typeof getDefaultConfig>;
13
13
  * return configMetroIntlayerSync(defaultConfig);
14
14
  * ```
15
15
  *
16
- * > Note: `configMetroIntlayerSync` allow to build intlayer dictionaries on server start
16
+ * > Note: `configMetroIntlayerSync` does not build intlayer dictionaries on server start. Use `configMetroIntlayer` for that.
17
17
  */
18
18
  declare const configMetroIntlayerSync: (baseConfig?: MetroConfig) => MetroConfig;
19
19
  /**
@@ -28,8 +28,7 @@ declare const configMetroIntlayerSync: (baseConfig?: MetroConfig) => MetroConfig
28
28
  * })();
29
29
  * ```
30
30
  *
31
- * > Note: `configMetroIntlayer` is a promise function. Use `configMetroIntlayerSync` instead if you want to use it synchronously.
32
- * > Note: `configMetroIntlayerSync` do not allow to build intlayer dictionaries on server start
31
+ * > Note: `configMetroIntlayer` builds intlayer dictionaries on server start. Use `configMetroIntlayerSync` instead if you want to skip that.
33
32
  */
34
33
  declare const configMetroIntlayer: (baseConfig?: MetroConfig) => Promise<MetroConfig>;
35
34
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"configMetroIntlayer.d.ts","names":[],"sources":["../../src/configMetroIntlayer.ts"],"mappings":";;;KAQK,WAAA,GAAc,UAAA,QAAkB,gBAAA;;AAJqB;;;;;AAmB1D;;;;;;;cAAa,uBAAA,GACX,UAAA,GAAa,WAAA,KACZ,WAAA;;AAyEH;;;;;;;;;;;;;;cAAa,mBAAA,GACX,UAAA,GAAa,WAAA,KACZ,OAAA,CAAQ,WAAA"}
1
+ {"version":3,"file":"configMetroIntlayer.d.ts","names":[],"sources":["../../src/configMetroIntlayer.ts"],"mappings":";;;KAQK,WAAA,GAAc,UAAA,QAAkB,gBAAA;;AAJqB;;;;;AAmB1D;;;;;;;cAAa,uBAAA,GACX,UAAA,GAAa,WAAA,KACZ,WAAA;;AAgFH;;;;;;;;;;;;;cAAa,mBAAA,GACX,UAAA,GAAa,WAAA,KACZ,OAAA,CAAQ,WAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/exclusionList.d.ts
2
- declare const exclusionList: (additionalExclusions?: (RegExp | string)[]) => RegExp;
2
+ declare const exclusionList: (additionalExclusions: (RegExp | string)[]) => RegExp[];
3
3
  //#endregion
4
4
  export { exclusionList };
5
5
  //# sourceMappingURL=exclusionList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exclusionList.d.ts","names":[],"sources":["../../src/exclusionList.ts"],"mappings":";cAaa,aAAA,GAAiB,oBAAA,IAAwB,MAAA,iBAAkB,MAAA"}
1
+ {"version":3,"file":"exclusionList.d.ts","names":[],"sources":["../../src/exclusionList.ts"],"mappings":";cAkBa,aAAA,GACX,oBAAA,GAAuB,MAAA,iBACtB,MAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-intlayer",
3
- "version": "8.3.4",
3
+ "version": "8.4.0-canary.0",
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,11 +86,11 @@
86
86
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
87
87
  },
88
88
  "dependencies": {
89
- "@intlayer/chokidar": "8.3.4",
90
- "@intlayer/config": "8.3.4",
91
- "@intlayer/core": "8.3.4",
92
- "@intlayer/types": "8.3.4",
93
- "react-intlayer": "8.3.4"
89
+ "@intlayer/chokidar": "8.4.0-canary.0",
90
+ "@intlayer/config": "8.4.0-canary.0",
91
+ "@intlayer/core": "8.4.0-canary.0",
92
+ "@intlayer/types": "8.4.0-canary.0",
93
+ "react-intlayer": "8.4.0-canary.0"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@types/node": "25.5.0",
@@ -98,7 +98,7 @@
98
98
  "@utils/ts-config": "1.0.4",
99
99
  "@utils/ts-config-types": "1.0.4",
100
100
  "@utils/tsdown-config": "1.0.4",
101
- "expo": "55.0.6",
101
+ "expo": "55.0.7",
102
102
  "metro-resolver": "0.84.2",
103
103
  "react": ">=18.0.0",
104
104
  "rimraf": "6.1.3",
@@ -110,7 +110,7 @@
110
110
  "expo": ">=52",
111
111
  "metro-resolver": ">=0.80",
112
112
  "react": ">=18.0.0",
113
- "react-intlayer": "8.3.4"
113
+ "react-intlayer": "8.4.0-canary.0"
114
114
  },
115
115
  "engines": {
116
116
  "node": ">=14.18"
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;