react-native-intlayer 7.5.0-canary.1 → 7.5.1
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
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_exclusionList = require('./exclusionList.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
|
-
let
|
|
5
|
-
let
|
|
4
|
+
let _intlayer_chokidar = require("@intlayer/chokidar");
|
|
5
|
+
let _intlayer_config = require("@intlayer/config");
|
|
6
6
|
let metro_resolver = require("metro-resolver");
|
|
7
7
|
|
|
8
8
|
//#region src/configMetroIntlayer.ts
|
|
@@ -20,8 +20,8 @@ let metro_resolver = require("metro-resolver");
|
|
|
20
20
|
* > Note: `configMetroIntlayerSync` allow to build intlayer dictionaries on server start
|
|
21
21
|
*/
|
|
22
22
|
const configMetroIntlayerSync = (baseConfig) => {
|
|
23
|
-
const alias = (0,
|
|
24
|
-
configuration: (0,
|
|
23
|
+
const alias = (0, _intlayer_config.getAlias)({
|
|
24
|
+
configuration: (0, _intlayer_config.getConfiguration)(),
|
|
25
25
|
formatter: node_path.resolve
|
|
26
26
|
});
|
|
27
27
|
return {
|
|
@@ -64,7 +64,7 @@ const configMetroIntlayerSync = (baseConfig) => {
|
|
|
64
64
|
* > Note: `configMetroIntlayerSync` do not allow to build intlayer dictionaries on server start
|
|
65
65
|
*/
|
|
66
66
|
const configMetroIntlayer = async (baseConfig) => {
|
|
67
|
-
await (0,
|
|
67
|
+
await (0, _intlayer_chokidar.prepareIntlayer)((0, _intlayer_config.getConfiguration)());
|
|
68
68
|
return configMetroIntlayerSync(baseConfig);
|
|
69
69
|
};
|
|
70
70
|
|
|
@@ -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';\nimport { getAlias, getConfiguration } from '@intlayer/config';\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":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,2BACX,eACgB;CAGhB,MAAM,
|
|
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';\nimport { getAlias, getConfiguration } from '@intlayer/config';\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":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,2BACX,eACgB;CAGhB,MAAM,uCAAiB;EACrB,uDAHsC;EAItC,WAAWA;EACZ,CAAC;AAiDF,QA/Ce;EACb,GAAG;EAEH,UAAU;GACR,GAAG,YAAY;GACf,iBAAiB,SAAS,YAAY,GAAG,SAAS;AAChD,QAAI,OAAO,KAAK,MAAM,CAAC,SAAS,WAAW,CACzC,QAAO;KACL,UAAU,MAAM;KAChB,MAAM;KACP;AAIH,QAAI,eAAe,0BACjB,QAAO;KACL,UAAU,QAAQ,QAAQ,0BAA0B;KACpD,MAAM;KACP;AAIH,QAAI,eAAe,sBAEjB,QAAO;KACL,UAAU,QAAQ,QAAQ,8BAA8B;KACxD,MAAM;KACP;AAIH,QAAI,OAAQ,QAAgB,mBAAmB,WAC7C,QAAQ,QAAgB,eAAe,SAAS,YAAY,GAAG,KAAK;AAItE,uCAAe,SAAgB,YAAY,GAAG,KAAK;;GAErD,WAAWC,oCAAc,CACvB,GAAG,CAAC,YAAY,UAAU,aAAa,EAAE,CAAC,CAAC,MAAM,EAGjD,uDACD,CAAC;GACH;EACF;;;;;;;;;;;;;;;;;AAoBH,MAAa,sBAAsB,OACjC,eACyB;AAGzB,uFAFwC,CAEJ;AAEpC,QAAO,wBAAwB,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-intlayer",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.1",
|
|
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": [
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@intlayer/chokidar": "7.5.
|
|
91
|
-
"@intlayer/config": "7.5.
|
|
92
|
-
"@intlayer/core": "7.5.
|
|
93
|
-
"@intlayer/types": "7.5.
|
|
94
|
-
"react-intlayer": "7.5.
|
|
90
|
+
"@intlayer/chokidar": "7.5.1",
|
|
91
|
+
"@intlayer/config": "7.5.1",
|
|
92
|
+
"@intlayer/core": "7.5.1",
|
|
93
|
+
"@intlayer/types": "7.5.1",
|
|
94
|
+
"react-intlayer": "7.5.1"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@types/node": "25.0.
|
|
97
|
+
"@types/node": "25.0.3",
|
|
98
98
|
"@types/react": ">=18.0.0",
|
|
99
99
|
"@utils/ts-config": "1.0.4",
|
|
100
100
|
"@utils/ts-config-types": "1.0.4",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"metro-resolver": "0.82.0",
|
|
104
104
|
"react": ">=18.0.0",
|
|
105
105
|
"rimraf": "6.1.2",
|
|
106
|
-
"tsdown": "0.18.
|
|
106
|
+
"tsdown": "0.18.1",
|
|
107
107
|
"typescript": "5.9.3",
|
|
108
108
|
"vitest": "4.0.16"
|
|
109
109
|
},
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"expo": ">=52",
|
|
112
112
|
"metro-resolver": ">=0.80",
|
|
113
113
|
"react": ">=18.0.0",
|
|
114
|
-
"react-intlayer": "7.5.
|
|
114
|
+
"react-intlayer": "7.5.1"
|
|
115
115
|
},
|
|
116
116
|
"engines": {
|
|
117
117
|
"node": ">=14.18"
|