@intlify/unplugin-vue-i18n 0.7.0 → 0.7.2
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 +3 -1
- package/lib/index.cjs +21 -7
- package/lib/index.mjs +21 -7
- package/package.json +1 -1
- package/CHANGELOG.md +0 -121
package/README.md
CHANGED
|
@@ -252,7 +252,7 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
|
|
|
252
252
|
- **Type:** `string | string[] | undefined`
|
|
253
253
|
- **Default:** `undefined`
|
|
254
254
|
|
|
255
|
-
A [
|
|
255
|
+
A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, you can specify a path to pre-compile i18n resources files. The extensions of i18n resources to be precompiled are as follows:
|
|
256
256
|
|
|
257
257
|
```
|
|
258
258
|
- json
|
|
@@ -263,6 +263,8 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
|
|
|
263
263
|
|
|
264
264
|
Note `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.
|
|
265
265
|
|
|
266
|
+
If nothing is specified for this option, i.e. `undefined`, nothing is done to the resource in the above format.
|
|
267
|
+
|
|
266
268
|
### `runtimeOnly`
|
|
267
269
|
|
|
268
270
|
- **Type:** `boolean`
|
package/lib/index.cjs
CHANGED
|
@@ -109,14 +109,17 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
109
109
|
raiseError(`This plugin is supported 'vite' and 'webpack' only`);
|
|
110
110
|
}
|
|
111
111
|
let include = options.include;
|
|
112
|
+
let exclude = null;
|
|
112
113
|
if (include) {
|
|
113
114
|
if (shared.isArray(include)) {
|
|
114
115
|
include = include.map((item) => pathe.normalize(item));
|
|
115
116
|
} else if (shared.isString(include)) {
|
|
116
117
|
include = pathe.normalize(include);
|
|
117
118
|
}
|
|
119
|
+
} else {
|
|
120
|
+
exclude = "**/**";
|
|
118
121
|
}
|
|
119
|
-
const filter = pluginutils.createFilter(include);
|
|
122
|
+
const filter = pluginutils.createFilter(include, exclude);
|
|
120
123
|
const forceStringify = !!options.forceStringify;
|
|
121
124
|
const defaultSFCLang = shared.isString(options.defaultSFCLang) ? options.defaultSFCLang : "json";
|
|
122
125
|
const globalSFCScope = !!options.globalSFCScope;
|
|
@@ -144,7 +147,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
144
147
|
enforce: meta.framework === "vite" ? "pre" : "post",
|
|
145
148
|
vite: {
|
|
146
149
|
config(config, { command }) {
|
|
147
|
-
|
|
150
|
+
config.resolve = normalizeConfigResolveAlias(
|
|
151
|
+
config.resolve,
|
|
152
|
+
meta.framework
|
|
153
|
+
);
|
|
148
154
|
if (command === "build" && runtimeOnly) {
|
|
149
155
|
const aliasName = getAliasName();
|
|
150
156
|
debug(`alias name: ${aliasName}`);
|
|
@@ -160,7 +166,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
160
166
|
`set ${aliasName} runtime only: ${aliasName}/dist/${aliasName}.runtime.esm-bundler.js`
|
|
161
167
|
);
|
|
162
168
|
} else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
163
|
-
|
|
169
|
+
config.resolve = normalizeConfigResolveAlias(
|
|
170
|
+
config.resolve,
|
|
171
|
+
meta.framework
|
|
172
|
+
);
|
|
164
173
|
if (shared.isArray(config.resolve.alias)) {
|
|
165
174
|
config.resolve.alias.push({
|
|
166
175
|
find: "vue-i18n",
|
|
@@ -221,7 +230,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
221
230
|
sourceMap = !!compiler.options.devtool;
|
|
222
231
|
debug(`webpack: isProduction = ${isProduction}, sourceMap = ${sourceMap}`);
|
|
223
232
|
if (isProduction && runtimeOnly) {
|
|
224
|
-
|
|
233
|
+
compiler.options.resolve = normalizeConfigResolveAlias(
|
|
234
|
+
compiler.options.resolve,
|
|
235
|
+
meta.framework
|
|
236
|
+
);
|
|
225
237
|
compiler.options.resolve.alias["vue-i18n"] = `vue-i18n/dist/vue-i18n.runtime.esm-bundler.js`;
|
|
226
238
|
}
|
|
227
239
|
loadWebpack().then((webpack) => {
|
|
@@ -393,19 +405,21 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
393
405
|
});
|
|
394
406
|
function normalizeConfigResolveAlias(resolve, framework) {
|
|
395
407
|
if (resolve && resolve.alias) {
|
|
396
|
-
return;
|
|
408
|
+
return resolve;
|
|
397
409
|
}
|
|
398
410
|
if (!resolve) {
|
|
399
411
|
if (framework === "vite") {
|
|
400
|
-
|
|
412
|
+
return { alias: [] };
|
|
401
413
|
} else if (framework === "webpack") {
|
|
402
|
-
|
|
414
|
+
return { alias: {} };
|
|
403
415
|
}
|
|
404
416
|
} else if (!resolve.alias) {
|
|
405
417
|
if (framework === "vite") {
|
|
406
418
|
resolve.alias = [];
|
|
419
|
+
return resolve;
|
|
407
420
|
} else if (framework === "webpack") {
|
|
408
421
|
resolve.alias = {};
|
|
422
|
+
return resolve;
|
|
409
423
|
}
|
|
410
424
|
}
|
|
411
425
|
}
|
package/lib/index.mjs
CHANGED
|
@@ -97,14 +97,17 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
97
97
|
raiseError(`This plugin is supported 'vite' and 'webpack' only`);
|
|
98
98
|
}
|
|
99
99
|
let include = options.include;
|
|
100
|
+
let exclude = null;
|
|
100
101
|
if (include) {
|
|
101
102
|
if (isArray(include)) {
|
|
102
103
|
include = include.map((item) => normalize(item));
|
|
103
104
|
} else if (isString(include)) {
|
|
104
105
|
include = normalize(include);
|
|
105
106
|
}
|
|
107
|
+
} else {
|
|
108
|
+
exclude = "**/**";
|
|
106
109
|
}
|
|
107
|
-
const filter = createFilter(include);
|
|
110
|
+
const filter = createFilter(include, exclude);
|
|
108
111
|
const forceStringify = !!options.forceStringify;
|
|
109
112
|
const defaultSFCLang = isString(options.defaultSFCLang) ? options.defaultSFCLang : "json";
|
|
110
113
|
const globalSFCScope = !!options.globalSFCScope;
|
|
@@ -132,7 +135,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
132
135
|
enforce: meta.framework === "vite" ? "pre" : "post",
|
|
133
136
|
vite: {
|
|
134
137
|
config(config, { command }) {
|
|
135
|
-
|
|
138
|
+
config.resolve = normalizeConfigResolveAlias(
|
|
139
|
+
config.resolve,
|
|
140
|
+
meta.framework
|
|
141
|
+
);
|
|
136
142
|
if (command === "build" && runtimeOnly) {
|
|
137
143
|
const aliasName = getAliasName();
|
|
138
144
|
debug(`alias name: ${aliasName}`);
|
|
@@ -148,7 +154,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
148
154
|
`set ${aliasName} runtime only: ${aliasName}/dist/${aliasName}.runtime.esm-bundler.js`
|
|
149
155
|
);
|
|
150
156
|
} else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
151
|
-
|
|
157
|
+
config.resolve = normalizeConfigResolveAlias(
|
|
158
|
+
config.resolve,
|
|
159
|
+
meta.framework
|
|
160
|
+
);
|
|
152
161
|
if (isArray(config.resolve.alias)) {
|
|
153
162
|
config.resolve.alias.push({
|
|
154
163
|
find: "vue-i18n",
|
|
@@ -209,7 +218,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
209
218
|
sourceMap = !!compiler.options.devtool;
|
|
210
219
|
debug(`webpack: isProduction = ${isProduction}, sourceMap = ${sourceMap}`);
|
|
211
220
|
if (isProduction && runtimeOnly) {
|
|
212
|
-
|
|
221
|
+
compiler.options.resolve = normalizeConfigResolveAlias(
|
|
222
|
+
compiler.options.resolve,
|
|
223
|
+
meta.framework
|
|
224
|
+
);
|
|
213
225
|
compiler.options.resolve.alias["vue-i18n"] = `vue-i18n/dist/vue-i18n.runtime.esm-bundler.js`;
|
|
214
226
|
}
|
|
215
227
|
loadWebpack().then((webpack) => {
|
|
@@ -381,19 +393,21 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
381
393
|
});
|
|
382
394
|
function normalizeConfigResolveAlias(resolve, framework) {
|
|
383
395
|
if (resolve && resolve.alias) {
|
|
384
|
-
return;
|
|
396
|
+
return resolve;
|
|
385
397
|
}
|
|
386
398
|
if (!resolve) {
|
|
387
399
|
if (framework === "vite") {
|
|
388
|
-
|
|
400
|
+
return { alias: [] };
|
|
389
401
|
} else if (framework === "webpack") {
|
|
390
|
-
|
|
402
|
+
return { alias: {} };
|
|
391
403
|
}
|
|
392
404
|
} else if (!resolve.alias) {
|
|
393
405
|
if (framework === "vite") {
|
|
394
406
|
resolve.alias = [];
|
|
407
|
+
return resolve;
|
|
395
408
|
} else if (framework === "webpack") {
|
|
396
409
|
resolve.alias = {};
|
|
410
|
+
return resolve;
|
|
397
411
|
}
|
|
398
412
|
}
|
|
399
413
|
}
|
package/package.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
## @intlify/unplugin-vue-i18n@0.7.0 (2022-09-27)
|
|
3
|
-
|
|
4
|
-
#### :star: Features
|
|
5
|
-
* [#189](https://github.com/intlify/bundle-tools/pull/189) fix(unplugin-vue-i18n): support HMR for vite ([@kazupon](https://github.com/kazupon))
|
|
6
|
-
|
|
7
|
-
#### Committers: 1
|
|
8
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## @intlify/unplugin-vue-i18n@0.6.2 (2022-09-27)
|
|
12
|
-
|
|
13
|
-
#### :bug: Bug Fixes
|
|
14
|
-
* [#187](https://github.com/intlify/bundle-tools/pull/187) fix(unplugin-vue-i18n): cannot set vue-i18n-bridge dist path ([@kazupon](https://github.com/kazupon))
|
|
15
|
-
|
|
16
|
-
#### Committers: 1
|
|
17
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## @intlify/unplugin-vue-i18n@0.6.1 (2022-09-26)
|
|
21
|
-
|
|
22
|
-
#### :zap: Improvement Features
|
|
23
|
-
* [#184](https://github.com/intlify/bundle-tools/pull/184) fix(unplugin-vue-i18n): port vue-i18n-bridge module detecting from vite-plugin-vue-i18n ([@kazupon](https://github.com/kazupon))
|
|
24
|
-
|
|
25
|
-
#### Committers: 1
|
|
26
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## @intlify/unplugin-vue-i18n@0.6.0 (2022-09-19)
|
|
30
|
-
|
|
31
|
-
#### :bug: Bug Fixes
|
|
32
|
-
* [#180](https://github.com/intlify/bundle-tools/pull/180) fix(unplugin-vue-i18n): improve compilation error handling ([@kazupon](https://github.com/kazupon))
|
|
33
|
-
|
|
34
|
-
#### Committers: 1
|
|
35
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## @intlify/unplugin-vue-i18n@0.5.0 (2022-07-26)
|
|
39
|
-
|
|
40
|
-
#### :star: Features
|
|
41
|
-
* [#156](https://github.com/intlify/bundle-tools/pull/156) feat(unplugin-vue-i18n): support petite-vue-i18n and useVueI18nImportName option ([@kazupon](https://github.com/kazupon))
|
|
42
|
-
|
|
43
|
-
#### :zap: Improvement Features
|
|
44
|
-
* [#155](https://github.com/intlify/bundle-tools/pull/155) fix(unplugin-vue-i18n): improve wrong virtual module implementation ([@kazupon](https://github.com/kazupon))
|
|
45
|
-
* [#154](https://github.com/intlify/bundle-tools/pull/154) fix(unplugin-vue-i18n): support unplugin v0.8 ([@kazupon](https://github.com/kazupon))
|
|
46
|
-
|
|
47
|
-
#### Committers: 1
|
|
48
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## @intlify/unplugin-vue-i18n@0.4.0 (2022-07-07)
|
|
52
|
-
|
|
53
|
-
#### :star: Features
|
|
54
|
-
* [#138](https://github.com/intlify/bundle-tools/pull/138) feat(unplugin-vue-i18n): support esm options for bridge ([@kazupon](https://github.com/kazupon))
|
|
55
|
-
|
|
56
|
-
#### Committers: 1
|
|
57
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
## @intlify/unplugin-vue-i18n@0.3.0 (2022-07-07)
|
|
61
|
-
|
|
62
|
-
#### :star: Features
|
|
63
|
-
* [#136](https://github.com/intlify/bundle-tools/pull/136) feat(unplugin-vue-i18n): support fullinstall option ([@kazupon](https://github.com/kazupon))
|
|
64
|
-
* [#135](https://github.com/intlify/bundle-tools/pull/135) feat(unplugin-vue-i18n): support composition only option ([@kazupon](https://github.com/kazupon))
|
|
65
|
-
* [#134](https://github.com/intlify/bundle-tools/pull/134) feat(unplugin-vue-i18n): support runtimeOnly option ([@kazupon](https://github.com/kazupon))
|
|
66
|
-
|
|
67
|
-
#### :pencil: Documentation
|
|
68
|
-
* [#133](https://github.com/intlify/bundle-tools/pull/133) docs: consistent plugin name and add Nuxt ([@Atinux](https://github.com/Atinux))
|
|
69
|
-
|
|
70
|
-
#### Committers: 2
|
|
71
|
-
- Sébastien Chopin ([@Atinux](https://github.com/Atinux))
|
|
72
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
## @intlify/unplugin-vue-i18n@0.2.1 (2022-05-07)
|
|
76
|
-
|
|
77
|
-
#### :bug: Bug Fixes
|
|
78
|
-
* [#118](https://github.com/intlify/bundle-tools/pull/118) fix(unplugin-vue-i18n): code transforming strictly ([@kazupon](https://github.com/kazupon))
|
|
79
|
-
|
|
80
|
-
#### Committers: 1
|
|
81
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
## @intlify/unplugin-vue-i18n@0.2.0 (2022-05-06)
|
|
85
|
-
|
|
86
|
-
#### :star: Features
|
|
87
|
-
* [#117](https://github.com/intlify/bundle-tools/pull/117) feat: support virtual resource importing ([@kazupon](https://github.com/kazupon))
|
|
88
|
-
|
|
89
|
-
#### Committers: 1
|
|
90
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## @intlify/unplugin-vue-i18n@0.1.2 (2022-05-06)
|
|
94
|
-
|
|
95
|
-
#### :bug: Bug Fixes
|
|
96
|
-
* [#115](https://github.com/intlify/bundle-tools/pull/115) fix(unplugin-vue-i18n): export d.ts files ([@kazupon](https://github.com/kazupon))
|
|
97
|
-
|
|
98
|
-
#### Committers: 1
|
|
99
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## @intlify/unplugin-vue-i18n@0.1.1 (2022-05-06)
|
|
103
|
-
|
|
104
|
-
#### :bug: Bug Fixes
|
|
105
|
-
* [#114](https://github.com/intlify/bundle-tools/pull/114) fix(unplugin-vue-i18n): export types ([@kazupon](https://github.com/kazupon))
|
|
106
|
-
|
|
107
|
-
#### Committers: 1
|
|
108
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
## @intlify/unplugin-vue-i18n@0.1.0 (2022-05-06)
|
|
112
|
-
|
|
113
|
-
#### :star: Features
|
|
114
|
-
* [#113](https://github.com/intlify/bundle-tools/pull/113) feat: unplugin basic implementation for vue-i18n ([@kazupon](https://github.com/kazupon))
|
|
115
|
-
|
|
116
|
-
#### Committers: 1
|
|
117
|
-
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
|
|
118
|
-
|
|
119
|
-
## @intlify/unplugin-vue-i18n@0.0.0 (2022-05-02)
|
|
120
|
-
|
|
121
|
-
:tada: Initial release.
|