@intlify/bundle-utils 3.2.1 → 3.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/lib/deps.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export declare type InstalledPackage = 'vue-i18n' | 'petite-vue-i18n';
2
+ export declare function checkInstallPackage(pkg: string, debug: Function): InstalledPackage;
3
+ export declare function checkVueI18nBridgeInstallPackage(debug: Function): boolean;
4
+ declare type VueI18nVersion = '8' | '9' | 'unknown' | '';
5
+ export declare function getVueI18nVersion(debug: Function): VueI18nVersion;
6
+ export declare function loadModule(moduleName: string, debug: Function): any;
7
+ export {};
package/lib/deps.js ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadModule = exports.getVueI18nVersion = exports.checkVueI18nBridgeInstallPackage = exports.checkInstallPackage = void 0;
4
+ // eslint-disable-next-line @typescript-eslint/ban-types
5
+ function checkInstallPackage(pkg, debug) {
6
+ let installedVueI18n = false;
7
+ try {
8
+ debug(`vue-i18n load path: ${require.resolve('vue-i18n')}`);
9
+ installedVueI18n = true;
10
+ }
11
+ catch (e) {
12
+ debug(`cannot find 'vue-i18n'`, e);
13
+ }
14
+ let installedPetiteVueI18n = false;
15
+ try {
16
+ debug(`petite-vue-i18n load path: ${require.resolve('petite-vue-i18n')}`);
17
+ installedPetiteVueI18n = true;
18
+ }
19
+ catch (e) {
20
+ debug(`cannot find 'petite-vue-i18n'`, e);
21
+ }
22
+ if (installedVueI18n) {
23
+ return 'vue-i18n';
24
+ }
25
+ if (installedPetiteVueI18n) {
26
+ return 'petite-vue-i18n';
27
+ }
28
+ throw new Error(`${pkg} requires 'vue-i18n' or 'petite-vue-i18n' to be present in the dependency tree.`);
29
+ }
30
+ exports.checkInstallPackage = checkInstallPackage;
31
+ // eslint-disable-next-line @typescript-eslint/ban-types
32
+ function checkVueI18nBridgeInstallPackage(debug) {
33
+ let ret = false;
34
+ try {
35
+ debug(`vue-i18n-bridge load path: ${require.resolve('vue-i18n-bridge')}`);
36
+ ret = true;
37
+ }
38
+ catch (e) {
39
+ debug(`cannot find 'vue-i18n-bridge'`, e);
40
+ }
41
+ return ret;
42
+ }
43
+ exports.checkVueI18nBridgeInstallPackage = checkVueI18nBridgeInstallPackage;
44
+ function getVueI18nVersion(debug) {
45
+ const VueI18n = loadModule('vue-i18n', debug);
46
+ if (VueI18n == null) {
47
+ return '';
48
+ }
49
+ if (VueI18n.version && VueI18n.version.startsWith('8.')) {
50
+ return '8';
51
+ }
52
+ if (VueI18n.VERSION && VueI18n.VERSION.startsWith('9.')) {
53
+ return '9';
54
+ }
55
+ return 'unknown';
56
+ }
57
+ exports.getVueI18nVersion = getVueI18nVersion;
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ function loadModule(moduleName, debug) {
60
+ try {
61
+ return require(moduleName);
62
+ }
63
+ catch (e) {
64
+ debug(`cannot load '${moduleName}'`, e);
65
+ return null;
66
+ }
67
+ }
68
+ exports.loadModule = loadModule;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { CodeGenOptions, CodeGenResult, DevEnv } from './codegen';
2
2
  export { generate as generateJSON } from './json';
3
3
  export { generate as generateYAML } from './yaml';
4
- export { checkInstallPackage, checkVueI18nBridgeInstallPackage, InstalledPackage } from './check';
4
+ export { getVueI18nVersion, checkInstallPackage, checkVueI18nBridgeInstallPackage, InstalledPackage } from './deps';
package/lib/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkVueI18nBridgeInstallPackage = exports.checkInstallPackage = exports.generateYAML = exports.generateJSON = void 0;
3
+ exports.checkVueI18nBridgeInstallPackage = exports.checkInstallPackage = exports.getVueI18nVersion = exports.generateYAML = exports.generateJSON = void 0;
4
4
  var json_1 = require("./json");
5
5
  Object.defineProperty(exports, "generateJSON", { enumerable: true, get: function () { return json_1.generate; } });
6
6
  var yaml_1 = require("./yaml");
7
7
  Object.defineProperty(exports, "generateYAML", { enumerable: true, get: function () { return yaml_1.generate; } });
8
- var check_1 = require("./check");
9
- Object.defineProperty(exports, "checkInstallPackage", { enumerable: true, get: function () { return check_1.checkInstallPackage; } });
10
- Object.defineProperty(exports, "checkVueI18nBridgeInstallPackage", { enumerable: true, get: function () { return check_1.checkVueI18nBridgeInstallPackage; } });
8
+ var deps_1 = require("./deps");
9
+ Object.defineProperty(exports, "getVueI18nVersion", { enumerable: true, get: function () { return deps_1.getVueI18nVersion; } });
10
+ Object.defineProperty(exports, "checkInstallPackage", { enumerable: true, get: function () { return deps_1.checkInstallPackage; } });
11
+ Object.defineProperty(exports, "checkVueI18nBridgeInstallPackage", { enumerable: true, get: function () { return deps_1.checkVueI18nBridgeInstallPackage; } });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intlify/bundle-utils",
3
3
  "description": "Bundle utilities for Intlify project",
4
- "version": "3.2.1",
4
+ "version": "3.4.0",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
package/CHANGELOG.md DELETED
@@ -1,147 +0,0 @@
1
-
2
- ## @intlify/bundle-utils@3.2.1 (2022-09-27)
3
-
4
- #### :bug: Bug Fixes
5
- * [#186](https://github.com/intlify/bundle-tools/pull/186) fix(bundle-utils): export `checkVueI18nBridgeInstallPackage` ([@kazupon](https://github.com/kazupon))
6
-
7
- #### Committers: 1
8
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
9
-
10
-
11
- ## @intlify/bundle-utils@3.2.0 (2022-09-27)
12
-
13
- #### :star: Features
14
- * [#185](https://github.com/intlify/bundle-tools/pull/185) feat: add vue-i18n-bridge install checking ([@kazupon](https://github.com/kazupon))
15
-
16
- #### Committers: 1
17
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
18
-
19
-
20
- ## @intlify/bundle-utils@3.1.2 (2022-09-19)
21
-
22
- #### :zap: Improvement Features
23
- * [#178](https://github.com/intlify/bundle-tools/pull/178) fix(bundle-utils): improve compile error handling ([@kazupon](https://github.com/kazupon))
24
-
25
- #### Committers: 1
26
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
27
-
28
-
29
- ## @intlify/bundle-utils@3.1.1 (2022-09-19)
30
-
31
- #### :bug: Bug Fixes
32
- * [#177](https://github.com/intlify/bundle-tools/pull/177) fix(bundle-utils): fix wrong error callbacking and error handling improvement ([@kazupon](https://github.com/kazupon))
33
-
34
- #### Committers: 1
35
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
36
-
37
-
38
- ## @intlify/bundle-utils@3.1.0 (2022-05-06)
39
-
40
- #### :zap: Improvement Features
41
- * [#116](https://github.com/intlify/bundle-tools/pull/116) improvement(bundle-utils): support ESM exporting on bridge ([@kazupon](https://github.com/kazupon))
42
-
43
- #### Committers: 1
44
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
45
-
46
-
47
- ## @intlify/bundle-utils@3.0.0 (2022-04-05)
48
-
49
- #### :star: Features
50
- * [#101](https://github.com/intlify/bundle-tools/pull/101) feat(bundle-utils): pinned intlify related module next version ([@kazupon](https://github.com/kazupon))
51
-
52
- #### Committers: 1
53
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
54
-
55
-
56
- ## @intlify/bundle-utils@2.2.2 (2022-04-05)
57
-
58
- #### :zap: Improvement Features
59
- * [#100](https://github.com/intlify/bundle-tools/pull/100) fix(bundle-utils): pinned latest stable version ([@kazupon](https://github.com/kazupon))
60
-
61
- #### Committers: 1
62
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
63
-
64
-
65
- ## @intlify/bundle-utils@2.2.1 (2022-03-22)
66
-
67
- #### :bug: Bug Fixes
68
- * [#98](https://github.com/intlify/bundle-tools/pull/98) fix(bundle-utils): fix nested array code generation ([@kazupon](https://github.com/kazupon))
69
-
70
- #### Committers: 1
71
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
72
-
73
-
74
- ## @intlify/bundle-utils@2.2.1 (2022-03-22)
75
-
76
- #### :bug: Bug Fixes
77
- * [#98](https://github.com/intlify/bundle-tools/pull/98) fix(bundle-utils): fix nested array code generation ([@kazupon](https://github.com/kazupon))
78
-
79
- #### Committers: 1
80
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
81
-
82
-
83
- ## @intlify/bundle-utils@2.2.0 (2021-12-16)
84
-
85
- #### :zap: Improvement Features
86
- * [#75](https://github.com/intlify/bundle-tools/pull/75) Add vue-class-components support via loader option ([@SniperJoe](https://github.com/SniperJoe))
87
-
88
- #### Committers: 1
89
- - [@SniperJoe](https://github.com/SniperJoe)
90
-
91
-
92
- ## @intlify/bundle-utils@2.1.0 (2021-11-10)
93
-
94
- #### :zap: Improvement Features
95
- * [#67](https://github.com/intlify/bundle-tools/pull/67) fix: add vite and vue-i18n as peerDependencies ([@AlexandreBonaventure](https://github.com/AlexandreBonaventure))
96
-
97
- #### Committers: 1
98
- - Alexandre Bonaventure Geissmann ([@AlexandreBonaventure](https://github.com/AlexandreBonaventure))
99
-
100
-
101
- ## @intlify/bundle-utils@2.0.0 (2021-10-24)
102
-
103
- #### :star: Features
104
- * [#60](https://github.com/intlify/bundle-tools/pull/60) feat: change to intlify beta related deps ([@kazupon](https://github.com/kazupon))
105
-
106
- #### Committers: 1
107
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
108
-
109
-
110
- ## @intlify/bundle-utils@1.0.0 (2021-10-24)
111
-
112
- #### :star: Features
113
- * [#56](https://github.com/intlify/bundle-tools/pull/56) feat: bump to major version ([@kazupon](https://github.com/kazupon))
114
-
115
- #### Committers: 1
116
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
117
-
118
-
119
- ## @intlify/bundle-utils@0.3.0 (2021-09-29)
120
-
121
- #### :star: Features
122
- * [#47](https://github.com/intlify/bundle-tools/pull/47) feat: support vue i18n bridge ([@kazupon](https://github.com/kazupon))
123
-
124
- #### Committers: 1
125
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
126
-
127
-
128
- ## @intlify/bundle-utils@0.2.0 (2021-07-26)
129
-
130
- #### :star: Features
131
- * [#36](https://github.com/intlify/bundle-tools/pull/36) add install package checking ([@kazupon](https://github.com/kazupon))
132
-
133
- #### Committers: 1
134
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
135
-
136
-
137
- ## @intlify/bundle-utils@0.1.0 (2021-07-12)
138
-
139
- #### :star: Features
140
- * [#26](https://github.com/intlify/bundle-tools/pull/26) feat: bundle-utils basic implementation ([@kazupon](https://github.com/kazupon))
141
-
142
- #### Committers: 1
143
- - kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
144
-
145
- ## v0.0.0 (2021-07-13)
146
-
147
- :tada: Initial release.