@intlify/unplugin-vue-i18n 0.6.1 → 0.7.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/CHANGELOG.md +18 -0
- package/lib/index.cjs +18 -17
- package/lib/index.mjs +18 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
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
|
+
|
|
2
20
|
## @intlify/unplugin-vue-i18n@0.6.1 (2022-09-26)
|
|
3
21
|
|
|
4
22
|
#### :zap: Improvement Features
|
package/lib/index.cjs
CHANGED
|
@@ -97,23 +97,12 @@ function raiseError(message) {
|
|
|
97
97
|
throw new Error(`[unplugin-vue-i18n] ${message}`);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
function checkVueI18nBridgeInstallPackage(debug) {
|
|
101
|
-
let ret = false;
|
|
102
|
-
try {
|
|
103
|
-
debug(`vue-i18n-bridge load path: ${require.resolve("vue-i18n-bridge")}`);
|
|
104
|
-
ret = true;
|
|
105
|
-
} catch (e) {
|
|
106
|
-
debug(`cannot find 'vue-i18n-bridge'`, e);
|
|
107
|
-
}
|
|
108
|
-
return ret;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
100
|
const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
|
|
112
101
|
const INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID = "@intlify/vite-plugin-vue-i18n/messages";
|
|
113
102
|
const VIRTUAL_PREFIX = "\0";
|
|
114
103
|
const debug = createDebug__default("unplugin-vue-i18n");
|
|
115
104
|
const installedPkg = bundleUtils.checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
|
|
116
|
-
const installedVueI18nBridge = checkVueI18nBridgeInstallPackage(debug);
|
|
105
|
+
const installedVueI18nBridge = bundleUtils.checkVueI18nBridgeInstallPackage(debug);
|
|
117
106
|
const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
118
107
|
debug("plugin options:", options, meta.framework);
|
|
119
108
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
@@ -157,17 +146,18 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
157
146
|
config(config, { command }) {
|
|
158
147
|
normalizeConfigResolveAlias(config.resolve, meta.framework);
|
|
159
148
|
if (command === "build" && runtimeOnly) {
|
|
149
|
+
const aliasName = getAliasName();
|
|
150
|
+
debug(`alias name: ${aliasName}`);
|
|
160
151
|
if (shared.isArray(config.resolve.alias)) {
|
|
161
152
|
config.resolve.alias.push({
|
|
162
|
-
find:
|
|
163
|
-
replacement: `${
|
|
153
|
+
find: aliasName,
|
|
154
|
+
replacement: `${aliasName}/dist/${aliasName}.runtime.esm-bundler.js`
|
|
164
155
|
});
|
|
165
156
|
} else if (shared.isObject(config.resolve.alias)) {
|
|
166
|
-
config.resolve.alias[
|
|
157
|
+
config.resolve.alias[aliasName] = `${aliasName}/dist/${aliasName}.runtime.esm-bundler.js`;
|
|
167
158
|
}
|
|
168
|
-
debug(`alias name: ${getAliasName()}`);
|
|
169
159
|
debug(
|
|
170
|
-
`set ${
|
|
160
|
+
`set ${aliasName} runtime only: ${aliasName}/dist/${aliasName}.runtime.esm-bundler.js`
|
|
171
161
|
);
|
|
172
162
|
} else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
173
163
|
normalizeConfigResolveAlias(config.resolve, meta.framework);
|
|
@@ -213,6 +203,17 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
213
203
|
return orgTransform.apply(this, [code, id]);
|
|
214
204
|
};
|
|
215
205
|
}
|
|
206
|
+
},
|
|
207
|
+
async handleHotUpdate({ file, server }) {
|
|
208
|
+
if (/\.(json5?|ya?ml)$/.test(file)) {
|
|
209
|
+
const module = server.moduleGraph.getModuleById(
|
|
210
|
+
asVirtualId(INTLIFY_BUNDLE_IMPORT_ID, meta.framework)
|
|
211
|
+
);
|
|
212
|
+
if (module) {
|
|
213
|
+
server.moduleGraph.invalidateModule(module);
|
|
214
|
+
return [module];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
216
217
|
}
|
|
217
218
|
},
|
|
218
219
|
webpack(compiler) {
|
package/lib/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import createDebug from 'debug';
|
|
|
4
4
|
import fg from 'fast-glob';
|
|
5
5
|
import { isString, isArray, isBoolean, isObject, isNumber, isEmptyObject, assign, generateCodeFrame } from '@intlify/shared';
|
|
6
6
|
import { createFilter } from '@rollup/pluginutils';
|
|
7
|
-
import { checkInstallPackage, generateJSON, generateYAML } from '@intlify/bundle-utils';
|
|
7
|
+
import { checkInstallPackage, checkVueI18nBridgeInstallPackage, generateJSON, generateYAML } from '@intlify/bundle-utils';
|
|
8
8
|
import { parse as parse$1 } from '@vue/compiler-sfc';
|
|
9
9
|
import JSON5 from 'json5';
|
|
10
10
|
import yaml from 'js-yaml';
|
|
@@ -85,17 +85,6 @@ function raiseError(message) {
|
|
|
85
85
|
throw new Error(`[unplugin-vue-i18n] ${message}`);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
function checkVueI18nBridgeInstallPackage(debug) {
|
|
89
|
-
let ret = false;
|
|
90
|
-
try {
|
|
91
|
-
debug(`vue-i18n-bridge load path: ${require.resolve("vue-i18n-bridge")}`);
|
|
92
|
-
ret = true;
|
|
93
|
-
} catch (e) {
|
|
94
|
-
debug(`cannot find 'vue-i18n-bridge'`, e);
|
|
95
|
-
}
|
|
96
|
-
return ret;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
88
|
const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
|
|
100
89
|
const INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID = "@intlify/vite-plugin-vue-i18n/messages";
|
|
101
90
|
const VIRTUAL_PREFIX = "\0";
|
|
@@ -145,17 +134,18 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
145
134
|
config(config, { command }) {
|
|
146
135
|
normalizeConfigResolveAlias(config.resolve, meta.framework);
|
|
147
136
|
if (command === "build" && runtimeOnly) {
|
|
137
|
+
const aliasName = getAliasName();
|
|
138
|
+
debug(`alias name: ${aliasName}`);
|
|
148
139
|
if (isArray(config.resolve.alias)) {
|
|
149
140
|
config.resolve.alias.push({
|
|
150
|
-
find:
|
|
151
|
-
replacement: `${
|
|
141
|
+
find: aliasName,
|
|
142
|
+
replacement: `${aliasName}/dist/${aliasName}.runtime.esm-bundler.js`
|
|
152
143
|
});
|
|
153
144
|
} else if (isObject(config.resolve.alias)) {
|
|
154
|
-
config.resolve.alias[
|
|
145
|
+
config.resolve.alias[aliasName] = `${aliasName}/dist/${aliasName}.runtime.esm-bundler.js`;
|
|
155
146
|
}
|
|
156
|
-
debug(`alias name: ${getAliasName()}`);
|
|
157
147
|
debug(
|
|
158
|
-
`set ${
|
|
148
|
+
`set ${aliasName} runtime only: ${aliasName}/dist/${aliasName}.runtime.esm-bundler.js`
|
|
159
149
|
);
|
|
160
150
|
} else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
|
|
161
151
|
normalizeConfigResolveAlias(config.resolve, meta.framework);
|
|
@@ -201,6 +191,17 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
201
191
|
return orgTransform.apply(this, [code, id]);
|
|
202
192
|
};
|
|
203
193
|
}
|
|
194
|
+
},
|
|
195
|
+
async handleHotUpdate({ file, server }) {
|
|
196
|
+
if (/\.(json5?|ya?ml)$/.test(file)) {
|
|
197
|
+
const module = server.moduleGraph.getModuleById(
|
|
198
|
+
asVirtualId(INTLIFY_BUNDLE_IMPORT_ID, meta.framework)
|
|
199
|
+
);
|
|
200
|
+
if (module) {
|
|
201
|
+
server.moduleGraph.invalidateModule(module);
|
|
202
|
+
return [module];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
204
205
|
}
|
|
205
206
|
},
|
|
206
207
|
webpack(compiler) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/unplugin-vue-i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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": "^3.1
|
|
29
|
+
"@intlify/bundle-utils": "^3.2.1",
|
|
30
30
|
"@intlify/shared": "next",
|
|
31
31
|
"@rollup/pluginutils": "^4.2.0",
|
|
32
32
|
"@vue/compiler-sfc": "^3.2.23",
|