react-native-intlayer 8.1.2 → 8.1.3-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.
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/cjs/configMetroIntlayer.cjs +1 -74
- package/dist/cjs/configMetroIntlayer.cjs.map +1 -1
- package/dist/cjs/exclusionList.cjs +1 -15
- package/dist/cjs/exclusionList.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -6
- package/dist/cjs/intlayerPolyfill.cjs +1 -22
- package/dist/cjs/intlayerPolyfill.cjs.map +1 -1
- package/dist/cjs/intlayerProvider.cjs +1 -34
- package/dist/cjs/intlayerProvider.cjs.map +1 -1
- package/dist/cjs/metro.cjs +1 -5
- package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -8
- package/dist/esm/configMetroIntlayer.mjs +1 -72
- package/dist/esm/configMetroIntlayer.mjs.map +1 -1
- package/dist/esm/exclusionList.mjs +1 -12
- package/dist/esm/exclusionList.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -4
- package/dist/esm/intlayerPolyfill.mjs +1 -20
- package/dist/esm/intlayerPolyfill.mjs.map +1 -1
- package/dist/esm/intlayerProvider.mjs +1 -32
- package/dist/esm/intlayerProvider.mjs.map +1 -1
- package/dist/esm/metro.mjs +1 -3
- package/dist/types/configMetroIntlayer.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|
|
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;
|
|
@@ -1,75 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_exclusionList = require('./exclusionList.cjs');
|
|
4
|
-
let node_path = require("node:path");
|
|
5
|
-
let _intlayer_chokidar = require("@intlayer/chokidar");
|
|
6
|
-
let _intlayer_config = require("@intlayer/config");
|
|
7
|
-
let metro_resolver = require("metro-resolver");
|
|
8
|
-
|
|
9
|
-
//#region src/configMetroIntlayer.ts
|
|
10
|
-
/**
|
|
11
|
-
* // metro.config.js
|
|
12
|
-
* const { getDefaultConfig } = require("expo/metro-config");
|
|
13
|
-
* const { configMetroIntlayerSync } = require("react-native-intlayer/metro");
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* const defaultConfig = getDefaultConfig(__dirname);
|
|
17
|
-
*
|
|
18
|
-
* return configMetroIntlayerSync(defaultConfig);
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* > Note: `configMetroIntlayerSync` allow to build intlayer dictionaries on server start
|
|
22
|
-
*/
|
|
23
|
-
const configMetroIntlayerSync = (baseConfig) => {
|
|
24
|
-
const alias = (0, _intlayer_config.getAlias)({
|
|
25
|
-
configuration: (0, _intlayer_config.getConfiguration)(),
|
|
26
|
-
formatter: node_path.resolve
|
|
27
|
-
});
|
|
28
|
-
return {
|
|
29
|
-
...baseConfig,
|
|
30
|
-
resolver: {
|
|
31
|
-
...baseConfig?.resolver,
|
|
32
|
-
resolveRequest: (context, moduleName, ...args) => {
|
|
33
|
-
if (Object.keys(alias).includes(moduleName)) return {
|
|
34
|
-
filePath: alias[moduleName],
|
|
35
|
-
type: "sourceFile"
|
|
36
|
-
};
|
|
37
|
-
if (moduleName === "@intlayer/config/client") return {
|
|
38
|
-
filePath: require.resolve("@intlayer/config/client"),
|
|
39
|
-
type: "sourceFile"
|
|
40
|
-
};
|
|
41
|
-
if (moduleName === "@intlayer/core/file") return {
|
|
42
|
-
filePath: require.resolve("@intlayer/core/file/browser"),
|
|
43
|
-
type: "sourceFile"
|
|
44
|
-
};
|
|
45
|
-
if (typeof context.resolveRequest === "function") return context.resolveRequest(context, moduleName, ...args);
|
|
46
|
-
return (0, metro_resolver.resolve)(context, moduleName, ...args);
|
|
47
|
-
},
|
|
48
|
-
blockList: require_exclusionList.exclusionList([...[baseConfig?.resolver?.blockList ?? []].flat(), /.*\.content\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/])
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* // metro.config.js
|
|
54
|
-
* const { getDefaultConfig } = require("expo/metro-config");
|
|
55
|
-
* const { configMetroIntlayer } = require("react-native-intlayer/metro");
|
|
56
|
-
*
|
|
57
|
-
* module.exports = (async () => {
|
|
58
|
-
* const defaultConfig = getDefaultConfig(__dirname);
|
|
59
|
-
*
|
|
60
|
-
* return await configMetroIntlayer(defaultConfig);
|
|
61
|
-
* })();
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* > Note: `configMetroIntlayer` is a promise function. Use `configMetroIntlayerSync` instead if you want to use it synchronously.
|
|
65
|
-
* > Note: `configMetroIntlayerSync` do not allow to build intlayer dictionaries on server start
|
|
66
|
-
*/
|
|
67
|
-
const configMetroIntlayer = async (baseConfig) => {
|
|
68
|
-
await (0, _intlayer_chokidar.prepareIntlayer)((0, _intlayer_config.getConfiguration)());
|
|
69
|
-
return configMetroIntlayerSync(baseConfig);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
//#endregion
|
|
73
|
-
exports.configMetroIntlayer = configMetroIntlayer;
|
|
74
|
-
exports.configMetroIntlayerSync = configMetroIntlayerSync;
|
|
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;
|
|
75
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';\nimport {
|
|
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,16 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let node_path = require("node:path");
|
|
4
|
-
node_path = require_runtime.__toESM(node_path);
|
|
5
|
-
|
|
6
|
-
//#region src/exclusionList.ts
|
|
7
|
-
const escapeRegExp = (pattern) => {
|
|
8
|
-
if (Object.prototype.toString.call(pattern) === "[object RegExp]") return pattern.source.replace(/\/|\\\//g, `\\${node_path.default.sep}`);
|
|
9
|
-
else if (typeof pattern === "string") return pattern.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&").replaceAll("/", `\\${node_path.default.sep}`);
|
|
10
|
-
else throw new Error(`Unexpected exclusion pattern: ${pattern}`);
|
|
11
|
-
};
|
|
12
|
-
const exclusionList = (additionalExclusions) => new RegExp(`(${(additionalExclusions || []).map(escapeRegExp).join("|")})$`);
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
exports.exclusionList = exclusionList;
|
|
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;
|
|
16
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":"
|
|
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"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_intlayerPolyfill = require('./intlayerPolyfill.cjs');
|
|
3
|
-
const require_intlayerProvider = require('./intlayerProvider.cjs');
|
|
4
|
-
|
|
5
|
-
exports.IntlayerProvider = require_intlayerProvider.IntlayerProvider;
|
|
6
|
-
exports.intlayerPolyfill = require_intlayerPolyfill.intlayerPolyfill;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./intlayerPolyfill.cjs`),t=require(`./intlayerProvider.cjs`);exports.IntlayerProvider=t.IntlayerProvider,exports.intlayerPolyfill=e.intlayerPolyfill;
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/intlayerPolyfill.ts
|
|
4
|
-
/**
|
|
5
|
-
* Applies necessary polyfills for React Native to support Intlayer.
|
|
6
|
-
*
|
|
7
|
-
* This includes polyfilling `structuredClone` if it is missing,
|
|
8
|
-
* and providing no-op implementations for standard DOM `window` methods
|
|
9
|
-
* (`addEventListener`, `removeEventListener`, `postMessage`)
|
|
10
|
-
* to ensure compatibility with libraries that expect a browser-like environment.
|
|
11
|
-
*/
|
|
12
|
-
const intlayerPolyfill = () => {
|
|
13
|
-
if (typeof global.structuredClone !== "function") global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
14
|
-
if (typeof window !== "undefined") {
|
|
15
|
-
if (typeof window.addEventListener !== "function") window.addEventListener = () => null;
|
|
16
|
-
if (typeof window.removeEventListener !== "function") window.removeEventListener = () => null;
|
|
17
|
-
if (typeof window.postMessage !== "function") window.postMessage = () => null;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
exports.intlayerPolyfill = intlayerPolyfill;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=()=>{typeof global.structuredClone!=`function`&&(global.structuredClone=e=>JSON.parse(JSON.stringify(e))),typeof window<`u`&&(typeof window.addEventListener!=`function`&&(window.addEventListener=()=>null),typeof window.removeEventListener!=`function`&&(window.removeEventListener=()=>null),typeof window.postMessage!=`function`&&(window.postMessage=()=>null))};exports.intlayerPolyfill=e;
|
|
23
2
|
//# sourceMappingURL=intlayerPolyfill.cjs.map
|
|
@@ -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 polyfilling `structuredClone` if it is missing,\n * and providing no-op implementations for standard DOM `window` methods\n * (`addEventListener`, `removeEventListener`, `postMessage`)\n * to ensure compatibility with libraries that expect a browser-like environment.\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 if (typeof window.addEventListener !== 'function') {\n window.addEventListener = () => null;\n }\n if (typeof window.removeEventListener !== 'function') {\n window.removeEventListener = () => null;\n }\n if (typeof window.postMessage !== 'function') {\n window.postMessage = () => null;\n }\n }\n};\n"],"mappings":"
|
|
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 polyfilling `structuredClone` if it is missing,\n * and providing no-op implementations for standard DOM `window` methods\n * (`addEventListener`, `removeEventListener`, `postMessage`)\n * to ensure compatibility with libraries that expect a browser-like environment.\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 if (typeof window.addEventListener !== 'function') {\n window.addEventListener = () => null;\n }\n if (typeof window.removeEventListener !== 'function') {\n window.removeEventListener = () => null;\n }\n if (typeof window.postMessage !== 'function') {\n window.postMessage = () => null;\n }\n }\n};\n"],"mappings":"mEAQA,MAAa,MAAyB,CAChC,OAAO,OAAO,iBAAoB,aACpC,OAAO,gBAAmB,GAAQ,KAAK,MAAM,KAAK,UAAU,EAAI,CAAC,EAG/D,OAAO,OAAW,MAChB,OAAO,OAAO,kBAAqB,aACrC,OAAO,qBAAyB,MAE9B,OAAO,OAAO,qBAAwB,aACxC,OAAO,wBAA4B,MAEjC,OAAO,OAAO,aAAgB,aAChC,OAAO,gBAAoB"}
|
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_intlayerPolyfill = require('./intlayerPolyfill.cjs');
|
|
4
|
-
let react_intlayer = require("react-intlayer");
|
|
5
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
-
|
|
7
|
-
//#region src/intlayerProvider.tsx
|
|
8
|
-
require_intlayerPolyfill.intlayerPolyfill();
|
|
9
|
-
/**
|
|
10
|
-
* Provider component that wraps your application and provides the Intlayer context.
|
|
11
|
-
*
|
|
12
|
-
* This provider also automatically applies necessary polyfills for React Native.
|
|
13
|
-
*
|
|
14
|
-
* @param props - The provider props, excluding editor-specific and cookie-specific options which are not applicable in React Native.
|
|
15
|
-
* @returns The provider component.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* import { IntlayerProvider } from 'react-native-intlayer';
|
|
20
|
-
*
|
|
21
|
-
* const App = () => (
|
|
22
|
-
* <IntlayerProvider>
|
|
23
|
-
* <MyComponent />
|
|
24
|
-
* </IntlayerProvider>
|
|
25
|
-
* );
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
const IntlayerProvider = ({ children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_intlayer.IntlayerProviderContent, {
|
|
29
|
-
...props,
|
|
30
|
-
children
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.IntlayerProvider = IntlayerProvider;
|
|
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;
|
|
35
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":"
|
|
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,wBAAAA,CAAwB,GAAI,EAAQ,YAAmC"}
|
package/dist/cjs/metro.cjs
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_configMetroIntlayer = require('./configMetroIntlayer.cjs');
|
|
3
|
-
|
|
4
|
-
exports.configMetroIntlayer = require_configMetroIntlayer.configMetroIntlayer;
|
|
5
|
-
exports.configMetroIntlayerSync = require_configMetroIntlayer.configMetroIntlayerSync;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./configMetroIntlayer.cjs`);exports.configMetroIntlayer=e.configMetroIntlayer,exports.configMetroIntlayerSync=e.configMetroIntlayerSync;
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
3
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
4
|
-
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { __require };
|
|
1
|
+
var e=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});export{e as __require};
|
|
@@ -1,73 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { exclusionList } from "./exclusionList.mjs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import { prepareIntlayer } from "@intlayer/chokidar";
|
|
5
|
-
import { getAlias, getConfiguration } from "@intlayer/config";
|
|
6
|
-
import { resolve as resolve$1 } from "metro-resolver";
|
|
7
|
-
|
|
8
|
-
//#region src/configMetroIntlayer.ts
|
|
9
|
-
/**
|
|
10
|
-
* // metro.config.js
|
|
11
|
-
* const { getDefaultConfig } = require("expo/metro-config");
|
|
12
|
-
* const { configMetroIntlayerSync } = require("react-native-intlayer/metro");
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* const defaultConfig = getDefaultConfig(__dirname);
|
|
16
|
-
*
|
|
17
|
-
* return configMetroIntlayerSync(defaultConfig);
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* > Note: `configMetroIntlayerSync` allow to build intlayer dictionaries on server start
|
|
21
|
-
*/
|
|
22
|
-
const configMetroIntlayerSync = (baseConfig) => {
|
|
23
|
-
const alias = getAlias({
|
|
24
|
-
configuration: getConfiguration(),
|
|
25
|
-
formatter: resolve
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
...baseConfig,
|
|
29
|
-
resolver: {
|
|
30
|
-
...baseConfig?.resolver,
|
|
31
|
-
resolveRequest: (context, moduleName, ...args) => {
|
|
32
|
-
if (Object.keys(alias).includes(moduleName)) return {
|
|
33
|
-
filePath: alias[moduleName],
|
|
34
|
-
type: "sourceFile"
|
|
35
|
-
};
|
|
36
|
-
if (moduleName === "@intlayer/config/client") return {
|
|
37
|
-
filePath: __require.resolve("@intlayer/config/client"),
|
|
38
|
-
type: "sourceFile"
|
|
39
|
-
};
|
|
40
|
-
if (moduleName === "@intlayer/core/file") return {
|
|
41
|
-
filePath: __require.resolve("@intlayer/core/file/browser"),
|
|
42
|
-
type: "sourceFile"
|
|
43
|
-
};
|
|
44
|
-
if (typeof context.resolveRequest === "function") return context.resolveRequest(context, moduleName, ...args);
|
|
45
|
-
return resolve$1(context, moduleName, ...args);
|
|
46
|
-
},
|
|
47
|
-
blockList: exclusionList([...[baseConfig?.resolver?.blockList ?? []].flat(), /.*\.content\.(?:ts|tsx|js|jsx|cjs|cjx|mjs|mjx|json)$/])
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* // metro.config.js
|
|
53
|
-
* const { getDefaultConfig } = require("expo/metro-config");
|
|
54
|
-
* const { configMetroIntlayer } = require("react-native-intlayer/metro");
|
|
55
|
-
*
|
|
56
|
-
* module.exports = (async () => {
|
|
57
|
-
* const defaultConfig = getDefaultConfig(__dirname);
|
|
58
|
-
*
|
|
59
|
-
* return await configMetroIntlayer(defaultConfig);
|
|
60
|
-
* })();
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* > Note: `configMetroIntlayer` is a promise function. Use `configMetroIntlayerSync` instead if you want to use it synchronously.
|
|
64
|
-
* > Note: `configMetroIntlayerSync` do not allow to build intlayer dictionaries on server start
|
|
65
|
-
*/
|
|
66
|
-
const configMetroIntlayer = async (baseConfig) => {
|
|
67
|
-
await prepareIntlayer(getConfiguration());
|
|
68
|
-
return configMetroIntlayerSync(baseConfig);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
export { configMetroIntlayer, 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});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};
|
|
73
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';\nimport {
|
|
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,13 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/exclusionList.ts
|
|
4
|
-
const escapeRegExp = (pattern) => {
|
|
5
|
-
if (Object.prototype.toString.call(pattern) === "[object RegExp]") return pattern.source.replace(/\/|\\\//g, `\\${path.sep}`);
|
|
6
|
-
else if (typeof pattern === "string") return pattern.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&").replaceAll("/", `\\${path.sep}`);
|
|
7
|
-
else throw new Error(`Unexpected exclusion pattern: ${pattern}`);
|
|
8
|
-
};
|
|
9
|
-
const exclusionList = (additionalExclusions) => new RegExp(`(${(additionalExclusions || []).map(escapeRegExp).join("|")})$`);
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { exclusionList };
|
|
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};
|
|
13
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":"
|
|
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"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IntlayerProvider } from "./intlayerProvider.mjs";
|
|
3
|
-
|
|
4
|
-
export { IntlayerProvider, intlayerPolyfill };
|
|
1
|
+
import{intlayerPolyfill as e}from"./intlayerPolyfill.mjs";import{IntlayerProvider as t}from"./intlayerProvider.mjs";export{t as IntlayerProvider,e as intlayerPolyfill};
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Applies necessary polyfills for React Native to support Intlayer.
|
|
4
|
-
*
|
|
5
|
-
* This includes polyfilling `structuredClone` if it is missing,
|
|
6
|
-
* and providing no-op implementations for standard DOM `window` methods
|
|
7
|
-
* (`addEventListener`, `removeEventListener`, `postMessage`)
|
|
8
|
-
* to ensure compatibility with libraries that expect a browser-like environment.
|
|
9
|
-
*/
|
|
10
|
-
const intlayerPolyfill = () => {
|
|
11
|
-
if (typeof global.structuredClone !== "function") global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
12
|
-
if (typeof window !== "undefined") {
|
|
13
|
-
if (typeof window.addEventListener !== "function") window.addEventListener = () => null;
|
|
14
|
-
if (typeof window.removeEventListener !== "function") window.removeEventListener = () => null;
|
|
15
|
-
if (typeof window.postMessage !== "function") window.postMessage = () => null;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { intlayerPolyfill };
|
|
1
|
+
const e=()=>{typeof global.structuredClone!=`function`&&(global.structuredClone=e=>JSON.parse(JSON.stringify(e))),typeof window<`u`&&(typeof window.addEventListener!=`function`&&(window.addEventListener=()=>null),typeof window.removeEventListener!=`function`&&(window.removeEventListener=()=>null),typeof window.postMessage!=`function`&&(window.postMessage=()=>null))};export{e as intlayerPolyfill};
|
|
21
2
|
//# sourceMappingURL=intlayerPolyfill.mjs.map
|
|
@@ -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 polyfilling `structuredClone` if it is missing,\n * and providing no-op implementations for standard DOM `window` methods\n * (`addEventListener`, `removeEventListener`, `postMessage`)\n * to ensure compatibility with libraries that expect a browser-like environment.\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 if (typeof window.addEventListener !== 'function') {\n window.addEventListener = () => null;\n }\n if (typeof window.removeEventListener !== 'function') {\n window.removeEventListener = () => null;\n }\n if (typeof window.postMessage !== 'function') {\n window.postMessage = () => null;\n }\n }\n};\n"],"mappings":"
|
|
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 polyfilling `structuredClone` if it is missing,\n * and providing no-op implementations for standard DOM `window` methods\n * (`addEventListener`, `removeEventListener`, `postMessage`)\n * to ensure compatibility with libraries that expect a browser-like environment.\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 if (typeof window.addEventListener !== 'function') {\n window.addEventListener = () => null;\n }\n if (typeof window.removeEventListener !== 'function') {\n window.removeEventListener = () => null;\n }\n if (typeof window.postMessage !== 'function') {\n window.postMessage = () => null;\n }\n }\n};\n"],"mappings":"AAQA,MAAa,MAAyB,CAChC,OAAO,OAAO,iBAAoB,aACpC,OAAO,gBAAmB,GAAQ,KAAK,MAAM,KAAK,UAAU,EAAI,CAAC,EAG/D,OAAO,OAAW,MAChB,OAAO,OAAO,kBAAqB,aACrC,OAAO,qBAAyB,MAE9B,OAAO,OAAO,qBAAwB,aACxC,OAAO,wBAA4B,MAEjC,OAAO,OAAO,aAAgB,aAChC,OAAO,gBAAoB"}
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IntlayerProviderContent } from "react-intlayer";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
//#region src/intlayerProvider.tsx
|
|
6
|
-
intlayerPolyfill();
|
|
7
|
-
/**
|
|
8
|
-
* Provider component that wraps your application and provides the Intlayer context.
|
|
9
|
-
*
|
|
10
|
-
* This provider also automatically applies necessary polyfills for React Native.
|
|
11
|
-
*
|
|
12
|
-
* @param props - The provider props, excluding editor-specific and cookie-specific options which are not applicable in React Native.
|
|
13
|
-
* @returns The provider component.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* import { IntlayerProvider } from 'react-native-intlayer';
|
|
18
|
-
*
|
|
19
|
-
* const App = () => (
|
|
20
|
-
* <IntlayerProvider>
|
|
21
|
-
* <MyComponent />
|
|
22
|
-
* </IntlayerProvider>
|
|
23
|
-
* );
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
const IntlayerProvider = ({ children, ...props }) => /* @__PURE__ */ jsx(IntlayerProviderContent, {
|
|
27
|
-
...props,
|
|
28
|
-
children
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { IntlayerProvider };
|
|
1
|
+
import{intlayerPolyfill as e}from"./intlayerPolyfill.mjs";import{IntlayerProviderContent as t}from"react-intlayer";import{jsx as n}from"react/jsx-runtime";e();const r=({children:e,...r})=>n(t,{...r,children:e});export{r as IntlayerProvider};
|
|
33
2
|
//# sourceMappingURL=intlayerProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerProvider.mjs","names":[],"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":"
|
|
1
|
+
{"version":3,"file":"intlayerProvider.mjs","names":[],"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":"2JAMA,GAAkB,CA0BlB,MAAa,GAAoB,CAC/B,WACA,GAAG,KAEH,EAAC,EAAA,CAAwB,GAAI,EAAQ,YAAmC"}
|
package/dist/esm/metro.mjs
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export { configMetroIntlayer, configMetroIntlayerSync };
|
|
1
|
+
import{configMetroIntlayer as e,configMetroIntlayerSync as t}from"./configMetroIntlayer.mjs";export{e as configMetroIntlayer,t as configMetroIntlayerSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configMetroIntlayer.d.ts","names":[],"sources":["../../src/configMetroIntlayer.ts"],"mappings":";;;
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-intlayer",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.3-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": [
|
|
@@ -87,11 +87,11 @@
|
|
|
87
87
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@intlayer/chokidar": "8.1.
|
|
91
|
-
"@intlayer/config": "8.1.
|
|
92
|
-
"@intlayer/core": "8.1.
|
|
93
|
-
"@intlayer/types": "8.1.
|
|
94
|
-
"react-intlayer": "8.1.
|
|
90
|
+
"@intlayer/chokidar": "8.1.3-canary.0",
|
|
91
|
+
"@intlayer/config": "8.1.3-canary.0",
|
|
92
|
+
"@intlayer/core": "8.1.3-canary.0",
|
|
93
|
+
"@intlayer/types": "8.1.3-canary.0",
|
|
94
|
+
"react-intlayer": "8.1.3-canary.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@types/node": "25.2.3",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"expo": ">=52",
|
|
112
112
|
"metro-resolver": ">=0.80",
|
|
113
113
|
"react": ">=18.0.0",
|
|
114
|
-
"react-intlayer": "8.1.
|
|
114
|
+
"react-intlayer": "8.1.3-canary.0"
|
|
115
115
|
},
|
|
116
116
|
"engines": {
|
|
117
117
|
"node": ">=14.18"
|