lynx-intlayer 8.6.1 → 8.6.2
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/plugin/pluginIntlayerLynx.cjs +4 -4
- package/dist/cjs/plugin/pluginIntlayerLynx.cjs.map +1 -1
- package/dist/esm/plugin/pluginIntlayerLynx.mjs +3 -3
- package/dist/esm/plugin/pluginIntlayerLynx.mjs.map +1 -1
- package/dist/types/plugin/pluginIntlayerLynx.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
|
|
3
|
-
let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
|
|
4
3
|
let _intlayer_chokidar_watcher = require("@intlayer/chokidar/watcher");
|
|
5
4
|
let _intlayer_config_colors = require("@intlayer/config/colors");
|
|
5
|
+
let _intlayer_config_envVars = require("@intlayer/config/envVars");
|
|
6
6
|
let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
7
7
|
let _intlayer_config_node = require("@intlayer/config/node");
|
|
8
8
|
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
@@ -40,14 +40,14 @@ const pluginIntlayerLynx = () => {
|
|
|
40
40
|
let defineVars = {};
|
|
41
41
|
if (isBuild) {
|
|
42
42
|
const appLogger = (0, _intlayer_config_logger.getAppLogger)(configuration);
|
|
43
|
-
const unusedNodeTypes = await (0,
|
|
43
|
+
const unusedNodeTypes = await (0, _intlayer_config_utils.getUnusedNodeTypesAsync)((0, _intlayer_dictionaries_entry.getDictionaries)(configuration));
|
|
44
44
|
if (unusedNodeTypes.length > 0) appLogger(["Filtering out unused plugins:", unusedNodeTypes.map((key) => (0, _intlayer_config_logger.colorize)(key, _intlayer_config_colors.BLUE)).join(", ")], { isVerbose: true });
|
|
45
|
-
defineVars = (0,
|
|
45
|
+
defineVars = (0, _intlayer_config_envVars.formatNodeTypeToEnvVar)(unusedNodeTypes, true);
|
|
46
46
|
}
|
|
47
47
|
api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {
|
|
48
48
|
return mergeRsbuildConfig(config, {
|
|
49
49
|
source: { define: {
|
|
50
|
-
|
|
50
|
+
...(0, _intlayer_config_envVars.getConfigEnvVars)(configuration, true),
|
|
51
51
|
...defineVars
|
|
52
52
|
} },
|
|
53
53
|
resolve: { alias: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginIntlayerLynx.cjs","names":["BLUE"],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport {
|
|
1
|
+
{"version":3,"file":"pluginIntlayerLynx.cjs","names":["BLUE"],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { BLUE } from '@intlayer/config/colors';\nimport {\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n getAlias,\n getProjectRequire,\n getUnusedNodeTypesAsync,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { RsbuildPlugin } from '@rsbuild/core';\n\n/**\n * A Lynx plugin to integrate Intlayer into the Lynx build process.\n *\n * - Loads the Intlayer configuration and injects environment variables.\n * - If enabled, starts a file watcher for dictionary changes.\n * - On build, prepares the Intlayer configuration.\n * - Optionally checks for dictionary changes before compiling (hot reload).\n *\n * Usage in your lynx.config.ts:\n *\n * import { defineConfig } from '@lynx-js/rspeedy'\n * import { pluginIntlayerLynx } from '@intlayer/lynx-plugin'\n *\n * export default defineConfig({\n * plugins: [\n * pluginIntlayerLynx(),\n * ],\n * // ...other configuration\n * })\n */\nexport const pluginIntlayerLynx = (): RsbuildPlugin => {\n return {\n name: 'plugin-intlayer-lynx',\n\n async setup(api) {\n // Load the Intlayer configuration and format env variables for Lynx.\n const configuration = getConfiguration();\n\n await prepareIntlayer(configuration);\n\n // If file watching is enabled in Intlayer's config, start it.\n if (configuration.content.watch) {\n watch({ configuration });\n }\n\n const isBuild = api.context.action === 'build';\n\n let defineVars = {};\n\n if (isBuild) {\n const appLogger = getAppLogger(configuration);\n\n const dictionaries = getDictionaries(configuration);\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n if (unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out unused plugins:',\n unusedNodeTypes.map((key) => colorize(key, BLUE)).join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n defineVars = formatNodeTypeToEnvVar(unusedNodeTypes, true);\n }\n\n // Merge Intlayer-specific environment variables and alias configuration.\n api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {\n return mergeRsbuildConfig(config, {\n source: {\n define: {\n ...getConfigEnvVars(configuration, true),\n ...defineVars,\n },\n },\n resolve: {\n alias: {\n ...getAlias({ configuration }),\n react: getProjectRequire().resolve('@lynx-js/react'),\n },\n },\n });\n });\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,2BAA0C;AACrD,QAAO;EACL,MAAM;EAEN,MAAM,MAAM,KAAK;GAEf,MAAM,6DAAkC;AAExC,uDAAsB,cAAc;AAGpC,OAAI,cAAc,QAAQ,MACxB,uCAAM,EAAE,eAAe,CAAC;GAG1B,MAAM,UAAU,IAAI,QAAQ,WAAW;GAEvC,IAAI,aAAa,EAAE;AAEnB,OAAI,SAAS;IACX,MAAM,sDAAyB,cAAc;IAG7C,MAAM,kBAAkB,4GADa,cAAc,CACgB;AAEnE,QAAI,gBAAgB,SAAS,EAC3B,WACE,CACE,iCACA,gBAAgB,KAAK,8CAAiB,KAAKA,6BAAK,CAAC,CAAC,KAAK,KAAK,CAC7D,EACD,EACE,WAAW,MACZ,CACF;AAGH,sEAAoC,iBAAiB,KAAK;;AAI5D,OAAI,oBAAoB,OAAO,QAAQ,EAAE,yBAAyB;AAChE,WAAO,mBAAmB,QAAQ;KAChC,QAAQ,EACN,QAAQ;MACN,kDAAoB,eAAe,KAAK;MACxC,GAAG;MACJ,EACF;KACD,SAAS,EACP,OAAO;MACL,wCAAY,EAAE,eAAe,CAAC;MAC9B,sDAA0B,CAAC,QAAQ,iBAAiB;MACrD,EACF;KACF,CAAC;KACF;;EAEL"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { prepareIntlayer } from "@intlayer/chokidar/build";
|
|
2
|
-
import { formatNodeTypeToEnvVar, getUnusedNodeTypesAsync } from "@intlayer/chokidar/utils";
|
|
3
2
|
import { watch } from "@intlayer/chokidar/watcher";
|
|
4
3
|
import { BLUE } from "@intlayer/config/colors";
|
|
4
|
+
import { formatNodeTypeToEnvVar, getConfigEnvVars } from "@intlayer/config/envVars";
|
|
5
5
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
6
6
|
import { getConfiguration } from "@intlayer/config/node";
|
|
7
|
-
import { getAlias, getProjectRequire } from "@intlayer/config/utils";
|
|
7
|
+
import { getAlias, getProjectRequire, getUnusedNodeTypesAsync } from "@intlayer/config/utils";
|
|
8
8
|
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
9
9
|
|
|
10
10
|
//#region src/plugin/pluginIntlayerLynx.ts
|
|
@@ -46,7 +46,7 @@ const pluginIntlayerLynx = () => {
|
|
|
46
46
|
api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {
|
|
47
47
|
return mergeRsbuildConfig(config, {
|
|
48
48
|
source: { define: {
|
|
49
|
-
|
|
49
|
+
...getConfigEnvVars(configuration, true),
|
|
50
50
|
...defineVars
|
|
51
51
|
} },
|
|
52
52
|
resolve: { alias: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginIntlayerLynx.mjs","names":[],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport {
|
|
1
|
+
{"version":3,"file":"pluginIntlayerLynx.mjs","names":[],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { BLUE } from '@intlayer/config/colors';\nimport {\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n getAlias,\n getProjectRequire,\n getUnusedNodeTypesAsync,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { RsbuildPlugin } from '@rsbuild/core';\n\n/**\n * A Lynx plugin to integrate Intlayer into the Lynx build process.\n *\n * - Loads the Intlayer configuration and injects environment variables.\n * - If enabled, starts a file watcher for dictionary changes.\n * - On build, prepares the Intlayer configuration.\n * - Optionally checks for dictionary changes before compiling (hot reload).\n *\n * Usage in your lynx.config.ts:\n *\n * import { defineConfig } from '@lynx-js/rspeedy'\n * import { pluginIntlayerLynx } from '@intlayer/lynx-plugin'\n *\n * export default defineConfig({\n * plugins: [\n * pluginIntlayerLynx(),\n * ],\n * // ...other configuration\n * })\n */\nexport const pluginIntlayerLynx = (): RsbuildPlugin => {\n return {\n name: 'plugin-intlayer-lynx',\n\n async setup(api) {\n // Load the Intlayer configuration and format env variables for Lynx.\n const configuration = getConfiguration();\n\n await prepareIntlayer(configuration);\n\n // If file watching is enabled in Intlayer's config, start it.\n if (configuration.content.watch) {\n watch({ configuration });\n }\n\n const isBuild = api.context.action === 'build';\n\n let defineVars = {};\n\n if (isBuild) {\n const appLogger = getAppLogger(configuration);\n\n const dictionaries = getDictionaries(configuration);\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n if (unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out unused plugins:',\n unusedNodeTypes.map((key) => colorize(key, BLUE)).join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n defineVars = formatNodeTypeToEnvVar(unusedNodeTypes, true);\n }\n\n // Merge Intlayer-specific environment variables and alias configuration.\n api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {\n return mergeRsbuildConfig(config, {\n source: {\n define: {\n ...getConfigEnvVars(configuration, true),\n ...defineVars,\n },\n },\n resolve: {\n alias: {\n ...getAlias({ configuration }),\n react: getProjectRequire().resolve('@lynx-js/react'),\n },\n },\n });\n });\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,2BAA0C;AACrD,QAAO;EACL,MAAM;EAEN,MAAM,MAAM,KAAK;GAEf,MAAM,gBAAgB,kBAAkB;AAExC,SAAM,gBAAgB,cAAc;AAGpC,OAAI,cAAc,QAAQ,MACxB,OAAM,EAAE,eAAe,CAAC;GAG1B,MAAM,UAAU,IAAI,QAAQ,WAAW;GAEvC,IAAI,aAAa,EAAE;AAEnB,OAAI,SAAS;IACX,MAAM,YAAY,aAAa,cAAc;IAG7C,MAAM,kBAAkB,MAAM,wBADT,gBAAgB,cAAc,CACgB;AAEnE,QAAI,gBAAgB,SAAS,EAC3B,WACE,CACE,iCACA,gBAAgB,KAAK,QAAQ,SAAS,KAAK,KAAK,CAAC,CAAC,KAAK,KAAK,CAC7D,EACD,EACE,WAAW,MACZ,CACF;AAGH,iBAAa,uBAAuB,iBAAiB,KAAK;;AAI5D,OAAI,oBAAoB,OAAO,QAAQ,EAAE,yBAAyB;AAChE,WAAO,mBAAmB,QAAQ;KAChC,QAAQ,EACN,QAAQ;MACN,GAAG,iBAAiB,eAAe,KAAK;MACxC,GAAG;MACJ,EACF;KACD,SAAS,EACP,OAAO;MACL,GAAG,SAAS,EAAE,eAAe,CAAC;MAC9B,OAAO,mBAAmB,CAAC,QAAQ,iBAAiB;MACrD,EACF;KACF,CAAC;KACF;;EAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginIntlayerLynx.d.ts","names":[],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"pluginIntlayerLynx.d.ts","names":[],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"mappings":";;;;;AAqCA;;;;;;;;;;;;;;;;;;cAAa,kBAAA,QAAyB,aAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lynx-intlayer",
|
|
3
|
-
"version": "8.6.
|
|
3
|
+
"version": "8.6.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Lynx plugin for seamless internationalization (i18n) and localization (l10n) of your mobile app.",
|
|
6
6
|
"keywords": [
|
|
@@ -86,11 +86,11 @@
|
|
|
86
86
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@intlayer/chokidar": "8.6.
|
|
90
|
-
"@intlayer/config": "8.6.
|
|
91
|
-
"@intlayer/core": "8.6.
|
|
92
|
-
"@intlayer/dictionaries-entry": "8.6.
|
|
93
|
-
"@intlayer/types": "8.6.
|
|
89
|
+
"@intlayer/chokidar": "8.6.2",
|
|
90
|
+
"@intlayer/config": "8.6.2",
|
|
91
|
+
"@intlayer/core": "8.6.2",
|
|
92
|
+
"@intlayer/dictionaries-entry": "8.6.2",
|
|
93
|
+
"@intlayer/types": "8.6.2"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@rsbuild/core": "1.6.15",
|