vite-intlayer 7.4.0 → 7.5.0-canary.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.
|
@@ -26,9 +26,10 @@ const intlayerPlugin = (configOptions) => {
|
|
|
26
26
|
const plugins = [{
|
|
27
27
|
name: "vite-intlayer-plugin",
|
|
28
28
|
config: async (config, env) => {
|
|
29
|
+
const { mode } = intlayerConfig.build;
|
|
29
30
|
const isDevCommand = env.command === "serve" && env.mode === "development";
|
|
30
31
|
const isBuildCommand = env.command === "build";
|
|
31
|
-
if (isDevCommand || isBuildCommand) await prepareIntlayer(intlayerConfig, {
|
|
32
|
+
if (isDevCommand || isBuildCommand || mode === "auto") await prepareIntlayer(intlayerConfig, {
|
|
32
33
|
clean: isBuildCommand,
|
|
33
34
|
cacheTimeoutMs: isBuildCommand ? 1e3 * 30 : 1e3 * 60 * 60
|
|
34
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerPlugin.mjs","names":["plugins: PluginOption[]"],"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport {\n type GetConfigurationOptions,\n getAlias,\n getConfiguration,\n} from '@intlayer/config';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport type { PluginOption } from 'vite';\nimport { intlayerPrune } from './intlayerPrunePlugin';\n\n/**\n * @deprecated Rename to intlayer instead\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: [ intlayer() ],\n * });\n * ```\n * */\nexport const intlayerPlugin = (\n configOptions?: GetConfigurationOptions\n): PluginOption => {\n const intlayerConfig = getConfiguration(configOptions);\n\n const alias = getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value),\n });\n\n const aliasPackages = Object.keys(alias);\n\n const plugins: PluginOption[] = [\n {\n name: 'vite-intlayer-plugin',\n\n config: async (config, env) => {\n const isDevCommand =\n env.command === 'serve' && env.mode === 'development';\n const isBuildCommand = env.command === 'build';\n\n // Only call prepareIntlayer during `dev` or `build` (not during `start`)\n // If prod: clean and rebuild once\n // If dev: rebuild only once if it's more than 1 hour since last rebuild\n if (isDevCommand || isBuildCommand) {\n // prepareIntlayer use runOnce to ensure to run only once because will run twice on client and server side otherwise\n await prepareIntlayer(intlayerConfig, {\n clean: isBuildCommand,\n cacheTimeoutMs: isBuildCommand\n ? 1000 * 30 // 30 seconds for build (to ensure to rebuild all dictionaries)\n : 1000 * 60 * 60, // 1 hour for dev (default cache timeout)\n });\n }\n\n // Update Vite's resolve alias\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve?.alias,\n ...alias,\n },\n };\n\n config.optimizeDeps = {\n ...config.optimizeDeps,\n exclude: [...(config.optimizeDeps?.exclude ?? []), ...aliasPackages],\n };\n\n // Update Vite's SSR Externalization\n // We must ensure that intlayer packages are processed by Vite (bundled)\n // so that the aliases defined above are actually applied\n if (config.ssr?.noExternal !== true) {\n const currentNoExternal = Array.isArray(config.ssr?.noExternal)\n ? config.ssr.noExternal\n : config.ssr?.noExternal\n ? [config.ssr.noExternal]\n : [];\n\n config.ssr = {\n ...config.ssr,\n noExternal: [\n ...(currentNoExternal as (string | RegExp)[]),\n // Regex to bundle all intlayer related packages\n /(^@intlayer\\/|intlayer$)/,\n ],\n };\n }\n\n return config;\n },\n\n configureServer: async (_server) => {\n if (intlayerConfig.content.watch) {\n // Start watching (assuming watch is also async)\n watch({ configuration: intlayerConfig });\n }\n },\n },\n ];\n\n // Add Babel transform plugin if enabled\n plugins.push(intlayerPrune(intlayerConfig));\n\n return plugins;\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: [ intlayer() ],\n * });\n * ```\n */\nexport const intlayer = intlayerPlugin;\n/**\n * @deprecated Rename to intlayer instead\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: [ intlayer() ],\n * });\n * ```\n */\nexport const intLayerPlugin = intlayerPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,MAAa,kBACX,kBACiB;CACjB,MAAM,iBAAiB,iBAAiB,cAAc;CAEtD,MAAM,QAAQ,SAAS;EACrB,eAAe;EACf,YAAY,UAAkB,QAAQ,MAAM;EAC7C,CAAC;CAEF,MAAM,gBAAgB,OAAO,KAAK,MAAM;CAExC,MAAMA,UAA0B,CAC9B;EACE,MAAM;EAEN,QAAQ,OAAO,QAAQ,QAAQ;GAC7B,MAAM,eACJ,IAAI,YAAY,WAAW,IAAI,SAAS;GAC1C,MAAM,iBAAiB,IAAI,YAAY;AAKvC,OAAI,gBAAgB,
|
|
1
|
+
{"version":3,"file":"intlayerPlugin.mjs","names":["plugins: PluginOption[]"],"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport {\n type GetConfigurationOptions,\n getAlias,\n getConfiguration,\n} from '@intlayer/config';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport type { PluginOption } from 'vite';\nimport { intlayerPrune } from './intlayerPrunePlugin';\n\n/**\n * @deprecated Rename to intlayer instead\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: [ intlayer() ],\n * });\n * ```\n * */\nexport const intlayerPlugin = (\n configOptions?: GetConfigurationOptions\n): PluginOption => {\n const intlayerConfig = getConfiguration(configOptions);\n\n const alias = getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value),\n });\n\n const aliasPackages = Object.keys(alias);\n\n const plugins: PluginOption[] = [\n {\n name: 'vite-intlayer-plugin',\n\n config: async (config, env) => {\n const { mode } = intlayerConfig.build;\n\n const isDevCommand =\n env.command === 'serve' && env.mode === 'development';\n const isBuildCommand = env.command === 'build';\n\n // Only call prepareIntlayer during `dev` or `build` (not during `start`)\n // If prod: clean and rebuild once\n // If dev: rebuild only once if it's more than 1 hour since last rebuild\n if (isDevCommand || isBuildCommand || mode === 'auto') {\n // prepareIntlayer use runOnce to ensure to run only once because will run twice on client and server side otherwise\n await prepareIntlayer(intlayerConfig, {\n clean: isBuildCommand,\n cacheTimeoutMs: isBuildCommand\n ? 1000 * 30 // 30 seconds for build (to ensure to rebuild all dictionaries)\n : 1000 * 60 * 60, // 1 hour for dev (default cache timeout)\n });\n }\n\n // Update Vite's resolve alias\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve?.alias,\n ...alias,\n },\n };\n\n config.optimizeDeps = {\n ...config.optimizeDeps,\n exclude: [...(config.optimizeDeps?.exclude ?? []), ...aliasPackages],\n };\n\n // Update Vite's SSR Externalization\n // We must ensure that intlayer packages are processed by Vite (bundled)\n // so that the aliases defined above are actually applied\n if (config.ssr?.noExternal !== true) {\n const currentNoExternal = Array.isArray(config.ssr?.noExternal)\n ? config.ssr.noExternal\n : config.ssr?.noExternal\n ? [config.ssr.noExternal]\n : [];\n\n config.ssr = {\n ...config.ssr,\n noExternal: [\n ...(currentNoExternal as (string | RegExp)[]),\n // Regex to bundle all intlayer related packages\n /(^@intlayer\\/|intlayer$)/,\n ],\n };\n }\n\n return config;\n },\n\n configureServer: async (_server) => {\n if (intlayerConfig.content.watch) {\n // Start watching (assuming watch is also async)\n watch({ configuration: intlayerConfig });\n }\n },\n },\n ];\n\n // Add Babel transform plugin if enabled\n plugins.push(intlayerPrune(intlayerConfig));\n\n return plugins;\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: [ intlayer() ],\n * });\n * ```\n */\nexport const intlayer = intlayerPlugin;\n/**\n * @deprecated Rename to intlayer instead\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: [ intlayer() ],\n * });\n * ```\n */\nexport const intLayerPlugin = intlayerPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,MAAa,kBACX,kBACiB;CACjB,MAAM,iBAAiB,iBAAiB,cAAc;CAEtD,MAAM,QAAQ,SAAS;EACrB,eAAe;EACf,YAAY,UAAkB,QAAQ,MAAM;EAC7C,CAAC;CAEF,MAAM,gBAAgB,OAAO,KAAK,MAAM;CAExC,MAAMA,UAA0B,CAC9B;EACE,MAAM;EAEN,QAAQ,OAAO,QAAQ,QAAQ;GAC7B,MAAM,EAAE,SAAS,eAAe;GAEhC,MAAM,eACJ,IAAI,YAAY,WAAW,IAAI,SAAS;GAC1C,MAAM,iBAAiB,IAAI,YAAY;AAKvC,OAAI,gBAAgB,kBAAkB,SAAS,OAE7C,OAAM,gBAAgB,gBAAgB;IACpC,OAAO;IACP,gBAAgB,iBACZ,MAAO,KACP,MAAO,KAAK;IACjB,CAAC;AAIJ,UAAO,UAAU;IACf,GAAG,OAAO;IACV,OAAO;KACL,GAAG,OAAO,SAAS;KACnB,GAAG;KACJ;IACF;AAED,UAAO,eAAe;IACpB,GAAG,OAAO;IACV,SAAS,CAAC,GAAI,OAAO,cAAc,WAAW,EAAE,EAAG,GAAG,cAAc;IACrE;AAKD,OAAI,OAAO,KAAK,eAAe,MAAM;IACnC,MAAM,oBAAoB,MAAM,QAAQ,OAAO,KAAK,WAAW,GAC3D,OAAO,IAAI,aACX,OAAO,KAAK,aACV,CAAC,OAAO,IAAI,WAAW,GACvB,EAAE;AAER,WAAO,MAAM;KACX,GAAG,OAAO;KACV,YAAY,CACV,GAAI,mBAEJ,2BACD;KACF;;AAGH,UAAO;;EAGT,iBAAiB,OAAO,YAAY;AAClC,OAAI,eAAe,QAAQ,MAEzB,OAAM,EAAE,eAAe,gBAAgB,CAAC;;EAG7C,CACF;AAGD,SAAQ,KAAK,cAAc,eAAe,CAAC;AAE3C,QAAO;;;;;;;;;;;;AAaT,MAAa,WAAW;;;;;;;;;;;;;AAaxB,MAAa,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerPlugin.d.ts","names":[],"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":[],"mappings":";;;;;;;AAuBA;
|
|
1
|
+
{"version":3,"file":"intlayerPlugin.d.ts","names":[],"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":[],"mappings":";;;;;;;AAuBA;AAkGA;AAaA;;;;;;;;cA/Ga,iCACK,4BACf;;;;;;;;;;;cAgGU,2BAjGK,4BACf;;;;;;;;;;;;;cA6GU,iCA9GK,4BACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-intlayer",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0-canary.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Vite plugin for seamless internationalization (i18n), providing locale detection, redirection, and environment-based configuration",
|
|
6
6
|
"keywords": [
|
|
@@ -78,28 +78,28 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@babel/core": "7.28.4",
|
|
81
|
-
"@intlayer/babel": "7.
|
|
82
|
-
"@intlayer/chokidar": "7.
|
|
83
|
-
"@intlayer/config": "7.
|
|
84
|
-
"@intlayer/core": "7.
|
|
85
|
-
"@intlayer/dictionaries-entry": "7.
|
|
86
|
-
"@intlayer/types": "7.
|
|
87
|
-
"intlayer": "7.
|
|
81
|
+
"@intlayer/babel": "7.5.0-canary.1",
|
|
82
|
+
"@intlayer/chokidar": "7.5.0-canary.1",
|
|
83
|
+
"@intlayer/config": "7.5.0-canary.1",
|
|
84
|
+
"@intlayer/core": "7.5.0-canary.1",
|
|
85
|
+
"@intlayer/dictionaries-entry": "7.5.0-canary.1",
|
|
86
|
+
"@intlayer/types": "7.5.0-canary.1",
|
|
87
|
+
"intlayer": "7.5.0-canary.1"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@types/node": "
|
|
90
|
+
"@types/node": "25.0.2",
|
|
91
91
|
"@utils/ts-config": "1.0.4",
|
|
92
92
|
"@utils/ts-config-types": "1.0.4",
|
|
93
93
|
"@utils/tsdown-config": "1.0.4",
|
|
94
94
|
"rimraf": "6.1.2",
|
|
95
|
-
"tsdown": "0.
|
|
95
|
+
"tsdown": "0.18.0",
|
|
96
96
|
"typescript": "5.9.3",
|
|
97
|
-
"vitest": "4.0.
|
|
97
|
+
"vitest": "4.0.16"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@babel/core": ">=6.0.0",
|
|
101
|
-
"@intlayer/svelte-compiler": "7.
|
|
102
|
-
"@intlayer/vue-compiler": "7.
|
|
101
|
+
"@intlayer/svelte-compiler": "7.5.0-canary.1",
|
|
102
|
+
"@intlayer/vue-compiler": "7.5.0-canary.1",
|
|
103
103
|
"vite": ">=4.0.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependenciesMeta": {
|