@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 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
@@ -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
  }
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/deine-config.ts
1191
+ // src/define-config.ts
1192
1192
  function defineConfig(config) {
1193
1193
  return config;
1194
1194
  }
package/dist/index.mjs CHANGED
@@ -1189,7 +1189,7 @@ var _Generate = class {
1189
1189
  var Generate = _Generate;
1190
1190
  __publicField(Generate, "options");
1191
1191
 
1192
- // src/deine-config.ts
1192
+ // src/define-config.ts
1193
1193
  function defineConfig(config) {
1194
1194
  return config;
1195
1195
  }
@@ -1,5 +1,5 @@
1
1
  {{#include-query-params operations}}
2
- namespace RequestQueryParams {
2
+ export namespace RequestQueryParams {
3
3
  {{#each operations}}
4
4
  {{#if parametersQuery}}
5
5
  export type {{to-upper name true}} = {
@@ -3,7 +3,7 @@ import { PluginOption } from 'vite';
3
3
  interface PluginOptions {
4
4
  alias: string;
5
5
  dir: string;
6
- dts: string;
6
+ dts: string | boolean;
7
7
  }
8
8
  /**
9
9
  * Request插件
@@ -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 }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('../chunk-XXPGZHWZ.js');
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, _nullishCoalesce(options.dts, () => ( DECLARATION_FILE))),
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 ?? DECLARATION_FILE),
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
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gopowerteam/request-generate",
3
3
  "type": "commonjs",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "private": false,
6
6
  "keywords": [
7
7
  "gopowerteam",