@intlify/unplugin-vue-i18n 4.0.0 → 5.0.0-beta.0
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 +9 -4
- package/lib/index.cjs +21 -47
- package/lib/index.mjs +22 -48
- package/lib/types.d.cts +0 -2
- package/lib/types.d.mts +0 -2
- package/lib/types.d.ts +0 -2
- 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[]`
|
package/lib/index.cjs
CHANGED
|
@@ -74,10 +74,6 @@ const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
|
|
|
74
74
|
const VIRTUAL_PREFIX = "\0";
|
|
75
75
|
const debug = createDebug__default("unplugin-vue-i18n");
|
|
76
76
|
const installedPkg = bundleUtils.checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
|
|
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
|
-
}
|
|
81
77
|
const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
82
78
|
debug("plugin options:", options, meta.framework);
|
|
83
79
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
@@ -102,12 +98,9 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
102
98
|
const forceStringify = !!options.forceStringify;
|
|
103
99
|
const defaultSFCLang = shared.isString(options.defaultSFCLang) ? options.defaultSFCLang : "json";
|
|
104
100
|
const globalSFCScope = !!options.globalSFCScope;
|
|
105
|
-
const useClassComponent = !!options.useClassComponent;
|
|
106
101
|
const runtimeOnly = shared.isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
|
|
107
102
|
debug("runtimeOnly", runtimeOnly);
|
|
108
|
-
const
|
|
109
|
-
debug("jitCompilation", jitCompilation);
|
|
110
|
-
const dropMessageCompiler = jitCompilation ? !!options.dropMessageCompiler : false;
|
|
103
|
+
const dropMessageCompiler = !!options.dropMessageCompiler;
|
|
111
104
|
debug("dropMessageCompiler", dropMessageCompiler);
|
|
112
105
|
const compositionOnly = installedPkg === "vue-i18n" ? shared.isBoolean(options.compositionOnly) ? options.compositionOnly : true : true;
|
|
113
106
|
debug("compositionOnly", compositionOnly);
|
|
@@ -120,9 +113,9 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
120
113
|
warn(`'useVueI18nImportName' option is experimental`);
|
|
121
114
|
}
|
|
122
115
|
debug("useVueI18nImportName", useVueI18nImportName);
|
|
123
|
-
const getVueI18nAliasName = () =>
|
|
124
|
-
const getVueI18nAliasPath = (
|
|
125
|
-
return `${
|
|
116
|
+
const getVueI18nAliasName = () => installedPkg === "petite-vue-i18n" && shared.isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : installedPkg;
|
|
117
|
+
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
118
|
+
return `${installedPkg}/dist/${installedPkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
|
|
126
119
|
};
|
|
127
120
|
const allowDynamic = !!options.allowDynamic;
|
|
128
121
|
debug("allowDynamic", allowDynamic);
|
|
@@ -155,25 +148,22 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
155
148
|
if (shared.isArray(config.resolve.alias)) {
|
|
156
149
|
config.resolve.alias.push({
|
|
157
150
|
find: vueI18nAliasName,
|
|
158
|
-
replacement: getVueI18nAliasPath(
|
|
151
|
+
replacement: getVueI18nAliasPath({
|
|
159
152
|
ssr: ssrBuild,
|
|
160
153
|
runtimeOnly
|
|
161
154
|
})
|
|
162
155
|
});
|
|
163
156
|
} else if (shared.isObject(config.resolve.alias)) {
|
|
164
|
-
config.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath(
|
|
157
|
+
config.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath({
|
|
165
158
|
ssr: ssrBuild,
|
|
166
159
|
runtimeOnly
|
|
167
160
|
});
|
|
168
161
|
}
|
|
169
162
|
debug(
|
|
170
|
-
`set ${vueI18nAliasName} runtime only: ${getVueI18nAliasPath(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
runtimeOnly
|
|
175
|
-
}
|
|
176
|
-
)}`
|
|
163
|
+
`set ${vueI18nAliasName} runtime only: ${getVueI18nAliasPath({
|
|
164
|
+
ssr: ssrBuild,
|
|
165
|
+
runtimeOnly
|
|
166
|
+
})}`
|
|
177
167
|
);
|
|
178
168
|
} else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
179
169
|
config.resolve = normalizeConfigResolveAlias(
|
|
@@ -199,10 +189,6 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
199
189
|
debug(
|
|
200
190
|
`set __VUE_I18N_FULL_INSTALL__ is '${config.define["__VUE_I18N_FULL_INSTALL__"]}'`
|
|
201
191
|
);
|
|
202
|
-
config.define["__INTLIFY_JIT_COMPILATION__"] = jitCompilation;
|
|
203
|
-
debug(
|
|
204
|
-
`set __INTLIFY_JIT_COMPILATION__ is '${config.define["__INTLIFY_JIT_COMPILATION__"]}'`
|
|
205
|
-
);
|
|
206
192
|
config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"] = dropMessageCompiler;
|
|
207
193
|
debug(
|
|
208
194
|
`set __INTLIFY_DROP_MESSAGE_COMPILER__ is '${config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"]}'`
|
|
@@ -257,11 +243,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
257
243
|
{
|
|
258
244
|
inSourceMap,
|
|
259
245
|
isGlobal: globalSFCScope,
|
|
260
|
-
useClassComponent,
|
|
261
246
|
allowDynamic,
|
|
262
247
|
strictMessage,
|
|
263
248
|
escapeHtml,
|
|
264
|
-
jit:
|
|
249
|
+
jit: true,
|
|
265
250
|
onlyLocales,
|
|
266
251
|
forceStringify
|
|
267
252
|
}
|
|
@@ -274,9 +259,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
274
259
|
return;
|
|
275
260
|
return {
|
|
276
261
|
code: generatedCode,
|
|
277
|
-
|
|
278
|
-
map: jitCompilation ? { mappings: "" } : sourceMap ? map : { mappings: "" }
|
|
279
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
262
|
+
map: { mappings: "" }
|
|
280
263
|
};
|
|
281
264
|
} else {
|
|
282
265
|
return result;
|
|
@@ -305,12 +288,12 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
305
288
|
meta.framework
|
|
306
289
|
);
|
|
307
290
|
if (isProduction) {
|
|
308
|
-
compiler.options.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath(
|
|
291
|
+
compiler.options.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath({
|
|
309
292
|
ssr: ssrBuild,
|
|
310
293
|
runtimeOnly
|
|
311
294
|
});
|
|
312
295
|
debug(
|
|
313
|
-
`set ${vueI18nAliasName}: ${getVueI18nAliasPath(
|
|
296
|
+
`set ${vueI18nAliasName}: ${getVueI18nAliasPath({
|
|
314
297
|
ssr: ssrBuild,
|
|
315
298
|
runtimeOnly
|
|
316
299
|
})}`
|
|
@@ -370,8 +353,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
370
353
|
{
|
|
371
354
|
forceStringify,
|
|
372
355
|
strictMessage,
|
|
373
|
-
escapeHtml
|
|
374
|
-
useClassComponent
|
|
356
|
+
escapeHtml
|
|
375
357
|
}
|
|
376
358
|
);
|
|
377
359
|
return {
|
|
@@ -406,11 +388,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
406
388
|
{
|
|
407
389
|
inSourceMap,
|
|
408
390
|
isGlobal: globalSFCScope,
|
|
409
|
-
useClassComponent,
|
|
410
391
|
allowDynamic,
|
|
411
392
|
strictMessage,
|
|
412
393
|
escapeHtml,
|
|
413
|
-
jit:
|
|
394
|
+
jit: true,
|
|
414
395
|
onlyLocales,
|
|
415
396
|
forceStringify
|
|
416
397
|
}
|
|
@@ -424,8 +405,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
424
405
|
return {
|
|
425
406
|
code: generatedCode,
|
|
426
407
|
// prettier-ignore
|
|
427
|
-
map:
|
|
428
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
408
|
+
map: { mappings: "" }
|
|
429
409
|
};
|
|
430
410
|
}
|
|
431
411
|
} else {
|
|
@@ -445,8 +425,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
445
425
|
{
|
|
446
426
|
inSourceMap,
|
|
447
427
|
isGlobal: globalSFCScope,
|
|
448
|
-
|
|
449
|
-
jit: jitCompilation,
|
|
428
|
+
jit: true,
|
|
450
429
|
strictMessage,
|
|
451
430
|
escapeHtml,
|
|
452
431
|
onlyLocales,
|
|
@@ -469,8 +448,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
469
448
|
return {
|
|
470
449
|
code: generatedCode,
|
|
471
450
|
// prettier-ignore
|
|
472
|
-
map:
|
|
473
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
451
|
+
map: { mappings: "" }
|
|
474
452
|
};
|
|
475
453
|
}
|
|
476
454
|
}
|
|
@@ -515,8 +493,7 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
515
493
|
onlyLocales = [],
|
|
516
494
|
strictMessage = true,
|
|
517
495
|
escapeHtml = false,
|
|
518
|
-
|
|
519
|
-
jit = false
|
|
496
|
+
jit = true
|
|
520
497
|
}) {
|
|
521
498
|
const codes = [];
|
|
522
499
|
for (const res of resources) {
|
|
@@ -527,7 +504,6 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
527
504
|
const generate = /json5?/.test(ext) ? bundleUtils.generateJSON : bundleUtils.generateYAML;
|
|
528
505
|
const parseOptions = getOptions(res, isProduction, {}, false, {
|
|
529
506
|
isGlobal,
|
|
530
|
-
useClassComponent,
|
|
531
507
|
jit,
|
|
532
508
|
onlyLocales,
|
|
533
509
|
strictMessage,
|
|
@@ -601,11 +577,10 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
601
577
|
forceStringify = false,
|
|
602
578
|
isGlobal = false,
|
|
603
579
|
onlyLocales = [],
|
|
604
|
-
useClassComponent = false,
|
|
605
580
|
allowDynamic = false,
|
|
606
581
|
strictMessage = true,
|
|
607
582
|
escapeHtml = false,
|
|
608
|
-
jit =
|
|
583
|
+
jit = true
|
|
609
584
|
}) {
|
|
610
585
|
const mode = isProduction ? "production" : "development";
|
|
611
586
|
const baseOptions = {
|
|
@@ -613,7 +588,6 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
613
588
|
sourceMap,
|
|
614
589
|
inSourceMap,
|
|
615
590
|
forceStringify,
|
|
616
|
-
useClassComponent,
|
|
617
591
|
allowDynamic,
|
|
618
592
|
strictMessage,
|
|
619
593
|
escapeHtml,
|
package/lib/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import createDebug from 'debug';
|
|
|
4
4
|
import fg from 'fast-glob';
|
|
5
5
|
import { isArray, isString, isBoolean, isObject, isNumber, isEmptyObject, assign, generateCodeFrame } from '@intlify/shared';
|
|
6
6
|
import { createFilter } from '@rollup/pluginutils';
|
|
7
|
-
import { checkInstallPackage,
|
|
7
|
+
import { checkInstallPackage, generateJSON, generateYAML, generateJavaScript } from '@intlify/bundle-utils';
|
|
8
8
|
import { parse as parse$1 } from '@vue/compiler-sfc';
|
|
9
9
|
import { promises } from 'fs';
|
|
10
10
|
import pc from 'picocolors';
|
|
@@ -64,10 +64,6 @@ const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
|
|
|
64
64
|
const VIRTUAL_PREFIX = "\0";
|
|
65
65
|
const debug = createDebug("unplugin-vue-i18n");
|
|
66
66
|
const installedPkg = checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
|
|
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
|
-
}
|
|
71
67
|
const unplugin = createUnplugin((options = {}, meta) => {
|
|
72
68
|
debug("plugin options:", options, meta.framework);
|
|
73
69
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
@@ -92,12 +88,9 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
92
88
|
const forceStringify = !!options.forceStringify;
|
|
93
89
|
const defaultSFCLang = isString(options.defaultSFCLang) ? options.defaultSFCLang : "json";
|
|
94
90
|
const globalSFCScope = !!options.globalSFCScope;
|
|
95
|
-
const useClassComponent = !!options.useClassComponent;
|
|
96
91
|
const runtimeOnly = isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
|
|
97
92
|
debug("runtimeOnly", runtimeOnly);
|
|
98
|
-
const
|
|
99
|
-
debug("jitCompilation", jitCompilation);
|
|
100
|
-
const dropMessageCompiler = jitCompilation ? !!options.dropMessageCompiler : false;
|
|
93
|
+
const dropMessageCompiler = !!options.dropMessageCompiler;
|
|
101
94
|
debug("dropMessageCompiler", dropMessageCompiler);
|
|
102
95
|
const compositionOnly = installedPkg === "vue-i18n" ? isBoolean(options.compositionOnly) ? options.compositionOnly : true : true;
|
|
103
96
|
debug("compositionOnly", compositionOnly);
|
|
@@ -110,9 +103,9 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
110
103
|
warn(`'useVueI18nImportName' option is experimental`);
|
|
111
104
|
}
|
|
112
105
|
debug("useVueI18nImportName", useVueI18nImportName);
|
|
113
|
-
const getVueI18nAliasName = () =>
|
|
114
|
-
const getVueI18nAliasPath = (
|
|
115
|
-
return `${
|
|
106
|
+
const getVueI18nAliasName = () => installedPkg === "petite-vue-i18n" && isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : installedPkg;
|
|
107
|
+
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
108
|
+
return `${installedPkg}/dist/${installedPkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
|
|
116
109
|
};
|
|
117
110
|
const allowDynamic = !!options.allowDynamic;
|
|
118
111
|
debug("allowDynamic", allowDynamic);
|
|
@@ -145,25 +138,22 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
145
138
|
if (isArray(config.resolve.alias)) {
|
|
146
139
|
config.resolve.alias.push({
|
|
147
140
|
find: vueI18nAliasName,
|
|
148
|
-
replacement: getVueI18nAliasPath(
|
|
141
|
+
replacement: getVueI18nAliasPath({
|
|
149
142
|
ssr: ssrBuild,
|
|
150
143
|
runtimeOnly
|
|
151
144
|
})
|
|
152
145
|
});
|
|
153
146
|
} else if (isObject(config.resolve.alias)) {
|
|
154
|
-
config.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath(
|
|
147
|
+
config.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath({
|
|
155
148
|
ssr: ssrBuild,
|
|
156
149
|
runtimeOnly
|
|
157
150
|
});
|
|
158
151
|
}
|
|
159
152
|
debug(
|
|
160
|
-
`set ${vueI18nAliasName} runtime only: ${getVueI18nAliasPath(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
runtimeOnly
|
|
165
|
-
}
|
|
166
|
-
)}`
|
|
153
|
+
`set ${vueI18nAliasName} runtime only: ${getVueI18nAliasPath({
|
|
154
|
+
ssr: ssrBuild,
|
|
155
|
+
runtimeOnly
|
|
156
|
+
})}`
|
|
167
157
|
);
|
|
168
158
|
} else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
169
159
|
config.resolve = normalizeConfigResolveAlias(
|
|
@@ -189,10 +179,6 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
189
179
|
debug(
|
|
190
180
|
`set __VUE_I18N_FULL_INSTALL__ is '${config.define["__VUE_I18N_FULL_INSTALL__"]}'`
|
|
191
181
|
);
|
|
192
|
-
config.define["__INTLIFY_JIT_COMPILATION__"] = jitCompilation;
|
|
193
|
-
debug(
|
|
194
|
-
`set __INTLIFY_JIT_COMPILATION__ is '${config.define["__INTLIFY_JIT_COMPILATION__"]}'`
|
|
195
|
-
);
|
|
196
182
|
config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"] = dropMessageCompiler;
|
|
197
183
|
debug(
|
|
198
184
|
`set __INTLIFY_DROP_MESSAGE_COMPILER__ is '${config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"]}'`
|
|
@@ -247,11 +233,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
247
233
|
{
|
|
248
234
|
inSourceMap,
|
|
249
235
|
isGlobal: globalSFCScope,
|
|
250
|
-
useClassComponent,
|
|
251
236
|
allowDynamic,
|
|
252
237
|
strictMessage,
|
|
253
238
|
escapeHtml,
|
|
254
|
-
jit:
|
|
239
|
+
jit: true,
|
|
255
240
|
onlyLocales,
|
|
256
241
|
forceStringify
|
|
257
242
|
}
|
|
@@ -264,9 +249,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
264
249
|
return;
|
|
265
250
|
return {
|
|
266
251
|
code: generatedCode,
|
|
267
|
-
|
|
268
|
-
map: jitCompilation ? { mappings: "" } : sourceMap ? map : { mappings: "" }
|
|
269
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
252
|
+
map: { mappings: "" }
|
|
270
253
|
};
|
|
271
254
|
} else {
|
|
272
255
|
return result;
|
|
@@ -295,12 +278,12 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
295
278
|
meta.framework
|
|
296
279
|
);
|
|
297
280
|
if (isProduction) {
|
|
298
|
-
compiler.options.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath(
|
|
281
|
+
compiler.options.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath({
|
|
299
282
|
ssr: ssrBuild,
|
|
300
283
|
runtimeOnly
|
|
301
284
|
});
|
|
302
285
|
debug(
|
|
303
|
-
`set ${vueI18nAliasName}: ${getVueI18nAliasPath(
|
|
286
|
+
`set ${vueI18nAliasName}: ${getVueI18nAliasPath({
|
|
304
287
|
ssr: ssrBuild,
|
|
305
288
|
runtimeOnly
|
|
306
289
|
})}`
|
|
@@ -360,8 +343,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
360
343
|
{
|
|
361
344
|
forceStringify,
|
|
362
345
|
strictMessage,
|
|
363
|
-
escapeHtml
|
|
364
|
-
useClassComponent
|
|
346
|
+
escapeHtml
|
|
365
347
|
}
|
|
366
348
|
);
|
|
367
349
|
return {
|
|
@@ -396,11 +378,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
396
378
|
{
|
|
397
379
|
inSourceMap,
|
|
398
380
|
isGlobal: globalSFCScope,
|
|
399
|
-
useClassComponent,
|
|
400
381
|
allowDynamic,
|
|
401
382
|
strictMessage,
|
|
402
383
|
escapeHtml,
|
|
403
|
-
jit:
|
|
384
|
+
jit: true,
|
|
404
385
|
onlyLocales,
|
|
405
386
|
forceStringify
|
|
406
387
|
}
|
|
@@ -414,8 +395,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
414
395
|
return {
|
|
415
396
|
code: generatedCode,
|
|
416
397
|
// prettier-ignore
|
|
417
|
-
map:
|
|
418
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
398
|
+
map: { mappings: "" }
|
|
419
399
|
};
|
|
420
400
|
}
|
|
421
401
|
} else {
|
|
@@ -435,8 +415,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
435
415
|
{
|
|
436
416
|
inSourceMap,
|
|
437
417
|
isGlobal: globalSFCScope,
|
|
438
|
-
|
|
439
|
-
jit: jitCompilation,
|
|
418
|
+
jit: true,
|
|
440
419
|
strictMessage,
|
|
441
420
|
escapeHtml,
|
|
442
421
|
onlyLocales,
|
|
@@ -459,8 +438,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
459
438
|
return {
|
|
460
439
|
code: generatedCode,
|
|
461
440
|
// prettier-ignore
|
|
462
|
-
map:
|
|
463
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
441
|
+
map: { mappings: "" }
|
|
464
442
|
};
|
|
465
443
|
}
|
|
466
444
|
}
|
|
@@ -505,8 +483,7 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
505
483
|
onlyLocales = [],
|
|
506
484
|
strictMessage = true,
|
|
507
485
|
escapeHtml = false,
|
|
508
|
-
|
|
509
|
-
jit = false
|
|
486
|
+
jit = true
|
|
510
487
|
}) {
|
|
511
488
|
const codes = [];
|
|
512
489
|
for (const res of resources) {
|
|
@@ -517,7 +494,6 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
517
494
|
const generate = /json5?/.test(ext) ? generateJSON : generateYAML;
|
|
518
495
|
const parseOptions = getOptions(res, isProduction, {}, false, {
|
|
519
496
|
isGlobal,
|
|
520
|
-
useClassComponent,
|
|
521
497
|
jit,
|
|
522
498
|
onlyLocales,
|
|
523
499
|
strictMessage,
|
|
@@ -591,11 +567,10 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
591
567
|
forceStringify = false,
|
|
592
568
|
isGlobal = false,
|
|
593
569
|
onlyLocales = [],
|
|
594
|
-
useClassComponent = false,
|
|
595
570
|
allowDynamic = false,
|
|
596
571
|
strictMessage = true,
|
|
597
572
|
escapeHtml = false,
|
|
598
|
-
jit =
|
|
573
|
+
jit = true
|
|
599
574
|
}) {
|
|
600
575
|
const mode = isProduction ? "production" : "development";
|
|
601
576
|
const baseOptions = {
|
|
@@ -603,7 +578,6 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
603
578
|
sourceMap,
|
|
604
579
|
inSourceMap,
|
|
605
580
|
forceStringify,
|
|
606
|
-
useClassComponent,
|
|
607
581
|
allowDynamic,
|
|
608
582
|
strictMessage,
|
|
609
583
|
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,7 +11,6 @@ interface PluginOptions {
|
|
|
12
11
|
forceStringify?: boolean;
|
|
13
12
|
defaultSFCLang?: SFCLangFormat;
|
|
14
13
|
globalSFCScope?: boolean;
|
|
15
|
-
useClassComponent?: boolean;
|
|
16
14
|
useVueI18nImportName?: boolean;
|
|
17
15
|
strictMessage?: boolean;
|
|
18
16
|
escapeHtml?: boolean;
|
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,7 +11,6 @@ interface PluginOptions {
|
|
|
12
11
|
forceStringify?: boolean;
|
|
13
12
|
defaultSFCLang?: SFCLangFormat;
|
|
14
13
|
globalSFCScope?: boolean;
|
|
15
|
-
useClassComponent?: boolean;
|
|
16
14
|
useVueI18nImportName?: boolean;
|
|
17
15
|
strictMessage?: boolean;
|
|
18
16
|
escapeHtml?: boolean;
|
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,7 +11,6 @@ interface PluginOptions {
|
|
|
12
11
|
forceStringify?: boolean;
|
|
13
12
|
defaultSFCLang?: SFCLangFormat;
|
|
14
13
|
globalSFCScope?: boolean;
|
|
15
|
-
useClassComponent?: boolean;
|
|
16
14
|
useVueI18nImportName?: boolean;
|
|
17
15
|
strictMessage?: boolean;
|
|
18
16
|
escapeHtml?: boolean;
|
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.0",
|
|
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",
|