@intlify/unplugin-vue-i18n 6.0.6 → 6.0.8
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 +6 -27
- package/lib/index.mjs +6 -27
- 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 = "handler" in jsonPlugin.transform ? jsonPlugin.transform.handler : jsonPlugin.transform;
|
|
264
|
+
async function overrideJson(code, id) {
|
|
285
265
|
if (!/\.json$/.test(id) || filter(id)) {
|
|
286
266
|
return;
|
|
287
267
|
}
|
|
@@ -292,11 +272,10 @@ function resourcePlugin({
|
|
|
292
272
|
debug$2("org json plugin");
|
|
293
273
|
return orgTransform.apply(this, [code, id]);
|
|
294
274
|
}
|
|
295
|
-
|
|
296
|
-
jsonPlugin
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
);
|
|
275
|
+
if ("handler" in jsonPlugin.transform) {
|
|
276
|
+
jsonPlugin.transform.handler = overrideJson;
|
|
277
|
+
}
|
|
278
|
+
jsonPlugin.transform = overrideJson;
|
|
300
279
|
}
|
|
301
280
|
const esbuildPlugin = getVitePlugin(config, "vite:esbuild");
|
|
302
281
|
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 = "handler" in jsonPlugin.transform ? jsonPlugin.transform.handler : jsonPlugin.transform;
|
|
252
|
+
async function overrideJson(code, id) {
|
|
273
253
|
if (!/\.json$/.test(id) || filter(id)) {
|
|
274
254
|
return;
|
|
275
255
|
}
|
|
@@ -280,11 +260,10 @@ function resourcePlugin({
|
|
|
280
260
|
debug$2("org json plugin");
|
|
281
261
|
return orgTransform.apply(this, [code, id]);
|
|
282
262
|
}
|
|
283
|
-
|
|
284
|
-
jsonPlugin
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
);
|
|
263
|
+
if ("handler" in jsonPlugin.transform) {
|
|
264
|
+
jsonPlugin.transform.handler = overrideJson;
|
|
265
|
+
}
|
|
266
|
+
jsonPlugin.transform = overrideJson;
|
|
288
267
|
}
|
|
289
268
|
const esbuildPlugin = getVitePlugin(config, "vite:esbuild");
|
|
290
269
|
if (esbuildPlugin) {
|