vite-intlayer 4.0.2 → 4.0.3
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/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</a>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
# vite-intlayer:
|
|
20
|
+
# vite-intlayer: Internationalize (i18n) an Vite application
|
|
21
21
|
|
|
22
22
|
**Intlayer** is a suite of packages designed specifically for JavaScript developers. It is compatible with frameworks like React, React, and Express.js.
|
|
23
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport process from 'process';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\n/**\n *\n * A Vite plugin that integrates
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport process from 'process';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\n/**\n *\n * A Vite plugin that integrates Intlayer configuration into the build process\n *\n * ```ts\n * // Example usage of the plugin in a Vite configuration\n * export default defineConfig({\n * plugins: [ intlayerPlugin() ],\n * });\n * ```\n * */\nexport const intlayerPlugin = (_pluginOptions: PluginOptions = {}): Plugin => ({\n name: 'vite-intlayer-plugin',\n\n config: (config, { mode }) => {\n const intlayerConfig = getConfiguration();\n const { mainDir, baseDir, watch: isWatchMode } = intlayerConfig.content;\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = {\n ...process.env,\n ...loadEnv(mode, process.cwd()),\n ...env,\n };\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n // Update Vite's resolve alias\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve?.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n };\n\n if (isWatchMode) {\n // Ajout de l'option optimizeDeps.exclude\n config.optimizeDeps = {\n ...config.optimizeDeps,\n exclude: [\n ...(config.optimizeDeps?.exclude || []),\n '@intlayer/dictionaries-entry',\n ],\n };\n }\n\n const externals: string[] = (config.build?.rollupOptions?.external ??\n []) as string[];\n\n config.build = {\n ...config.build,\n rollupOptions: {\n ...config.build?.rollupOptions,\n external: [...externals, 'module'],\n },\n };\n\n return config;\n },\n\n buildStart: () => {\n // Code to run when Vite build starts\n watch();\n },\n configureServer: () => {\n // Custom server configuration, if needed\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwC;AACxC,qBAAoB;AACpB,sBAAsB;AACtB,oBAAoD;AAEpD,kBAAqC;AAkB9B,MAAM,iBAAiB,CAAC,iBAAgC,CAAC,OAAe;AAAA,EAC7E,MAAM;AAAA,EAEN,QAAQ,CAAC,QAAQ,EAAE,KAAK,MAAM;AAC5B,UAAM,qBAAiB,gCAAiB;AACxC,UAAM,EAAE,SAAS,SAAS,OAAO,YAAY,IAAI,eAAe;AAGhE,UAAM,UAAM,iCAAkB,MAAM;AAEpC,mBAAAA,QAAQ,MAAM;AAAA,MACZ,GAAG,eAAAA,QAAQ;AAAA,MACX,OAAG,qBAAQ,MAAM,eAAAA,QAAQ,IAAI,CAAC;AAAA,MAC9B,GAAG;AAAA,IACL;AAEA,UAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,UAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAGnE,WAAO,UAAU;AAAA,MACf,GAAG,OAAO;AAAA,MACV,OAAO;AAAA,QACL,GAAG,OAAO,SAAS;AAAA,QACnB,oCAAgC,qBAAQ,wBAAwB;AAAA,MAClE;AAAA,IACF;AAEA,QAAI,aAAa;AAEf,aAAO,eAAe;AAAA,QACpB,GAAG,OAAO;AAAA,QACV,SAAS;AAAA,UACP,GAAI,OAAO,cAAc,WAAW,CAAC;AAAA,UACrC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,YAAuB,OAAO,OAAO,eAAe,YACxD,CAAC;AAEH,WAAO,QAAQ;AAAA,MACb,GAAG,OAAO;AAAA,MACV,eAAe;AAAA,QACb,GAAG,OAAO,OAAO;AAAA,QACjB,UAAU,CAAC,GAAG,WAAW,QAAQ;AAAA,MACnC;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,MAAM;AAEhB,+BAAM;AAAA,EACR;AAAA,EACA,iBAAiB,MAAM;AAAA,EAEvB;AACF;","names":["process"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport process from 'process';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\n/**\n *\n * A Vite plugin that integrates
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport process from 'process';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\n/**\n *\n * A Vite plugin that integrates Intlayer configuration into the build process\n *\n * ```ts\n * // Example usage of the plugin in a Vite configuration\n * export default defineConfig({\n * plugins: [ intlayerPlugin() ],\n * });\n * ```\n * */\nexport const intlayerPlugin = (_pluginOptions: PluginOptions = {}): Plugin => ({\n name: 'vite-intlayer-plugin',\n\n config: (config, { mode }) => {\n const intlayerConfig = getConfiguration();\n const { mainDir, baseDir, watch: isWatchMode } = intlayerConfig.content;\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = {\n ...process.env,\n ...loadEnv(mode, process.cwd()),\n ...env,\n };\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n // Update Vite's resolve alias\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve?.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n };\n\n if (isWatchMode) {\n // Ajout de l'option optimizeDeps.exclude\n config.optimizeDeps = {\n ...config.optimizeDeps,\n exclude: [\n ...(config.optimizeDeps?.exclude || []),\n '@intlayer/dictionaries-entry',\n ],\n };\n }\n\n const externals: string[] = (config.build?.rollupOptions?.external ??\n []) as string[];\n\n config.build = {\n ...config.build,\n rollupOptions: {\n ...config.build?.rollupOptions,\n external: [...externals, 'module'],\n },\n };\n\n return config;\n },\n\n buildStart: () => {\n // Code to run when Vite build starts\n watch();\n },\n configureServer: () => {\n // Custom server configuration, if needed\n },\n});\n"],"mappings":"AAAA,SAAS,MAAM,UAAU,eAAe;AACxC,OAAO,aAAa;AACpB,SAAS,aAAa;AACtB,SAAS,kBAAkB,yBAAyB;AAEpD,SAAS,eAA4B;AAkB9B,MAAM,iBAAiB,CAAC,iBAAgC,CAAC,OAAe;AAAA,EAC7E,MAAM;AAAA,EAEN,QAAQ,CAAC,QAAQ,EAAE,KAAK,MAAM;AAC5B,UAAM,iBAAiB,iBAAiB;AACxC,UAAM,EAAE,SAAS,SAAS,OAAO,YAAY,IAAI,eAAe;AAGhE,UAAM,MAAM,kBAAkB,MAAM;AAEpC,YAAQ,MAAM;AAAA,MACZ,GAAG,QAAQ;AAAA,MACX,GAAG,QAAQ,MAAM,QAAQ,IAAI,CAAC;AAAA,MAC9B,GAAG;AAAA,IACL;AAEA,UAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,UAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAGnE,WAAO,UAAU;AAAA,MACf,GAAG,OAAO;AAAA,MACV,OAAO;AAAA,QACL,GAAG,OAAO,SAAS;AAAA,QACnB,gCAAgC,QAAQ,wBAAwB;AAAA,MAClE;AAAA,IACF;AAEA,QAAI,aAAa;AAEf,aAAO,eAAe;AAAA,QACpB,GAAG,OAAO;AAAA,QACV,SAAS;AAAA,UACP,GAAI,OAAO,cAAc,WAAW,CAAC;AAAA,UACrC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,YAAuB,OAAO,OAAO,eAAe,YACxD,CAAC;AAEH,WAAO,QAAQ;AAAA,MACb,GAAG,OAAO;AAAA,MACV,eAAe;AAAA,QACb,GAAG,OAAO,OAAO;AAAA,QACjB,UAAU,CAAC,GAAG,WAAW,QAAQ;AAAA,MACnC;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,MAAM;AAEhB,UAAM;AAAA,EACR;AAAA,EACA,iBAAiB,MAAM;AAAA,EAEvB;AACF;","names":[]}
|
|
@@ -2,7 +2,7 @@ import { type Plugin } from 'vite';
|
|
|
2
2
|
type PluginOptions = {};
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* A Vite plugin that integrates
|
|
5
|
+
* A Vite plugin that integrates Intlayer configuration into the build process
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
8
|
* // Example usage of the plugin in a Vite configuration
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-intlayer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "A Vite plugin for seamless internationalization (i18n), providing locale detection, redirection, and environment-based configuration",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"intlayer",
|
|
8
8
|
"data",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"vite": "^6.0.7",
|
|
61
|
-
"@intlayer/
|
|
62
|
-
"@intlayer/
|
|
63
|
-
"@intlayer/
|
|
61
|
+
"@intlayer/chokidar": "4.0.3",
|
|
62
|
+
"@intlayer/config": "4.0.3",
|
|
63
|
+
"@intlayer/core": "4.0.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "^22.10.6",
|
|
@@ -72,16 +72,16 @@
|
|
|
72
72
|
"tsc-alias": "^1.8.10",
|
|
73
73
|
"tsup": "^8.3.5",
|
|
74
74
|
"typescript": "^5.7.3",
|
|
75
|
-
"@utils/tsup-config": "1.0.4",
|
|
76
|
-
"@utils/ts-config": "1.0.4",
|
|
77
75
|
"@utils/ts-config-types": "1.0.4",
|
|
78
|
-
"@utils/eslint-config": "1.0.4"
|
|
76
|
+
"@utils/eslint-config": "1.0.4",
|
|
77
|
+
"@utils/ts-config": "1.0.4",
|
|
78
|
+
"@utils/tsup-config": "1.0.4"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"vite": ">=4.0.0",
|
|
82
|
-
"@intlayer/chokidar": "4.0.
|
|
83
|
-
"@intlayer/config": "4.0.
|
|
84
|
-
"@intlayer/core": "4.0.
|
|
82
|
+
"@intlayer/chokidar": "4.0.3",
|
|
83
|
+
"@intlayer/config": "4.0.3",
|
|
84
|
+
"@intlayer/core": "4.0.3"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">=14.18"
|