@intlify/unplugin-vue-i18n 0.10.0 → 0.11.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 +2 -2
- package/lib/index.cjs +15 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.mjs +15 -1
- package/package.json +9 -10
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ const app = createApp()
|
|
|
213
213
|
app.use(i18n).mount('#app')
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
Change your vite.config.ts file accordingly to import all the files from locales folder on the root. Change `'./locales/**'` to path of your locales.
|
|
216
|
+
Change your vite.config.ts file accordingly to import all the files from locales folder on the root. Change `'./src/locales/**'` to path of your locales.
|
|
217
217
|
```ts
|
|
218
218
|
// vite.config.ts
|
|
219
219
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
|
@@ -222,7 +222,7 @@ import path from 'path'
|
|
|
222
222
|
export default defineConfig({
|
|
223
223
|
plugins: [
|
|
224
224
|
VueI18nPlugin({
|
|
225
|
-
include: [path.resolve(__dirname, './locales/**')],
|
|
225
|
+
include: [path.resolve(__dirname, './src/locales/**')],
|
|
226
226
|
}),
|
|
227
227
|
],
|
|
228
228
|
})
|
package/lib/index.cjs
CHANGED
|
@@ -146,6 +146,14 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
146
146
|
const vueI18nAliasName = getVueI18nAliasName();
|
|
147
147
|
return {
|
|
148
148
|
name: "unplugin-vue-i18n",
|
|
149
|
+
/**
|
|
150
|
+
* NOTE:
|
|
151
|
+
*
|
|
152
|
+
* For vite, If we have json (including SFC's custom block),
|
|
153
|
+
* transform it first because it will be transformed into javascript code by `vite:json` plugin.
|
|
154
|
+
*
|
|
155
|
+
* For webpack, This plugin will handle with ‘post’, because vue-loader generate the request query.
|
|
156
|
+
*/
|
|
149
157
|
enforce: meta.framework === "vite" ? "pre" : "post",
|
|
150
158
|
vite: {
|
|
151
159
|
config(config, { command }) {
|
|
@@ -278,6 +286,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
278
286
|
return {
|
|
279
287
|
code: generatedCode,
|
|
280
288
|
map: sourceMap ? map : { mappings: "" }
|
|
289
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
281
290
|
};
|
|
282
291
|
} else {
|
|
283
292
|
return result;
|
|
@@ -361,6 +370,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
361
370
|
return asVirtualId(id, meta.framework);
|
|
362
371
|
}
|
|
363
372
|
},
|
|
373
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
364
374
|
async load(id) {
|
|
365
375
|
debug("load", id);
|
|
366
376
|
const { query } = parseVueRequest(id);
|
|
@@ -442,6 +452,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
442
452
|
return {
|
|
443
453
|
code: generatedCode,
|
|
444
454
|
map: sourceMap ? map : { mappings: "" }
|
|
455
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
445
456
|
};
|
|
446
457
|
}
|
|
447
458
|
} else {
|
|
@@ -489,6 +500,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
489
500
|
return {
|
|
490
501
|
code: generatedCode,
|
|
491
502
|
map: sourceMap ? map : { mappings: "" }
|
|
503
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
492
504
|
};
|
|
493
505
|
}
|
|
494
506
|
}
|
|
@@ -595,7 +607,9 @@ async function getCode(source, filename, sourceMap, query, framework = "vite") {
|
|
|
595
607
|
}
|
|
596
608
|
}
|
|
597
609
|
function isCustomBlock(query) {
|
|
598
|
-
return !shared.isEmptyObject(query) && "vue" in query && (query["type"] === "custom" ||
|
|
610
|
+
return !shared.isEmptyObject(query) && "vue" in query && (query["type"] === "custom" || // for vite (@vite-plugin-vue)
|
|
611
|
+
query["type"] === "i18n" || // for webpack (vue-loader)
|
|
612
|
+
query["blockType"] === "i18n");
|
|
599
613
|
}
|
|
600
614
|
function getOptions(filename, isProduction, query, sourceMap, {
|
|
601
615
|
inSourceMap = void 0,
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _unplugin from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.js';
|
|
3
|
-
export {
|
|
3
|
+
export { SFCLangFormat } from './types.js';
|
|
4
4
|
|
|
5
5
|
declare const unplugin: _unplugin.UnpluginInstance<PluginOptions, boolean>;
|
|
6
6
|
|
|
7
|
-
export { unplugin as default, unplugin };
|
|
7
|
+
export { PluginOptions, unplugin as default, unplugin };
|
package/lib/index.mjs
CHANGED
|
@@ -142,6 +142,14 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
142
142
|
const vueI18nAliasName = getVueI18nAliasName();
|
|
143
143
|
return {
|
|
144
144
|
name: "unplugin-vue-i18n",
|
|
145
|
+
/**
|
|
146
|
+
* NOTE:
|
|
147
|
+
*
|
|
148
|
+
* For vite, If we have json (including SFC's custom block),
|
|
149
|
+
* transform it first because it will be transformed into javascript code by `vite:json` plugin.
|
|
150
|
+
*
|
|
151
|
+
* For webpack, This plugin will handle with ‘post’, because vue-loader generate the request query.
|
|
152
|
+
*/
|
|
145
153
|
enforce: meta.framework === "vite" ? "pre" : "post",
|
|
146
154
|
vite: {
|
|
147
155
|
config(config, { command }) {
|
|
@@ -274,6 +282,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
274
282
|
return {
|
|
275
283
|
code: generatedCode,
|
|
276
284
|
map: sourceMap ? map : { mappings: "" }
|
|
285
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
277
286
|
};
|
|
278
287
|
} else {
|
|
279
288
|
return result;
|
|
@@ -357,6 +366,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
357
366
|
return asVirtualId(id, meta.framework);
|
|
358
367
|
}
|
|
359
368
|
},
|
|
369
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
360
370
|
async load(id) {
|
|
361
371
|
debug("load", id);
|
|
362
372
|
const { query } = parseVueRequest(id);
|
|
@@ -438,6 +448,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
438
448
|
return {
|
|
439
449
|
code: generatedCode,
|
|
440
450
|
map: sourceMap ? map : { mappings: "" }
|
|
451
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
441
452
|
};
|
|
442
453
|
}
|
|
443
454
|
} else {
|
|
@@ -485,6 +496,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
485
496
|
return {
|
|
486
497
|
code: generatedCode,
|
|
487
498
|
map: sourceMap ? map : { mappings: "" }
|
|
499
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
488
500
|
};
|
|
489
501
|
}
|
|
490
502
|
}
|
|
@@ -591,7 +603,9 @@ async function getCode(source, filename, sourceMap, query, framework = "vite") {
|
|
|
591
603
|
}
|
|
592
604
|
}
|
|
593
605
|
function isCustomBlock(query) {
|
|
594
|
-
return !isEmptyObject(query) && "vue" in query && (query["type"] === "custom" ||
|
|
606
|
+
return !isEmptyObject(query) && "vue" in query && (query["type"] === "custom" || // for vite (@vite-plugin-vue)
|
|
607
|
+
query["type"] === "i18n" || // for webpack (vue-loader)
|
|
608
|
+
query["blockType"] === "i18n");
|
|
595
609
|
}
|
|
596
610
|
function getOptions(filename, isProduction, query, sourceMap, {
|
|
597
611
|
inSourceMap = void 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/unplugin-vue-i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "unplugin for Vue I18n",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@intlify/bundle-utils": "^
|
|
29
|
+
"@intlify/bundle-utils": "^6.0.1",
|
|
30
30
|
"@intlify/shared": "9.3.0-beta.17",
|
|
31
31
|
"@rollup/pluginutils": "^5.0.2",
|
|
32
32
|
"@vue/compiler-sfc": "^3.2.47",
|
|
@@ -40,8 +40,7 @@
|
|
|
40
40
|
"unplugin": "^1.1.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"unbuild": "^1.0.2"
|
|
43
|
+
"unbuild": "^1.1.2"
|
|
45
44
|
},
|
|
46
45
|
"engines": {
|
|
47
46
|
"node": ">= 14.16"
|
|
@@ -67,19 +66,19 @@
|
|
|
67
66
|
"types": "./index.d.ts",
|
|
68
67
|
"exports": {
|
|
69
68
|
".": {
|
|
69
|
+
"types": "./index.d.ts",
|
|
70
70
|
"require": "./lib/index.cjs",
|
|
71
|
-
"import": "./lib/index.mjs"
|
|
72
|
-
"types": "./index.d.ts"
|
|
71
|
+
"import": "./lib/index.mjs"
|
|
73
72
|
},
|
|
74
73
|
"./vite": {
|
|
74
|
+
"types": "./vite.d.ts",
|
|
75
75
|
"require": "./lib/vite.cjs",
|
|
76
|
-
"import": "./lib/vite.mjs"
|
|
77
|
-
"types": "./vite.d.ts"
|
|
76
|
+
"import": "./lib/vite.mjs"
|
|
78
77
|
},
|
|
79
78
|
"./webpack": {
|
|
79
|
+
"types": "./webpack.d.ts",
|
|
80
80
|
"require": "./lib/webpack.cjs",
|
|
81
|
-
"import": "./lib/webpack.mjs"
|
|
82
|
-
"types": "./webpack.d.ts"
|
|
81
|
+
"import": "./lib/webpack.mjs"
|
|
83
82
|
},
|
|
84
83
|
"./types": {
|
|
85
84
|
"types": "./types.d.ts"
|