react-native-intlayer 5.1.8 → 5.2.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/configMetroIntlayer.cjs +77 -0
- package/dist/cjs/configMetroIntlayer.cjs.map +1 -0
- package/dist/cjs/exclusionList.cjs +52 -0
- package/dist/cjs/exclusionList.cjs.map +1 -0
- package/dist/cjs/index.cjs +4 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/intlayerPolyfill.cjs +36 -0
- package/dist/cjs/intlayerPolyfill.cjs.map +1 -0
- package/dist/esm/configMetroIntlayer.mjs +43 -0
- package/dist/esm/configMetroIntlayer.mjs.map +1 -0
- package/dist/esm/exclusionList.mjs +18 -0
- package/dist/esm/exclusionList.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/intlayerPolyfill.mjs +12 -0
- package/dist/esm/intlayerPolyfill.mjs.map +1 -0
- package/dist/types/configMetroIntlayer.d.ts +5 -0
- package/dist/types/configMetroIntlayer.d.ts.map +1 -0
- package/dist/types/exclusionList.d.ts +2 -0
- package/dist/types/exclusionList.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/intlayerPolyfill.d.ts +2 -0
- package/dist/types/intlayerPolyfill.d.ts.map +1 -0
- package/package.json +14 -10
- package/dist/cjs/intlayerPlugin.cjs +0 -47
- package/dist/cjs/intlayerPlugin.cjs.map +0 -1
- package/dist/esm/intlayerPlugin.mjs +0 -27
- package/dist/esm/intlayerPlugin.mjs.map +0 -1
- package/dist/types/intlayerMiddlewarePlugin.d.ts +0 -6
- package/dist/types/intlayerMiddlewarePlugin.d.ts.map +0 -1
- package/dist/types/intlayerPlugin.d.ts +0 -6
- package/dist/types/intlayerPlugin.d.ts.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
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 __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var configMetroIntlayer_exports = {};
|
|
30
|
+
__export(configMetroIntlayer_exports, {
|
|
31
|
+
configMetroIntlayer: () => configMetroIntlayer
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(configMetroIntlayer_exports);
|
|
34
|
+
var import_config = require("@intlayer/config");
|
|
35
|
+
var import_path = require("path");
|
|
36
|
+
var import_metro_resolver = require("metro-resolver");
|
|
37
|
+
var import_exclusionList = require('./exclusionList.cjs');
|
|
38
|
+
var import_chokidar = require("@intlayer/chokidar");
|
|
39
|
+
const configMetroIntlayer = async (baseConfig) => {
|
|
40
|
+
const intlayerConfig = (0, import_config.getConfiguration)();
|
|
41
|
+
await (0, import_chokidar.prepareIntlayer)(intlayerConfig);
|
|
42
|
+
const { mainDir, configDir, watchedFilesPattern } = intlayerConfig.content;
|
|
43
|
+
const dictionariesPath = (0, import_path.join)(mainDir, "dictionaries.cjs");
|
|
44
|
+
const configurationPath = (0, import_path.join)(configDir, "configuration.json");
|
|
45
|
+
const config = {
|
|
46
|
+
...baseConfig,
|
|
47
|
+
resolver: {
|
|
48
|
+
...baseConfig.resolver,
|
|
49
|
+
resolveRequest: (context, moduleName, platform) => {
|
|
50
|
+
if (moduleName === "@intlayer/dictionaries-entry") {
|
|
51
|
+
return {
|
|
52
|
+
filePath: require.resolve(dictionariesPath),
|
|
53
|
+
type: "sourceFile"
|
|
54
|
+
};
|
|
55
|
+
} else if (moduleName === "@intlayer/config/built") {
|
|
56
|
+
return {
|
|
57
|
+
filePath: require.resolve(configurationPath),
|
|
58
|
+
type: "sourceFile"
|
|
59
|
+
};
|
|
60
|
+
} else if (moduleName === "@intlayer/config/client") {
|
|
61
|
+
return {
|
|
62
|
+
filePath: require.resolve("@intlayer/config/client"),
|
|
63
|
+
type: "sourceFile"
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return (0, import_metro_resolver.resolve)(context, moduleName, platform);
|
|
67
|
+
},
|
|
68
|
+
blockList: (0, import_exclusionList.exclusionList)(watchedFilesPattern)
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return config;
|
|
72
|
+
};
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
configMetroIntlayer
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=configMetroIntlayer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/configMetroIntlayer.ts"],"sourcesContent":["import { getDefaultConfig } from 'expo/metro-config';\nimport { getConfiguration } from '@intlayer/config';\nimport { join } from 'path';\nimport { resolve } from 'metro-resolver';\nimport { exclusionList } from './exclusionList';\nimport { prepareIntlayer } from '@intlayer/chokidar';\n\ntype MetroConfig = ReturnType<typeof getDefaultConfig>;\n\nexport const configMetroIntlayer = async (\n baseConfig: MetroConfig\n): Promise<MetroConfig> => {\n const intlayerConfig = getConfiguration();\n\n await prepareIntlayer(intlayerConfig);\n\n const { mainDir, configDir, watchedFilesPattern } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.cjs');\n const configurationPath = join(configDir, 'configuration.json');\n\n const config = {\n ...baseConfig,\n\n resolver: {\n ...baseConfig.resolver,\n resolveRequest: (context, moduleName, platform) => {\n if (moduleName === '@intlayer/dictionaries-entry') {\n return {\n filePath: require.resolve(dictionariesPath),\n type: 'sourceFile',\n };\n } else if (moduleName === '@intlayer/config/built') {\n return {\n filePath: require.resolve(configurationPath),\n type: 'sourceFile',\n };\n } else if (moduleName === '@intlayer/config/client') {\n return {\n filePath: require.resolve('@intlayer/config/client'),\n type: 'sourceFile',\n };\n }\n\n // Prevent infinite recursion\n return resolve(context, moduleName, platform);\n },\n blockList: exclusionList(watchedFilesPattern),\n },\n } satisfies MetroConfig;\n\n return config;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAiC;AACjC,kBAAqB;AACrB,4BAAwB;AACxB,2BAA8B;AAC9B,sBAAgC;AAIzB,MAAM,sBAAsB,OACjC,eACyB;AACzB,QAAM,qBAAiB,gCAAiB;AAExC,YAAM,iCAAgB,cAAc;AAEpC,QAAM,EAAE,SAAS,WAAW,oBAAoB,IAAI,eAAe;AAEnE,QAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,QAAM,wBAAoB,kBAAK,WAAW,oBAAoB;AAE9D,QAAM,SAAS;AAAA,IACb,GAAG;AAAA,IAEH,UAAU;AAAA,MACR,GAAG,WAAW;AAAA,MACd,gBAAgB,CAAC,SAAS,YAAY,aAAa;AACjD,YAAI,eAAe,gCAAgC;AACjD,iBAAO;AAAA,YACL,UAAU,QAAQ,QAAQ,gBAAgB;AAAA,YAC1C,MAAM;AAAA,UACR;AAAA,QACF,WAAW,eAAe,0BAA0B;AAClD,iBAAO;AAAA,YACL,UAAU,QAAQ,QAAQ,iBAAiB;AAAA,YAC3C,MAAM;AAAA,UACR;AAAA,QACF,WAAW,eAAe,2BAA2B;AACnD,iBAAO;AAAA,YACL,UAAU,gBAAgB,yBAAyB;AAAA,YACnD,MAAM;AAAA,UACR;AAAA,QACF;AAGA,mBAAO,+BAAQ,SAAS,YAAY,QAAQ;AAAA,MAC9C;AAAA,MACA,eAAW,oCAAc,mBAAmB;AAAA,IAC9C;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
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 __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var exclusionList_exports = {};
|
|
30
|
+
__export(exclusionList_exports, {
|
|
31
|
+
exclusionList: () => exclusionList
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(exclusionList_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
const escapeRegExp = (pattern) => {
|
|
36
|
+
if (Object.prototype.toString.call(pattern) === "[object RegExp]") {
|
|
37
|
+
return pattern.source.replace(/\/|\\\//g, "\\" + import_path.default.sep);
|
|
38
|
+
} else if (typeof pattern === "string") {
|
|
39
|
+
var escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
40
|
+
return escaped.replaceAll("/", "\\" + import_path.default.sep);
|
|
41
|
+
} else {
|
|
42
|
+
throw new Error("Unexpected exclusion pattern: " + pattern);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const exclusionList = (additionalExclusions) => new RegExp(
|
|
46
|
+
"(" + (additionalExclusions || []).map(escapeRegExp).join("|") + ")$"
|
|
47
|
+
);
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
exclusionList
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=exclusionList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/exclusionList.ts"],"sourcesContent":["import path from '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(\n '(' + (additionalExclusions || []).map(escapeRegExp).join('|') + ')$'\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,MAAM,eAAe,CAAC,YAA6B;AACjD,MAAI,OAAO,UAAU,SAAS,KAAK,OAAO,MAAM,mBAAmB;AACjE,WAAQ,QAAmB,OAAO,QAAQ,YAAY,OAAO,YAAAA,QAAK,GAAG;AAAA,EACvE,WAAW,OAAO,YAAY,UAAU;AACtC,QAAI,UAAU,QAAQ,QAAQ,qCAAqC,MAAM;AACzE,WAAO,QAAQ,WAAW,KAAK,OAAO,YAAAA,QAAK,GAAG;AAAA,EAChD,OAAO;AACL,UAAM,IAAI,MAAM,mCAAmC,OAAO;AAAA,EAC5D;AACF;AAEO,MAAM,gBAAgB,CAAC,yBAC5B,IAAI;AAAA,EACF,OAAO,wBAAwB,CAAC,GAAG,IAAI,YAAY,EAAE,KAAK,GAAG,IAAI;AACnE;","names":["path"]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -15,9 +15,11 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var index_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(index_exports);
|
|
18
|
-
__reExport(index_exports, require('./
|
|
18
|
+
__reExport(index_exports, require('./configMetroIntlayer.cjs'), module.exports);
|
|
19
|
+
__reExport(index_exports, require('./intlayerPolyfill.cjs'), module.exports);
|
|
19
20
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20
21
|
0 && (module.exports = {
|
|
21
|
-
...require('./
|
|
22
|
+
...require('./configMetroIntlayer.cjs'),
|
|
23
|
+
...require('./intlayerPolyfill.cjs')
|
|
22
24
|
});
|
|
23
25
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './configMetroIntlayer';\nexport * from './intlayerPolyfill';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,kCAAd;AACA,0BAAc,+BADd;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var intlayerPolyfill_exports = {};
|
|
20
|
+
__export(intlayerPolyfill_exports, {
|
|
21
|
+
intlayerPolyfill: () => intlayerPolyfill
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(intlayerPolyfill_exports);
|
|
24
|
+
const intlayerPolyfill = () => {
|
|
25
|
+
if (typeof global.structuredClone !== "function") {
|
|
26
|
+
global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
27
|
+
window.addEventListener = () => null;
|
|
28
|
+
window.removeEventListener = () => null;
|
|
29
|
+
window.postMessage = () => null;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
intlayerPolyfill
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=intlayerPolyfill.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerPolyfill.ts"],"sourcesContent":["export const intlayerPolyfill = () => {\n if (typeof global.structuredClone !== 'function') {\n global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));\n window.addEventListener = () => null;\n window.removeEventListener = () => null;\n window.postMessage = () => null;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,mBAAmB,MAAM;AACpC,MAAI,OAAO,OAAO,oBAAoB,YAAY;AAChD,WAAO,kBAAkB,CAAC,QAAQ,KAAK,MAAM,KAAK,UAAU,GAAG,CAAC;AAChE,WAAO,mBAAmB,MAAM;AAChC,WAAO,sBAAsB,MAAM;AACnC,WAAO,cAAc,MAAM;AAAA,EAC7B;AACF;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getConfiguration } from "@intlayer/config";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { resolve } from "metro-resolver";
|
|
4
|
+
import { exclusionList } from "./exclusionList.mjs";
|
|
5
|
+
import { prepareIntlayer } from "@intlayer/chokidar";
|
|
6
|
+
const configMetroIntlayer = async (baseConfig) => {
|
|
7
|
+
const intlayerConfig = getConfiguration();
|
|
8
|
+
await prepareIntlayer(intlayerConfig);
|
|
9
|
+
const { mainDir, configDir, watchedFilesPattern } = intlayerConfig.content;
|
|
10
|
+
const dictionariesPath = join(mainDir, "dictionaries.cjs");
|
|
11
|
+
const configurationPath = join(configDir, "configuration.json");
|
|
12
|
+
const config = {
|
|
13
|
+
...baseConfig,
|
|
14
|
+
resolver: {
|
|
15
|
+
...baseConfig.resolver,
|
|
16
|
+
resolveRequest: (context, moduleName, platform) => {
|
|
17
|
+
if (moduleName === "@intlayer/dictionaries-entry") {
|
|
18
|
+
return {
|
|
19
|
+
filePath: require.resolve(dictionariesPath),
|
|
20
|
+
type: "sourceFile"
|
|
21
|
+
};
|
|
22
|
+
} else if (moduleName === "@intlayer/config/built") {
|
|
23
|
+
return {
|
|
24
|
+
filePath: require.resolve(configurationPath),
|
|
25
|
+
type: "sourceFile"
|
|
26
|
+
};
|
|
27
|
+
} else if (moduleName === "@intlayer/config/client") {
|
|
28
|
+
return {
|
|
29
|
+
filePath: require.resolve("@intlayer/config/client"),
|
|
30
|
+
type: "sourceFile"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return resolve(context, moduleName, platform);
|
|
34
|
+
},
|
|
35
|
+
blockList: exclusionList(watchedFilesPattern)
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return config;
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
configMetroIntlayer
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=configMetroIntlayer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/configMetroIntlayer.ts"],"sourcesContent":["import { getDefaultConfig } from 'expo/metro-config';\nimport { getConfiguration } from '@intlayer/config';\nimport { join } from 'path';\nimport { resolve } from 'metro-resolver';\nimport { exclusionList } from './exclusionList';\nimport { prepareIntlayer } from '@intlayer/chokidar';\n\ntype MetroConfig = ReturnType<typeof getDefaultConfig>;\n\nexport const configMetroIntlayer = async (\n baseConfig: MetroConfig\n): Promise<MetroConfig> => {\n const intlayerConfig = getConfiguration();\n\n await prepareIntlayer(intlayerConfig);\n\n const { mainDir, configDir, watchedFilesPattern } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.cjs');\n const configurationPath = join(configDir, 'configuration.json');\n\n const config = {\n ...baseConfig,\n\n resolver: {\n ...baseConfig.resolver,\n resolveRequest: (context, moduleName, platform) => {\n if (moduleName === '@intlayer/dictionaries-entry') {\n return {\n filePath: require.resolve(dictionariesPath),\n type: 'sourceFile',\n };\n } else if (moduleName === '@intlayer/config/built') {\n return {\n filePath: require.resolve(configurationPath),\n type: 'sourceFile',\n };\n } else if (moduleName === '@intlayer/config/client') {\n return {\n filePath: require.resolve('@intlayer/config/client'),\n type: 'sourceFile',\n };\n }\n\n // Prevent infinite recursion\n return resolve(context, moduleName, platform);\n },\n blockList: exclusionList(watchedFilesPattern),\n },\n } satisfies MetroConfig;\n\n return config;\n};\n"],"mappings":"AACA,SAAS,wBAAwB;AACjC,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAIzB,MAAM,sBAAsB,OACjC,eACyB;AACzB,QAAM,iBAAiB,iBAAiB;AAExC,QAAM,gBAAgB,cAAc;AAEpC,QAAM,EAAE,SAAS,WAAW,oBAAoB,IAAI,eAAe;AAEnE,QAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,QAAM,oBAAoB,KAAK,WAAW,oBAAoB;AAE9D,QAAM,SAAS;AAAA,IACb,GAAG;AAAA,IAEH,UAAU;AAAA,MACR,GAAG,WAAW;AAAA,MACd,gBAAgB,CAAC,SAAS,YAAY,aAAa;AACjD,YAAI,eAAe,gCAAgC;AACjD,iBAAO;AAAA,YACL,UAAU,QAAQ,QAAQ,gBAAgB;AAAA,YAC1C,MAAM;AAAA,UACR;AAAA,QACF,WAAW,eAAe,0BAA0B;AAClD,iBAAO;AAAA,YACL,UAAU,QAAQ,QAAQ,iBAAiB;AAAA,YAC3C,MAAM;AAAA,UACR;AAAA,QACF,WAAW,eAAe,2BAA2B;AACnD,iBAAO;AAAA,YACL,UAAU,gBAAgB,yBAAyB;AAAA,YACnD,MAAM;AAAA,UACR;AAAA,QACF;AAGA,eAAO,QAAQ,SAAS,YAAY,QAAQ;AAAA,MAC9C;AAAA,MACA,WAAW,cAAc,mBAAmB;AAAA,IAC9C;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
const escapeRegExp = (pattern) => {
|
|
3
|
+
if (Object.prototype.toString.call(pattern) === "[object RegExp]") {
|
|
4
|
+
return pattern.source.replace(/\/|\\\//g, "\\" + path.sep);
|
|
5
|
+
} else if (typeof pattern === "string") {
|
|
6
|
+
var escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
7
|
+
return escaped.replaceAll("/", "\\" + path.sep);
|
|
8
|
+
} else {
|
|
9
|
+
throw new Error("Unexpected exclusion pattern: " + pattern);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const exclusionList = (additionalExclusions) => new RegExp(
|
|
13
|
+
"(" + (additionalExclusions || []).map(escapeRegExp).join("|") + ")$"
|
|
14
|
+
);
|
|
15
|
+
export {
|
|
16
|
+
exclusionList
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=exclusionList.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/exclusionList.ts"],"sourcesContent":["import path from '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(\n '(' + (additionalExclusions || []).map(escapeRegExp).join('|') + ')$'\n );\n"],"mappings":"AAAA,OAAO,UAAU;AAEjB,MAAM,eAAe,CAAC,YAA6B;AACjD,MAAI,OAAO,UAAU,SAAS,KAAK,OAAO,MAAM,mBAAmB;AACjE,WAAQ,QAAmB,OAAO,QAAQ,YAAY,OAAO,KAAK,GAAG;AAAA,EACvE,WAAW,OAAO,YAAY,UAAU;AACtC,QAAI,UAAU,QAAQ,QAAQ,qCAAqC,MAAM;AACzE,WAAO,QAAQ,WAAW,KAAK,OAAO,KAAK,GAAG;AAAA,EAChD,OAAO;AACL,UAAM,IAAI,MAAM,mCAAmC,OAAO;AAAA,EAC5D;AACF;AAEO,MAAM,gBAAgB,CAAC,yBAC5B,IAAI;AAAA,EACF,OAAO,wBAAwB,CAAC,GAAG,IAAI,YAAY,EAAE,KAAK,GAAG,IAAI;AACnE;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './configMetroIntlayer';\nexport * from './intlayerPolyfill';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const intlayerPolyfill = () => {
|
|
2
|
+
if (typeof global.structuredClone !== "function") {
|
|
3
|
+
global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
4
|
+
window.addEventListener = () => null;
|
|
5
|
+
window.removeEventListener = () => null;
|
|
6
|
+
window.postMessage = () => null;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
intlayerPolyfill
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=intlayerPolyfill.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerPolyfill.ts"],"sourcesContent":["export const intlayerPolyfill = () => {\n if (typeof global.structuredClone !== 'function') {\n global.structuredClone = (obj) => JSON.parse(JSON.stringify(obj));\n window.addEventListener = () => null;\n window.removeEventListener = () => null;\n window.postMessage = () => null;\n }\n};\n"],"mappings":"AAAO,MAAM,mBAAmB,MAAM;AACpC,MAAI,OAAO,OAAO,oBAAoB,YAAY;AAChD,WAAO,kBAAkB,CAAC,QAAQ,KAAK,MAAM,KAAK,UAAU,GAAG,CAAC;AAChE,WAAO,mBAAmB,MAAM;AAChC,WAAO,sBAAsB,MAAM;AACnC,WAAO,cAAc,MAAM;AAAA,EAC7B;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configMetroIntlayer.d.ts","sourceRoot":"","sources":["../../src/configMetroIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAOrD,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEvD,eAAO,MAAM,mBAAmB,GAC9B,YAAY,WAAW,KACtB,OAAO,CAAC,WAAW,CAyCrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclusionList.d.ts","sourceRoot":"","sources":["../../src/exclusionList.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa,GAAI,uBAAuB,MAAM,EAAE,GAAG,MAAM,EAAE,WAGrE,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intlayerPolyfill.d.ts","sourceRoot":"","sources":["../../src/intlayerPolyfill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAO5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-intlayer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.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": [
|
|
@@ -57,30 +57,34 @@
|
|
|
57
57
|
"./package.json"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@intlayer/
|
|
61
|
-
"@intlayer/
|
|
62
|
-
"@intlayer/core": "5.
|
|
60
|
+
"@intlayer/chokidar": "5.2.0",
|
|
61
|
+
"@intlayer/config": "5.2.0",
|
|
62
|
+
"@intlayer/core": "5.2.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/node": "^22.10.6",
|
|
66
66
|
"@typescript-eslint/parser": "^8.24.0",
|
|
67
67
|
"concurrently": "^9.1.2",
|
|
68
68
|
"eslint": "^9.20.0",
|
|
69
|
+
"expo": "^52.0.37",
|
|
70
|
+
"metro-resolver": "^0.82.0",
|
|
69
71
|
"prettier": "^3.5.0",
|
|
70
72
|
"rimraf": "^6.0.1",
|
|
71
73
|
"tsc-alias": "^1.8.10",
|
|
72
74
|
"tsup": "^8.3.5",
|
|
73
75
|
"typescript": "^5.7.3",
|
|
74
|
-
"@utils/
|
|
75
|
-
"@utils/ts-config": "1.0.4",
|
|
76
|
+
"@utils/eslint-config": "1.0.4",
|
|
76
77
|
"@utils/ts-config-types": "1.0.4",
|
|
77
|
-
"@utils/
|
|
78
|
+
"@utils/ts-config": "1.0.4",
|
|
79
|
+
"@utils/tsup-config": "1.0.4"
|
|
78
80
|
},
|
|
79
81
|
"peerDependencies": {
|
|
82
|
+
"expo": "^52.0.37",
|
|
83
|
+
"metro-resolver": "^0.82.0",
|
|
80
84
|
"vite": ">=4.0.0",
|
|
81
|
-
"@intlayer/chokidar": "5.
|
|
82
|
-
"@intlayer/config": "5.
|
|
83
|
-
"@intlayer/core": "5.
|
|
85
|
+
"@intlayer/chokidar": "5.2.0",
|
|
86
|
+
"@intlayer/config": "5.2.0",
|
|
87
|
+
"@intlayer/core": "5.2.0"
|
|
84
88
|
},
|
|
85
89
|
"engines": {
|
|
86
90
|
"node": ">=14.18"
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var intlayerPlugin_exports = {};
|
|
20
|
-
__export(intlayerPlugin_exports, {
|
|
21
|
-
IntlayerMetroPlugin: () => IntlayerMetroPlugin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(intlayerPlugin_exports);
|
|
24
|
-
var import_chokidar = require("@intlayer/chokidar");
|
|
25
|
-
var import_config = require("@intlayer/config");
|
|
26
|
-
class IntlayerMetroPlugin {
|
|
27
|
-
configuration = (0, import_config.getConfiguration)();
|
|
28
|
-
eventListener;
|
|
29
|
-
async run() {
|
|
30
|
-
if (this.configuration.content.watch) {
|
|
31
|
-
(0, import_chokidar.watch)(this.configuration);
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
await (0, import_chokidar.prepareIntlayer)(this.configuration);
|
|
35
|
-
if (this.configuration.editor.hotReload) {
|
|
36
|
-
this.eventListener = await (0, import_chokidar.checkDictionaryChanges)();
|
|
37
|
-
}
|
|
38
|
-
} catch (error) {
|
|
39
|
-
(0, import_config.logger)(`Error in IntlayerMetroPlugin: ${error}`, { level: "error" });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
IntlayerMetroPlugin
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=intlayerPlugin.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import {\n checkDictionaryChanges,\n prepareIntlayer,\n watch,\n} from '@intlayer/chokidar';\nimport { getConfiguration, logger } from '@intlayer/config';\nimport type { IntlayerEventListener } from '@intlayer/api';\n\nexport class IntlayerMetroPlugin {\n private configuration = getConfiguration();\n private eventListener: IntlayerEventListener | undefined;\n\n async run(): Promise<void> {\n if (this.configuration.content.watch) {\n watch(this.configuration);\n }\n\n try {\n await prepareIntlayer(this.configuration);\n if (this.configuration.editor.hotReload) {\n this.eventListener = await checkDictionaryChanges();\n }\n } catch (error) {\n logger(`Error in IntlayerMetroPlugin: ${error}`, { level: 'error' });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAIO;AACP,oBAAyC;AAGlC,MAAM,oBAAoB;AAAA,EACvB,oBAAgB,gCAAiB;AAAA,EACjC;AAAA,EAER,MAAM,MAAqB;AACzB,QAAI,KAAK,cAAc,QAAQ,OAAO;AACpC,iCAAM,KAAK,aAAa;AAAA,IAC1B;AAEA,QAAI;AACF,gBAAM,iCAAgB,KAAK,aAAa;AACxC,UAAI,KAAK,cAAc,OAAO,WAAW;AACvC,aAAK,gBAAgB,UAAM,wCAAuB;AAAA,MACpD;AAAA,IACF,SAAS,OAAO;AACd,gCAAO,iCAAiC,KAAK,IAAI,EAAE,OAAO,QAAQ,CAAC;AAAA,IACrE;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
checkDictionaryChanges,
|
|
3
|
-
prepareIntlayer,
|
|
4
|
-
watch
|
|
5
|
-
} from "@intlayer/chokidar";
|
|
6
|
-
import { getConfiguration, logger } from "@intlayer/config";
|
|
7
|
-
class IntlayerMetroPlugin {
|
|
8
|
-
configuration = getConfiguration();
|
|
9
|
-
eventListener;
|
|
10
|
-
async run() {
|
|
11
|
-
if (this.configuration.content.watch) {
|
|
12
|
-
watch(this.configuration);
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
await prepareIntlayer(this.configuration);
|
|
16
|
-
if (this.configuration.editor.hotReload) {
|
|
17
|
-
this.eventListener = await checkDictionaryChanges();
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
logger(`Error in IntlayerMetroPlugin: ${error}`, { level: "error" });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
IntlayerMetroPlugin
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=intlayerPlugin.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import {\n checkDictionaryChanges,\n prepareIntlayer,\n watch,\n} from '@intlayer/chokidar';\nimport { getConfiguration, logger } from '@intlayer/config';\nimport type { IntlayerEventListener } from '@intlayer/api';\n\nexport class IntlayerMetroPlugin {\n private configuration = getConfiguration();\n private eventListener: IntlayerEventListener | undefined;\n\n async run(): Promise<void> {\n if (this.configuration.content.watch) {\n watch(this.configuration);\n }\n\n try {\n await prepareIntlayer(this.configuration);\n if (this.configuration.editor.hotReload) {\n this.eventListener = await checkDictionaryChanges();\n }\n } catch (error) {\n logger(`Error in IntlayerMetroPlugin: ${error}`, { level: 'error' });\n }\n }\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB,cAAc;AAGlC,MAAM,oBAAoB;AAAA,EACvB,gBAAgB,iBAAiB;AAAA,EACjC;AAAA,EAER,MAAM,MAAqB;AACzB,QAAI,KAAK,cAAc,QAAQ,OAAO;AACpC,YAAM,KAAK,aAAa;AAAA,IAC1B;AAEA,QAAI;AACF,YAAM,gBAAgB,KAAK,aAAa;AACxC,UAAI,KAAK,cAAc,OAAO,WAAW;AACvC,aAAK,gBAAgB,MAAM,uBAAuB;AAAA,MACpD;AAAA,IACF,SAAS,OAAO;AACd,aAAO,iCAAiC,KAAK,IAAI,EAAE,OAAO,QAAQ,CAAC;AAAA,IACrE;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerMiddlewarePlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerMiddlewarePlugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAW,MAAM,EAAE,MAAM,MAAM,CAAC;AA0B5C;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAO,MAiD3C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerPlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerPlugin.ts"],"names":[],"mappings":"AAQA,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,aAAa,CAAoC;IAEnD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAc3B"}
|