@intlify/unplugin-vue-i18n 0.6.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
1
 
2
+ ## @intlify/unplugin-vue-i18n@0.6.1 (2022-09-26)
3
+
4
+ #### :zap: Improvement Features
5
+ * [#184](https://github.com/intlify/bundle-tools/pull/184) fix(unplugin-vue-i18n): port vue-i18n-bridge module detecting from vite-plugin-vue-i18n ([@kazupon](https://github.com/kazupon))
6
+
7
+ #### Committers: 1
8
+ - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
9
+
10
+
2
11
  ## @intlify/unplugin-vue-i18n@0.6.0 (2022-09-19)
3
12
 
4
13
  #### :bug: Bug Fixes
package/lib/index.cjs CHANGED
@@ -97,11 +97,23 @@ function raiseError(message) {
97
97
  throw new Error(`[unplugin-vue-i18n] ${message}`);
98
98
  }
99
99
 
100
+ function checkVueI18nBridgeInstallPackage(debug) {
101
+ let ret = false;
102
+ try {
103
+ debug(`vue-i18n-bridge load path: ${require.resolve("vue-i18n-bridge")}`);
104
+ ret = true;
105
+ } catch (e) {
106
+ debug(`cannot find 'vue-i18n-bridge'`, e);
107
+ }
108
+ return ret;
109
+ }
110
+
100
111
  const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
101
112
  const INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID = "@intlify/vite-plugin-vue-i18n/messages";
102
113
  const VIRTUAL_PREFIX = "\0";
103
114
  const debug = createDebug__default("unplugin-vue-i18n");
104
115
  const installedPkg = bundleUtils.checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
116
+ const installedVueI18nBridge = checkVueI18nBridgeInstallPackage(debug);
105
117
  const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
106
118
  debug("plugin options:", options, meta.framework);
107
119
  if (!["vite", "webpack"].includes(meta.framework)) {
@@ -133,7 +145,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
133
145
  warn(`'useVueI18nImportName' option is experimental`);
134
146
  }
135
147
  debug("useVueI18nImportName", useVueI18nImportName);
136
- const getAliasName = () => installedPkg === "petite-vue-i18n" && shared.isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : `${installedPkg}`;
148
+ const getAliasName = () => installedVueI18nBridge && installedPkg === "vue-i18n" ? "vue-i18n-bridge" : installedPkg === "petite-vue-i18n" && shared.isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : `${installedPkg}`;
137
149
  const esm = shared.isBoolean(options.esm) ? options.esm : true;
138
150
  debug("esm", esm);
139
151
  let isProduction = false;
package/lib/index.mjs CHANGED
@@ -85,11 +85,23 @@ function raiseError(message) {
85
85
  throw new Error(`[unplugin-vue-i18n] ${message}`);
86
86
  }
87
87
 
88
+ function checkVueI18nBridgeInstallPackage(debug) {
89
+ let ret = false;
90
+ try {
91
+ debug(`vue-i18n-bridge load path: ${require.resolve("vue-i18n-bridge")}`);
92
+ ret = true;
93
+ } catch (e) {
94
+ debug(`cannot find 'vue-i18n-bridge'`, e);
95
+ }
96
+ return ret;
97
+ }
98
+
88
99
  const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
89
100
  const INTLIFY_BUNDLE_IMPORT_DEPRECTED_ID = "@intlify/vite-plugin-vue-i18n/messages";
90
101
  const VIRTUAL_PREFIX = "\0";
91
102
  const debug = createDebug("unplugin-vue-i18n");
92
103
  const installedPkg = checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
104
+ const installedVueI18nBridge = checkVueI18nBridgeInstallPackage(debug);
93
105
  const unplugin = createUnplugin((options = {}, meta) => {
94
106
  debug("plugin options:", options, meta.framework);
95
107
  if (!["vite", "webpack"].includes(meta.framework)) {
@@ -121,7 +133,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
121
133
  warn(`'useVueI18nImportName' option is experimental`);
122
134
  }
123
135
  debug("useVueI18nImportName", useVueI18nImportName);
124
- const getAliasName = () => installedPkg === "petite-vue-i18n" && isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : `${installedPkg}`;
136
+ const getAliasName = () => installedVueI18nBridge && installedPkg === "vue-i18n" ? "vue-i18n-bridge" : installedPkg === "petite-vue-i18n" && isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : `${installedPkg}`;
125
137
  const esm = isBoolean(options.esm) ? options.esm : true;
126
138
  debug("esm", esm);
127
139
  let isProduction = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlify/unplugin-vue-i18n",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "unplugin for Vue I18n",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
@@ -11,7 +11,8 @@
11
11
  },
12
12
  "peerDependencies": {
13
13
  "petite-vue-i18n": "*",
14
- "vue-i18n": "*"
14
+ "vue-i18n": "*",
15
+ "vue-i18n-bridge": "*"
15
16
  },
16
17
  "peerDependenciesMeta": {
17
18
  "petite-vue-i18n": {
@@ -19,6 +20,9 @@
19
20
  },
20
21
  "vue-i18n": {
21
22
  "optional": true
23
+ },
24
+ "vue-i18n-bridge": {
25
+ "optional": true
22
26
  }
23
27
  },
24
28
  "dependencies": {