@intlify/unplugin-vue-i18n 4.0.0 → 5.0.0-beta.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/README.md +12 -4
- package/lib/index.cjs +77 -116
- package/lib/index.mjs +75 -118
- package/lib/types.d.cts +0 -3
- package/lib/types.d.mts +0 -3
- package/lib/types.d.ts +0 -3
- package/lib/vite.cjs +3 -1
- package/lib/vite.mjs +3 -1
- package/lib/webpack.cjs +3 -1
- package/lib/webpack.mjs +3 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -353,13 +353,11 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
|
|
|
353
353
|
- **Default:** `true`
|
|
354
354
|
|
|
355
355
|
> [!IMPORTANT]
|
|
356
|
-
'jitCompilation' option
|
|
356
|
+
'jitCompilation' option is deprected in v5.
|
|
357
|
+
This option will be supported with vue-i18n until v9 latest version.
|
|
357
358
|
|
|
358
359
|
Whether locale mesages should be compiled by JIT (Just in Time) compilation with vue-i18n's message compiler.
|
|
359
360
|
|
|
360
|
-
> [!NOTE]
|
|
361
|
-
This option works with vue-i18n v9.3 and later.
|
|
362
|
-
|
|
363
361
|
JIT compilation has been supported since vue-i18n v9.3. This means that since v9 was released until now, the message compiler compiles to executable JavaScript code, however it did not work in the CSP environment. Also, since this was an AOT (Ahead of Time) compilation, it was not possible to dynamically retrieve locale messages from the back-end Database and compose locale mesages with programatic.
|
|
364
362
|
|
|
365
363
|
> [!WARNING]
|
|
@@ -376,6 +374,9 @@ Whether to tree-shake message compiler when we will be bundling.
|
|
|
376
374
|
|
|
377
375
|
If do you will use this option, you need to enable `jitCompilation` option.
|
|
378
376
|
|
|
377
|
+
> [NOTE]
|
|
378
|
+
> After v5 or later, this option can be set with or without `jitCompilation`.
|
|
379
|
+
|
|
379
380
|
> [!NOTE]
|
|
380
381
|
This option works with vue-i18n v9.3 and later.
|
|
381
382
|
|
|
@@ -546,6 +547,10 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
546
547
|
|
|
547
548
|
This option that to use i18n custom blocks in `vue-class-component`.
|
|
548
549
|
|
|
550
|
+
> [!IMPORTANT]
|
|
551
|
+
`useClassComponent` option is deprecated in v5.
|
|
552
|
+
This option will be supported with vue-i18n until v9 latest version.
|
|
553
|
+
|
|
549
554
|
### `onlyLocales`
|
|
550
555
|
|
|
551
556
|
- **Type:** `string | string[]`
|
|
@@ -562,6 +567,9 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
562
567
|
|
|
563
568
|
This option allows a smooth migration from `petite-vue-i18n` to `vue-i18n` and allows progressive enhacement.
|
|
564
569
|
|
|
570
|
+
> [!IMPORTANT]
|
|
571
|
+
`useVueI18nImportName` option is deprecated in v5.
|
|
572
|
+
This option will be supported with vue-i18n until v9 latest version.
|
|
565
573
|
|
|
566
574
|
## 📜 Changelog
|
|
567
575
|
|
package/lib/index.cjs
CHANGED
|
@@ -10,14 +10,20 @@ const shared = require('@intlify/shared');
|
|
|
10
10
|
const pluginutils = require('@rollup/pluginutils');
|
|
11
11
|
const bundleUtils = require('@intlify/bundle-utils');
|
|
12
12
|
const compilerSfc = require('@vue/compiler-sfc');
|
|
13
|
-
const fs = require('fs');
|
|
13
|
+
const fs = require('node:fs');
|
|
14
14
|
const pc = require('picocolors');
|
|
15
|
+
const module$1 = require('node:module');
|
|
16
|
+
const path = require('node:path');
|
|
15
17
|
|
|
18
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
16
19
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
17
20
|
|
|
18
21
|
const createDebug__default = /*#__PURE__*/_interopDefaultCompat(createDebug);
|
|
19
22
|
const fg__default = /*#__PURE__*/_interopDefaultCompat(fg);
|
|
23
|
+
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
20
24
|
const pc__default = /*#__PURE__*/_interopDefaultCompat(pc);
|
|
25
|
+
const module__default = /*#__PURE__*/_interopDefaultCompat(module$1);
|
|
26
|
+
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
21
27
|
|
|
22
28
|
function parseVueRequest(id) {
|
|
23
29
|
const [filename, rawQuery] = id.split(`?`, 2);
|
|
@@ -57,14 +63,39 @@ function parseVueRequest(id) {
|
|
|
57
63
|
};
|
|
58
64
|
}
|
|
59
65
|
|
|
66
|
+
const _require = module__default.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
67
|
+
function checkInstallPackage(debug) {
|
|
68
|
+
const pkgInfo = resolvePkgPath("vue-i18n", debug) || resolvePkgPath("petite-vue-i18n", debug);
|
|
69
|
+
if (!pkgInfo) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`requires 'vue-i18n' or 'petite-vue-i18n' to be present in the dependency tree.`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
debug("installed package info:", pkgInfo);
|
|
75
|
+
return pkgInfo;
|
|
76
|
+
}
|
|
77
|
+
function resolvePkgPath(id, debug) {
|
|
78
|
+
try {
|
|
79
|
+
const resolvedPath = _require.resolve(id);
|
|
80
|
+
const pkgPath = path__default.dirname(resolvedPath);
|
|
81
|
+
const pkgJson = JSON.parse(
|
|
82
|
+
fs__default.readFileSync(path__default.join(pkgPath, "package.json"), "utf-8")
|
|
83
|
+
);
|
|
84
|
+
const pkgName = pkgJson.name.startsWith("vue-i18n") ? "vue-i18n" : pkgJson.name.startsWith("petite-vue-i18n") ? "petite-vue-i18n" : "";
|
|
85
|
+
return pkgJson ? { alias: id, pkg: pkgName } : null;
|
|
86
|
+
} catch (e) {
|
|
87
|
+
debug(`cannot find '${id}'`, e);
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
60
91
|
function warn(...args) {
|
|
61
92
|
console.warn(pc__default.yellow(pc__default.bold(`[unplugin-vue-i18n] `)), ...args);
|
|
62
93
|
}
|
|
63
94
|
function error(...args) {
|
|
64
95
|
console.error(pc__default.red(pc__default.bold(`[unplugin-vue-i18n] `)), ...args);
|
|
65
96
|
}
|
|
66
|
-
async function getRaw(
|
|
67
|
-
return fs.promises.readFile(
|
|
97
|
+
async function getRaw(path2) {
|
|
98
|
+
return fs.promises.readFile(path2, { encoding: "utf-8" });
|
|
68
99
|
}
|
|
69
100
|
function raiseError(message) {
|
|
70
101
|
throw new Error(`[unplugin-vue-i18n] ${message}`);
|
|
@@ -73,11 +104,7 @@ function raiseError(message) {
|
|
|
73
104
|
const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
|
|
74
105
|
const VIRTUAL_PREFIX = "\0";
|
|
75
106
|
const debug = createDebug__default("unplugin-vue-i18n");
|
|
76
|
-
const
|
|
77
|
-
const vueI18nVersion = bundleUtils.getVueI18nVersion(debug);
|
|
78
|
-
if (vueI18nVersion === "8") {
|
|
79
|
-
warn(`vue-i18n@8 is not supported, since sinece Vue 2 was EOL on 2023.`);
|
|
80
|
-
}
|
|
107
|
+
const installedPkgInfo = checkInstallPackage(debug);
|
|
81
108
|
const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
82
109
|
debug("plugin options:", options, meta.framework);
|
|
83
110
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
@@ -102,27 +129,18 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
102
129
|
const forceStringify = !!options.forceStringify;
|
|
103
130
|
const defaultSFCLang = shared.isString(options.defaultSFCLang) ? options.defaultSFCLang : "json";
|
|
104
131
|
const globalSFCScope = !!options.globalSFCScope;
|
|
105
|
-
const useClassComponent = !!options.useClassComponent;
|
|
106
132
|
const runtimeOnly = shared.isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
|
|
107
133
|
debug("runtimeOnly", runtimeOnly);
|
|
108
|
-
const
|
|
109
|
-
debug("jitCompilation", jitCompilation);
|
|
110
|
-
const dropMessageCompiler = jitCompilation ? !!options.dropMessageCompiler : false;
|
|
134
|
+
const dropMessageCompiler = !!options.dropMessageCompiler;
|
|
111
135
|
debug("dropMessageCompiler", dropMessageCompiler);
|
|
112
|
-
const compositionOnly =
|
|
136
|
+
const compositionOnly = installedPkgInfo.pkg === "vue-i18n" ? shared.isBoolean(options.compositionOnly) ? options.compositionOnly : true : true;
|
|
113
137
|
debug("compositionOnly", compositionOnly);
|
|
114
|
-
const fullInstall =
|
|
138
|
+
const fullInstall = installedPkgInfo.pkg === "vue-i18n" ? shared.isBoolean(options.fullInstall) ? options.fullInstall : true : false;
|
|
115
139
|
debug("fullInstall", fullInstall);
|
|
116
140
|
const ssrBuild = !!options.ssr;
|
|
117
141
|
debug("ssr", ssrBuild);
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
warn(`'useVueI18nImportName' option is experimental`);
|
|
121
|
-
}
|
|
122
|
-
debug("useVueI18nImportName", useVueI18nImportName);
|
|
123
|
-
const getVueI18nAliasName = () => vueI18nVersion === "9" ? "vue-i18n" : vueI18nVersion === "unknown" && installedPkg === "petite-vue-i18n" && shared.isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : installedPkg;
|
|
124
|
-
const getVueI18nAliasPath = (aliasName, { ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
125
|
-
return `${aliasName}/dist/${installedPkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
|
|
142
|
+
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
143
|
+
return `${installedPkgInfo.alias}/dist/${installedPkgInfo.pkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
|
|
126
144
|
};
|
|
127
145
|
const allowDynamic = !!options.allowDynamic;
|
|
128
146
|
debug("allowDynamic", allowDynamic);
|
|
@@ -132,7 +150,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
132
150
|
debug("escapeHtml", escapeHtml);
|
|
133
151
|
let isProduction = false;
|
|
134
152
|
let sourceMap = false;
|
|
135
|
-
const vueI18nAliasName =
|
|
153
|
+
const vueI18nAliasName = installedPkgInfo.alias;
|
|
154
|
+
debug(`vue-i18n alias name: ${vueI18nAliasName}`);
|
|
136
155
|
return {
|
|
137
156
|
name: "unplugin-vue-i18n",
|
|
138
157
|
/**
|
|
@@ -145,69 +164,28 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
145
164
|
*/
|
|
146
165
|
enforce: meta.framework === "vite" ? "pre" : "post",
|
|
147
166
|
vite: {
|
|
148
|
-
config(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (shared.isArray(config.resolve.alias)) {
|
|
156
|
-
config.resolve.alias.push({
|
|
157
|
-
find: vueI18nAliasName,
|
|
158
|
-
replacement: getVueI18nAliasPath(vueI18nAliasName, {
|
|
159
|
-
ssr: ssrBuild,
|
|
160
|
-
runtimeOnly
|
|
161
|
-
})
|
|
162
|
-
});
|
|
163
|
-
} else if (shared.isObject(config.resolve.alias)) {
|
|
164
|
-
config.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath(vueI18nAliasName, {
|
|
165
|
-
ssr: ssrBuild,
|
|
166
|
-
runtimeOnly
|
|
167
|
-
});
|
|
167
|
+
config() {
|
|
168
|
+
const defineConfig = {
|
|
169
|
+
define: {
|
|
170
|
+
__VUE_I18N_LEGACY_API__: !compositionOnly,
|
|
171
|
+
__VUE_I18N_FULL_INSTALL__: fullInstall,
|
|
172
|
+
__INTLIFY_DROP_MESSAGE_COMPILER__: dropMessageCompiler,
|
|
173
|
+
__VUE_I18N_PROD_DEVTOOLS__: false
|
|
168
174
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
};
|
|
176
|
+
debug("define Config:", defineConfig);
|
|
177
|
+
const aliasConfig = {
|
|
178
|
+
resolve: {
|
|
179
|
+
alias: {
|
|
180
|
+
[vueI18nAliasName]: getVueI18nAliasPath({
|
|
173
181
|
ssr: ssrBuild,
|
|
174
182
|
runtimeOnly
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
);
|
|
178
|
-
} else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
179
|
-
config.resolve = normalizeConfigResolveAlias(
|
|
180
|
-
config.resolve,
|
|
181
|
-
meta.framework
|
|
182
|
-
);
|
|
183
|
-
if (shared.isArray(config.resolve.alias)) {
|
|
184
|
-
config.resolve.alias.push({
|
|
185
|
-
find: vueI18nAliasName,
|
|
186
|
-
replacement: `petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js`
|
|
187
|
-
});
|
|
188
|
-
} else {
|
|
189
|
-
config.resolve.alias[vueI18nAliasName] = `petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js`;
|
|
183
|
+
})
|
|
184
|
+
}
|
|
190
185
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
config.define["__VUE_I18N_LEGACY_API__"] = !compositionOnly;
|
|
195
|
-
debug(
|
|
196
|
-
`set __VUE_I18N_LEGACY_API__ is '${config.define["__VUE_I18N_LEGACY_API__"]}'`
|
|
197
|
-
);
|
|
198
|
-
config.define["__VUE_I18N_FULL_INSTALL__"] = fullInstall;
|
|
199
|
-
debug(
|
|
200
|
-
`set __VUE_I18N_FULL_INSTALL__ is '${config.define["__VUE_I18N_FULL_INSTALL__"]}'`
|
|
201
|
-
);
|
|
202
|
-
config.define["__INTLIFY_JIT_COMPILATION__"] = jitCompilation;
|
|
203
|
-
debug(
|
|
204
|
-
`set __INTLIFY_JIT_COMPILATION__ is '${config.define["__INTLIFY_JIT_COMPILATION__"]}'`
|
|
205
|
-
);
|
|
206
|
-
config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"] = dropMessageCompiler;
|
|
207
|
-
debug(
|
|
208
|
-
`set __INTLIFY_DROP_MESSAGE_COMPILER__ is '${config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"]}'`
|
|
209
|
-
);
|
|
210
|
-
config.define["__VUE_I18N_PROD_DEVTOOLS__"] = false;
|
|
186
|
+
};
|
|
187
|
+
debug("alias Config:", aliasConfig);
|
|
188
|
+
return shared.assign(defineConfig, aliasConfig);
|
|
211
189
|
},
|
|
212
190
|
configResolved(config) {
|
|
213
191
|
isProduction = config.isProduction;
|
|
@@ -257,11 +235,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
257
235
|
{
|
|
258
236
|
inSourceMap,
|
|
259
237
|
isGlobal: globalSFCScope,
|
|
260
|
-
useClassComponent,
|
|
261
238
|
allowDynamic,
|
|
262
239
|
strictMessage,
|
|
263
240
|
escapeHtml,
|
|
264
|
-
jit:
|
|
241
|
+
jit: true,
|
|
265
242
|
onlyLocales,
|
|
266
243
|
forceStringify
|
|
267
244
|
}
|
|
@@ -274,9 +251,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
274
251
|
return;
|
|
275
252
|
return {
|
|
276
253
|
code: generatedCode,
|
|
277
|
-
|
|
278
|
-
map: jitCompilation ? { mappings: "" } : sourceMap ? map : { mappings: "" }
|
|
279
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
254
|
+
map: { mappings: "" }
|
|
280
255
|
};
|
|
281
256
|
} else {
|
|
282
257
|
return result;
|
|
@@ -304,21 +279,16 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
304
279
|
compiler.options.resolve,
|
|
305
280
|
meta.framework
|
|
306
281
|
);
|
|
307
|
-
|
|
308
|
-
|
|
282
|
+
compiler.options.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath({
|
|
283
|
+
ssr: ssrBuild,
|
|
284
|
+
runtimeOnly
|
|
285
|
+
});
|
|
286
|
+
debug(
|
|
287
|
+
`set ${vueI18nAliasName}: ${getVueI18nAliasPath({
|
|
309
288
|
ssr: ssrBuild,
|
|
310
289
|
runtimeOnly
|
|
311
|
-
})
|
|
312
|
-
|
|
313
|
-
`set ${vueI18nAliasName}: ${getVueI18nAliasPath(vueI18nAliasName, {
|
|
314
|
-
ssr: ssrBuild,
|
|
315
|
-
runtimeOnly
|
|
316
|
-
})}`
|
|
317
|
-
);
|
|
318
|
-
} else if (!isProduction && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
319
|
-
compiler.options.resolve.alias[vueI18nAliasName] = `petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js`;
|
|
320
|
-
debug(`petite-vue-i18n alias name: ${vueI18nAliasName}`);
|
|
321
|
-
}
|
|
290
|
+
})}`
|
|
291
|
+
);
|
|
322
292
|
loadWebpack().then((webpack) => {
|
|
323
293
|
if (webpack) {
|
|
324
294
|
compiler.options.plugins.push(
|
|
@@ -370,8 +340,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
370
340
|
{
|
|
371
341
|
forceStringify,
|
|
372
342
|
strictMessage,
|
|
373
|
-
escapeHtml
|
|
374
|
-
useClassComponent
|
|
343
|
+
escapeHtml
|
|
375
344
|
}
|
|
376
345
|
);
|
|
377
346
|
return {
|
|
@@ -406,11 +375,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
406
375
|
{
|
|
407
376
|
inSourceMap,
|
|
408
377
|
isGlobal: globalSFCScope,
|
|
409
|
-
useClassComponent,
|
|
410
378
|
allowDynamic,
|
|
411
379
|
strictMessage,
|
|
412
380
|
escapeHtml,
|
|
413
|
-
jit:
|
|
381
|
+
jit: true,
|
|
414
382
|
onlyLocales,
|
|
415
383
|
forceStringify
|
|
416
384
|
}
|
|
@@ -424,8 +392,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
424
392
|
return {
|
|
425
393
|
code: generatedCode,
|
|
426
394
|
// prettier-ignore
|
|
427
|
-
map:
|
|
428
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
395
|
+
map: { mappings: "" }
|
|
429
396
|
};
|
|
430
397
|
}
|
|
431
398
|
} else {
|
|
@@ -445,8 +412,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
445
412
|
{
|
|
446
413
|
inSourceMap,
|
|
447
414
|
isGlobal: globalSFCScope,
|
|
448
|
-
|
|
449
|
-
jit: jitCompilation,
|
|
415
|
+
jit: true,
|
|
450
416
|
strictMessage,
|
|
451
417
|
escapeHtml,
|
|
452
418
|
onlyLocales,
|
|
@@ -469,8 +435,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
469
435
|
return {
|
|
470
436
|
code: generatedCode,
|
|
471
437
|
// prettier-ignore
|
|
472
|
-
map:
|
|
473
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
438
|
+
map: { mappings: "" }
|
|
474
439
|
};
|
|
475
440
|
}
|
|
476
441
|
}
|
|
@@ -515,8 +480,7 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
515
480
|
onlyLocales = [],
|
|
516
481
|
strictMessage = true,
|
|
517
482
|
escapeHtml = false,
|
|
518
|
-
|
|
519
|
-
jit = false
|
|
483
|
+
jit = true
|
|
520
484
|
}) {
|
|
521
485
|
const codes = [];
|
|
522
486
|
for (const res of resources) {
|
|
@@ -527,7 +491,6 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
527
491
|
const generate = /json5?/.test(ext) ? bundleUtils.generateJSON : bundleUtils.generateYAML;
|
|
528
492
|
const parseOptions = getOptions(res, isProduction, {}, false, {
|
|
529
493
|
isGlobal,
|
|
530
|
-
useClassComponent,
|
|
531
494
|
jit,
|
|
532
495
|
onlyLocales,
|
|
533
496
|
strictMessage,
|
|
@@ -601,11 +564,10 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
601
564
|
forceStringify = false,
|
|
602
565
|
isGlobal = false,
|
|
603
566
|
onlyLocales = [],
|
|
604
|
-
useClassComponent = false,
|
|
605
567
|
allowDynamic = false,
|
|
606
568
|
strictMessage = true,
|
|
607
569
|
escapeHtml = false,
|
|
608
|
-
jit =
|
|
570
|
+
jit = true
|
|
609
571
|
}) {
|
|
610
572
|
const mode = isProduction ? "production" : "development";
|
|
611
573
|
const baseOptions = {
|
|
@@ -613,7 +575,6 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
613
575
|
sourceMap,
|
|
614
576
|
inSourceMap,
|
|
615
577
|
forceStringify,
|
|
616
|
-
useClassComponent,
|
|
617
578
|
allowDynamic,
|
|
618
579
|
strictMessage,
|
|
619
580
|
escapeHtml,
|
package/lib/index.mjs
CHANGED
|
@@ -2,12 +2,14 @@ import { createUnplugin } from 'unplugin';
|
|
|
2
2
|
import { normalize, parse } from 'pathe';
|
|
3
3
|
import createDebug from 'debug';
|
|
4
4
|
import fg from 'fast-glob';
|
|
5
|
-
import { isArray, isString, isBoolean,
|
|
5
|
+
import { isArray, isString, isBoolean, assign, isNumber, isEmptyObject, generateCodeFrame } from '@intlify/shared';
|
|
6
6
|
import { createFilter } from '@rollup/pluginutils';
|
|
7
|
-
import {
|
|
7
|
+
import { generateJSON, generateYAML, generateJavaScript } from '@intlify/bundle-utils';
|
|
8
8
|
import { parse as parse$1 } from '@vue/compiler-sfc';
|
|
9
|
-
import { promises } from 'fs';
|
|
9
|
+
import fs, { promises } from 'node:fs';
|
|
10
10
|
import pc from 'picocolors';
|
|
11
|
+
import module from 'node:module';
|
|
12
|
+
import path from 'node:path';
|
|
11
13
|
|
|
12
14
|
function parseVueRequest(id) {
|
|
13
15
|
const [filename, rawQuery] = id.split(`?`, 2);
|
|
@@ -47,14 +49,39 @@ function parseVueRequest(id) {
|
|
|
47
49
|
};
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
const _require = module.createRequire(import.meta.url);
|
|
53
|
+
function checkInstallPackage(debug) {
|
|
54
|
+
const pkgInfo = resolvePkgPath("vue-i18n", debug) || resolvePkgPath("petite-vue-i18n", debug);
|
|
55
|
+
if (!pkgInfo) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`requires 'vue-i18n' or 'petite-vue-i18n' to be present in the dependency tree.`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
debug("installed package info:", pkgInfo);
|
|
61
|
+
return pkgInfo;
|
|
62
|
+
}
|
|
63
|
+
function resolvePkgPath(id, debug) {
|
|
64
|
+
try {
|
|
65
|
+
const resolvedPath = _require.resolve(id);
|
|
66
|
+
const pkgPath = path.dirname(resolvedPath);
|
|
67
|
+
const pkgJson = JSON.parse(
|
|
68
|
+
fs.readFileSync(path.join(pkgPath, "package.json"), "utf-8")
|
|
69
|
+
);
|
|
70
|
+
const pkgName = pkgJson.name.startsWith("vue-i18n") ? "vue-i18n" : pkgJson.name.startsWith("petite-vue-i18n") ? "petite-vue-i18n" : "";
|
|
71
|
+
return pkgJson ? { alias: id, pkg: pkgName } : null;
|
|
72
|
+
} catch (e) {
|
|
73
|
+
debug(`cannot find '${id}'`, e);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
50
77
|
function warn(...args) {
|
|
51
78
|
console.warn(pc.yellow(pc.bold(`[unplugin-vue-i18n] `)), ...args);
|
|
52
79
|
}
|
|
53
80
|
function error(...args) {
|
|
54
81
|
console.error(pc.red(pc.bold(`[unplugin-vue-i18n] `)), ...args);
|
|
55
82
|
}
|
|
56
|
-
async function getRaw(
|
|
57
|
-
return promises.readFile(
|
|
83
|
+
async function getRaw(path2) {
|
|
84
|
+
return promises.readFile(path2, { encoding: "utf-8" });
|
|
58
85
|
}
|
|
59
86
|
function raiseError(message) {
|
|
60
87
|
throw new Error(`[unplugin-vue-i18n] ${message}`);
|
|
@@ -63,11 +90,7 @@ function raiseError(message) {
|
|
|
63
90
|
const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
|
|
64
91
|
const VIRTUAL_PREFIX = "\0";
|
|
65
92
|
const debug = createDebug("unplugin-vue-i18n");
|
|
66
|
-
const
|
|
67
|
-
const vueI18nVersion = getVueI18nVersion(debug);
|
|
68
|
-
if (vueI18nVersion === "8") {
|
|
69
|
-
warn(`vue-i18n@8 is not supported, since sinece Vue 2 was EOL on 2023.`);
|
|
70
|
-
}
|
|
93
|
+
const installedPkgInfo = checkInstallPackage(debug);
|
|
71
94
|
const unplugin = createUnplugin((options = {}, meta) => {
|
|
72
95
|
debug("plugin options:", options, meta.framework);
|
|
73
96
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
@@ -92,27 +115,18 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
92
115
|
const forceStringify = !!options.forceStringify;
|
|
93
116
|
const defaultSFCLang = isString(options.defaultSFCLang) ? options.defaultSFCLang : "json";
|
|
94
117
|
const globalSFCScope = !!options.globalSFCScope;
|
|
95
|
-
const useClassComponent = !!options.useClassComponent;
|
|
96
118
|
const runtimeOnly = isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
|
|
97
119
|
debug("runtimeOnly", runtimeOnly);
|
|
98
|
-
const
|
|
99
|
-
debug("jitCompilation", jitCompilation);
|
|
100
|
-
const dropMessageCompiler = jitCompilation ? !!options.dropMessageCompiler : false;
|
|
120
|
+
const dropMessageCompiler = !!options.dropMessageCompiler;
|
|
101
121
|
debug("dropMessageCompiler", dropMessageCompiler);
|
|
102
|
-
const compositionOnly =
|
|
122
|
+
const compositionOnly = installedPkgInfo.pkg === "vue-i18n" ? isBoolean(options.compositionOnly) ? options.compositionOnly : true : true;
|
|
103
123
|
debug("compositionOnly", compositionOnly);
|
|
104
|
-
const fullInstall =
|
|
124
|
+
const fullInstall = installedPkgInfo.pkg === "vue-i18n" ? isBoolean(options.fullInstall) ? options.fullInstall : true : false;
|
|
105
125
|
debug("fullInstall", fullInstall);
|
|
106
126
|
const ssrBuild = !!options.ssr;
|
|
107
127
|
debug("ssr", ssrBuild);
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
warn(`'useVueI18nImportName' option is experimental`);
|
|
111
|
-
}
|
|
112
|
-
debug("useVueI18nImportName", useVueI18nImportName);
|
|
113
|
-
const getVueI18nAliasName = () => vueI18nVersion === "9" ? "vue-i18n" : vueI18nVersion === "unknown" && installedPkg === "petite-vue-i18n" && isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : installedPkg;
|
|
114
|
-
const getVueI18nAliasPath = (aliasName, { ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
115
|
-
return `${aliasName}/dist/${installedPkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
|
|
128
|
+
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
129
|
+
return `${installedPkgInfo.alias}/dist/${installedPkgInfo.pkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
|
|
116
130
|
};
|
|
117
131
|
const allowDynamic = !!options.allowDynamic;
|
|
118
132
|
debug("allowDynamic", allowDynamic);
|
|
@@ -122,7 +136,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
122
136
|
debug("escapeHtml", escapeHtml);
|
|
123
137
|
let isProduction = false;
|
|
124
138
|
let sourceMap = false;
|
|
125
|
-
const vueI18nAliasName =
|
|
139
|
+
const vueI18nAliasName = installedPkgInfo.alias;
|
|
140
|
+
debug(`vue-i18n alias name: ${vueI18nAliasName}`);
|
|
126
141
|
return {
|
|
127
142
|
name: "unplugin-vue-i18n",
|
|
128
143
|
/**
|
|
@@ -135,69 +150,28 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
135
150
|
*/
|
|
136
151
|
enforce: meta.framework === "vite" ? "pre" : "post",
|
|
137
152
|
vite: {
|
|
138
|
-
config(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (isArray(config.resolve.alias)) {
|
|
146
|
-
config.resolve.alias.push({
|
|
147
|
-
find: vueI18nAliasName,
|
|
148
|
-
replacement: getVueI18nAliasPath(vueI18nAliasName, {
|
|
149
|
-
ssr: ssrBuild,
|
|
150
|
-
runtimeOnly
|
|
151
|
-
})
|
|
152
|
-
});
|
|
153
|
-
} else if (isObject(config.resolve.alias)) {
|
|
154
|
-
config.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath(vueI18nAliasName, {
|
|
155
|
-
ssr: ssrBuild,
|
|
156
|
-
runtimeOnly
|
|
157
|
-
});
|
|
153
|
+
config() {
|
|
154
|
+
const defineConfig = {
|
|
155
|
+
define: {
|
|
156
|
+
__VUE_I18N_LEGACY_API__: !compositionOnly,
|
|
157
|
+
__VUE_I18N_FULL_INSTALL__: fullInstall,
|
|
158
|
+
__INTLIFY_DROP_MESSAGE_COMPILER__: dropMessageCompiler,
|
|
159
|
+
__VUE_I18N_PROD_DEVTOOLS__: false
|
|
158
160
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
};
|
|
162
|
+
debug("define Config:", defineConfig);
|
|
163
|
+
const aliasConfig = {
|
|
164
|
+
resolve: {
|
|
165
|
+
alias: {
|
|
166
|
+
[vueI18nAliasName]: getVueI18nAliasPath({
|
|
163
167
|
ssr: ssrBuild,
|
|
164
168
|
runtimeOnly
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
);
|
|
168
|
-
} else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
169
|
-
config.resolve = normalizeConfigResolveAlias(
|
|
170
|
-
config.resolve,
|
|
171
|
-
meta.framework
|
|
172
|
-
);
|
|
173
|
-
if (isArray(config.resolve.alias)) {
|
|
174
|
-
config.resolve.alias.push({
|
|
175
|
-
find: vueI18nAliasName,
|
|
176
|
-
replacement: `petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js`
|
|
177
|
-
});
|
|
178
|
-
} else {
|
|
179
|
-
config.resolve.alias[vueI18nAliasName] = `petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js`;
|
|
169
|
+
})
|
|
170
|
+
}
|
|
180
171
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
config.define["__VUE_I18N_LEGACY_API__"] = !compositionOnly;
|
|
185
|
-
debug(
|
|
186
|
-
`set __VUE_I18N_LEGACY_API__ is '${config.define["__VUE_I18N_LEGACY_API__"]}'`
|
|
187
|
-
);
|
|
188
|
-
config.define["__VUE_I18N_FULL_INSTALL__"] = fullInstall;
|
|
189
|
-
debug(
|
|
190
|
-
`set __VUE_I18N_FULL_INSTALL__ is '${config.define["__VUE_I18N_FULL_INSTALL__"]}'`
|
|
191
|
-
);
|
|
192
|
-
config.define["__INTLIFY_JIT_COMPILATION__"] = jitCompilation;
|
|
193
|
-
debug(
|
|
194
|
-
`set __INTLIFY_JIT_COMPILATION__ is '${config.define["__INTLIFY_JIT_COMPILATION__"]}'`
|
|
195
|
-
);
|
|
196
|
-
config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"] = dropMessageCompiler;
|
|
197
|
-
debug(
|
|
198
|
-
`set __INTLIFY_DROP_MESSAGE_COMPILER__ is '${config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"]}'`
|
|
199
|
-
);
|
|
200
|
-
config.define["__VUE_I18N_PROD_DEVTOOLS__"] = false;
|
|
172
|
+
};
|
|
173
|
+
debug("alias Config:", aliasConfig);
|
|
174
|
+
return assign(defineConfig, aliasConfig);
|
|
201
175
|
},
|
|
202
176
|
configResolved(config) {
|
|
203
177
|
isProduction = config.isProduction;
|
|
@@ -247,11 +221,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
247
221
|
{
|
|
248
222
|
inSourceMap,
|
|
249
223
|
isGlobal: globalSFCScope,
|
|
250
|
-
useClassComponent,
|
|
251
224
|
allowDynamic,
|
|
252
225
|
strictMessage,
|
|
253
226
|
escapeHtml,
|
|
254
|
-
jit:
|
|
227
|
+
jit: true,
|
|
255
228
|
onlyLocales,
|
|
256
229
|
forceStringify
|
|
257
230
|
}
|
|
@@ -264,9 +237,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
264
237
|
return;
|
|
265
238
|
return {
|
|
266
239
|
code: generatedCode,
|
|
267
|
-
|
|
268
|
-
map: jitCompilation ? { mappings: "" } : sourceMap ? map : { mappings: "" }
|
|
269
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
240
|
+
map: { mappings: "" }
|
|
270
241
|
};
|
|
271
242
|
} else {
|
|
272
243
|
return result;
|
|
@@ -294,21 +265,16 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
294
265
|
compiler.options.resolve,
|
|
295
266
|
meta.framework
|
|
296
267
|
);
|
|
297
|
-
|
|
298
|
-
|
|
268
|
+
compiler.options.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath({
|
|
269
|
+
ssr: ssrBuild,
|
|
270
|
+
runtimeOnly
|
|
271
|
+
});
|
|
272
|
+
debug(
|
|
273
|
+
`set ${vueI18nAliasName}: ${getVueI18nAliasPath({
|
|
299
274
|
ssr: ssrBuild,
|
|
300
275
|
runtimeOnly
|
|
301
|
-
})
|
|
302
|
-
|
|
303
|
-
`set ${vueI18nAliasName}: ${getVueI18nAliasPath(vueI18nAliasName, {
|
|
304
|
-
ssr: ssrBuild,
|
|
305
|
-
runtimeOnly
|
|
306
|
-
})}`
|
|
307
|
-
);
|
|
308
|
-
} else if (!isProduction && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
309
|
-
compiler.options.resolve.alias[vueI18nAliasName] = `petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js`;
|
|
310
|
-
debug(`petite-vue-i18n alias name: ${vueI18nAliasName}`);
|
|
311
|
-
}
|
|
276
|
+
})}`
|
|
277
|
+
);
|
|
312
278
|
loadWebpack().then((webpack) => {
|
|
313
279
|
if (webpack) {
|
|
314
280
|
compiler.options.plugins.push(
|
|
@@ -360,8 +326,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
360
326
|
{
|
|
361
327
|
forceStringify,
|
|
362
328
|
strictMessage,
|
|
363
|
-
escapeHtml
|
|
364
|
-
useClassComponent
|
|
329
|
+
escapeHtml
|
|
365
330
|
}
|
|
366
331
|
);
|
|
367
332
|
return {
|
|
@@ -396,11 +361,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
396
361
|
{
|
|
397
362
|
inSourceMap,
|
|
398
363
|
isGlobal: globalSFCScope,
|
|
399
|
-
useClassComponent,
|
|
400
364
|
allowDynamic,
|
|
401
365
|
strictMessage,
|
|
402
366
|
escapeHtml,
|
|
403
|
-
jit:
|
|
367
|
+
jit: true,
|
|
404
368
|
onlyLocales,
|
|
405
369
|
forceStringify
|
|
406
370
|
}
|
|
@@ -414,8 +378,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
414
378
|
return {
|
|
415
379
|
code: generatedCode,
|
|
416
380
|
// prettier-ignore
|
|
417
|
-
map:
|
|
418
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
381
|
+
map: { mappings: "" }
|
|
419
382
|
};
|
|
420
383
|
}
|
|
421
384
|
} else {
|
|
@@ -435,8 +398,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
435
398
|
{
|
|
436
399
|
inSourceMap,
|
|
437
400
|
isGlobal: globalSFCScope,
|
|
438
|
-
|
|
439
|
-
jit: jitCompilation,
|
|
401
|
+
jit: true,
|
|
440
402
|
strictMessage,
|
|
441
403
|
escapeHtml,
|
|
442
404
|
onlyLocales,
|
|
@@ -459,8 +421,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
459
421
|
return {
|
|
460
422
|
code: generatedCode,
|
|
461
423
|
// prettier-ignore
|
|
462
|
-
map:
|
|
463
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
424
|
+
map: { mappings: "" }
|
|
464
425
|
};
|
|
465
426
|
}
|
|
466
427
|
}
|
|
@@ -505,8 +466,7 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
505
466
|
onlyLocales = [],
|
|
506
467
|
strictMessage = true,
|
|
507
468
|
escapeHtml = false,
|
|
508
|
-
|
|
509
|
-
jit = false
|
|
469
|
+
jit = true
|
|
510
470
|
}) {
|
|
511
471
|
const codes = [];
|
|
512
472
|
for (const res of resources) {
|
|
@@ -517,7 +477,6 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
517
477
|
const generate = /json5?/.test(ext) ? generateJSON : generateYAML;
|
|
518
478
|
const parseOptions = getOptions(res, isProduction, {}, false, {
|
|
519
479
|
isGlobal,
|
|
520
|
-
useClassComponent,
|
|
521
480
|
jit,
|
|
522
481
|
onlyLocales,
|
|
523
482
|
strictMessage,
|
|
@@ -591,11 +550,10 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
591
550
|
forceStringify = false,
|
|
592
551
|
isGlobal = false,
|
|
593
552
|
onlyLocales = [],
|
|
594
|
-
useClassComponent = false,
|
|
595
553
|
allowDynamic = false,
|
|
596
554
|
strictMessage = true,
|
|
597
555
|
escapeHtml = false,
|
|
598
|
-
jit =
|
|
556
|
+
jit = true
|
|
599
557
|
}) {
|
|
600
558
|
const mode = isProduction ? "production" : "development";
|
|
601
559
|
const baseOptions = {
|
|
@@ -603,7 +561,6 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
603
561
|
sourceMap,
|
|
604
562
|
inSourceMap,
|
|
605
563
|
forceStringify,
|
|
606
|
-
useClassComponent,
|
|
607
564
|
allowDynamic,
|
|
608
565
|
strictMessage,
|
|
609
566
|
escapeHtml,
|
package/lib/types.d.cts
CHANGED
|
@@ -3,7 +3,6 @@ interface PluginOptions {
|
|
|
3
3
|
include?: string | string[];
|
|
4
4
|
onlyLocales?: string | string[];
|
|
5
5
|
allowDynamic?: boolean;
|
|
6
|
-
jitCompilation?: boolean;
|
|
7
6
|
dropMessageCompiler?: boolean;
|
|
8
7
|
runtimeOnly?: boolean;
|
|
9
8
|
compositionOnly?: boolean;
|
|
@@ -12,8 +11,6 @@ interface PluginOptions {
|
|
|
12
11
|
forceStringify?: boolean;
|
|
13
12
|
defaultSFCLang?: SFCLangFormat;
|
|
14
13
|
globalSFCScope?: boolean;
|
|
15
|
-
useClassComponent?: boolean;
|
|
16
|
-
useVueI18nImportName?: boolean;
|
|
17
14
|
strictMessage?: boolean;
|
|
18
15
|
escapeHtml?: boolean;
|
|
19
16
|
}
|
package/lib/types.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ interface PluginOptions {
|
|
|
3
3
|
include?: string | string[];
|
|
4
4
|
onlyLocales?: string | string[];
|
|
5
5
|
allowDynamic?: boolean;
|
|
6
|
-
jitCompilation?: boolean;
|
|
7
6
|
dropMessageCompiler?: boolean;
|
|
8
7
|
runtimeOnly?: boolean;
|
|
9
8
|
compositionOnly?: boolean;
|
|
@@ -12,8 +11,6 @@ interface PluginOptions {
|
|
|
12
11
|
forceStringify?: boolean;
|
|
13
12
|
defaultSFCLang?: SFCLangFormat;
|
|
14
13
|
globalSFCScope?: boolean;
|
|
15
|
-
useClassComponent?: boolean;
|
|
16
|
-
useVueI18nImportName?: boolean;
|
|
17
14
|
strictMessage?: boolean;
|
|
18
15
|
escapeHtml?: boolean;
|
|
19
16
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ interface PluginOptions {
|
|
|
3
3
|
include?: string | string[];
|
|
4
4
|
onlyLocales?: string | string[];
|
|
5
5
|
allowDynamic?: boolean;
|
|
6
|
-
jitCompilation?: boolean;
|
|
7
6
|
dropMessageCompiler?: boolean;
|
|
8
7
|
runtimeOnly?: boolean;
|
|
9
8
|
compositionOnly?: boolean;
|
|
@@ -12,8 +11,6 @@ interface PluginOptions {
|
|
|
12
11
|
forceStringify?: boolean;
|
|
13
12
|
defaultSFCLang?: SFCLangFormat;
|
|
14
13
|
globalSFCScope?: boolean;
|
|
15
|
-
useClassComponent?: boolean;
|
|
16
|
-
useVueI18nImportName?: boolean;
|
|
17
14
|
strictMessage?: boolean;
|
|
18
15
|
escapeHtml?: boolean;
|
|
19
16
|
}
|
package/lib/vite.cjs
CHANGED
|
@@ -9,8 +9,10 @@ require('@intlify/shared');
|
|
|
9
9
|
require('@rollup/pluginutils');
|
|
10
10
|
require('@intlify/bundle-utils');
|
|
11
11
|
require('@vue/compiler-sfc');
|
|
12
|
-
require('fs');
|
|
12
|
+
require('node:fs');
|
|
13
13
|
require('picocolors');
|
|
14
|
+
require('node:module');
|
|
15
|
+
require('node:path');
|
|
14
16
|
|
|
15
17
|
const vite = index.unplugin.vite;
|
|
16
18
|
|
package/lib/vite.mjs
CHANGED
|
@@ -7,8 +7,10 @@ import '@intlify/shared';
|
|
|
7
7
|
import '@rollup/pluginutils';
|
|
8
8
|
import '@intlify/bundle-utils';
|
|
9
9
|
import '@vue/compiler-sfc';
|
|
10
|
-
import 'fs';
|
|
10
|
+
import 'node:fs';
|
|
11
11
|
import 'picocolors';
|
|
12
|
+
import 'node:module';
|
|
13
|
+
import 'node:path';
|
|
12
14
|
|
|
13
15
|
const vite = unplugin.vite;
|
|
14
16
|
|
package/lib/webpack.cjs
CHANGED
|
@@ -9,8 +9,10 @@ require('@intlify/shared');
|
|
|
9
9
|
require('@rollup/pluginutils');
|
|
10
10
|
require('@intlify/bundle-utils');
|
|
11
11
|
require('@vue/compiler-sfc');
|
|
12
|
-
require('fs');
|
|
12
|
+
require('node:fs');
|
|
13
13
|
require('picocolors');
|
|
14
|
+
require('node:module');
|
|
15
|
+
require('node:path');
|
|
14
16
|
|
|
15
17
|
const webpack = index.unplugin.webpack;
|
|
16
18
|
|
package/lib/webpack.mjs
CHANGED
|
@@ -7,8 +7,10 @@ import '@intlify/shared';
|
|
|
7
7
|
import '@rollup/pluginutils';
|
|
8
8
|
import '@intlify/bundle-utils';
|
|
9
9
|
import '@vue/compiler-sfc';
|
|
10
|
-
import 'fs';
|
|
10
|
+
import 'node:fs';
|
|
11
11
|
import 'picocolors';
|
|
12
|
+
import 'node:module';
|
|
13
|
+
import 'node:path';
|
|
12
14
|
|
|
13
15
|
const webpack = unplugin.webpack;
|
|
14
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/unplugin-vue-i18n",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-beta.1",
|
|
4
4
|
"description": "unplugin for Vue I18n",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@intlify/bundle-utils": "^
|
|
30
|
-
"@intlify/shared": "
|
|
29
|
+
"@intlify/bundle-utils": "^9.0.0-beta.0",
|
|
30
|
+
"@intlify/shared": "next",
|
|
31
31
|
"@rollup/pluginutils": "^5.1.0",
|
|
32
32
|
"@vue/compiler-sfc": "^3.2.47",
|
|
33
33
|
"debug": "^4.3.3",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"unbuild": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
46
|
+
"node": ">= 18"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"lib",
|