@intlify/unplugin-vue-i18n 6.0.6 → 6.0.7
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/lib/index.cjs +3 -28
- package/lib/index.mjs +3 -28
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -44,23 +44,6 @@ function resolveNamespace(name) {
|
|
|
44
44
|
function getVitePlugin(config, name) {
|
|
45
45
|
return config.plugins.find((p) => p.name === name);
|
|
46
46
|
}
|
|
47
|
-
function getVitePluginTransform(plugin) {
|
|
48
|
-
if (plugin.transform) {
|
|
49
|
-
return "handler" in plugin.transform ? [plugin.transform.handler, "handler"] : [plugin.transform, "transform"];
|
|
50
|
-
} else {
|
|
51
|
-
return [void 0, void 0];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function overrideVitePluginTransform(plugin, override, to) {
|
|
55
|
-
if (plugin.transform == void 0) {
|
|
56
|
-
throw new Error("plugin.transform is undefined");
|
|
57
|
-
}
|
|
58
|
-
if (to === "handler" && "handler" in plugin.transform) {
|
|
59
|
-
plugin.transform.handler = override;
|
|
60
|
-
} else {
|
|
61
|
-
plugin.transform = override;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
47
|
function checkVuePlugin(vuePlugin) {
|
|
65
48
|
if (vuePlugin == null || !vuePlugin.api) {
|
|
66
49
|
error(
|
|
@@ -277,11 +260,8 @@ function resourcePlugin({
|
|
|
277
260
|
);
|
|
278
261
|
const jsonPlugin = getVitePlugin(config, "vite:json");
|
|
279
262
|
if (jsonPlugin) {
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
throw new Error("vite:json plugin not found!");
|
|
283
|
-
}
|
|
284
|
-
async function overrideViteJsonPlugin(code, id) {
|
|
263
|
+
const orgTransform = jsonPlugin.transform;
|
|
264
|
+
jsonPlugin.transform = async function(code, id) {
|
|
285
265
|
if (!/\.json$/.test(id) || filter(id)) {
|
|
286
266
|
return;
|
|
287
267
|
}
|
|
@@ -291,12 +271,7 @@ function resourcePlugin({
|
|
|
291
271
|
}
|
|
292
272
|
debug$2("org json plugin");
|
|
293
273
|
return orgTransform.apply(this, [code, id]);
|
|
294
|
-
}
|
|
295
|
-
overrideVitePluginTransform(
|
|
296
|
-
jsonPlugin,
|
|
297
|
-
overrideViteJsonPlugin,
|
|
298
|
-
transformWay
|
|
299
|
-
);
|
|
274
|
+
};
|
|
300
275
|
}
|
|
301
276
|
const esbuildPlugin = getVitePlugin(config, "vite:esbuild");
|
|
302
277
|
if (esbuildPlugin) {
|
package/lib/index.mjs
CHANGED
|
@@ -32,23 +32,6 @@ function resolveNamespace(name) {
|
|
|
32
32
|
function getVitePlugin(config, name) {
|
|
33
33
|
return config.plugins.find((p) => p.name === name);
|
|
34
34
|
}
|
|
35
|
-
function getVitePluginTransform(plugin) {
|
|
36
|
-
if (plugin.transform) {
|
|
37
|
-
return "handler" in plugin.transform ? [plugin.transform.handler, "handler"] : [plugin.transform, "transform"];
|
|
38
|
-
} else {
|
|
39
|
-
return [void 0, void 0];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function overrideVitePluginTransform(plugin, override, to) {
|
|
43
|
-
if (plugin.transform == void 0) {
|
|
44
|
-
throw new Error("plugin.transform is undefined");
|
|
45
|
-
}
|
|
46
|
-
if (to === "handler" && "handler" in plugin.transform) {
|
|
47
|
-
plugin.transform.handler = override;
|
|
48
|
-
} else {
|
|
49
|
-
plugin.transform = override;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
35
|
function checkVuePlugin(vuePlugin) {
|
|
53
36
|
if (vuePlugin == null || !vuePlugin.api) {
|
|
54
37
|
error(
|
|
@@ -265,11 +248,8 @@ function resourcePlugin({
|
|
|
265
248
|
);
|
|
266
249
|
const jsonPlugin = getVitePlugin(config, "vite:json");
|
|
267
250
|
if (jsonPlugin) {
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
throw new Error("vite:json plugin not found!");
|
|
271
|
-
}
|
|
272
|
-
async function overrideViteJsonPlugin(code, id) {
|
|
251
|
+
const orgTransform = jsonPlugin.transform;
|
|
252
|
+
jsonPlugin.transform = async function(code, id) {
|
|
273
253
|
if (!/\.json$/.test(id) || filter(id)) {
|
|
274
254
|
return;
|
|
275
255
|
}
|
|
@@ -279,12 +259,7 @@ function resourcePlugin({
|
|
|
279
259
|
}
|
|
280
260
|
debug$2("org json plugin");
|
|
281
261
|
return orgTransform.apply(this, [code, id]);
|
|
282
|
-
}
|
|
283
|
-
overrideVitePluginTransform(
|
|
284
|
-
jsonPlugin,
|
|
285
|
-
overrideViteJsonPlugin,
|
|
286
|
-
transformWay
|
|
287
|
-
);
|
|
262
|
+
};
|
|
288
263
|
}
|
|
289
264
|
const esbuildPlugin = getVitePlugin(config, "vite:esbuild");
|
|
290
265
|
if (esbuildPlugin) {
|