react-intlayer 3.4.9 → 3.5.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.
- package/dist/cjs/vite/index.cjs +25 -0
- package/dist/cjs/vite/index.cjs.map +1 -0
- package/dist/cjs/vite/intlayerMiddlewarePlugin.cjs +98 -0
- package/dist/cjs/vite/intlayerMiddlewarePlugin.cjs.map +1 -0
- package/dist/cjs/vite/intlayerPlugin.cjs +8 -7
- package/dist/cjs/vite/intlayerPlugin.cjs.map +1 -1
- package/dist/esm/vite/index.mjs +3 -0
- package/dist/esm/vite/index.mjs.map +1 -0
- package/dist/esm/vite/intlayerMiddlewarePlugin.mjs +78 -0
- package/dist/esm/vite/intlayerMiddlewarePlugin.mjs.map +1 -0
- package/dist/esm/vite/intlayerPlugin.mjs +8 -7
- package/dist/esm/vite/intlayerPlugin.mjs.map +1 -1
- package/dist/types/vite/index.d.ts +3 -0
- package/dist/types/vite/index.d.ts.map +1 -0
- package/dist/types/vite/intlayerMiddlewarePlugin.d.ts +13 -0
- package/dist/types/vite/intlayerMiddlewarePlugin.d.ts.map +1 -0
- package/dist/types/vite/intlayerPlugin.d.ts.map +1 -1
- package/package.json +20 -19
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var vite_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(vite_exports);
|
|
18
|
+
__reExport(vite_exports, require('./intlayerPlugin.cjs'), module.exports);
|
|
19
|
+
__reExport(vite_exports, require('./intlayerMiddlewarePlugin.cjs'), module.exports);
|
|
20
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
+
0 && (module.exports = {
|
|
22
|
+
...require('./intlayerPlugin.cjs'),
|
|
23
|
+
...require('./intlayerMiddlewarePlugin.cjs')
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/index.ts"],"sourcesContent":["export * from './intlayerPlugin';\nexport * from './intlayerMiddlewarePlugin';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAc,6BAAd;AACA,yBAAc,uCADd;","names":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var intlayerMiddlewarePlugin_exports = {};
|
|
20
|
+
__export(intlayerMiddlewarePlugin_exports, {
|
|
21
|
+
intLayerMiddlewarePlugin: () => intLayerMiddlewarePlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(intlayerMiddlewarePlugin_exports);
|
|
24
|
+
var import_config = require("@intlayer/config");
|
|
25
|
+
var import_core = require("@intlayer/core");
|
|
26
|
+
const intlayerConfig = (0, import_config.getConfiguration)();
|
|
27
|
+
const { internationalization, middleware } = intlayerConfig;
|
|
28
|
+
const { locales: supportedLocales, defaultLocale } = internationalization;
|
|
29
|
+
const { cookieName, headerName, prefixDefault } = middleware;
|
|
30
|
+
const intLayerMiddlewarePlugin = (_pluginOptions = {}) => ({
|
|
31
|
+
name: "vite-intlayer-middleware-plugin",
|
|
32
|
+
configureServer: (server) => {
|
|
33
|
+
server.middlewares.use((req, res, next) => {
|
|
34
|
+
if (req.url?.startsWith("/node_modules") || req.url?.startsWith("/@") || req.url?.split("?")[0].match(/\.[a-z]+$/i)) {
|
|
35
|
+
return next();
|
|
36
|
+
}
|
|
37
|
+
const originalUrl = req.url ?? "/";
|
|
38
|
+
const cookies = parseCookies(req.headers.cookie ?? "");
|
|
39
|
+
const cookieLocale = cookies[cookieName];
|
|
40
|
+
const headers = req.headers;
|
|
41
|
+
const headerLocale = headers[headerName];
|
|
42
|
+
const pathParts = originalUrl.split("?")[0].split("/").filter(Boolean);
|
|
43
|
+
const firstPart = pathParts[0];
|
|
44
|
+
const pathLocale = pathParts[0] && supportedLocales.includes(firstPart) ? pathParts[0] : void 0;
|
|
45
|
+
if (!pathLocale) {
|
|
46
|
+
let locale;
|
|
47
|
+
if (!locale && cookieLocale && supportedLocales.includes(cookieLocale)) {
|
|
48
|
+
locale = cookieLocale;
|
|
49
|
+
}
|
|
50
|
+
if (!locale && headerLocale && supportedLocales.includes(headerLocale)) {
|
|
51
|
+
locale = headerLocale;
|
|
52
|
+
}
|
|
53
|
+
if (!locale) {
|
|
54
|
+
const detectedLocale = (0, import_core.localeDetector)(
|
|
55
|
+
headers,
|
|
56
|
+
supportedLocales,
|
|
57
|
+
defaultLocale
|
|
58
|
+
);
|
|
59
|
+
locale = detectedLocale;
|
|
60
|
+
}
|
|
61
|
+
req.url = formatUrlWithLocale(originalUrl, locale);
|
|
62
|
+
if (req.url === originalUrl) {
|
|
63
|
+
return next();
|
|
64
|
+
}
|
|
65
|
+
res.writeHead(301, { Location: req.url });
|
|
66
|
+
return res.end();
|
|
67
|
+
}
|
|
68
|
+
if (pathLocale.toString() === defaultLocale.toString() && !prefixDefault) {
|
|
69
|
+
req.url = (0, import_core.getPathWithoutLocale)(originalUrl, supportedLocales);
|
|
70
|
+
res.writeHead(301, { Location: req.url });
|
|
71
|
+
return res.end();
|
|
72
|
+
}
|
|
73
|
+
return next();
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const parseCookies = (cookieHeader) => cookieHeader.split(";").reduce(
|
|
78
|
+
(acc, cookie) => {
|
|
79
|
+
const [key, val] = cookie.trim().split("=");
|
|
80
|
+
acc[key] = val;
|
|
81
|
+
return acc;
|
|
82
|
+
},
|
|
83
|
+
{}
|
|
84
|
+
);
|
|
85
|
+
const formatUrlWithLocale = (url, locale) => {
|
|
86
|
+
if (locale.toString() === defaultLocale.toString()) {
|
|
87
|
+
if (prefixDefault) {
|
|
88
|
+
return `/${locale}${url}`;
|
|
89
|
+
}
|
|
90
|
+
return url;
|
|
91
|
+
}
|
|
92
|
+
return `/${locale}${url}`;
|
|
93
|
+
};
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
intLayerMiddlewarePlugin
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=intlayerMiddlewarePlugin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/intlayerMiddlewarePlugin.ts"],"sourcesContent":["import { getConfiguration, Locales } from '@intlayer/config';\nimport {\n getPathWithoutLocale,\n localeDetector as localeDetector,\n} from '@intlayer/core';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { type Plugin } from 'vite';\n\nconst intlayerConfig = getConfiguration();\nconst { internationalization, middleware } = intlayerConfig;\n\nconst { locales: supportedLocales, defaultLocale } = internationalization;\nconst { cookieName, headerName, prefixDefault } = middleware;\n\n/**\n * A Vite plugin that integrates IntLayer middleware into the build process\n *\n * ```ts\n * // Example usage of the plugin in a Vite configuration\n * export default defineConfig({\n * plugins: [ intLayerMiddlewarePlugin() ],\n * });\n * ```\n */\nexport const intLayerMiddlewarePlugin = (_pluginOptions = {}): Plugin => ({\n name: 'vite-intlayer-middleware-plugin',\n\n configureServer: (server) => {\n // server.middlewares is a Connect instance; you can add middleware here\n server.middlewares.use((req, res, next) => {\n // Skip if request looks like a static asset or internal Vite request\n if (\n req.url?.startsWith('/node_modules') ||\n req.url?.startsWith('/@') ||\n req.url?.split('?')[0].match(/\\.[a-z]+$/i) // checks if URL has a file extension\n ) {\n return next();\n }\n\n const originalUrl = req.url ?? '/';\n\n const cookies = parseCookies(req.headers.cookie ?? '');\n const cookieLocale = cookies[cookieName];\n\n const headers = req.headers;\n const headerLocale = headers[headerName];\n\n const pathParts = originalUrl.split('?')[0].split('/').filter(Boolean);\n\n const firstPart = pathParts[0] as unknown as Locales;\n\n const pathLocale =\n pathParts[0] && supportedLocales.includes(firstPart)\n ? pathParts[0]\n : undefined;\n\n if (!pathLocale) {\n let locale;\n\n // Try to get the locale from the request cookies\n if (\n !locale &&\n cookieLocale &&\n supportedLocales.includes(cookieLocale as Locales)\n ) {\n locale = cookieLocale as Locales;\n }\n\n // Try to get the locale from the request headers\n if (\n !locale &&\n headerLocale &&\n supportedLocales.includes(headerLocale as Locales)\n ) {\n locale = headerLocale as Locales;\n }\n\n // Get the locale from the negotiator\n if (!locale) {\n const detectedLocale = localeDetector(\n headers as Record<string, string>,\n supportedLocales,\n defaultLocale\n );\n locale = detectedLocale;\n }\n\n // Instead of redirecting, try rewriting internally:\n req.url = formatUrlWithLocale(originalUrl, locale);\n\n if (req.url === originalUrl) {\n return next();\n }\n\n res.writeHead(301, { Location: req.url });\n return res.end();\n }\n\n if (\n pathLocale.toString() === defaultLocale.toString() &&\n !prefixDefault\n ) {\n req.url = getPathWithoutLocale(originalUrl, supportedLocales);\n\n res.writeHead(301, { Location: req.url });\n return res.end();\n }\n\n return next();\n });\n },\n});\n\n// Simple cookie parser:\nconst parseCookies = (cookieHeader: string) =>\n cookieHeader.split(';').reduce(\n (acc, cookie) => {\n const [key, val] = cookie.trim().split('=');\n acc[key as keyof typeof acc] = val;\n return acc;\n },\n {} as Record<string, string>\n );\n\nconst formatUrlWithLocale = (url: string, locale: Locales) => {\n if (locale.toString() === defaultLocale.toString()) {\n if (prefixDefault) {\n return `/${locale}${url}`;\n }\n\n return url;\n }\n\n return `/${locale}${url}`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0C;AAC1C,kBAGO;AAIP,MAAM,qBAAiB,gCAAiB;AACxC,MAAM,EAAE,sBAAsB,WAAW,IAAI;AAE7C,MAAM,EAAE,SAAS,kBAAkB,cAAc,IAAI;AACrD,MAAM,EAAE,YAAY,YAAY,cAAc,IAAI;AAY3C,MAAM,2BAA2B,CAAC,iBAAiB,CAAC,OAAe;AAAA,EACxE,MAAM;AAAA,EAEN,iBAAiB,CAAC,WAAW;AAE3B,WAAO,YAAY,IAAI,CAAC,KAAK,KAAK,SAAS;AAEzC,UACE,IAAI,KAAK,WAAW,eAAe,KACnC,IAAI,KAAK,WAAW,IAAI,KACxB,IAAI,KAAK,MAAM,GAAG,EAAE,CAAC,EAAE,MAAM,YAAY,GACzC;AACA,eAAO,KAAK;AAAA,MACd;AAEA,YAAM,cAAc,IAAI,OAAO;AAE/B,YAAM,UAAU,aAAa,IAAI,QAAQ,UAAU,EAAE;AACrD,YAAM,eAAe,QAAQ,UAAU;AAEvC,YAAM,UAAU,IAAI;AACpB,YAAM,eAAe,QAAQ,UAAU;AAEvC,YAAM,YAAY,YAAY,MAAM,GAAG,EAAE,CAAC,EAAE,MAAM,GAAG,EAAE,OAAO,OAAO;AAErE,YAAM,YAAY,UAAU,CAAC;AAE7B,YAAM,aACJ,UAAU,CAAC,KAAK,iBAAiB,SAAS,SAAS,IAC/C,UAAU,CAAC,IACX;AAEN,UAAI,CAAC,YAAY;AACf,YAAI;AAGJ,YACE,CAAC,UACD,gBACA,iBAAiB,SAAS,YAAuB,GACjD;AACA,mBAAS;AAAA,QACX;AAGA,YACE,CAAC,UACD,gBACA,iBAAiB,SAAS,YAAuB,GACjD;AACA,mBAAS;AAAA,QACX;AAGA,YAAI,CAAC,QAAQ;AACX,gBAAM,qBAAiB;AAAA,YACrB;AAAA,YACA;AAAA,YACA;AAAA,UACF;AACA,mBAAS;AAAA,QACX;AAGA,YAAI,MAAM,oBAAoB,aAAa,MAAM;AAEjD,YAAI,IAAI,QAAQ,aAAa;AAC3B,iBAAO,KAAK;AAAA,QACd;AAEA,YAAI,UAAU,KAAK,EAAE,UAAU,IAAI,IAAI,CAAC;AACxC,eAAO,IAAI,IAAI;AAAA,MACjB;AAEA,UACE,WAAW,SAAS,MAAM,cAAc,SAAS,KACjD,CAAC,eACD;AACA,YAAI,UAAM,kCAAqB,aAAa,gBAAgB;AAE5D,YAAI,UAAU,KAAK,EAAE,UAAU,IAAI,IAAI,CAAC;AACxC,eAAO,IAAI,IAAI;AAAA,MACjB;AAEA,aAAO,KAAK;AAAA,IACd,CAAC;AAAA,EACH;AACF;AAGA,MAAM,eAAe,CAAC,iBACpB,aAAa,MAAM,GAAG,EAAE;AAAA,EACtB,CAAC,KAAK,WAAW;AACf,UAAM,CAAC,KAAK,GAAG,IAAI,OAAO,KAAK,EAAE,MAAM,GAAG;AAC1C,QAAI,GAAuB,IAAI;AAC/B,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;AAEF,MAAM,sBAAsB,CAAC,KAAa,WAAoB;AAC5D,MAAI,OAAO,SAAS,MAAM,cAAc,SAAS,GAAG;AAClD,QAAI,eAAe;AACjB,aAAO,IAAI,MAAM,GAAG,GAAG;AAAA,IACzB;AAEA,WAAO;AAAA,EACT;AAEA,SAAO,IAAI,MAAM,GAAG,GAAG;AACzB;","names":[]}
|
|
@@ -36,14 +36,17 @@ 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";
|
|
40
39
|
const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
41
40
|
name: "vite-intlayer-plugin",
|
|
42
41
|
config: (config, { mode }) => {
|
|
43
42
|
const intlayerConfig = (0, import_config.getConfiguration)();
|
|
44
|
-
const { mainDir, baseDir } = intlayerConfig.content;
|
|
43
|
+
const { mainDir, baseDir, watch: isWatchMode } = intlayerConfig.content;
|
|
45
44
|
const env = (0, import_config.formatEnvVariable)("vite");
|
|
46
|
-
import_process.default.env = {
|
|
45
|
+
import_process.default.env = {
|
|
46
|
+
...import_process.default.env,
|
|
47
|
+
...(0, import_vite.loadEnv)(mode, import_process.default.cwd()),
|
|
48
|
+
...env
|
|
49
|
+
};
|
|
47
50
|
const dictionariesPath = (0, import_path.join)(mainDir, "dictionaries.mjs");
|
|
48
51
|
const relativeDictionariesPath = (0, import_path.relative)(baseDir, dictionariesPath);
|
|
49
52
|
config.resolve = {
|
|
@@ -53,7 +56,7 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
|
53
56
|
"@intlayer/dictionaries-entry": (0, import_path.resolve)(relativeDictionariesPath)
|
|
54
57
|
}
|
|
55
58
|
};
|
|
56
|
-
if (
|
|
59
|
+
if (isWatchMode) {
|
|
57
60
|
config.optimizeDeps = {
|
|
58
61
|
...config.optimizeDeps,
|
|
59
62
|
exclude: [
|
|
@@ -73,9 +76,7 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
|
73
76
|
return config;
|
|
74
77
|
},
|
|
75
78
|
buildStart: () => {
|
|
76
|
-
(0, import_chokidar.watch)(
|
|
77
|
-
persistent: isDev
|
|
78
|
-
});
|
|
79
|
+
(0, import_chokidar.watch)();
|
|
79
80
|
},
|
|
80
81
|
configureServer: () => {
|
|
81
82
|
}
|
|
@@ -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\
|
|
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';\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/index.ts"],"sourcesContent":["export * from './intlayerPlugin';\nexport * from './intlayerMiddlewarePlugin';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import "../chunk-ZD7AOCMD.mjs";
|
|
2
|
+
import { getConfiguration } from "@intlayer/config";
|
|
3
|
+
import {
|
|
4
|
+
getPathWithoutLocale,
|
|
5
|
+
localeDetector
|
|
6
|
+
} from "@intlayer/core";
|
|
7
|
+
const intlayerConfig = getConfiguration();
|
|
8
|
+
const { internationalization, middleware } = intlayerConfig;
|
|
9
|
+
const { locales: supportedLocales, defaultLocale } = internationalization;
|
|
10
|
+
const { cookieName, headerName, prefixDefault } = middleware;
|
|
11
|
+
const intLayerMiddlewarePlugin = (_pluginOptions = {}) => ({
|
|
12
|
+
name: "vite-intlayer-middleware-plugin",
|
|
13
|
+
configureServer: (server) => {
|
|
14
|
+
server.middlewares.use((req, res, next) => {
|
|
15
|
+
if (req.url?.startsWith("/node_modules") || req.url?.startsWith("/@") || req.url?.split("?")[0].match(/\.[a-z]+$/i)) {
|
|
16
|
+
return next();
|
|
17
|
+
}
|
|
18
|
+
const originalUrl = req.url ?? "/";
|
|
19
|
+
const cookies = parseCookies(req.headers.cookie ?? "");
|
|
20
|
+
const cookieLocale = cookies[cookieName];
|
|
21
|
+
const headers = req.headers;
|
|
22
|
+
const headerLocale = headers[headerName];
|
|
23
|
+
const pathParts = originalUrl.split("?")[0].split("/").filter(Boolean);
|
|
24
|
+
const firstPart = pathParts[0];
|
|
25
|
+
const pathLocale = pathParts[0] && supportedLocales.includes(firstPart) ? pathParts[0] : void 0;
|
|
26
|
+
if (!pathLocale) {
|
|
27
|
+
let locale;
|
|
28
|
+
if (!locale && cookieLocale && supportedLocales.includes(cookieLocale)) {
|
|
29
|
+
locale = cookieLocale;
|
|
30
|
+
}
|
|
31
|
+
if (!locale && headerLocale && supportedLocales.includes(headerLocale)) {
|
|
32
|
+
locale = headerLocale;
|
|
33
|
+
}
|
|
34
|
+
if (!locale) {
|
|
35
|
+
const detectedLocale = localeDetector(
|
|
36
|
+
headers,
|
|
37
|
+
supportedLocales,
|
|
38
|
+
defaultLocale
|
|
39
|
+
);
|
|
40
|
+
locale = detectedLocale;
|
|
41
|
+
}
|
|
42
|
+
req.url = formatUrlWithLocale(originalUrl, locale);
|
|
43
|
+
if (req.url === originalUrl) {
|
|
44
|
+
return next();
|
|
45
|
+
}
|
|
46
|
+
res.writeHead(301, { Location: req.url });
|
|
47
|
+
return res.end();
|
|
48
|
+
}
|
|
49
|
+
if (pathLocale.toString() === defaultLocale.toString() && !prefixDefault) {
|
|
50
|
+
req.url = getPathWithoutLocale(originalUrl, supportedLocales);
|
|
51
|
+
res.writeHead(301, { Location: req.url });
|
|
52
|
+
return res.end();
|
|
53
|
+
}
|
|
54
|
+
return next();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const parseCookies = (cookieHeader) => cookieHeader.split(";").reduce(
|
|
59
|
+
(acc, cookie) => {
|
|
60
|
+
const [key, val] = cookie.trim().split("=");
|
|
61
|
+
acc[key] = val;
|
|
62
|
+
return acc;
|
|
63
|
+
},
|
|
64
|
+
{}
|
|
65
|
+
);
|
|
66
|
+
const formatUrlWithLocale = (url, locale) => {
|
|
67
|
+
if (locale.toString() === defaultLocale.toString()) {
|
|
68
|
+
if (prefixDefault) {
|
|
69
|
+
return `/${locale}${url}`;
|
|
70
|
+
}
|
|
71
|
+
return url;
|
|
72
|
+
}
|
|
73
|
+
return `/${locale}${url}`;
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
intLayerMiddlewarePlugin
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=intlayerMiddlewarePlugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/intlayerMiddlewarePlugin.ts"],"sourcesContent":["import { getConfiguration, Locales } from '@intlayer/config';\nimport {\n getPathWithoutLocale,\n localeDetector as localeDetector,\n} from '@intlayer/core';\n// @ts-ignore - Fix error Module '\"vite\"' has no exported member\nimport { type Plugin } from 'vite';\n\nconst intlayerConfig = getConfiguration();\nconst { internationalization, middleware } = intlayerConfig;\n\nconst { locales: supportedLocales, defaultLocale } = internationalization;\nconst { cookieName, headerName, prefixDefault } = middleware;\n\n/**\n * A Vite plugin that integrates IntLayer middleware into the build process\n *\n * ```ts\n * // Example usage of the plugin in a Vite configuration\n * export default defineConfig({\n * plugins: [ intLayerMiddlewarePlugin() ],\n * });\n * ```\n */\nexport const intLayerMiddlewarePlugin = (_pluginOptions = {}): Plugin => ({\n name: 'vite-intlayer-middleware-plugin',\n\n configureServer: (server) => {\n // server.middlewares is a Connect instance; you can add middleware here\n server.middlewares.use((req, res, next) => {\n // Skip if request looks like a static asset or internal Vite request\n if (\n req.url?.startsWith('/node_modules') ||\n req.url?.startsWith('/@') ||\n req.url?.split('?')[0].match(/\\.[a-z]+$/i) // checks if URL has a file extension\n ) {\n return next();\n }\n\n const originalUrl = req.url ?? '/';\n\n const cookies = parseCookies(req.headers.cookie ?? '');\n const cookieLocale = cookies[cookieName];\n\n const headers = req.headers;\n const headerLocale = headers[headerName];\n\n const pathParts = originalUrl.split('?')[0].split('/').filter(Boolean);\n\n const firstPart = pathParts[0] as unknown as Locales;\n\n const pathLocale =\n pathParts[0] && supportedLocales.includes(firstPart)\n ? pathParts[0]\n : undefined;\n\n if (!pathLocale) {\n let locale;\n\n // Try to get the locale from the request cookies\n if (\n !locale &&\n cookieLocale &&\n supportedLocales.includes(cookieLocale as Locales)\n ) {\n locale = cookieLocale as Locales;\n }\n\n // Try to get the locale from the request headers\n if (\n !locale &&\n headerLocale &&\n supportedLocales.includes(headerLocale as Locales)\n ) {\n locale = headerLocale as Locales;\n }\n\n // Get the locale from the negotiator\n if (!locale) {\n const detectedLocale = localeDetector(\n headers as Record<string, string>,\n supportedLocales,\n defaultLocale\n );\n locale = detectedLocale;\n }\n\n // Instead of redirecting, try rewriting internally:\n req.url = formatUrlWithLocale(originalUrl, locale);\n\n if (req.url === originalUrl) {\n return next();\n }\n\n res.writeHead(301, { Location: req.url });\n return res.end();\n }\n\n if (\n pathLocale.toString() === defaultLocale.toString() &&\n !prefixDefault\n ) {\n req.url = getPathWithoutLocale(originalUrl, supportedLocales);\n\n res.writeHead(301, { Location: req.url });\n return res.end();\n }\n\n return next();\n });\n },\n});\n\n// Simple cookie parser:\nconst parseCookies = (cookieHeader: string) =>\n cookieHeader.split(';').reduce(\n (acc, cookie) => {\n const [key, val] = cookie.trim().split('=');\n acc[key as keyof typeof acc] = val;\n return acc;\n },\n {} as Record<string, string>\n );\n\nconst formatUrlWithLocale = (url: string, locale: Locales) => {\n if (locale.toString() === defaultLocale.toString()) {\n if (prefixDefault) {\n return `/${locale}${url}`;\n }\n\n return url;\n }\n\n return `/${locale}${url}`;\n};\n"],"mappings":";AAAA,SAAS,wBAAiC;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAIP,MAAM,iBAAiB,iBAAiB;AACxC,MAAM,EAAE,sBAAsB,WAAW,IAAI;AAE7C,MAAM,EAAE,SAAS,kBAAkB,cAAc,IAAI;AACrD,MAAM,EAAE,YAAY,YAAY,cAAc,IAAI;AAY3C,MAAM,2BAA2B,CAAC,iBAAiB,CAAC,OAAe;AAAA,EACxE,MAAM;AAAA,EAEN,iBAAiB,CAAC,WAAW;AAE3B,WAAO,YAAY,IAAI,CAAC,KAAK,KAAK,SAAS;AAEzC,UACE,IAAI,KAAK,WAAW,eAAe,KACnC,IAAI,KAAK,WAAW,IAAI,KACxB,IAAI,KAAK,MAAM,GAAG,EAAE,CAAC,EAAE,MAAM,YAAY,GACzC;AACA,eAAO,KAAK;AAAA,MACd;AAEA,YAAM,cAAc,IAAI,OAAO;AAE/B,YAAM,UAAU,aAAa,IAAI,QAAQ,UAAU,EAAE;AACrD,YAAM,eAAe,QAAQ,UAAU;AAEvC,YAAM,UAAU,IAAI;AACpB,YAAM,eAAe,QAAQ,UAAU;AAEvC,YAAM,YAAY,YAAY,MAAM,GAAG,EAAE,CAAC,EAAE,MAAM,GAAG,EAAE,OAAO,OAAO;AAErE,YAAM,YAAY,UAAU,CAAC;AAE7B,YAAM,aACJ,UAAU,CAAC,KAAK,iBAAiB,SAAS,SAAS,IAC/C,UAAU,CAAC,IACX;AAEN,UAAI,CAAC,YAAY;AACf,YAAI;AAGJ,YACE,CAAC,UACD,gBACA,iBAAiB,SAAS,YAAuB,GACjD;AACA,mBAAS;AAAA,QACX;AAGA,YACE,CAAC,UACD,gBACA,iBAAiB,SAAS,YAAuB,GACjD;AACA,mBAAS;AAAA,QACX;AAGA,YAAI,CAAC,QAAQ;AACX,gBAAM,iBAAiB;AAAA,YACrB;AAAA,YACA;AAAA,YACA;AAAA,UACF;AACA,mBAAS;AAAA,QACX;AAGA,YAAI,MAAM,oBAAoB,aAAa,MAAM;AAEjD,YAAI,IAAI,QAAQ,aAAa;AAC3B,iBAAO,KAAK;AAAA,QACd;AAEA,YAAI,UAAU,KAAK,EAAE,UAAU,IAAI,IAAI,CAAC;AACxC,eAAO,IAAI,IAAI;AAAA,MACjB;AAEA,UACE,WAAW,SAAS,MAAM,cAAc,SAAS,KACjD,CAAC,eACD;AACA,YAAI,MAAM,qBAAqB,aAAa,gBAAgB;AAE5D,YAAI,UAAU,KAAK,EAAE,UAAU,IAAI,IAAI,CAAC;AACxC,eAAO,IAAI,IAAI;AAAA,MACjB;AAEA,aAAO,KAAK;AAAA,IACd,CAAC;AAAA,EACH;AACF;AAGA,MAAM,eAAe,CAAC,iBACpB,aAAa,MAAM,GAAG,EAAE;AAAA,EACtB,CAAC,KAAK,WAAW;AACf,UAAM,CAAC,KAAK,GAAG,IAAI,OAAO,KAAK,EAAE,MAAM,GAAG;AAC1C,QAAI,GAAuB,IAAI;AAC/B,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;AAEF,MAAM,sBAAsB,CAAC,KAAa,WAAoB;AAC5D,MAAI,OAAO,SAAS,MAAM,cAAc,SAAS,GAAG;AAClD,QAAI,eAAe;AACjB,aAAO,IAAI,MAAM,GAAG,GAAG;AAAA,IACzB;AAEA,WAAO;AAAA,EACT;AAEA,SAAO,IAAI,MAAM,GAAG,GAAG;AACzB;","names":[]}
|
|
@@ -4,14 +4,17 @@ 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";
|
|
8
7
|
const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
9
8
|
name: "vite-intlayer-plugin",
|
|
10
9
|
config: (config, { mode }) => {
|
|
11
10
|
const intlayerConfig = getConfiguration();
|
|
12
|
-
const { mainDir, baseDir } = intlayerConfig.content;
|
|
11
|
+
const { mainDir, baseDir, watch: isWatchMode } = intlayerConfig.content;
|
|
13
12
|
const env = formatEnvVariable("vite");
|
|
14
|
-
process.env = {
|
|
13
|
+
process.env = {
|
|
14
|
+
...process.env,
|
|
15
|
+
...loadEnv(mode, process.cwd()),
|
|
16
|
+
...env
|
|
17
|
+
};
|
|
15
18
|
const dictionariesPath = join(mainDir, "dictionaries.mjs");
|
|
16
19
|
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
17
20
|
config.resolve = {
|
|
@@ -21,7 +24,7 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
|
21
24
|
"@intlayer/dictionaries-entry": resolve(relativeDictionariesPath)
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
|
-
if (
|
|
27
|
+
if (isWatchMode) {
|
|
25
28
|
config.optimizeDeps = {
|
|
26
29
|
...config.optimizeDeps,
|
|
27
30
|
exclude: [
|
|
@@ -41,9 +44,7 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
|
|
|
41
44
|
return config;
|
|
42
45
|
},
|
|
43
46
|
buildStart: () => {
|
|
44
|
-
watch(
|
|
45
|
-
persistent: isDev
|
|
46
|
-
});
|
|
47
|
+
watch();
|
|
47
48
|
},
|
|
48
49
|
configureServer: () => {
|
|
49
50
|
}
|
|
@@ -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\
|
|
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';\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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Plugin } from '../vite';
|
|
2
|
+
/**
|
|
3
|
+
* A Vite plugin that integrates IntLayer middleware into the build process
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* // Example usage of the plugin in a Vite configuration
|
|
7
|
+
* export default defineConfig({
|
|
8
|
+
* plugins: [ intLayerMiddlewarePlugin() ],
|
|
9
|
+
* });
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const intLayerMiddlewarePlugin: (_pluginOptions?: {}) => Plugin;
|
|
13
|
+
//# sourceMappingURL=intlayerMiddlewarePlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intlayerMiddlewarePlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/intlayerMiddlewarePlugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAQnC;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,2BAA0B,MAuF7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/intlayerPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"intlayerPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/intlayerPlugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAG5C,KAAK,aAAa,GAAG,EAEpB,CAAC;AAEF;;;;;;;;;;MAUM;AACN,eAAO,MAAM,cAAc,oBAAoB,aAAa,KAAQ,MA4DlE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
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": [
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"require": "./dist/cjs/craco/craco.config.cjs",
|
|
56
56
|
"import": "./dist/esm/craco/craco.config.mjs"
|
|
57
57
|
},
|
|
58
|
-
"./vite
|
|
59
|
-
"types": "./dist/types/vite/
|
|
60
|
-
"require": "./dist/cjs/vite/
|
|
61
|
-
"import": "./dist/esm/vite/
|
|
58
|
+
"./vite": {
|
|
59
|
+
"types": "./dist/types/vite/index.d.ts",
|
|
60
|
+
"require": "./dist/cjs/vite/index.cjs",
|
|
61
|
+
"import": "./dist/esm/vite/index.mjs"
|
|
62
62
|
},
|
|
63
63
|
"./editor": {
|
|
64
64
|
"types": "./dist/types/editor/index.d.ts",
|
|
@@ -89,13 +89,13 @@
|
|
|
89
89
|
"cross-spawn": "^7.0.6",
|
|
90
90
|
"js-cookie": "^3.0.5",
|
|
91
91
|
"react-cookie": "^7.2.2",
|
|
92
|
-
"vite": "^6.0.
|
|
92
|
+
"vite": "^6.0.3",
|
|
93
93
|
"webpack": "^5.96.1",
|
|
94
|
-
"@intlayer/
|
|
95
|
-
"@intlayer/
|
|
96
|
-
"@intlayer/
|
|
97
|
-
"@intlayer/
|
|
98
|
-
"@intlayer/
|
|
94
|
+
"@intlayer/chokidar": "^3.5.1",
|
|
95
|
+
"@intlayer/config": "^3.5.1",
|
|
96
|
+
"@intlayer/dictionaries-entry": "^3.5.1",
|
|
97
|
+
"@intlayer/webpack": "^3.5.1",
|
|
98
|
+
"@intlayer/core": "^3.5.1"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@craco/types": "^7.1.0",
|
|
@@ -113,20 +113,21 @@
|
|
|
113
113
|
"tsc-alias": "^1.8.10",
|
|
114
114
|
"tsup": "^8.3.5",
|
|
115
115
|
"typescript": "^5.7.2",
|
|
116
|
+
"@utils/eslint-config": "^1.0.4",
|
|
116
117
|
"@utils/ts-config": "^1.0.4",
|
|
117
118
|
"@utils/ts-config-types": "^1.0.4",
|
|
118
|
-
"@utils/tsup-config": "^1.0.4"
|
|
119
|
-
"@utils/eslint-config": "^1.0.4"
|
|
119
|
+
"@utils/tsup-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
|
-
"
|
|
125
|
-
"@intlayer/config": "^3.
|
|
126
|
-
"@intlayer/
|
|
127
|
-
"@intlayer/
|
|
128
|
-
"intlayer": "^3.
|
|
129
|
-
"@intlayer/
|
|
124
|
+
"vite": ">=4.0.0",
|
|
125
|
+
"@intlayer/config": "^3.5.1",
|
|
126
|
+
"@intlayer/chokidar": "^3.5.1",
|
|
127
|
+
"@intlayer/core": "^3.5.1",
|
|
128
|
+
"@intlayer/dictionaries-entry": "^3.5.1",
|
|
129
|
+
"@intlayer/webpack": "^3.5.1",
|
|
130
|
+
"intlayer": "^3.5.1"
|
|
130
131
|
},
|
|
131
132
|
"engines": {
|
|
132
133
|
"node": ">=14.18"
|