@gopowerteam/request-generate 0.2.3 → 0.3.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.
Files changed (34) hide show
  1. package/dist/chunk-C0xms8kb.cjs +34 -0
  2. package/dist/index.cjs +1105 -0
  3. package/dist/index.d.cts +739 -0
  4. package/dist/index.d.mts +739 -0
  5. package/dist/index.mjs +937 -1040
  6. package/dist/vite-plugin/index.cjs +238 -0
  7. package/dist/vite-plugin/index.d.cts +13 -0
  8. package/dist/vite-plugin/index.d.mts +14 -0
  9. package/dist/vite-plugin/index.mjs +118 -118
  10. package/package.json +29 -29
  11. package/dist/chunk-WF3XBEPN.mjs +0 -18
  12. package/dist/chunk-XXPGZHWZ.js +0 -10
  13. package/dist/index.d.ts +0 -165
  14. package/dist/index.js +0 -1203
  15. package/dist/vite-plugin/index.d.ts +0 -13
  16. package/dist/vite-plugin/index.js +0 -233
  17. /package/dist/templates/{export-model.hbs → templates/export-model.hbs} +0 -0
  18. /package/dist/templates/{export-service.hbs → templates/export-service.hbs} +0 -0
  19. /package/dist/templates/{partials → templates/partials}/export-description.hbs +0 -0
  20. /package/dist/templates/{partials → templates/partials}/export-header.hbs +0 -0
  21. /package/dist/templates/{partials → templates/partials}/export-model-field.hbs +0 -0
  22. /package/dist/templates/{partials → templates/partials}/export-model-import.hbs +0 -0
  23. /package/dist/templates/{partials → templates/partials}/export-model-type.hbs +0 -0
  24. /package/dist/templates/{partials → templates/partials}/export-operation-params-body.hbs +0 -0
  25. /package/dist/templates/{partials → templates/partials}/export-operation-params-path.hbs +0 -0
  26. /package/dist/templates/{partials → templates/partials}/export-operation-params-query.hbs +0 -0
  27. /package/dist/templates/{partials → templates/partials}/export-operation-response.hbs +0 -0
  28. /package/dist/templates/{partials → templates/partials}/export-schema-type.hbs +0 -0
  29. /package/dist/templates/{partials → templates/partials}/export-service-class.hbs +0 -0
  30. /package/dist/templates/{partials → templates/partials}/export-service-import.hbs +0 -0
  31. /package/dist/templates/{partials → templates/partials}/export-service-namespace-type.hbs +0 -0
  32. /package/dist/templates/{partials → templates/partials}/export-service-namespace.hbs +0 -0
  33. /package/dist/templates/{partials → templates/partials}/export-service-operation.hbs +0 -0
  34. /package/dist/templates/{partials → templates/partials}/is-required.hbs +0 -0
@@ -0,0 +1,238 @@
1
+ const require_chunk = require('../chunk-C0xms8kb.cjs');
2
+ let node_fs = require("node:fs");
3
+ node_fs = require_chunk.__toESM(node_fs);
4
+ let node_path = require("node:path");
5
+ node_path = require_chunk.__toESM(node_path);
6
+ let node_process = require("node:process");
7
+ node_process = require_chunk.__toESM(node_process);
8
+ let handlebars = require("handlebars");
9
+ handlebars = require_chunk.__toESM(handlebars);
10
+ let node_child_process = require("node:child_process");
11
+
12
+ //#region src/vite-plugin/templates.ts
13
+ const useRequestFunctionCodeTemplate = `
14
+ export function useRequest(
15
+ ...selects
16
+ ) {
17
+ const services = selects.map((select)=>{
18
+ const service = select(serviceMap)
19
+ return new service()
20
+ })
21
+
22
+ if(services.length === 1){
23
+ return services[0]
24
+ }else{
25
+ return services
26
+ }
27
+ }
28
+ `;
29
+ const useRequestFunctionTypeTemplate = `
30
+ export function useRequest<T1,T2,T3,T4,T5,T6>(
31
+ select1: ((services: typeof serviceMap) => { new (): T1 }),
32
+ select2: ((services: typeof serviceMap) => { new (): T2 }),
33
+ select3: ((services: typeof serviceMap) => { new (): T3 }),
34
+ select4: ((services: typeof serviceMap) => { new (): T4 }),
35
+ select5: ((services: typeof serviceMap) => { new (): T5 }),
36
+ select6: ((services: typeof serviceMap) => { new (): T6 }),
37
+ ): [T1,T2,T3,T4,T5,T6]
38
+ export function useRequest<T1,T2,T3,T4,T5>(
39
+ select1: ((services: typeof serviceMap) => { new (): T1 }),
40
+ select2: ((services: typeof serviceMap) => { new (): T2 }),
41
+ select3: ((services: typeof serviceMap) => { new (): T3 }),
42
+ select4: ((services: typeof serviceMap) => { new (): T4 }),
43
+ select5: ((services: typeof serviceMap) => { new (): T5 }),
44
+ ): [T1,T2,T3,T4,T5]
45
+ export function useRequest<T1,T2,T3,T4>(
46
+ select1: ((services: typeof serviceMap) => { new (): T1 }),
47
+ select2: ((services: typeof serviceMap) => { new (): T2 }),
48
+ select3: ((services: typeof serviceMap) => { new (): T3 }),
49
+ select4: ((services: typeof serviceMap) => { new (): T4 }),
50
+ ): [T1,T2,T3,T4]
51
+ export function useRequest<T1,T2,T3>(
52
+ select1: ((services: typeof serviceMap) => { new (): T1 }),
53
+ select2: ((services: typeof serviceMap) => { new (): T2 }),
54
+ select3: ((services: typeof serviceMap) => { new (): T3 }),
55
+ ): [T1,T2,T3]
56
+ export function useRequest<T1,T2>(
57
+ select1: ((services: typeof serviceMap) => { new (): T1 }),
58
+ select2: ((services: typeof serviceMap) => { new (): T2 }),
59
+ ): [T1,T2]
60
+ export function useRequest<T>(
61
+ select: ((services: typeof serviceMap) => { new (): T })
62
+ ): T
63
+ export function useRequest<T>(
64
+ ...selects: ((services: typeof serviceMap) => { new (): T })[]
65
+ ): T | T[]
66
+ `;
67
+ const importServiceTemplate = `
68
+ {{#if groups}}
69
+ {{#each groups}}
70
+ {{#each services}}
71
+ import { {{{name}}} as {{group}}_{{name}} } from '{{path}}'
72
+ {{/each}}
73
+ {{/each}}
74
+ {{else}}
75
+ {{#each services}}
76
+ import { {{{name}}} } from '{{path}}'
77
+ {{/each}}
78
+ {{/if}}
79
+ `;
80
+ const defineServiceMapTemplate = `
81
+ {{#if groups}}
82
+ const serviceMap = {
83
+ {{#each groups}}
84
+ {{{name}}}: {
85
+ {{#each services}}
86
+ {{{name}}}: {{group}}_{{name}},
87
+ {{/each}}
88
+ },
89
+ {{/each}}
90
+ }
91
+ {{else}}
92
+ const serviceMap = {
93
+ {{#each services}}
94
+ {{{name}}},
95
+ {{/each}}
96
+ }
97
+ {{/if}}
98
+ `;
99
+ const generateCodeTemplate = `
100
+ ${importServiceTemplate.trim()}
101
+
102
+ ${defineServiceMapTemplate.trim()}
103
+
104
+ ${useRequestFunctionCodeTemplate.trim()}
105
+ `;
106
+ const generateDeclareTemplate = `declare module '{{{MODULE_ID}}}' {
107
+ ${importServiceTemplate.trim()}
108
+
109
+ ${defineServiceMapTemplate.trim()}
110
+
111
+ ${useRequestFunctionTypeTemplate.trim()}
112
+ }
113
+ `;
114
+
115
+ //#endregion
116
+ //#region src/vite-plugin/index.ts
117
+ const MODULE_ID = "virtual:request";
118
+ const DECLARATION_FILE = "request.d.ts";
119
+ let viteConfig;
120
+ let GerneratedCodeStr = "";
121
+ function genretateDeclareAndCode(options) {
122
+ const services = getServiceItems(getServicePaths(options));
123
+ const groups = getServiceGroups(services);
124
+ if (services && services.length) {
125
+ generateCode(services, groups);
126
+ if (options.dts !== false) generateDeclare(services, groups, options);
127
+ }
128
+ }
129
+ function generateRequestCode() {
130
+ (0, node_child_process.execSync)(`${node_path.resolve(viteConfig.root, "node_modules", ".bin", "request-generate")}`, { env: {
131
+ ...node_process.default.env,
132
+ FORCE_COLOR: "1"
133
+ } });
134
+ }
135
+ /**
136
+ * Request插件
137
+ */
138
+ var vite_plugin_default = (options) => {
139
+ return {
140
+ name: "vite-plugin-vue-request",
141
+ enforce: "pre",
142
+ configResolved(config) {
143
+ viteConfig = config;
144
+ },
145
+ resolveId(id) {
146
+ return id === MODULE_ID ? MODULE_ID : void 0;
147
+ },
148
+ async buildStart() {
149
+ await generateRequestCode();
150
+ await genretateDeclareAndCode(options);
151
+ },
152
+ load(id) {
153
+ if (id !== MODULE_ID) return;
154
+ return GerneratedCodeStr;
155
+ }
156
+ };
157
+ };
158
+ /**
159
+ * 生成服务路径
160
+ * @param options PluginOptions
161
+ * @returns string[]
162
+ */
163
+ function getServicePaths(options) {
164
+ const paths = [];
165
+ const walk = (dir) => {
166
+ node_fs.readdirSync(dir).forEach((file) => {
167
+ const fullpath = node_path.join(dir, file).replace(/\\/g, "/");
168
+ const stat = node_fs.statSync(fullpath);
169
+ if (stat.isFile() && fullpath.endsWith("Service.ts")) paths.push(fullpath);
170
+ else if (stat.isDirectory()) walk(node_path.join(dir, file));
171
+ });
172
+ };
173
+ const { replacement } = viteConfig.resolve.alias.find((alias) => alias.find === options.alias);
174
+ if (node_fs.existsSync(node_path.resolve(options.dir))) walk(node_path.resolve(options.dir));
175
+ return paths.map((filepath) => filepath.replace(replacement.replace(/\\/g, "/"), options.alias));
176
+ }
177
+ /**
178
+ * 生成服务项
179
+ * @param paths
180
+ * @returns ServiceItem[]
181
+ */
182
+ function getServiceItems(paths) {
183
+ const toCaseString = (str = "") => str.replace(/-(\w)/g, (_, $1) => $1.toUpperCase()).replace(/^\S/, (s) => s.toUpperCase());
184
+ return paths.map((filePath) => {
185
+ const [name] = /[^\\]+(?=\.ts$)/.exec(toCaseString(node_path.basename(filePath))) || [];
186
+ const [group] = /(?<=^.\/http\/)(.*?)(?=\/.*?Service\.ts$)/.exec(filePath) || [];
187
+ return {
188
+ name: toCaseString(name),
189
+ group: group !== "services" ? toCaseString(group) : void 0,
190
+ path: filePath.replace(/\.ts$/g, "")
191
+ };
192
+ });
193
+ }
194
+ /**
195
+ * 获取分组列表
196
+ * @param services
197
+ * @returns GroupItem[]
198
+ */
199
+ function getServiceGroups(services) {
200
+ return services.reduce((r, s) => {
201
+ if (!s.group) return r;
202
+ const group = r.find((x) => x.name === s.group) || {
203
+ name: s.group,
204
+ services: []
205
+ };
206
+ group.services.push(s);
207
+ if (!r.find((g) => g === group)) r.push(group);
208
+ return r;
209
+ }, []);
210
+ }
211
+ /**
212
+ * 生成代码
213
+ * @param services
214
+ * @param groups
215
+ */
216
+ function generateCode(services, groups) {
217
+ GerneratedCodeStr = handlebars.default.compile(generateCodeTemplate)({
218
+ groups: groups.length ? groups : void 0,
219
+ services
220
+ });
221
+ }
222
+ /**
223
+ * 生成代码
224
+ * @param services
225
+ * @param groups
226
+ * @param options
227
+ */
228
+ function generateDeclare(services, groups, options) {
229
+ const content = handlebars.default.compile(generateDeclareTemplate)({
230
+ groups: groups.length ? groups : void 0,
231
+ services,
232
+ MODULE_ID
233
+ });
234
+ node_fs.writeFileSync(node_path.resolve(viteConfig.root, typeof options.dts === "string" ? options.dts : DECLARATION_FILE), content.replace(/\r\n/g, "\n"), "utf-8");
235
+ }
236
+
237
+ //#endregion
238
+ module.exports = vite_plugin_default;
@@ -0,0 +1,13 @@
1
+ import { PluginOption } from "vite";
2
+
3
+ //#region src/vite-plugin/index.d.ts
4
+ interface PluginOptions {
5
+ alias: string;
6
+ dir: string;
7
+ dts: string | boolean;
8
+ }
9
+ /**
10
+ * Request插件
11
+ */
12
+ declare const _default: (options: PluginOptions) => PluginOption;
13
+ export = _default;
@@ -0,0 +1,14 @@
1
+ import { PluginOption } from "vite";
2
+
3
+ //#region src/vite-plugin/index.d.ts
4
+ interface PluginOptions {
5
+ alias: string;
6
+ dir: string;
7
+ dts: string | boolean;
8
+ }
9
+ /**
10
+ * Request插件
11
+ */
12
+ declare const _default: (options: PluginOptions) => PluginOption;
13
+ //#endregion
14
+ export { _default as default };
@@ -1,14 +1,11 @@
1
- import "../chunk-WF3XBEPN.mjs";
2
-
3
- // src/vite-plugin/index.ts
4
- import { execSync } from "node:child_process";
5
- import * as fs from "node:fs";
6
- import * as path from "node:path";
1
+ import * as fs$1 from "node:fs";
2
+ import * as path$1 from "node:path";
7
3
  import process from "node:process";
8
4
  import Handlebars from "handlebars";
5
+ import { execSync } from "node:child_process";
9
6
 
10
- // src/vite-plugin/templates.ts
11
- var useRequestFunctionCodeTemplate = `
7
+ //#region src/vite-plugin/templates.ts
8
+ const useRequestFunctionCodeTemplate = `
12
9
  export function useRequest(
13
10
  ...selects
14
11
  ) {
@@ -24,7 +21,7 @@ export function useRequest(
24
21
  }
25
22
  }
26
23
  `;
27
- var useRequestFunctionTypeTemplate = `
24
+ const useRequestFunctionTypeTemplate = `
28
25
  export function useRequest<T1,T2,T3,T4,T5,T6>(
29
26
  select1: ((services: typeof serviceMap) => { new (): T1 }),
30
27
  select2: ((services: typeof serviceMap) => { new (): T2 }),
@@ -62,7 +59,7 @@ export function useRequest<T>(
62
59
  ...selects: ((services: typeof serviceMap) => { new (): T })[]
63
60
  ): T | T[]
64
61
  `;
65
- var importServiceTemplate = `
62
+ const importServiceTemplate = `
66
63
  {{#if groups}}
67
64
  {{#each groups}}
68
65
  {{#each services}}
@@ -75,7 +72,7 @@ import { {{{name}}} } from '{{path}}'
75
72
  {{/each}}
76
73
  {{/if}}
77
74
  `;
78
- var defineServiceMapTemplate = `
75
+ const defineServiceMapTemplate = `
79
76
  {{#if groups}}
80
77
  const serviceMap = {
81
78
  {{#each groups}}
@@ -94,14 +91,14 @@ const serviceMap = {
94
91
  }
95
92
  {{/if}}
96
93
  `;
97
- var generateCodeTemplate = `
94
+ const generateCodeTemplate = `
98
95
  ${importServiceTemplate.trim()}
99
96
 
100
97
  ${defineServiceMapTemplate.trim()}
101
98
 
102
99
  ${useRequestFunctionCodeTemplate.trim()}
103
100
  `;
104
- var generateDeclareTemplate = `declare module '{{{MODULE_ID}}}' {
101
+ const generateDeclareTemplate = `declare module '{{{MODULE_ID}}}' {
105
102
  ${importServiceTemplate.trim()}
106
103
 
107
104
  ${defineServiceMapTemplate.trim()}
@@ -110,124 +107,127 @@ var generateDeclareTemplate = `declare module '{{{MODULE_ID}}}' {
110
107
  }
111
108
  `;
112
109
 
113
- // src/vite-plugin/index.ts
114
- var MODULE_ID = "virtual:request";
115
- var DECLARATION_FILE = "request.d.ts";
116
- var viteConfig;
117
- var GerneratedCodeStr = "";
110
+ //#endregion
111
+ //#region src/vite-plugin/index.ts
112
+ const MODULE_ID = "virtual:request";
113
+ const DECLARATION_FILE = "request.d.ts";
114
+ let viteConfig;
115
+ let GerneratedCodeStr = "";
118
116
  function genretateDeclareAndCode(options) {
119
- const paths = getServicePaths(options);
120
- const services = getServiceItems(paths);
121
- const groups = getServiceGroups(services);
122
- if (services && services.length) {
123
- generateCode(services, groups);
124
- if (options.dts !== false) {
125
- generateDeclare(services, groups, options);
126
- }
127
- }
117
+ const services = getServiceItems(getServicePaths(options));
118
+ const groups = getServiceGroups(services);
119
+ if (services && services.length) {
120
+ generateCode(services, groups);
121
+ if (options.dts !== false) generateDeclare(services, groups, options);
122
+ }
128
123
  }
129
124
  function generateRequestCode() {
130
- const generateScript = path.resolve(viteConfig.root, "node_modules", ".bin", "request-generate");
131
- execSync(`${generateScript}`, {
132
- env: {
133
- ...process.env,
134
- FORCE_COLOR: "1"
135
- }
136
- });
125
+ execSync(`${path$1.resolve(viteConfig.root, "node_modules", ".bin", "request-generate")}`, { env: {
126
+ ...process.env,
127
+ FORCE_COLOR: "1"
128
+ } });
137
129
  }
130
+ /**
131
+ * Request插件
132
+ */
138
133
  var vite_plugin_default = (options) => {
139
- return {
140
- name: "vite-plugin-vue-request",
141
- enforce: "pre",
142
- configResolved(config) {
143
- viteConfig = config;
144
- },
145
- resolveId(id) {
146
- return id === MODULE_ID ? MODULE_ID : void 0;
147
- },
148
- async buildStart() {
149
- await generateRequestCode();
150
- await genretateDeclareAndCode(options);
151
- },
152
- load(id) {
153
- if (id !== MODULE_ID)
154
- return;
155
- return GerneratedCodeStr;
156
- }
157
- };
134
+ return {
135
+ name: "vite-plugin-vue-request",
136
+ enforce: "pre",
137
+ configResolved(config) {
138
+ viteConfig = config;
139
+ },
140
+ resolveId(id) {
141
+ return id === MODULE_ID ? MODULE_ID : void 0;
142
+ },
143
+ async buildStart() {
144
+ await generateRequestCode();
145
+ await genretateDeclareAndCode(options);
146
+ },
147
+ load(id) {
148
+ if (id !== MODULE_ID) return;
149
+ return GerneratedCodeStr;
150
+ }
151
+ };
158
152
  };
153
+ /**
154
+ * 生成服务路径
155
+ * @param options PluginOptions
156
+ * @returns string[]
157
+ */
159
158
  function getServicePaths(options) {
160
- const paths = [];
161
- const walk = (dir) => {
162
- fs.readdirSync(dir).forEach((file) => {
163
- const fullpath = path.join(dir, file).replace(/\\/g, "/");
164
- const stat = fs.statSync(fullpath);
165
- if (stat.isFile() && fullpath.endsWith("Service.ts")) {
166
- paths.push(fullpath);
167
- } else if (stat.isDirectory()) {
168
- const subdir = path.join(dir, file);
169
- walk(subdir);
170
- }
171
- });
172
- };
173
- const { replacement } = viteConfig.resolve.alias.find(
174
- (alias) => alias.find === options.alias
175
- );
176
- if (fs.existsSync(path.resolve(options.dir))) {
177
- walk(path.resolve(options.dir));
178
- }
179
- return paths.map(
180
- (filepath) => filepath.replace(replacement.replace(/\\/g, "/"), options.alias)
181
- );
159
+ const paths = [];
160
+ const walk = (dir) => {
161
+ fs$1.readdirSync(dir).forEach((file) => {
162
+ const fullpath = path$1.join(dir, file).replace(/\\/g, "/");
163
+ const stat = fs$1.statSync(fullpath);
164
+ if (stat.isFile() && fullpath.endsWith("Service.ts")) paths.push(fullpath);
165
+ else if (stat.isDirectory()) walk(path$1.join(dir, file));
166
+ });
167
+ };
168
+ const { replacement } = viteConfig.resolve.alias.find((alias) => alias.find === options.alias);
169
+ if (fs$1.existsSync(path$1.resolve(options.dir))) walk(path$1.resolve(options.dir));
170
+ return paths.map((filepath) => filepath.replace(replacement.replace(/\\/g, "/"), options.alias));
182
171
  }
172
+ /**
173
+ * 生成服务项
174
+ * @param paths
175
+ * @returns ServiceItem[]
176
+ */
183
177
  function getServiceItems(paths) {
184
- const toCaseString = (str = "") => str.replace(/-(\w)/g, (_, $1) => $1.toUpperCase()).replace(/^\S/, (s) => s.toUpperCase());
185
- return paths.map((filePath) => {
186
- const [name] = /[^\\]+(?=\.ts$)/.exec(toCaseString(path.basename(filePath))) || [];
187
- const [group] = /(?<=^.\/http\/)(.*?)(?=\/.*?Service\.ts$)/.exec(filePath) || [];
188
- return {
189
- name: toCaseString(name),
190
- group: group !== "services" ? toCaseString(group) : void 0,
191
- path: filePath.replace(/\.ts$/g, "")
192
- };
193
- });
178
+ const toCaseString = (str = "") => str.replace(/-(\w)/g, (_, $1) => $1.toUpperCase()).replace(/^\S/, (s) => s.toUpperCase());
179
+ return paths.map((filePath) => {
180
+ const [name] = /[^\\]+(?=\.ts$)/.exec(toCaseString(path$1.basename(filePath))) || [];
181
+ const [group] = /(?<=^.\/http\/)(.*?)(?=\/.*?Service\.ts$)/.exec(filePath) || [];
182
+ return {
183
+ name: toCaseString(name),
184
+ group: group !== "services" ? toCaseString(group) : void 0,
185
+ path: filePath.replace(/\.ts$/g, "")
186
+ };
187
+ });
194
188
  }
189
+ /**
190
+ * 获取分组列表
191
+ * @param services
192
+ * @returns GroupItem[]
193
+ */
195
194
  function getServiceGroups(services) {
196
- return services.reduce((r, s) => {
197
- if (!s.group) {
198
- return r;
199
- }
200
- const group = r.find((x) => x.name === s.group) || {
201
- name: s.group,
202
- services: []
203
- };
204
- group.services.push(s);
205
- if (!r.find((g) => g === group)) {
206
- r.push(group);
207
- }
208
- return r;
209
- }, []);
195
+ return services.reduce((r, s) => {
196
+ if (!s.group) return r;
197
+ const group = r.find((x) => x.name === s.group) || {
198
+ name: s.group,
199
+ services: []
200
+ };
201
+ group.services.push(s);
202
+ if (!r.find((g) => g === group)) r.push(group);
203
+ return r;
204
+ }, []);
210
205
  }
206
+ /**
207
+ * 生成代码
208
+ * @param services
209
+ * @param groups
210
+ */
211
211
  function generateCode(services, groups) {
212
- const template = Handlebars.compile(generateCodeTemplate);
213
- GerneratedCodeStr = template({
214
- groups: groups.length ? groups : void 0,
215
- services
216
- });
212
+ GerneratedCodeStr = Handlebars.compile(generateCodeTemplate)({
213
+ groups: groups.length ? groups : void 0,
214
+ services
215
+ });
217
216
  }
217
+ /**
218
+ * 生成代码
219
+ * @param services
220
+ * @param groups
221
+ * @param options
222
+ */
218
223
  function generateDeclare(services, groups, options) {
219
- const template = Handlebars.compile(generateDeclareTemplate);
220
- const content = template({
221
- groups: groups.length ? groups : void 0,
222
- services,
223
- MODULE_ID
224
- });
225
- fs.writeFileSync(
226
- path.resolve(viteConfig.root, typeof options.dts === "string" ? options.dts : DECLARATION_FILE),
227
- content.replace(/\r\n/g, "\n"),
228
- "utf-8"
229
- );
224
+ const content = Handlebars.compile(generateDeclareTemplate)({
225
+ groups: groups.length ? groups : void 0,
226
+ services,
227
+ MODULE_ID
228
+ });
229
+ fs$1.writeFileSync(path$1.resolve(viteConfig.root, typeof options.dts === "string" ? options.dts : DECLARATION_FILE), content.replace(/\r\n/g, "\n"), "utf-8");
230
230
  }
231
- export {
232
- vite_plugin_default as default
233
- };
231
+
232
+ //#endregion
233
+ export { vite_plugin_default as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gopowerteam/request-generate",
3
3
  "type": "commonjs",
4
- "version": "0.2.3",
4
+ "version": "0.3.0",
5
5
  "private": false,
6
6
  "keywords": [
7
7
  "gopowerteam",
@@ -9,19 +9,19 @@
9
9
  ],
10
10
  "exports": {
11
11
  ".": {
12
- "types": "./dist/index.d.ts",
12
+ "types": "./dist/index.d.mts",
13
13
  "import": "./dist/index.mjs",
14
- "require": "./dist/index.js"
14
+ "require": "./dist/index.cjs"
15
15
  },
16
16
  "./vite-plugin": {
17
- "types": "./dist/vite-plugin/index.d.ts",
17
+ "types": "./dist/vite-plugin/index.d.mts",
18
18
  "import": "./dist/vite-plugin/index.mjs",
19
- "require": "./dist/vite-plugin/index.js"
19
+ "require": "./dist/vite-plugin/index.cjs"
20
20
  }
21
21
  },
22
- "main": "./dist/index.js",
22
+ "main": "./dist/index.cjs",
23
23
  "module": "./dist/index.mjs",
24
- "types": "./dist/index.d.ts",
24
+ "types": "./dist/index.d.mts",
25
25
  "bin": {
26
26
  "request-download": "bin/download.mts",
27
27
  "request-generate": "bin/generate.mts"
@@ -37,33 +37,33 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "@apidevtools/swagger-parser": "^10.1.0",
41
- "chalk": "^5.3.0",
42
- "commander": "^10.0.0",
40
+ "@apidevtools/swagger-parser": "^12.1.0",
41
+ "chalk": "^5.6.2",
42
+ "commander": "^14.0.3",
43
43
  "handlebars": "^4.7.8",
44
- "ora": "^8.1.0",
45
- "qs": "^6.11.0",
46
- "rimraf": "^4.1.2",
47
- "rxjs": "^7.8.0",
48
- "tsx": "^4.7.0"
44
+ "ora": "^9.3.0",
45
+ "qs": "^6.15.0",
46
+ "rimraf": "^6.1.3",
47
+ "rxjs": "^7.8.2",
48
+ "tsx": "^4.21.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@types/jest": "^29.4.0",
52
- "@types/node": "20",
53
- "@types/qs": "^6.9.7",
51
+ "@types/node": "24",
52
+ "@types/qs": "^6.14.0",
54
53
  "@types/rimraf": "^3.0.2",
55
- "fs-extra": "^11.1.0",
56
- "jest": "^29.4.3",
57
- "openapi-types": "^12.1.0",
58
- "ts-jest": "^29.0.5",
59
- "tsup": "^6.6.3",
60
- "typescript": "^4.9.5",
61
- "vite": "^4.1.4",
62
- "@gopowerteam/request": "0.1.20"
54
+ "openapi-types": "^12.1.3",
55
+ "tsdown": "0.21.0-beta.2",
56
+ "typescript": "^5.9.3",
57
+ "vite": "^7.3.1",
58
+ "vitest": "^3.0.0",
59
+ "@gopowerteam/request": "0.2.0"
63
60
  },
64
61
  "scripts": {
65
- "dev": "tsup --watch",
66
- "build": "tsup",
67
- "lint": "eslint . --fix"
62
+ "dev": "tsdown --watch",
63
+ "build": "tsdown",
64
+ "lint": "eslint . --fix",
65
+ "test": "vitest run",
66
+ "test:watch": "vitest",
67
+ "test:coverage": "vitest run --coverage"
68
68
  }
69
69
  }
@@ -1,18 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
-
8
- // ../../node_modules/.pnpm/tsup@6.6.3_postcss@8.5.3_ts-node@10.9.1_@types+node@20.16.5_typescript@4.9.5__typescript@4.9.5/node_modules/tsup/assets/esm_shims.js
9
- import { fileURLToPath } from "url";
10
- import path from "path";
11
- var getFilename = () => fileURLToPath(import.meta.url);
12
- var getDirname = () => path.dirname(getFilename());
13
- var __dirname = /* @__PURE__ */ getDirname();
14
-
15
- export {
16
- __publicField,
17
- __dirname
18
- };
@@ -1,10 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
-
8
-
9
-
10
- exports.__publicField = __publicField;