lynx-intlayer 8.5.2 → 8.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,12 @@
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");
3
4
  let _intlayer_chokidar_watcher = require("@intlayer/chokidar/watcher");
5
+ let _intlayer_config_colors = require("@intlayer/config/colors");
6
+ let _intlayer_config_logger = require("@intlayer/config/logger");
4
7
  let _intlayer_config_node = require("@intlayer/config/node");
5
8
  let _intlayer_config_utils = require("@intlayer/config/utils");
9
+ let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
6
10
 
7
11
  //#region src/plugin/pluginIntlayerLynx.ts
8
12
  /**
@@ -32,9 +36,20 @@ const pluginIntlayerLynx = () => {
32
36
  const configuration = (0, _intlayer_config_node.getConfiguration)();
33
37
  await (0, _intlayer_chokidar_build.prepareIntlayer)(configuration);
34
38
  if (configuration.content.watch) (0, _intlayer_chokidar_watcher.watch)({ configuration });
39
+ const isBuild = api.context.action === "build";
40
+ let defineVars = {};
41
+ if (isBuild) {
42
+ const appLogger = (0, _intlayer_config_logger.getAppLogger)(configuration);
43
+ const unusedNodeTypes = await (0, _intlayer_chokidar_utils.getUnusedNodeTypesAsync)((0, _intlayer_dictionaries_entry.getDictionaries)(configuration));
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, _intlayer_chokidar_utils.formatNodeTypeToEnvVar)(unusedNodeTypes, true);
46
+ }
35
47
  api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {
36
48
  return mergeRsbuildConfig(config, {
37
- source: { define: { "process.env.INTLAYER_EDITOR_ENABLED": JSON.stringify(configuration.editor?.enabled === false ? "false" : "true") } },
49
+ source: { define: {
50
+ "process.env.INTLAYER_EDITOR_ENABLED": JSON.stringify(configuration.editor?.enabled === false ? "false" : "true"),
51
+ ...defineVars
52
+ } },
38
53
  resolve: { alias: {
39
54
  ...(0, _intlayer_config_utils.getAlias)({ configuration }),
40
55
  react: (0, _intlayer_config_utils.getProjectRequire)().resolve("@lynx-js/react")
@@ -1 +1 @@
1
- {"version":3,"file":"pluginIntlayerLynx.cjs","names":[],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias, getProjectRequire } from '@intlayer/config/utils';\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 // Merge Intlayer-specific environment variables and alias configuration.\n api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {\n return mergeRsbuildConfig(config, {\n source: {\n define: {\n 'process.env.INTLAYER_EDITOR_ENABLED': JSON.stringify(\n configuration.editor?.enabled === false ? 'false' : 'true'\n ),\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,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;AAI1B,OAAI,oBAAoB,OAAO,QAAQ,EAAE,yBAAyB;AAChE,WAAO,mBAAmB,QAAQ;KAChC,QAAQ,EACN,QAAQ,EACN,uCAAuC,KAAK,UAC1C,cAAc,QAAQ,YAAY,QAAQ,UAAU,OACrD,EACF,EACF;KACD,SAAS,EACP,OAAO;MACL,wCAAY,EAAE,eAAe,CAAC;MAC9B,sDAA0B,CAAC,QAAQ,iBAAiB;MACrD,EACF;KACF,CAAC;KACF;;EAEL"}
1
+ {"version":3,"file":"pluginIntlayerLynx.cjs","names":["BLUE"],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport {\n formatNodeTypeToEnvVar,\n getUnusedNodeTypesAsync,\n} from '@intlayer/chokidar/utils';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { BLUE } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias, getProjectRequire } 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 'process.env.INTLAYER_EDITOR_ENABLED': JSON.stringify(\n configuration.editor?.enabled === false ? 'false' : 'true'\n ),\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,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,8GADa,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,uCAAuC,KAAK,UAC1C,cAAc,QAAQ,YAAY,QAAQ,UAAU,OACrD;MACD,GAAG;MACJ,EACF;KACD,SAAS,EACP,OAAO;MACL,wCAAY,EAAE,eAAe,CAAC;MAC9B,sDAA0B,CAAC,QAAQ,iBAAiB;MACrD,EACF;KACF,CAAC;KACF;;EAEL"}
@@ -1,7 +1,11 @@
1
1
  import { prepareIntlayer } from "@intlayer/chokidar/build";
2
+ import { formatNodeTypeToEnvVar, getUnusedNodeTypesAsync } from "@intlayer/chokidar/utils";
2
3
  import { watch } from "@intlayer/chokidar/watcher";
4
+ import { BLUE } from "@intlayer/config/colors";
5
+ import { colorize, getAppLogger } from "@intlayer/config/logger";
3
6
  import { getConfiguration } from "@intlayer/config/node";
4
7
  import { getAlias, getProjectRequire } from "@intlayer/config/utils";
8
+ import { getDictionaries } from "@intlayer/dictionaries-entry";
5
9
 
6
10
  //#region src/plugin/pluginIntlayerLynx.ts
7
11
  /**
@@ -31,9 +35,20 @@ const pluginIntlayerLynx = () => {
31
35
  const configuration = getConfiguration();
32
36
  await prepareIntlayer(configuration);
33
37
  if (configuration.content.watch) watch({ configuration });
38
+ const isBuild = api.context.action === "build";
39
+ let defineVars = {};
40
+ if (isBuild) {
41
+ const appLogger = getAppLogger(configuration);
42
+ const unusedNodeTypes = await getUnusedNodeTypesAsync(getDictionaries(configuration));
43
+ if (unusedNodeTypes.length > 0) appLogger(["Filtering out unused plugins:", unusedNodeTypes.map((key) => colorize(key, BLUE)).join(", ")], { isVerbose: true });
44
+ defineVars = formatNodeTypeToEnvVar(unusedNodeTypes, true);
45
+ }
34
46
  api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {
35
47
  return mergeRsbuildConfig(config, {
36
- source: { define: { "process.env.INTLAYER_EDITOR_ENABLED": JSON.stringify(configuration.editor?.enabled === false ? "false" : "true") } },
48
+ source: { define: {
49
+ "process.env.INTLAYER_EDITOR_ENABLED": JSON.stringify(configuration.editor?.enabled === false ? "false" : "true"),
50
+ ...defineVars
51
+ } },
37
52
  resolve: { alias: {
38
53
  ...getAlias({ configuration }),
39
54
  react: getProjectRequire().resolve("@lynx-js/react")
@@ -1 +1 @@
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 { getConfiguration } from '@intlayer/config/node';\nimport { getAlias, getProjectRequire } from '@intlayer/config/utils';\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 // Merge Intlayer-specific environment variables and alias configuration.\n api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => {\n return mergeRsbuildConfig(config, {\n source: {\n define: {\n 'process.env.INTLAYER_EDITOR_ENABLED': JSON.stringify(\n configuration.editor?.enabled === false ? 'false' : 'true'\n ),\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,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;AAI1B,OAAI,oBAAoB,OAAO,QAAQ,EAAE,yBAAyB;AAChE,WAAO,mBAAmB,QAAQ;KAChC,QAAQ,EACN,QAAQ,EACN,uCAAuC,KAAK,UAC1C,cAAc,QAAQ,YAAY,QAAQ,UAAU,OACrD,EACF,EACF;KACD,SAAS,EACP,OAAO;MACL,GAAG,SAAS,EAAE,eAAe,CAAC;MAC9B,OAAO,mBAAmB,CAAC,QAAQ,iBAAiB;MACrD,EACF;KACF,CAAC;KACF;;EAEL"}
1
+ {"version":3,"file":"pluginIntlayerLynx.mjs","names":[],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport {\n formatNodeTypeToEnvVar,\n getUnusedNodeTypesAsync,\n} from '@intlayer/chokidar/utils';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { BLUE } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias, getProjectRequire } 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 'process.env.INTLAYER_EDITOR_ENABLED': JSON.stringify(\n configuration.editor?.enabled === false ? 'false' : 'true'\n ),\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,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,uCAAuC,KAAK,UAC1C,cAAc,QAAQ,YAAY,QAAQ,UAAU,OACrD;MACD,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":";;;;;AA0BA;;;;;;;;;;;;;;;;;;cAAa,kBAAA,QAAyB,aAAA"}
1
+ {"version":3,"file":"pluginIntlayerLynx.d.ts","names":[],"sources":["../../../src/plugin/pluginIntlayerLynx.ts"],"mappings":";;;;;AAiCA;;;;;;;;;;;;;;;;;;cAAa,kBAAA,QAAyB,aAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lynx-intlayer",
3
- "version": "8.5.2",
3
+ "version": "8.6.1",
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,10 +86,11 @@
86
86
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
87
87
  },
88
88
  "dependencies": {
89
- "@intlayer/chokidar": "8.5.2",
90
- "@intlayer/config": "8.5.2",
91
- "@intlayer/core": "8.5.2",
92
- "@intlayer/types": "8.5.2"
89
+ "@intlayer/chokidar": "8.6.1",
90
+ "@intlayer/config": "8.6.1",
91
+ "@intlayer/core": "8.6.1",
92
+ "@intlayer/dictionaries-entry": "8.6.1",
93
+ "@intlayer/types": "8.6.1"
93
94
  },
94
95
  "devDependencies": {
95
96
  "@rsbuild/core": "1.6.15",
@@ -100,9 +101,9 @@
100
101
  "expo": "54.0.30",
101
102
  "metro-resolver": "0.83.3",
102
103
  "rimraf": "6.1.3",
103
- "tsdown": "0.21.4",
104
+ "tsdown": "0.21.7",
104
105
  "typescript": "6.0.2",
105
- "vitest": "4.1.1"
106
+ "vitest": "4.1.2"
106
107
  },
107
108
  "peerDependencies": {
108
109
  "@lynx-js/rspeedy": ">=0.5.0",