@intlify/unplugin-vue-i18n 2.0.0 → 3.0.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 +28 -14
- package/lib/index.cjs +19 -1
- package/lib/index.mjs +19 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -281,13 +281,13 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
|
|
|
281
281
|
|
|
282
282
|
If nothing is specified for this option, i.e. `undefined`, nothing is done to the resource in the above format.
|
|
283
283
|
|
|
284
|
-
|
|
284
|
+
> [!WARNING]
|
|
285
285
|
`json` resources matches this option, it will be handled **before the internal json plugin of bundler, and will not be processed afterwards**, else the option doesn't match, the bundler side will handle.
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
> [!WARNING]
|
|
288
288
|
`yaml` resources don't support multi documentation with `|`, alias with `&` and `*`, tags with `! `, `@`, etc. Only simple data structures.
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
> [!WARNING]
|
|
291
291
|
`js` and `ts` resources are set **simple export (`export default`) as locale messages object, as default**.
|
|
292
292
|
|
|
293
293
|
```js
|
|
@@ -299,7 +299,7 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
|
|
|
299
299
|
|
|
300
300
|
If you need to use programmatically dynamic resource construction, you would be enable `allowDynamic` option. about details, see the section.
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
> [!WARNING]
|
|
303
303
|
If you use the `js` and `ts` resources formats, set the paths, so your application code is not targeted. We recommend that resources be isolated from the application code.
|
|
304
304
|
|
|
305
305
|
|
|
@@ -350,16 +350,19 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
|
|
|
350
350
|
### `jitCompilation`
|
|
351
351
|
|
|
352
352
|
- **Type:** `boolean`
|
|
353
|
-
- **Default:** `
|
|
353
|
+
- **Default:** `true`
|
|
354
|
+
|
|
355
|
+
> [!IMPORTANT]
|
|
356
|
+
'jitCompilation' option now defaults to `true` from 3.0.
|
|
354
357
|
|
|
355
358
|
Whether locale mesages should be compiled by JIT (Just in Time) compilation with vue-i18n's message compiler.
|
|
356
359
|
|
|
357
|
-
|
|
360
|
+
> [!NOTE]
|
|
358
361
|
This option works with vue-i18n v9.3 and later.
|
|
359
362
|
|
|
360
363
|
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.
|
|
361
364
|
|
|
362
|
-
|
|
365
|
+
> [!WARNING]
|
|
363
366
|
Enabling JIT compilation causes the message compiler to generate AST objects for locale mesages instead of JavaScript code. If you pre-compile locale messages with a tool such as the [Intlify CLI](https://github.com/intlify/cli) and import them dynamically, you need to rebuild that resource.
|
|
364
367
|
|
|
365
368
|
About JIT compilation, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#jit-compilation)
|
|
@@ -373,11 +376,11 @@ Whether to tree-shake message compiler when we will be bundling.
|
|
|
373
376
|
|
|
374
377
|
If do you will use this option, you need to enable `jitCompilation` option.
|
|
375
378
|
|
|
376
|
-
>
|
|
377
|
-
This option works with vue-i18n v9.3 and later.
|
|
379
|
+
> [!NOTE]
|
|
380
|
+
This option works with vue-i18n v9.3 and later.
|
|
378
381
|
|
|
379
|
-
>
|
|
380
|
-
If you enable this option, **you should check
|
|
382
|
+
> [!WARNING]
|
|
383
|
+
If you enable this option, **you should check resources in your application are pre-compiled with this plugin.** If you will be loading resources dynamically from the back-end via the API, enabling this option do not work because there is not message compiler.
|
|
381
384
|
|
|
382
385
|
### `ssr`
|
|
383
386
|
|
|
@@ -386,7 +389,7 @@ If you enable this option, **you should check resources in your application are
|
|
|
386
389
|
|
|
387
390
|
Whether to bundle vue-i18n module for SSR at build time
|
|
388
391
|
|
|
389
|
-
|
|
392
|
+
> [!NOTE]
|
|
390
393
|
This option works with vue-i18n v9.4 and later.
|
|
391
394
|
|
|
392
395
|
### `runtimeOnly`
|
|
@@ -541,26 +544,37 @@ If you enable this option, **you should check resources in your application are
|
|
|
541
544
|
- **Type:** `boolean`
|
|
542
545
|
- **Default:** `false`
|
|
543
546
|
|
|
547
|
+
> [!WARNING]
|
|
548
|
+
'bridge' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
549
|
+
|
|
544
550
|
The mode to birdge the i18n custom block to work in both vue-i18n@v8.x and vue-i18n@v9.x environments.
|
|
545
551
|
|
|
546
552
|
To support in a smooth transition from vue-i18n@v8.x to vue-i18n@v9.x, we provide a mode that bundles the i18n custom block to be available in either version.
|
|
547
553
|
|
|
548
|
-
|
|
554
|
+
> [!WARNING]
|
|
555
|
+
Note that if you set `bridge: true`, the bundle size will increase. It is recommended to disable this mode after the migration from vue-i18n@v8.26 to vue-i18n@v9.x is completed.
|
|
549
556
|
|
|
550
557
|
### `legacy`
|
|
551
558
|
|
|
552
559
|
- **Type:** `boolean`
|
|
553
560
|
- **Default:** `false`
|
|
554
561
|
|
|
562
|
+
> [!WARNING]
|
|
563
|
+
'legacy' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
564
|
+
|
|
555
565
|
This option supports Vue I18n v8.x compatibility for resources in i18n custom blocks.
|
|
556
566
|
|
|
557
|
-
|
|
567
|
+
> [!NOTE]
|
|
568
|
+
To work for Vue 2.7, the value of `vueVersion` must be set to `'v2.7'`.
|
|
558
569
|
|
|
559
570
|
### `vueVersion`
|
|
560
571
|
|
|
561
572
|
- **Type:** `string`
|
|
562
573
|
- **Default:** `undefined`
|
|
563
574
|
|
|
575
|
+
> [!WARNING]
|
|
576
|
+
'vueVersion' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
577
|
+
|
|
564
578
|
The version of Vue that will be used by Vue I18n. This option is enabled when the `legacy` option is `true`.
|
|
565
579
|
|
|
566
580
|
Available values are `'v2.6'` and `'v2.7'`.
|
package/lib/index.cjs
CHANGED
|
@@ -103,6 +103,9 @@ const debug = createDebug__default("unplugin-vue-i18n");
|
|
|
103
103
|
const installedPkg = bundleUtils.checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
|
|
104
104
|
const installedVueI18nBridge = bundleUtils.checkVueI18nBridgeInstallPackage(debug);
|
|
105
105
|
const vueI18nVersion = bundleUtils.getVueI18nVersion(debug);
|
|
106
|
+
if (vueI18nVersion === "8") {
|
|
107
|
+
warn(`vue-i18n@8 is not supported, since sinece Vue 2 was EOL on 2023.`);
|
|
108
|
+
}
|
|
106
109
|
const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
107
110
|
debug("plugin options:", options, meta.framework);
|
|
108
111
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
@@ -130,12 +133,27 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
130
133
|
const useClassComponent = !!options.useClassComponent;
|
|
131
134
|
const bridge = !!options.bridge;
|
|
132
135
|
debug("bridge", bridge);
|
|
136
|
+
if (bridge) {
|
|
137
|
+
warn(
|
|
138
|
+
`'bridge' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
133
141
|
const legacy = !!options.legacy;
|
|
134
142
|
debug("legacy", legacy);
|
|
143
|
+
if (legacy) {
|
|
144
|
+
warn(
|
|
145
|
+
`'legacy' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
135
148
|
const vueVersion = shared.isString(options.vueVersion) ? options.vueVersion : void 0;
|
|
149
|
+
if (!vueVersion) {
|
|
150
|
+
warn(
|
|
151
|
+
`'vueVersion' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
136
154
|
const runtimeOnly = shared.isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
|
|
137
155
|
debug("runtimeOnly", runtimeOnly);
|
|
138
|
-
const jitCompilation =
|
|
156
|
+
const jitCompilation = shared.isBoolean(options.jitCompilation) ? options.jitCompilation : true;
|
|
139
157
|
debug("jitCompilation", jitCompilation);
|
|
140
158
|
const dropMessageCompiler = jitCompilation ? !!options.dropMessageCompiler : false;
|
|
141
159
|
debug("dropMessageCompiler", dropMessageCompiler);
|
package/lib/index.mjs
CHANGED
|
@@ -91,6 +91,9 @@ const debug = createDebug("unplugin-vue-i18n");
|
|
|
91
91
|
const installedPkg = checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
|
|
92
92
|
const installedVueI18nBridge = checkVueI18nBridgeInstallPackage(debug);
|
|
93
93
|
const vueI18nVersion = getVueI18nVersion(debug);
|
|
94
|
+
if (vueI18nVersion === "8") {
|
|
95
|
+
warn(`vue-i18n@8 is not supported, since sinece Vue 2 was EOL on 2023.`);
|
|
96
|
+
}
|
|
94
97
|
const unplugin = createUnplugin((options = {}, meta) => {
|
|
95
98
|
debug("plugin options:", options, meta.framework);
|
|
96
99
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
@@ -118,12 +121,27 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
118
121
|
const useClassComponent = !!options.useClassComponent;
|
|
119
122
|
const bridge = !!options.bridge;
|
|
120
123
|
debug("bridge", bridge);
|
|
124
|
+
if (bridge) {
|
|
125
|
+
warn(
|
|
126
|
+
`'bridge' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
127
|
+
);
|
|
128
|
+
}
|
|
121
129
|
const legacy = !!options.legacy;
|
|
122
130
|
debug("legacy", legacy);
|
|
131
|
+
if (legacy) {
|
|
132
|
+
warn(
|
|
133
|
+
`'legacy' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
134
|
+
);
|
|
135
|
+
}
|
|
123
136
|
const vueVersion = isString(options.vueVersion) ? options.vueVersion : void 0;
|
|
137
|
+
if (!vueVersion) {
|
|
138
|
+
warn(
|
|
139
|
+
`'vueVersion' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
124
142
|
const runtimeOnly = isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
|
|
125
143
|
debug("runtimeOnly", runtimeOnly);
|
|
126
|
-
const jitCompilation =
|
|
144
|
+
const jitCompilation = isBoolean(options.jitCompilation) ? options.jitCompilation : true;
|
|
127
145
|
debug("jitCompilation", jitCompilation);
|
|
128
146
|
const dropMessageCompiler = jitCompilation ? !!options.dropMessageCompiler : false;
|
|
129
147
|
debug("dropMessageCompiler", dropMessageCompiler);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/unplugin-vue-i18n",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "unplugin for Vue I18n",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@intlify/bundle-utils": "^7.4.0",
|
|
30
30
|
"@intlify/shared": "^9.4.0",
|
|
31
|
-
"@rollup/pluginutils": "^5.0
|
|
31
|
+
"@rollup/pluginutils": "^5.1.0",
|
|
32
32
|
"@vue/compiler-sfc": "^3.2.47",
|
|
33
33
|
"debug": "^4.3.3",
|
|
34
34
|
"fast-glob": "^3.2.12",
|