vite-intlayer 4.1.6 → 4.1.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.
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var intlayerPlugin_exports = {};
|
|
30
20
|
__export(intlayerPlugin_exports, {
|
|
@@ -32,20 +22,21 @@ __export(intlayerPlugin_exports, {
|
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(intlayerPlugin_exports);
|
|
34
24
|
var import_path = require("path");
|
|
35
|
-
var import_process = __toESM(require("process"));
|
|
36
25
|
var import_chokidar = require("@intlayer/chokidar");
|
|
37
26
|
var import_config = require("@intlayer/config");
|
|
38
27
|
var import_vite = require("vite");
|
|
39
|
-
let mode;
|
|
40
28
|
const intlayerPlugin = (_pluginOptions = {}) => ({
|
|
41
29
|
name: "vite-intlayer-plugin",
|
|
42
|
-
config: (config,
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
...
|
|
47
|
-
|
|
48
|
-
...
|
|
30
|
+
config: (config, { mode }) => {
|
|
31
|
+
const viteEnvVar = (0, import_vite.loadEnv)(mode, process.cwd());
|
|
32
|
+
const intlayerEnvVar = (0, import_config.formatEnvVariable)("vite");
|
|
33
|
+
process.env = {
|
|
34
|
+
...process.env,
|
|
35
|
+
// Env var eventually provided by other plugins
|
|
36
|
+
...viteEnvVar,
|
|
37
|
+
// Env var loaded by vite .env files
|
|
38
|
+
...intlayerEnvVar
|
|
39
|
+
// Env var related to intlayer
|
|
49
40
|
};
|
|
50
41
|
const intlayerConfig = (0, import_config.getConfiguration)();
|
|
51
42
|
const { mainDir, baseDir, watch: isWatchMode } = intlayerConfig.content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport { buildAndWatchIntlayer } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { loadEnv, type PluginOption } 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 = (\n _pluginOptions: PluginOptions = {}\n): PluginOption => ({\n name: 'vite-intlayer-plugin',\n\n config: (config, { mode }) => {\n const viteEnvVar = loadEnv(mode, process.cwd());\n const intlayerEnvVar = formatEnvVariable('vite');\n\n process.env = {\n ...process.env, // Env var eventually provided by other plugins\n ...viteEnvVar, // Env var loaded by vite .env files\n ...intlayerEnvVar, // Env var related to intlayer\n };\n\n const intlayerConfig = getConfiguration();\n const { mainDir, baseDir, watch: isWatchMode } = intlayerConfig.content;\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: async () => {\n // Code to run when Vite build starts\n try {\n await buildAndWatchIntlayer();\n } catch (error) {\n console.error('Error starting the watch process:', error);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwC;AACxC,sBAAsC;AACtC,oBAAoD;AAEpD,kBAA2C;AAkBpC,MAAM,iBAAiB,CAC5B,iBAAgC,CAAC,OACf;AAAA,EAClB,MAAM;AAAA,EAEN,QAAQ,CAAC,QAAQ,EAAE,KAAK,MAAM;AAC5B,UAAM,iBAAa,qBAAQ,MAAM,QAAQ,IAAI,CAAC;AAC9C,UAAM,qBAAiB,iCAAkB,MAAM;AAE/C,YAAQ,MAAM;AAAA,MACZ,GAAG,QAAQ;AAAA;AAAA,MACX,GAAG;AAAA;AAAA,MACH,GAAG;AAAA;AAAA,IACL;AAEA,UAAM,qBAAiB,gCAAiB;AACxC,UAAM,EAAE,SAAS,SAAS,OAAO,YAAY,IAAI,eAAe;AAEhE,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,YAAY;AAEtB,QAAI;AACF,gBAAM,uCAAsB;AAAA,IAC9B,SAAS,OAAO;AACd,cAAQ,MAAM,qCAAqC,KAAK;AAAA,IAC1D;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { join, relative, resolve } from "path";
|
|
2
|
-
import process from "process";
|
|
3
2
|
import { buildAndWatchIntlayer } from "@intlayer/chokidar";
|
|
4
3
|
import { getConfiguration, formatEnvVariable } from "@intlayer/config";
|
|
5
4
|
import { loadEnv } from "vite";
|
|
6
|
-
let mode;
|
|
7
5
|
const intlayerPlugin = (_pluginOptions = {}) => ({
|
|
8
6
|
name: "vite-intlayer-plugin",
|
|
9
|
-
config: (config,
|
|
10
|
-
|
|
11
|
-
const
|
|
7
|
+
config: (config, { mode }) => {
|
|
8
|
+
const viteEnvVar = loadEnv(mode, process.cwd());
|
|
9
|
+
const intlayerEnvVar = formatEnvVariable("vite");
|
|
12
10
|
process.env = {
|
|
13
11
|
...process.env,
|
|
14
|
-
|
|
15
|
-
...
|
|
12
|
+
// Env var eventually provided by other plugins
|
|
13
|
+
...viteEnvVar,
|
|
14
|
+
// Env var loaded by vite .env files
|
|
15
|
+
...intlayerEnvVar
|
|
16
|
+
// Env var related to intlayer
|
|
16
17
|
};
|
|
17
18
|
const intlayerConfig = getConfiguration();
|
|
18
19
|
const { mainDir, baseDir, watch: isWatchMode } = intlayerConfig.content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport { buildAndWatchIntlayer } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { loadEnv, type PluginOption } 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 = (\n _pluginOptions: PluginOptions = {}\n): PluginOption => ({\n name: 'vite-intlayer-plugin',\n\n config: (config, { mode }) => {\n const viteEnvVar = loadEnv(mode, process.cwd());\n const intlayerEnvVar = formatEnvVariable('vite');\n\n process.env = {\n ...process.env, // Env var eventually provided by other plugins\n ...viteEnvVar, // Env var loaded by vite .env files\n ...intlayerEnvVar, // Env var related to intlayer\n };\n\n const intlayerConfig = getConfiguration();\n const { mainDir, baseDir, watch: isWatchMode } = intlayerConfig.content;\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: async () => {\n // Code to run when Vite build starts\n try {\n await buildAndWatchIntlayer();\n } catch (error) {\n console.error('Error starting the watch process:', error);\n }\n },\n});\n"],"mappings":"AAAA,SAAS,MAAM,UAAU,eAAe;AACxC,SAAS,6BAA6B;AACtC,SAAS,kBAAkB,yBAAyB;AAEpD,SAAS,eAAkC;AAkBpC,MAAM,iBAAiB,CAC5B,iBAAgC,CAAC,OACf;AAAA,EAClB,MAAM;AAAA,EAEN,QAAQ,CAAC,QAAQ,EAAE,KAAK,MAAM;AAC5B,UAAM,aAAa,QAAQ,MAAM,QAAQ,IAAI,CAAC;AAC9C,UAAM,iBAAiB,kBAAkB,MAAM;AAE/C,YAAQ,MAAM;AAAA,MACZ,GAAG,QAAQ;AAAA;AAAA,MACX,GAAG;AAAA;AAAA,MACH,GAAG;AAAA;AAAA,IACL;AAEA,UAAM,iBAAiB,iBAAiB;AACxC,UAAM,EAAE,SAAS,SAAS,OAAO,YAAY,IAAI,eAAe;AAEhE,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,YAAY;AAEtB,QAAI;AACF,YAAM,sBAAsB;AAAA,IAC9B,SAAS,OAAO;AACd,cAAQ,MAAM,qCAAqC,KAAK;AAAA,IAC1D;AAAA,EACF;AACF;","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":"AAIA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAGlD,KAAK,aAAa,GAAG,EAEpB,CAAC;AAEF;;;;;;;;;;MAUM;AACN,eAAO,MAAM,cAAc,oBACT,aAAa,KAC5B,YA6DD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-intlayer",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.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": [
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"./package.json"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@intlayer/
|
|
61
|
-
"@intlayer/
|
|
62
|
-
"@intlayer/core": "4.1.
|
|
60
|
+
"@intlayer/config": "4.1.8",
|
|
61
|
+
"@intlayer/chokidar": "4.1.8",
|
|
62
|
+
"@intlayer/core": "4.1.8"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/node": "^22.10.6",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"vite": ">=4.0.0",
|
|
81
|
-
"@intlayer/chokidar": "4.1.
|
|
82
|
-
"@intlayer/config": "4.1.
|
|
83
|
-
"@intlayer/core": "4.1.
|
|
81
|
+
"@intlayer/chokidar": "4.1.8",
|
|
82
|
+
"@intlayer/config": "4.1.8",
|
|
83
|
+
"@intlayer/core": "4.1.8"
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": ">=14.18"
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"lint:fix": "eslint . --cache --fix",
|
|
99
99
|
"prettier": "prettier . --check",
|
|
100
100
|
"prettier:fix": "prettier . --write",
|
|
101
|
+
"reset": "pnpm clean & pnpm build",
|
|
101
102
|
"test": "",
|
|
102
103
|
"typecheck": "tsup --project ./tsconfig.json --noEmit"
|
|
103
104
|
}
|