@intlify/unplugin-vue-i18n 0.9.3 → 0.10.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/README.md +25 -0
- package/lib/index.cjs +22 -1
- package/lib/index.mjs +22 -1
- package/lib/types.d.ts +2 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -300,6 +300,31 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
|
|
|
300
300
|
> ⚠️ NOTE:
|
|
301
301
|
If you use the `js` and `ts` resources formats, set the paths, so your application code is not targeted. We recommend that resources be isolated from the application code.
|
|
302
302
|
|
|
303
|
+
|
|
304
|
+
### `strictMessage`
|
|
305
|
+
|
|
306
|
+
- **Type:** `boolean`
|
|
307
|
+
- **Default:** `true`
|
|
308
|
+
|
|
309
|
+
Strictly checks that the locale message does not contain html tags.
|
|
310
|
+
|
|
311
|
+
If html tags are included, an error is thrown.
|
|
312
|
+
|
|
313
|
+
If you would not the error to be thrown, you can work around it by setting it to `false`, but **it means that the locale message might cause security problems with XSS**.
|
|
314
|
+
|
|
315
|
+
In that case, we recommend setting the `escapeHtml` option to `true`.
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
### `escapeHtml`
|
|
319
|
+
|
|
320
|
+
- **Type:** `boolean`
|
|
321
|
+
- **Default:** `false`
|
|
322
|
+
|
|
323
|
+
Whether to escape html tags if they are included in the locale message.
|
|
324
|
+
|
|
325
|
+
If `strictMessage` is disabled by `false`, we recommend this option be enabled.
|
|
326
|
+
|
|
327
|
+
|
|
303
328
|
### `allowDynamic`
|
|
304
329
|
|
|
305
330
|
- **Type:** `boolean`
|
package/lib/index.cjs
CHANGED
|
@@ -136,6 +136,11 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
136
136
|
const esm = shared.isBoolean(options.esm) ? options.esm : true;
|
|
137
137
|
debug("esm", esm);
|
|
138
138
|
const allowDynamic = !!options.allowDynamic;
|
|
139
|
+
debug("allowDynamic", allowDynamic);
|
|
140
|
+
const strictMessage = shared.isBoolean(options.strictMessage) ? options.strictMessage : true;
|
|
141
|
+
debug("strictMessage", strictMessage);
|
|
142
|
+
const escapeHtml = !!options.escapeHtml;
|
|
143
|
+
debug("escapeHtml", escapeHtml);
|
|
139
144
|
let isProduction = false;
|
|
140
145
|
let sourceMap = false;
|
|
141
146
|
const vueI18nAliasName = getVueI18nAliasName();
|
|
@@ -253,6 +258,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
253
258
|
isGlobal: globalSFCScope,
|
|
254
259
|
useClassComponent,
|
|
255
260
|
allowDynamic,
|
|
261
|
+
strictMessage,
|
|
262
|
+
escapeHtml,
|
|
256
263
|
bridge,
|
|
257
264
|
exportESM: esm,
|
|
258
265
|
forceStringify
|
|
@@ -375,6 +382,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
375
382
|
{
|
|
376
383
|
forceStringify,
|
|
377
384
|
bridge,
|
|
385
|
+
strictMessage,
|
|
386
|
+
escapeHtml,
|
|
378
387
|
exportESM: esm,
|
|
379
388
|
useClassComponent
|
|
380
389
|
}
|
|
@@ -413,6 +422,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
413
422
|
isGlobal: globalSFCScope,
|
|
414
423
|
useClassComponent,
|
|
415
424
|
allowDynamic,
|
|
425
|
+
strictMessage,
|
|
426
|
+
escapeHtml,
|
|
416
427
|
bridge,
|
|
417
428
|
exportESM: esm,
|
|
418
429
|
forceStringify
|
|
@@ -452,6 +463,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
|
|
|
452
463
|
isGlobal: globalSFCScope,
|
|
453
464
|
useClassComponent,
|
|
454
465
|
bridge,
|
|
466
|
+
strictMessage,
|
|
467
|
+
escapeHtml,
|
|
455
468
|
exportESM: esm,
|
|
456
469
|
forceStringify
|
|
457
470
|
}
|
|
@@ -519,6 +532,8 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
519
532
|
isGlobal = false,
|
|
520
533
|
bridge = false,
|
|
521
534
|
exportESM = true,
|
|
535
|
+
strictMessage = true,
|
|
536
|
+
escapeHtml = false,
|
|
522
537
|
useClassComponent = false
|
|
523
538
|
}) {
|
|
524
539
|
const codes = [];
|
|
@@ -533,6 +548,8 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
533
548
|
useClassComponent,
|
|
534
549
|
bridge,
|
|
535
550
|
exportESM,
|
|
551
|
+
strictMessage,
|
|
552
|
+
escapeHtml,
|
|
536
553
|
forceStringify
|
|
537
554
|
});
|
|
538
555
|
parseOptions.type = "bare";
|
|
@@ -587,7 +604,9 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
587
604
|
bridge = false,
|
|
588
605
|
exportESM = true,
|
|
589
606
|
useClassComponent = false,
|
|
590
|
-
allowDynamic = false
|
|
607
|
+
allowDynamic = false,
|
|
608
|
+
strictMessage = true,
|
|
609
|
+
escapeHtml = false
|
|
591
610
|
}) {
|
|
592
611
|
const mode = isProduction ? "production" : "development";
|
|
593
612
|
const baseOptions = {
|
|
@@ -597,6 +616,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
597
616
|
forceStringify,
|
|
598
617
|
useClassComponent,
|
|
599
618
|
allowDynamic,
|
|
619
|
+
strictMessage,
|
|
620
|
+
escapeHtml,
|
|
600
621
|
bridge,
|
|
601
622
|
exportESM,
|
|
602
623
|
env: mode,
|
package/lib/index.mjs
CHANGED
|
@@ -132,6 +132,11 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
132
132
|
const esm = isBoolean(options.esm) ? options.esm : true;
|
|
133
133
|
debug("esm", esm);
|
|
134
134
|
const allowDynamic = !!options.allowDynamic;
|
|
135
|
+
debug("allowDynamic", allowDynamic);
|
|
136
|
+
const strictMessage = isBoolean(options.strictMessage) ? options.strictMessage : true;
|
|
137
|
+
debug("strictMessage", strictMessage);
|
|
138
|
+
const escapeHtml = !!options.escapeHtml;
|
|
139
|
+
debug("escapeHtml", escapeHtml);
|
|
135
140
|
let isProduction = false;
|
|
136
141
|
let sourceMap = false;
|
|
137
142
|
const vueI18nAliasName = getVueI18nAliasName();
|
|
@@ -249,6 +254,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
249
254
|
isGlobal: globalSFCScope,
|
|
250
255
|
useClassComponent,
|
|
251
256
|
allowDynamic,
|
|
257
|
+
strictMessage,
|
|
258
|
+
escapeHtml,
|
|
252
259
|
bridge,
|
|
253
260
|
exportESM: esm,
|
|
254
261
|
forceStringify
|
|
@@ -371,6 +378,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
371
378
|
{
|
|
372
379
|
forceStringify,
|
|
373
380
|
bridge,
|
|
381
|
+
strictMessage,
|
|
382
|
+
escapeHtml,
|
|
374
383
|
exportESM: esm,
|
|
375
384
|
useClassComponent
|
|
376
385
|
}
|
|
@@ -409,6 +418,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
409
418
|
isGlobal: globalSFCScope,
|
|
410
419
|
useClassComponent,
|
|
411
420
|
allowDynamic,
|
|
421
|
+
strictMessage,
|
|
422
|
+
escapeHtml,
|
|
412
423
|
bridge,
|
|
413
424
|
exportESM: esm,
|
|
414
425
|
forceStringify
|
|
@@ -448,6 +459,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
|
|
|
448
459
|
isGlobal: globalSFCScope,
|
|
449
460
|
useClassComponent,
|
|
450
461
|
bridge,
|
|
462
|
+
strictMessage,
|
|
463
|
+
escapeHtml,
|
|
451
464
|
exportESM: esm,
|
|
452
465
|
forceStringify
|
|
453
466
|
}
|
|
@@ -515,6 +528,8 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
515
528
|
isGlobal = false,
|
|
516
529
|
bridge = false,
|
|
517
530
|
exportESM = true,
|
|
531
|
+
strictMessage = true,
|
|
532
|
+
escapeHtml = false,
|
|
518
533
|
useClassComponent = false
|
|
519
534
|
}) {
|
|
520
535
|
const codes = [];
|
|
@@ -529,6 +544,8 @@ async function generateBundleResources(resources, query, isProduction, {
|
|
|
529
544
|
useClassComponent,
|
|
530
545
|
bridge,
|
|
531
546
|
exportESM,
|
|
547
|
+
strictMessage,
|
|
548
|
+
escapeHtml,
|
|
532
549
|
forceStringify
|
|
533
550
|
});
|
|
534
551
|
parseOptions.type = "bare";
|
|
@@ -583,7 +600,9 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
583
600
|
bridge = false,
|
|
584
601
|
exportESM = true,
|
|
585
602
|
useClassComponent = false,
|
|
586
|
-
allowDynamic = false
|
|
603
|
+
allowDynamic = false,
|
|
604
|
+
strictMessage = true,
|
|
605
|
+
escapeHtml = false
|
|
587
606
|
}) {
|
|
588
607
|
const mode = isProduction ? "production" : "development";
|
|
589
608
|
const baseOptions = {
|
|
@@ -593,6 +612,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
593
612
|
forceStringify,
|
|
594
613
|
useClassComponent,
|
|
595
614
|
allowDynamic,
|
|
615
|
+
strictMessage,
|
|
616
|
+
escapeHtml,
|
|
596
617
|
bridge,
|
|
597
618
|
exportESM,
|
|
598
619
|
env: mode,
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/unplugin-vue-i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "unplugin for Vue I18n",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@intlify/bundle-utils": "^5.
|
|
30
|
-
"@intlify/shared": "
|
|
29
|
+
"@intlify/bundle-utils": "^5.4.0",
|
|
30
|
+
"@intlify/shared": "9.3.0-beta.17",
|
|
31
31
|
"@rollup/pluginutils": "^5.0.2",
|
|
32
32
|
"@vue/compiler-sfc": "^3.2.47",
|
|
33
33
|
"debug": "^4.3.3",
|