@intlify/unplugin-vue-i18n 11.1.0 → 11.1.1
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 +9 -5
- package/lib/index.mjs +9 -5
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -458,7 +458,7 @@ function resourcePlugin({
|
|
|
458
458
|
langInfo = defaultSFCLang;
|
|
459
459
|
}
|
|
460
460
|
debug$3("langInfo", langInfo);
|
|
461
|
-
const generate =
|
|
461
|
+
const generate = getGenerator(langInfo, bundleUtils.generateYAML);
|
|
462
462
|
const isGlobalBlock = globalSFCScope || !!query.global;
|
|
463
463
|
const parseOptions = getOptions(
|
|
464
464
|
filename,
|
|
@@ -468,6 +468,7 @@ function resourcePlugin({
|
|
|
468
468
|
{
|
|
469
469
|
inSourceMap,
|
|
470
470
|
isGlobal: globalSFCScope,
|
|
471
|
+
allowDynamic,
|
|
471
472
|
jit: true,
|
|
472
473
|
strictMessage,
|
|
473
474
|
escapeHtml,
|
|
@@ -493,7 +494,10 @@ function resourcePlugin({
|
|
|
493
494
|
warn("transformI18nBlock should return a string");
|
|
494
495
|
}
|
|
495
496
|
}
|
|
496
|
-
|
|
497
|
+
if (/\.?[cm]?[jt]s$/.test(langInfo)) {
|
|
498
|
+
source = `export default ${source.replace(/^[\s;]+/, "")}`;
|
|
499
|
+
}
|
|
500
|
+
const { code: generatedCode, map } = await generate(source, parseOptions);
|
|
497
501
|
debug$3("generated code", generatedCode);
|
|
498
502
|
debug$3("sourcemap", map, sourceMap);
|
|
499
503
|
if (code === generatedCode) return;
|
|
@@ -513,13 +517,13 @@ function getGenerator(ext, fallback = bundleUtils.generateJSON) {
|
|
|
513
517
|
if (/\.?json5?$/.test(ext)) {
|
|
514
518
|
return bundleUtils.generateJSON;
|
|
515
519
|
}
|
|
516
|
-
if (
|
|
520
|
+
if (/\.?ya?ml$/.test(ext)) {
|
|
517
521
|
return bundleUtils.generateYAML;
|
|
518
522
|
}
|
|
519
|
-
if (
|
|
523
|
+
if (/\.?[cm]?js$/.test(ext)) {
|
|
520
524
|
return bundleUtils.generateJavaScript;
|
|
521
525
|
}
|
|
522
|
-
if (
|
|
526
|
+
if (/\.?[cm]?ts$/.test(ext)) {
|
|
523
527
|
return bundleUtils.generateTypescript;
|
|
524
528
|
}
|
|
525
529
|
return fallback;
|
package/lib/index.mjs
CHANGED
|
@@ -446,7 +446,7 @@ function resourcePlugin({
|
|
|
446
446
|
langInfo = defaultSFCLang;
|
|
447
447
|
}
|
|
448
448
|
debug$3("langInfo", langInfo);
|
|
449
|
-
const generate =
|
|
449
|
+
const generate = getGenerator(langInfo, generateYAML);
|
|
450
450
|
const isGlobalBlock = globalSFCScope || !!query.global;
|
|
451
451
|
const parseOptions = getOptions(
|
|
452
452
|
filename,
|
|
@@ -456,6 +456,7 @@ function resourcePlugin({
|
|
|
456
456
|
{
|
|
457
457
|
inSourceMap,
|
|
458
458
|
isGlobal: globalSFCScope,
|
|
459
|
+
allowDynamic,
|
|
459
460
|
jit: true,
|
|
460
461
|
strictMessage,
|
|
461
462
|
escapeHtml,
|
|
@@ -481,7 +482,10 @@ function resourcePlugin({
|
|
|
481
482
|
warn("transformI18nBlock should return a string");
|
|
482
483
|
}
|
|
483
484
|
}
|
|
484
|
-
|
|
485
|
+
if (/\.?[cm]?[jt]s$/.test(langInfo)) {
|
|
486
|
+
source = `export default ${source.replace(/^[\s;]+/, "")}`;
|
|
487
|
+
}
|
|
488
|
+
const { code: generatedCode, map } = await generate(source, parseOptions);
|
|
485
489
|
debug$3("generated code", generatedCode);
|
|
486
490
|
debug$3("sourcemap", map, sourceMap);
|
|
487
491
|
if (code === generatedCode) return;
|
|
@@ -501,13 +505,13 @@ function getGenerator(ext, fallback = generateJSON) {
|
|
|
501
505
|
if (/\.?json5?$/.test(ext)) {
|
|
502
506
|
return generateJSON;
|
|
503
507
|
}
|
|
504
|
-
if (
|
|
508
|
+
if (/\.?ya?ml$/.test(ext)) {
|
|
505
509
|
return generateYAML;
|
|
506
510
|
}
|
|
507
|
-
if (
|
|
511
|
+
if (/\.?[cm]?js$/.test(ext)) {
|
|
508
512
|
return generateJavaScript;
|
|
509
513
|
}
|
|
510
|
-
if (
|
|
514
|
+
if (/\.?[cm]?ts$/.test(ext)) {
|
|
511
515
|
return generateTypescript;
|
|
512
516
|
}
|
|
513
517
|
return fallback;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/unplugin-vue-i18n",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"description": "unplugin for Vue I18n",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"picocolors": "^1.0.0",
|
|
36
36
|
"unplugin": "^2.3.4",
|
|
37
37
|
"vue": "^3.5.21",
|
|
38
|
-
"@intlify/bundle-utils": "11.1.
|
|
38
|
+
"@intlify/bundle-utils": "11.1.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@intlify/core-base": "next",
|