@intlify/unplugin-vue-i18n 0.3.0 → 0.4.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 CHANGED
@@ -414,6 +414,13 @@ About details, See the [here](https://vue-i18n.intlify.dev/guide/advanced/optimi
414
414
 
415
415
  > ⚠️ Note that if you set `bridge: true`, the bundle size will increase. It is recommended to disable this mode after the migration from vue-i18n@v8.26 to vue-i18n@v9.x is completed.
416
416
 
417
+ ### `esm`
418
+
419
+ - **Type:** `boolean`
420
+ - **Default:** `true`
421
+
422
+ For `bridge` option is `true`, whether to bundle locale resources with ESM. By default ESM, if you need to bundl with commonjs for especialy webpack, you need to set `false`
423
+
417
424
  ### `useClassComponent`
418
425
 
419
426
  - **Type:** `boolean`
package/lib/index.cjs CHANGED
@@ -122,6 +122,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
122
122
  debug("compositionOnly", compositionOnly);
123
123
  const fullInstall = shared.isBoolean(options.fullInstall) ? options.fullInstall : true;
124
124
  debug("fullInstall", fullInstall);
125
+ const esm = shared.isBoolean(options.esm) ? options.esm : true;
126
+ debug("esm", esm);
125
127
  let isProduction = false;
126
128
  let sourceMap = false;
127
129
  return {
@@ -229,6 +231,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
229
231
  const code = await generateBundleResources(resourcePaths, query, isProduction, {
230
232
  forceStringify,
231
233
  bridge,
234
+ exportESM: esm,
232
235
  useClassComponent
233
236
  });
234
237
  return {
@@ -251,6 +254,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
251
254
  isGlobal: globalSFCScope,
252
255
  useClassComponent,
253
256
  bridge,
257
+ exportESM: esm,
254
258
  forceStringify
255
259
  });
256
260
  debug("parseOptions", parseOptions);
@@ -283,6 +287,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
283
287
  isGlobal: globalSFCScope,
284
288
  useClassComponent,
285
289
  bridge,
290
+ exportESM: esm,
286
291
  forceStringify
287
292
  });
288
293
  debug("parseOptions", parseOptions);
@@ -332,6 +337,7 @@ async function generateBundleResources(resources, query, isProduction, {
332
337
  forceStringify = false,
333
338
  isGlobal = false,
334
339
  bridge = false,
340
+ exportESM = true,
335
341
  useClassComponent = false
336
342
  }) {
337
343
  const codes = [];
@@ -345,6 +351,7 @@ async function generateBundleResources(resources, query, isProduction, {
345
351
  isGlobal,
346
352
  useClassComponent,
347
353
  bridge,
354
+ exportESM,
348
355
  forceStringify
349
356
  });
350
357
  parseOptions.type = "bare";
@@ -393,6 +400,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
393
400
  forceStringify = false,
394
401
  isGlobal = false,
395
402
  bridge = false,
403
+ exportESM = true,
396
404
  useClassComponent = false
397
405
  }) {
398
406
  const mode = isProduction ? "production" : "development";
@@ -403,6 +411,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
403
411
  forceStringify,
404
412
  useClassComponent,
405
413
  bridge,
414
+ exportESM,
406
415
  env: mode,
407
416
  onWarn: (msg) => {
408
417
  warn(`${filename} ${msg}`);
package/lib/index.mjs CHANGED
@@ -111,6 +111,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
111
111
  debug("compositionOnly", compositionOnly);
112
112
  const fullInstall = isBoolean(options.fullInstall) ? options.fullInstall : true;
113
113
  debug("fullInstall", fullInstall);
114
+ const esm = isBoolean(options.esm) ? options.esm : true;
115
+ debug("esm", esm);
114
116
  let isProduction = false;
115
117
  let sourceMap = false;
116
118
  return {
@@ -218,6 +220,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
218
220
  const code = await generateBundleResources(resourcePaths, query, isProduction, {
219
221
  forceStringify,
220
222
  bridge,
223
+ exportESM: esm,
221
224
  useClassComponent
222
225
  });
223
226
  return {
@@ -240,6 +243,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
240
243
  isGlobal: globalSFCScope,
241
244
  useClassComponent,
242
245
  bridge,
246
+ exportESM: esm,
243
247
  forceStringify
244
248
  });
245
249
  debug("parseOptions", parseOptions);
@@ -272,6 +276,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
272
276
  isGlobal: globalSFCScope,
273
277
  useClassComponent,
274
278
  bridge,
279
+ exportESM: esm,
275
280
  forceStringify
276
281
  });
277
282
  debug("parseOptions", parseOptions);
@@ -321,6 +326,7 @@ async function generateBundleResources(resources, query, isProduction, {
321
326
  forceStringify = false,
322
327
  isGlobal = false,
323
328
  bridge = false,
329
+ exportESM = true,
324
330
  useClassComponent = false
325
331
  }) {
326
332
  const codes = [];
@@ -334,6 +340,7 @@ async function generateBundleResources(resources, query, isProduction, {
334
340
  isGlobal,
335
341
  useClassComponent,
336
342
  bridge,
343
+ exportESM,
337
344
  forceStringify
338
345
  });
339
346
  parseOptions.type = "bare";
@@ -382,6 +389,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
382
389
  forceStringify = false,
383
390
  isGlobal = false,
384
391
  bridge = false,
392
+ exportESM = true,
385
393
  useClassComponent = false
386
394
  }) {
387
395
  const mode = isProduction ? "production" : "development";
@@ -392,6 +400,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
392
400
  forceStringify,
393
401
  useClassComponent,
394
402
  bridge,
403
+ exportESM,
395
404
  env: mode,
396
405
  onWarn: (msg) => {
397
406
  warn(`${filename} ${msg}`);
package/lib/types.d.ts CHANGED
@@ -4,6 +4,7 @@ interface PluginOptions {
4
4
  runtimeOnly?: boolean;
5
5
  compositionOnly?: boolean;
6
6
  fullInstall?: boolean;
7
+ esm?: boolean;
7
8
  forceStringify?: boolean;
8
9
  defaultSFCLang?: SFCLangFormat;
9
10
  globalSFCScope?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlify/unplugin-vue-i18n",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "unplugin for Vue I18n",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
package/CHANGELOG.md DELETED
@@ -1,63 +0,0 @@
1
-
2
- ## @intlify/unplugin-vue-i18n@0.3.0 (2022-07-07)
3
-
4
- #### :star: Features
5
- * [#136](https://github.com/intlify/bundle-tools/pull/136) feat(unplugin-vue-i18n): support fullinstall option ([@kazupon](https://github.com/kazupon))
6
- * [#135](https://github.com/intlify/bundle-tools/pull/135) feat(unplugin-vue-i18n): support composition only option ([@kazupon](https://github.com/kazupon))
7
- * [#134](https://github.com/intlify/bundle-tools/pull/134) feat(unplugin-vue-i18n): support runtimeOnly option ([@kazupon](https://github.com/kazupon))
8
-
9
- #### :pencil: Documentation
10
- * [#133](https://github.com/intlify/bundle-tools/pull/133) docs: consistent plugin name and add Nuxt ([@Atinux](https://github.com/Atinux))
11
-
12
- #### Committers: 2
13
- - Sébastien Chopin ([@Atinux](https://github.com/Atinux))
14
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
15
-
16
-
17
- ## @intlify/unplugin-vue-i18n@0.2.1 (2022-05-07)
18
-
19
- #### :bug: Bug Fixes
20
- * [#118](https://github.com/intlify/bundle-tools/pull/118) fix(unplugin-vue-i18n): code transforming strictly ([@kazupon](https://github.com/kazupon))
21
-
22
- #### Committers: 1
23
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
24
-
25
-
26
- ## @intlify/unplugin-vue-i18n@0.2.0 (2022-05-06)
27
-
28
- #### :star: Features
29
- * [#117](https://github.com/intlify/bundle-tools/pull/117) feat: support virtual resource importing ([@kazupon](https://github.com/kazupon))
30
-
31
- #### Committers: 1
32
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
33
-
34
-
35
- ## @intlify/unplugin-vue-i18n@0.1.2 (2022-05-06)
36
-
37
- #### :bug: Bug Fixes
38
- * [#115](https://github.com/intlify/bundle-tools/pull/115) fix(unplugin-vue-i18n): export d.ts files ([@kazupon](https://github.com/kazupon))
39
-
40
- #### Committers: 1
41
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
42
-
43
-
44
- ## @intlify/unplugin-vue-i18n@0.1.1 (2022-05-06)
45
-
46
- #### :bug: Bug Fixes
47
- * [#114](https://github.com/intlify/bundle-tools/pull/114) fix(unplugin-vue-i18n): export types ([@kazupon](https://github.com/kazupon))
48
-
49
- #### Committers: 1
50
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
51
-
52
-
53
- ## @intlify/unplugin-vue-i18n@0.1.0 (2022-05-06)
54
-
55
- #### :star: Features
56
- * [#113](https://github.com/intlify/bundle-tools/pull/113) feat: unplugin basic implementation for vue-i18n ([@kazupon](https://github.com/kazupon))
57
-
58
- #### Committers: 1
59
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
60
-
61
- ## @intlify/unplugin-vue-i18n@0.0.0 (2022-05-02)
62
-
63
- :tada: Initial release.