react-intlayer 3.4.7 → 3.4.9
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.
|
@@ -36,6 +36,7 @@ var import_process = __toESM(require("process"));
|
|
|
36
36
|
var import_chokidar = require("@intlayer/chokidar");
|
|
37
37
|
var import_config = require("@intlayer/config");
|
|
38
38
|
var import_vite = require("vite");
|
|
39
|
+
const isDev = import_process.default.env.NODE_ENV === "development";
|
|
39
40
|
const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
40
41
|
name: "vite-intlayer-plugin",
|
|
41
42
|
config: (config, { mode }) => {
|
|
@@ -52,6 +53,15 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
|
52
53
|
"@intlayer/dictionaries-entry": (0, import_path.resolve)(relativeDictionariesPath)
|
|
53
54
|
}
|
|
54
55
|
};
|
|
56
|
+
if (isDev) {
|
|
57
|
+
config.optimizeDeps = {
|
|
58
|
+
...config.optimizeDeps,
|
|
59
|
+
exclude: [
|
|
60
|
+
...config.optimizeDeps?.exclude || [],
|
|
61
|
+
"@intlayer/dictionaries-entry"
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
55
65
|
const externals = config.build?.rollupOptions?.external ?? [];
|
|
56
66
|
config.build = {
|
|
57
67
|
...config.build,
|
|
@@ -64,7 +74,7 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
|
64
74
|
},
|
|
65
75
|
buildStart: () => {
|
|
66
76
|
(0, import_chokidar.watch)({
|
|
67
|
-
persistent:
|
|
77
|
+
persistent: isDev
|
|
68
78
|
});
|
|
69
79
|
},
|
|
70
80
|
configureServer: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport process from 'process';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\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 } = intlayerConfig.content;\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = { ...process.env, ...loadEnv(mode, process.cwd()), ...env };\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 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 persistent:
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport process from 'process';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\nconst isDev = process.env.NODE_ENV === 'development';\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 } = intlayerConfig.content;\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = { ...process.env, ...loadEnv(mode, process.cwd()), ...env };\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 (isDev) {\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 persistent: isDev,\n });\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;AACpD,kBAAqC;AAOrC,MAAM,QAAQ,eAAAA,QAAQ,IAAI,aAAa;AAahC,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,QAAQ,IAAI,eAAe;AAG5C,UAAM,UAAM,iCAAkB,MAAM;AAEpC,mBAAAA,QAAQ,MAAM,EAAE,GAAG,eAAAA,QAAQ,KAAK,OAAG,qBAAQ,MAAM,eAAAA,QAAQ,IAAI,CAAC,GAAG,GAAG,IAAI;AAExE,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,OAAO;AAET,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,MACJ,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AAAA,EACA,iBAAiB,MAAM;AAAA,EAEvB;AACF;","names":["process"]}
|
|
@@ -4,6 +4,7 @@ import process from "process";
|
|
|
4
4
|
import { watch } from "@intlayer/chokidar";
|
|
5
5
|
import { getConfiguration, formatEnvVariable } from "@intlayer/config";
|
|
6
6
|
import { loadEnv } from "vite";
|
|
7
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
7
8
|
const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
8
9
|
name: "vite-intlayer-plugin",
|
|
9
10
|
config: (config, { mode }) => {
|
|
@@ -20,6 +21,15 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
|
20
21
|
"@intlayer/dictionaries-entry": resolve(relativeDictionariesPath)
|
|
21
22
|
}
|
|
22
23
|
};
|
|
24
|
+
if (isDev) {
|
|
25
|
+
config.optimizeDeps = {
|
|
26
|
+
...config.optimizeDeps,
|
|
27
|
+
exclude: [
|
|
28
|
+
...config.optimizeDeps?.exclude || [],
|
|
29
|
+
"@intlayer/dictionaries-entry"
|
|
30
|
+
]
|
|
31
|
+
};
|
|
32
|
+
}
|
|
23
33
|
const externals = config.build?.rollupOptions?.external ?? [];
|
|
24
34
|
config.build = {
|
|
25
35
|
...config.build,
|
|
@@ -32,7 +42,7 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
|
32
42
|
},
|
|
33
43
|
buildStart: () => {
|
|
34
44
|
watch({
|
|
35
|
-
persistent:
|
|
45
|
+
persistent: isDev
|
|
36
46
|
});
|
|
37
47
|
},
|
|
38
48
|
configureServer: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport process from 'process';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\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 } = intlayerConfig.content;\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = { ...process.env, ...loadEnv(mode, process.cwd()), ...env };\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 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 persistent:
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport process from 'process';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\nconst isDev = process.env.NODE_ENV === 'development';\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 } = intlayerConfig.content;\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = { ...process.env, ...loadEnv(mode, process.cwd()), ...env };\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 (isDev) {\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 persistent: isDev,\n });\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;AACpD,SAAS,eAA4B;AAOrC,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAahC,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,QAAQ,IAAI,eAAe;AAG5C,UAAM,MAAM,kBAAkB,MAAM;AAEpC,YAAQ,MAAM,EAAE,GAAG,QAAQ,KAAK,GAAG,QAAQ,MAAM,QAAQ,IAAI,CAAC,GAAG,GAAG,IAAI;AAExE,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,OAAO;AAET,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,MACJ,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AAAA,EACA,iBAAiB,MAAM;AAAA,EAEvB;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/intlayerPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAG5C,KAAK,aAAa,GAAG,EAEpB,CAAC;
|
|
1
|
+
{"version":3,"file":"intlayerPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/intlayerPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAG5C,KAAK,aAAa,GAAG,EAEpB,CAAC;AAIF;;;;;;;;;;MAUM;AACN,eAAO,MAAM,cAAc,oBAAoB,aAAa,KAAQ,MA0DlE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Internationalization layer for React applications. Declare your multilingual contant in the same lever than your component. Powered by TypeScript, declaration files.",
|
|
6
6
|
"keywords": [
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
"react-cookie": "^7.2.2",
|
|
92
92
|
"vite": "^6.0.1",
|
|
93
93
|
"webpack": "^5.96.1",
|
|
94
|
-
"@intlayer/
|
|
95
|
-
"@intlayer/
|
|
96
|
-
"@intlayer/
|
|
97
|
-
"@intlayer/
|
|
98
|
-
"@intlayer/
|
|
94
|
+
"@intlayer/dictionaries-entry": "^3.4.9",
|
|
95
|
+
"@intlayer/webpack": "^3.4.9",
|
|
96
|
+
"@intlayer/core": "^3.4.9",
|
|
97
|
+
"@intlayer/config": "^3.4.9",
|
|
98
|
+
"@intlayer/chokidar": "^3.4.9"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@craco/types": "^7.1.0",
|
|
@@ -114,19 +114,19 @@
|
|
|
114
114
|
"tsup": "^8.3.5",
|
|
115
115
|
"typescript": "^5.7.2",
|
|
116
116
|
"@utils/ts-config": "^1.0.4",
|
|
117
|
-
"@utils/tsup-config": "^1.0.4",
|
|
118
117
|
"@utils/ts-config-types": "^1.0.4",
|
|
118
|
+
"@utils/tsup-config": "^1.0.4",
|
|
119
119
|
"@utils/eslint-config": "^1.0.4"
|
|
120
120
|
},
|
|
121
121
|
"peerDependencies": {
|
|
122
122
|
"react": ">=16.0.0 <19.0.0",
|
|
123
123
|
"react-dom": ">=16.0.0 <19.0.0",
|
|
124
|
-
"@intlayer/
|
|
125
|
-
"@intlayer/
|
|
126
|
-
"@intlayer/
|
|
127
|
-
"intlayer": "^3.4.
|
|
128
|
-
"
|
|
129
|
-
"@intlayer/
|
|
124
|
+
"@intlayer/chokidar": "^3.4.9",
|
|
125
|
+
"@intlayer/config": "^3.4.9",
|
|
126
|
+
"@intlayer/core": "^3.4.9",
|
|
127
|
+
"@intlayer/webpack": "^3.4.9",
|
|
128
|
+
"intlayer": "^3.4.9",
|
|
129
|
+
"@intlayer/dictionaries-entry": "^3.4.9"
|
|
130
130
|
},
|
|
131
131
|
"engines": {
|
|
132
132
|
"node": ">=14.18"
|