vite-intlayer 5.7.6 → 5.7.8
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
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
<div>
|
|
28
28
|
<br/>
|
|
29
29
|
<p align="center">
|
|
30
|
+
<a href="https://discord.gg/528mBV4N" target="blank"><img align="center"
|
|
31
|
+
src="https://img.shields.io/badge/discord-5865F2.svg?style=for-the-badge&logo=discord&logoColor=white"
|
|
32
|
+
alt="Intlayer Discord" height="30"/></a>
|
|
30
33
|
<a href="https://www.linkedin.com/company/intlayerorg" target="blank"><img align="center"
|
|
31
34
|
src="https://img.shields.io/badge/linkedin-%231DA1F2.svg?style=for-the-badge&logo=linkedin&logoColor=white"
|
|
32
35
|
alt="Intlayer LinkedIn" height="30"/></a>
|
|
@@ -90,7 +90,16 @@ const intlayerPlugin = () => {
|
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
buildStart: async () => {
|
|
93
|
-
|
|
93
|
+
const sentinelPath = (0, import_path.join)(
|
|
94
|
+
import_built.default.content.baseDir,
|
|
95
|
+
".intlayer",
|
|
96
|
+
"cache",
|
|
97
|
+
"intlayer-prepared.lock"
|
|
98
|
+
);
|
|
99
|
+
await (0, import_chokidar.runOnce)(
|
|
100
|
+
sentinelPath,
|
|
101
|
+
async () => await (0, import_chokidar.prepareIntlayer)(import_built.default)
|
|
102
|
+
);
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import {\n cleanOutputDir,\n prepareIntlayer,\n runOnce,\n watch,\n} from '@intlayer/chokidar';\nimport intlayerConfig from '@intlayer/config/built';\nimport { join, relative, resolve } from 'path';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { type PluginOption } from 'vite';\nimport { IntlayerPrunePlugin } from './intlayerPrunePlugin';\n\ncleanOutputDir();\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 = (): PluginOption => {\n const {\n mainDir,\n configDir,\n baseDir,\n watch: isWatchMode,\n } = intlayerConfig.content;\n const { optimize } = intlayerConfig.build;\n\n const plugins: PluginOption[] = [\n {\n name: 'vite-intlayer-plugin',\n\n config: (config) => {\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const unmergedDictionariesPath = join(\n mainDir,\n 'unmerged_dictionaries.mjs'\n );\n const relativeUnmergedDictionariesPath = relative(\n baseDir,\n unmergedDictionariesPath\n );\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\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 '@intlayer/unmerged-dictionaries-entry': resolve(\n relativeUnmergedDictionariesPath\n ),\n '@intlayer/config/built': resolve(relativeConfigurationPath),\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 '@intlayer/unmerged-dictionaries-entry',\n '@intlayer/config/built',\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 buildStart: async () => {\n const sentinelPath = join(\n intlayerConfig.content.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-prepared.lock'\n );\n\n // Code to run when Vite build starts\n // Only call prepareIntlayer once per server startup\n await runOnce(\n sentinelPath,\n async () => await prepareIntlayer(intlayerConfig)\n );\n },\n },\n ];\n\n // Add Babel transform plugin if enabled\n if (optimize) {\n plugins.push(IntlayerPrunePlugin(intlayerConfig));\n }\n\n return plugins;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKO;AACP,mBAA2B;AAC3B,kBAAwC;AAGxC,iCAAoC;AAAA,IAEpC,gCAAe;AAaR,MAAM,iBAAiB,MAAoB;AAChD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,EACT,IAAI,aAAAA,QAAe;AACnB,QAAM,EAAE,SAAS,IAAI,aAAAA,QAAe;AAEpC,QAAM,UAA0B;AAAA,IAC9B;AAAA,MACE,MAAM;AAAA,MAEN,QAAQ,CAAC,WAAW;AAClB,cAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,cAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAEnE,cAAM,+BAA2B;AAAA,UAC/B;AAAA,UACA;AAAA,QACF;AACA,cAAM,uCAAmC;AAAA,UACvC;AAAA,UACA;AAAA,QACF;AAEA,cAAM,wBAAoB,kBAAK,WAAW,oBAAoB;AAC9D,cAAM,gCAA4B,sBAAS,SAAS,iBAAiB;AAGrE,eAAO,UAAU;AAAA,UACf,GAAG,OAAO;AAAA,UACV,OAAO;AAAA,YACL,GAAG,OAAO,SAAS;AAAA,YACnB,oCAAgC,qBAAQ,wBAAwB;AAAA,YAChE,6CAAyC;AAAA,cACvC;AAAA,YACF;AAAA,YACA,8BAA0B,qBAAQ,yBAAyB;AAAA,UAC7D;AAAA,QACF;AAEA,YAAI,aAAa;AAEf,iBAAO,eAAe;AAAA,YACpB,GAAG,OAAO;AAAA,YACV,SAAS;AAAA,cACP,GAAI,OAAO,cAAc,WAAW,CAAC;AAAA,cACrC;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,eAAO;AAAA,MACT;AAAA,MAEA,iBAAiB,OAAO,WAAW;AACjC,YAAI,aAAAA,QAAe,QAAQ,OAAO;AAEhC,qCAAM,EAAE,eAAe,aAAAA,QAAe,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,MAEA,YAAY,YAAY;AACtB,cAAM,mBAAe;AAAA,UACnB,aAAAA,QAAe,QAAQ;AAAA,UACvB;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAIA,kBAAM;AAAA,UACJ;AAAA,UACA,YAAY,UAAM,iCAAgB,aAAAA,OAAc;AAAA,QAClD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,MAAI,UAAU;AACZ,YAAQ,SAAK,gDAAoB,aAAAA,OAAc,CAAC;AAAA,EAClD;AAEA,SAAO;AACT;","names":["intlayerConfig"]}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
cleanOutputDir,
|
|
3
|
+
prepareIntlayer,
|
|
4
|
+
runOnce,
|
|
5
|
+
watch
|
|
6
|
+
} from "@intlayer/chokidar";
|
|
2
7
|
import intlayerConfig from "@intlayer/config/built";
|
|
3
8
|
import { join, relative, resolve } from "path";
|
|
4
9
|
import { IntlayerPrunePlugin } from "./intlayerPrunePlugin.mjs";
|
|
@@ -57,7 +62,16 @@ const intlayerPlugin = () => {
|
|
|
57
62
|
}
|
|
58
63
|
},
|
|
59
64
|
buildStart: async () => {
|
|
60
|
-
|
|
65
|
+
const sentinelPath = join(
|
|
66
|
+
intlayerConfig.content.baseDir,
|
|
67
|
+
".intlayer",
|
|
68
|
+
"cache",
|
|
69
|
+
"intlayer-prepared.lock"
|
|
70
|
+
);
|
|
71
|
+
await runOnce(
|
|
72
|
+
sentinelPath,
|
|
73
|
+
async () => await prepareIntlayer(intlayerConfig)
|
|
74
|
+
);
|
|
61
75
|
}
|
|
62
76
|
}
|
|
63
77
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import {\n cleanOutputDir,\n prepareIntlayer,\n runOnce,\n watch,\n} from '@intlayer/chokidar';\nimport intlayerConfig from '@intlayer/config/built';\nimport { join, relative, resolve } from 'path';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { type PluginOption } from 'vite';\nimport { IntlayerPrunePlugin } from './intlayerPrunePlugin';\n\ncleanOutputDir();\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 = (): PluginOption => {\n const {\n mainDir,\n configDir,\n baseDir,\n watch: isWatchMode,\n } = intlayerConfig.content;\n const { optimize } = intlayerConfig.build;\n\n const plugins: PluginOption[] = [\n {\n name: 'vite-intlayer-plugin',\n\n config: (config) => {\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const unmergedDictionariesPath = join(\n mainDir,\n 'unmerged_dictionaries.mjs'\n );\n const relativeUnmergedDictionariesPath = relative(\n baseDir,\n unmergedDictionariesPath\n );\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\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 '@intlayer/unmerged-dictionaries-entry': resolve(\n relativeUnmergedDictionariesPath\n ),\n '@intlayer/config/built': resolve(relativeConfigurationPath),\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 '@intlayer/unmerged-dictionaries-entry',\n '@intlayer/config/built',\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 buildStart: async () => {\n const sentinelPath = join(\n intlayerConfig.content.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-prepared.lock'\n );\n\n // Code to run when Vite build starts\n // Only call prepareIntlayer once per server startup\n await runOnce(\n sentinelPath,\n async () => await prepareIntlayer(intlayerConfig)\n );\n },\n },\n ];\n\n // Add Babel transform plugin if enabled\n if (optimize) {\n plugins.push(IntlayerPrunePlugin(intlayerConfig));\n }\n\n return plugins;\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,oBAAoB;AAC3B,SAAS,MAAM,UAAU,eAAe;AAGxC,SAAS,2BAA2B;AAEpC,eAAe;AAaR,MAAM,iBAAiB,MAAoB;AAChD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,EACT,IAAI,eAAe;AACnB,QAAM,EAAE,SAAS,IAAI,eAAe;AAEpC,QAAM,UAA0B;AAAA,IAC9B;AAAA,MACE,MAAM;AAAA,MAEN,QAAQ,CAAC,WAAW;AAClB,cAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,cAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAEnE,cAAM,2BAA2B;AAAA,UAC/B;AAAA,UACA;AAAA,QACF;AACA,cAAM,mCAAmC;AAAA,UACvC;AAAA,UACA;AAAA,QACF;AAEA,cAAM,oBAAoB,KAAK,WAAW,oBAAoB;AAC9D,cAAM,4BAA4B,SAAS,SAAS,iBAAiB;AAGrE,eAAO,UAAU;AAAA,UACf,GAAG,OAAO;AAAA,UACV,OAAO;AAAA,YACL,GAAG,OAAO,SAAS;AAAA,YACnB,gCAAgC,QAAQ,wBAAwB;AAAA,YAChE,yCAAyC;AAAA,cACvC;AAAA,YACF;AAAA,YACA,0BAA0B,QAAQ,yBAAyB;AAAA,UAC7D;AAAA,QACF;AAEA,YAAI,aAAa;AAEf,iBAAO,eAAe;AAAA,YACpB,GAAG,OAAO;AAAA,YACV,SAAS;AAAA,cACP,GAAI,OAAO,cAAc,WAAW,CAAC;AAAA,cACrC;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,eAAO;AAAA,MACT;AAAA,MAEA,iBAAiB,OAAO,WAAW;AACjC,YAAI,eAAe,QAAQ,OAAO;AAEhC,gBAAM,EAAE,eAAe,eAAe,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,MAEA,YAAY,YAAY;AACtB,cAAM,eAAe;AAAA,UACnB,eAAe,QAAQ;AAAA,UACvB;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAIA,cAAM;AAAA,UACJ;AAAA,UACA,YAAY,MAAM,gBAAgB,cAAc;AAAA,QAClD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,MAAI,UAAU;AACZ,YAAQ,KAAK,oBAAoB,cAAc,CAAC;AAAA,EAClD;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerPlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"intlayerPlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerPlugin.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAKzC;;;;;;;;;;MAUM;AACN,eAAO,MAAM,cAAc,QAAO,YAyFjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-intlayer",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.8",
|
|
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": [
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"./package.json"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@intlayer/
|
|
62
|
-
"@intlayer/
|
|
63
|
-
"@intlayer/
|
|
64
|
-
"@intlayer/babel": "5.7.
|
|
61
|
+
"@intlayer/chokidar": "5.7.8",
|
|
62
|
+
"@intlayer/config": "5.7.8",
|
|
63
|
+
"@intlayer/core": "5.7.8",
|
|
64
|
+
"@intlayer/babel": "5.7.8"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/node": "^22.15.30",
|
|
@@ -75,15 +75,15 @@
|
|
|
75
75
|
"typescript": "^5.8.3",
|
|
76
76
|
"vitest": "^3.2.2",
|
|
77
77
|
"@utils/eslint-config": "1.0.4",
|
|
78
|
-
"@utils/ts-config": "1.0.4",
|
|
79
78
|
"@utils/ts-config-types": "1.0.4",
|
|
79
|
+
"@utils/ts-config": "1.0.4",
|
|
80
80
|
"@utils/tsup-config": "1.0.4"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"vite": ">=4.0.0",
|
|
84
|
-
"@intlayer/
|
|
85
|
-
"@intlayer/
|
|
86
|
-
"@intlayer/
|
|
84
|
+
"@intlayer/core": "5.7.8",
|
|
85
|
+
"@intlayer/chokidar": "5.7.8",
|
|
86
|
+
"@intlayer/config": "5.7.8"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": ">=14.18"
|