@gopowerteam/request-generate 0.2.2 → 0.2.3
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/bin/download.mts +2 -2
- package/bin/generate.mts +1 -1
- package/bin/index.mts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/templates/partials/export-service-namespace.hbs +1 -1
- package/dist/vite-plugin/index.d.ts +1 -1
- package/dist/vite-plugin/index.js +5 -3
- package/dist/vite-plugin/index.mjs +4 -2
- package/package.json +1 -1
package/bin/download.mts
CHANGED
|
@@ -32,7 +32,7 @@ const configFilePaths = [
|
|
|
32
32
|
* 加载配置文件
|
|
33
33
|
* @param {*} filePath
|
|
34
34
|
*/
|
|
35
|
-
async function loadConfigFile(filePath) {
|
|
35
|
+
async function loadConfigFile(filePath: string) {
|
|
36
36
|
if (filePath) {
|
|
37
37
|
configFilePaths.unshift(filePath)
|
|
38
38
|
}
|
|
@@ -62,7 +62,7 @@ if (RequestGenerate) {
|
|
|
62
62
|
console.log('接口文件更新完成')
|
|
63
63
|
process.exit(0)
|
|
64
64
|
})
|
|
65
|
-
.catch((error) => {
|
|
65
|
+
.catch((error: Error) => {
|
|
66
66
|
console.error(error)
|
|
67
67
|
process.exit(1)
|
|
68
68
|
})
|
package/bin/generate.mts
CHANGED
package/bin/index.mts
CHANGED
|
@@ -33,7 +33,7 @@ const configFilePaths = [
|
|
|
33
33
|
* @param {*} filePath
|
|
34
34
|
* @returns Promise
|
|
35
35
|
*/
|
|
36
|
-
async function loadConfigFile(filePath) {
|
|
36
|
+
async function loadConfigFile(filePath: string) {
|
|
37
37
|
if (filePath) {
|
|
38
38
|
configFilePaths.unshift(filePath)
|
|
39
39
|
}
|
|
@@ -64,7 +64,7 @@ if (RequestGenerate) {
|
|
|
64
64
|
.then(() => {
|
|
65
65
|
process.exit(0)
|
|
66
66
|
})
|
|
67
|
-
.catch((error) => {
|
|
67
|
+
.catch((error: Error) => {
|
|
68
68
|
console.error(error)
|
|
69
69
|
process.exit(1)
|
|
70
70
|
})
|
package/dist/index.js
CHANGED
|
@@ -1188,7 +1188,7 @@ var _Generate = class {
|
|
|
1188
1188
|
var Generate = _Generate;
|
|
1189
1189
|
_chunkXXPGZHWZjs.__publicField.call(void 0, Generate, "options");
|
|
1190
1190
|
|
|
1191
|
-
// src/
|
|
1191
|
+
// src/define-config.ts
|
|
1192
1192
|
function defineConfig(config) {
|
|
1193
1193
|
return config;
|
|
1194
1194
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-XXPGZHWZ.js');
|
|
2
2
|
|
|
3
3
|
// src/vite-plugin/index.ts
|
|
4
4
|
var _child_process = require('child_process');
|
|
@@ -120,8 +120,10 @@ function genretateDeclareAndCode(options) {
|
|
|
120
120
|
const services = getServiceItems(paths);
|
|
121
121
|
const groups = getServiceGroups(services);
|
|
122
122
|
if (services && services.length) {
|
|
123
|
-
generateDeclare(services, groups, options);
|
|
124
123
|
generateCode(services, groups);
|
|
124
|
+
if (options.dts !== false) {
|
|
125
|
+
generateDeclare(services, groups, options);
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
function generateRequestCode() {
|
|
@@ -221,7 +223,7 @@ function generateDeclare(services, groups, options) {
|
|
|
221
223
|
MODULE_ID
|
|
222
224
|
});
|
|
223
225
|
fs.writeFileSync(
|
|
224
|
-
path.resolve(viteConfig.root,
|
|
226
|
+
path.resolve(viteConfig.root, typeof options.dts === "string" ? options.dts : DECLARATION_FILE),
|
|
225
227
|
content.replace(/\r\n/g, "\n"),
|
|
226
228
|
"utf-8"
|
|
227
229
|
);
|
|
@@ -120,8 +120,10 @@ function genretateDeclareAndCode(options) {
|
|
|
120
120
|
const services = getServiceItems(paths);
|
|
121
121
|
const groups = getServiceGroups(services);
|
|
122
122
|
if (services && services.length) {
|
|
123
|
-
generateDeclare(services, groups, options);
|
|
124
123
|
generateCode(services, groups);
|
|
124
|
+
if (options.dts !== false) {
|
|
125
|
+
generateDeclare(services, groups, options);
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
function generateRequestCode() {
|
|
@@ -221,7 +223,7 @@ function generateDeclare(services, groups, options) {
|
|
|
221
223
|
MODULE_ID
|
|
222
224
|
});
|
|
223
225
|
fs.writeFileSync(
|
|
224
|
-
path.resolve(viteConfig.root, options.dts
|
|
226
|
+
path.resolve(viteConfig.root, typeof options.dts === "string" ? options.dts : DECLARATION_FILE),
|
|
225
227
|
content.replace(/\r\n/g, "\n"),
|
|
226
228
|
"utf-8"
|
|
227
229
|
);
|