phecda-server 1.2.2 → 1.2.4

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.
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/unplugin/unplugin.ts
22
+ var unplugin_exports = {};
23
+ __export(unplugin_exports, {
24
+ unplugin: () => unplugin
25
+ });
26
+ module.exports = __toCommonJS(unplugin_exports);
27
+ var import_path = require("path");
28
+ var import_unplugin = require("unplugin");
29
+
30
+ // src/compiler.ts
31
+ var Pcompiler = class {
32
+ content = "";
33
+ classMap = {};
34
+ constructor() {
35
+ }
36
+ getContent() {
37
+ let content = "";
38
+ for (const name in this.classMap) {
39
+ content += `
40
+ export class ${name}{
41
+ ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}
42
+ }`;
43
+ }
44
+ return content;
45
+ }
46
+ addMethod(className, methodName, route = "", requestType = "", params = []) {
47
+ const url = route.replace(/\/\:([^\/]*)/g, "");
48
+ if (!this.classMap[className])
49
+ this.classMap[className] = {};
50
+ this.classMap[className][methodName] = `
51
+ ${methodName}(${genParams(params)}){
52
+ const ret={tag:"${className}-${methodName}",body:{},query:{},params:{},realParam:'',method:"${requestType}",url:"${url}"}
53
+ ${params.filter((item) => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}
54
+ ${c.type === "params" ? `ret.realParam+='/'+arg${i}
55
+ ` : ""}`, "")}
56
+ return ret
57
+ }
58
+ `;
59
+ }
60
+ addMqMethod(className, methodName, exchange = "", routeKey = "", queue = "", params = []) {
61
+ if (!this.classMap[className])
62
+ this.classMap[className] = {};
63
+ this.classMap[className][methodName] = `
64
+ ${methodName}(${genParams(params)}){
65
+ const ret={tag:"${className}-${methodName}",exchange:"${exchange}",routeKey:"${routeKey}",queue:"${queue}",args:{}}
66
+ ${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}
67
+ `, "")}
68
+ return ret
69
+ }
70
+ `;
71
+ }
72
+ };
73
+ __name(Pcompiler, "Pcompiler");
74
+ function genParams(decorators) {
75
+ let index = 0;
76
+ return decorators.reduce((p) => {
77
+ return `${`${p}arg${index++}`},`;
78
+ }, "");
79
+ }
80
+ __name(genParams, "genParams");
81
+
82
+ // src/unplugin/unplugin.ts
83
+ var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
84
+ const { localPath = "pmeta.js" } = options;
85
+ let command;
86
+ const metaPath = (0, import_path.resolve)(process.cwd(), localPath).replace(/\\/g, "/");
87
+ return {
88
+ name: "phecda-server:client",
89
+ enforce: "pre",
90
+ vite: {
91
+ configResolved(config) {
92
+ command = config.command;
93
+ },
94
+ buildStart() {
95
+ if (command === "build") {
96
+ this.emitFile({
97
+ type: "chunk",
98
+ id: metaPath,
99
+ fileName: localPath,
100
+ preserveSignature: "allow-extension"
101
+ });
102
+ }
103
+ }
104
+ },
105
+ resolveId(id) {
106
+ if (id.endsWith(".controller"))
107
+ return metaPath;
108
+ },
109
+ transformInclude(id) {
110
+ return id === metaPath;
111
+ },
112
+ transform(code) {
113
+ const meta = JSON.parse(code);
114
+ const compiler = new Pcompiler();
115
+ for (const i of meta)
116
+ compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params);
117
+ return {
118
+ code: compiler.getContent()
119
+ };
120
+ }
121
+ };
122
+ });
123
+ // Annotate the CommonJS export names for ESM import in node:
124
+ 0 && (module.exports = {
125
+ unplugin
126
+ });
127
+ //# sourceMappingURL=unplugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/unplugin/unplugin.ts","../../src/compiler.ts"],"sourcesContent":["import { resolve } from 'path'\nimport { createUnplugin } from 'unplugin'\nimport { Pcompiler } from '../compiler'\nimport type { ServerMeta } from '../types'\n\nexport const unplugin = createUnplugin((options: { localPath?: string } = {}) => {\n const { localPath = 'pmeta.js' } = options\n\n let command: string\n const metaPath = resolve(process.cwd(), localPath).replace(/\\\\/g, '/')\n\n return {\n name: 'phecda-server:client',\n enforce: 'pre',\n vite: {\n configResolved(config) {\n command = config.command\n },\n\n buildStart() {\n if (command === 'build') {\n this.emitFile({\n type: 'chunk',\n id: metaPath,\n fileName: localPath,\n preserveSignature: 'allow-extension',\n })\n }\n },\n },\n resolveId(id) {\n if (id.endsWith('.controller'))\n\n return metaPath\n },\n\n transformInclude(id) {\n return id === metaPath\n },\n transform(code) {\n const meta = JSON.parse(code) as ServerMeta[]\n const compiler = new Pcompiler()\n\n for (const i of meta)\n compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params)\n\n return {\n code: compiler.getContent(),\n }\n },\n }\n})\n","import type { RequestType } from './types'\n\nexport class Pcompiler {\n content = ''\n classMap: Record<string, { [key: string]: string }> = {}\n constructor() { }\n\n getContent() {\n let content = ''\n\n for (const name in this.classMap) {\n content += `\n export class ${name}{\n ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}\n }`\n }\n return content\n }\n\n addMethod(className: string, methodName: string, route = '', requestType: RequestType | '' = '', params: { type: string; key: string; index: number }[] = []) {\n const url = route.replace(/\\/\\:([^\\/]*)/g, '')\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",body:{},query:{},params:{},realParam:'',method:\"${requestType}\",url:\"${url}\"}\n${params.filter(item => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}\\n${c.type === 'params' ? `ret.realParam+='/'+arg${i}\\n` : ''}`, '')}\nreturn ret\n }\n `\n }\n\n addMqMethod(className: string, methodName: string, exchange = '', routeKey = '', queue = '', params: { type: string; key: string; index: number }[] = []) {\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",exchange:\"${exchange}\",routeKey:\"${routeKey}\",queue:\"${queue}\",args:{}}\n${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}\\n`, '')}\nreturn ret\n }\n `\n }\n}\n\nfunction genParams(decorators: any[]) {\n let index = 0\n return decorators.reduce((p) => {\n return `${`${p}arg${index++}`},`\n }, '')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;kBAAwB;AACxB,sBAA+B;;;ACCxB,IAAMA,YAAN,MAAMA;EACXC,UAAU;EACVC,WAAsD,CAAC;EACvDC,cAAc;EAAE;EAEhBC,aAAa;AACX,QAAIH,UAAU;AAEd,eAAWI,QAAQ,KAAKH,UAAU;AAChCD,iBAAW;uBACMI;cACTC,OAAOC,OAAO,KAAKL,SAASG,KAAK,EAAEG,OAAO,CAACC,GAAGC,MAAMD,IAAIC,CAAAA;;IAElE;AACA,WAAOT;EACT;EAEAU,UAAUC,WAAmBC,YAAoBC,QAAQ,IAAIC,cAAgC,IAAIC,SAAyD,CAAA,GAAI;AAC5J,UAAMC,MAAMH,MAAMI,QAAQ,iBAAiB,EAAA;AAC3C,QAAI,CAAC,KAAKhB,SAASU;AACjB,WAAKV,SAASU,aAAa,CAAC;AAC9B,SAAKV,SAASU,WAAWC,cAAc;MACrCA,cAAcM,UAAUH,MAAAA;kBACZJ,a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AA;AAEd,eAAOjB;IACX;IAEAkB,iBAAiBL,IAAI;AACnB,aAAOA,OAAOb;IAChB;IACAmB,UAAUC,MAAM;AACd,YAAMC,OAAOC,KAAKC,MAAMH,IAAAA;AACxB,YAAMI,WAAW,IAAIC,UAAAA;AAErB,iBAAWC,KAAKL;AACdG,iBAASG,UAAUD,EAAErB,MAAMqB,EAAEE,QAAQF,EAAEG,OAAOA,OAAOH,EAAEG,OAAOjB,MAAMc,EAAEI,MAAM;AAE9E,aAAO;QACLV,MAAMI,SAASO,WAAU;MAC3B;IACF;EACF;AACF,CAAA;","names":["Pcompiler","content","classMap","constructor","getContent","name","Object","values","reduce","p","c","addMethod","className","methodName","route","requestType","params","url","replace","genParams","filter","item","key","i","type","addMqMethod","exchange","routeKey","queue","decorators","index","unplugin","createUnplugin","options","localPath","command","metaPath","resolve","process","cwd","replace","name","enforce","vite","configResolved","config","buildStart","emitFile","type","id","fileName","preserveSignature","resolveId","endsWith","transformInclude","transform","code","meta","JSON","parse","compiler","Pcompiler","i","addMethod","method","route","params","getContent"]}
@@ -0,0 +1,104 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/unplugin/unplugin.ts
5
+ import { resolve } from "path";
6
+ import { createUnplugin } from "unplugin";
7
+
8
+ // src/compiler.ts
9
+ var Pcompiler = class {
10
+ content = "";
11
+ classMap = {};
12
+ constructor() {
13
+ }
14
+ getContent() {
15
+ let content = "";
16
+ for (const name in this.classMap) {
17
+ content += `
18
+ export class ${name}{
19
+ ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}
20
+ }`;
21
+ }
22
+ return content;
23
+ }
24
+ addMethod(className, methodName, route = "", requestType = "", params = []) {
25
+ const url = route.replace(/\/\:([^\/]*)/g, "");
26
+ if (!this.classMap[className])
27
+ this.classMap[className] = {};
28
+ this.classMap[className][methodName] = `
29
+ ${methodName}(${genParams(params)}){
30
+ const ret={tag:"${className}-${methodName}",body:{},query:{},params:{},realParam:'',method:"${requestType}",url:"${url}"}
31
+ ${params.filter((item) => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}
32
+ ${c.type === "params" ? `ret.realParam+='/'+arg${i}
33
+ ` : ""}`, "")}
34
+ return ret
35
+ }
36
+ `;
37
+ }
38
+ addMqMethod(className, methodName, exchange = "", routeKey = "", queue = "", params = []) {
39
+ if (!this.classMap[className])
40
+ this.classMap[className] = {};
41
+ this.classMap[className][methodName] = `
42
+ ${methodName}(${genParams(params)}){
43
+ const ret={tag:"${className}-${methodName}",exchange:"${exchange}",routeKey:"${routeKey}",queue:"${queue}",args:{}}
44
+ ${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}
45
+ `, "")}
46
+ return ret
47
+ }
48
+ `;
49
+ }
50
+ };
51
+ __name(Pcompiler, "Pcompiler");
52
+ function genParams(decorators) {
53
+ let index = 0;
54
+ return decorators.reduce((p) => {
55
+ return `${`${p}arg${index++}`},`;
56
+ }, "");
57
+ }
58
+ __name(genParams, "genParams");
59
+
60
+ // src/unplugin/unplugin.ts
61
+ var unplugin = createUnplugin((options = {}) => {
62
+ const { localPath = "pmeta.js" } = options;
63
+ let command;
64
+ const metaPath = resolve(process.cwd(), localPath).replace(/\\/g, "/");
65
+ return {
66
+ name: "phecda-server:client",
67
+ enforce: "pre",
68
+ vite: {
69
+ configResolved(config) {
70
+ command = config.command;
71
+ },
72
+ buildStart() {
73
+ if (command === "build") {
74
+ this.emitFile({
75
+ type: "chunk",
76
+ id: metaPath,
77
+ fileName: localPath,
78
+ preserveSignature: "allow-extension"
79
+ });
80
+ }
81
+ }
82
+ },
83
+ resolveId(id) {
84
+ if (id.endsWith(".controller"))
85
+ return metaPath;
86
+ },
87
+ transformInclude(id) {
88
+ return id === metaPath;
89
+ },
90
+ transform(code) {
91
+ const meta = JSON.parse(code);
92
+ const compiler = new Pcompiler();
93
+ for (const i of meta)
94
+ compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params);
95
+ return {
96
+ code: compiler.getContent()
97
+ };
98
+ }
99
+ };
100
+ });
101
+ export {
102
+ unplugin
103
+ };
104
+ //# sourceMappingURL=unplugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/unplugin/unplugin.ts","../../src/compiler.ts"],"sourcesContent":["import { resolve } from 'path'\nimport { createUnplugin } from 'unplugin'\nimport { Pcompiler } from '../compiler'\nimport type { ServerMeta } from '../types'\n\nexport const unplugin = createUnplugin((options: { localPath?: string } = {}) => {\n const { localPath = 'pmeta.js' } = options\n\n let command: string\n const metaPath = resolve(process.cwd(), localPath).replace(/\\\\/g, '/')\n\n return {\n name: 'phecda-server:client',\n enforce: 'pre',\n vite: {\n configResolved(config) {\n command = config.command\n },\n\n buildStart() {\n if (command === 'build') {\n this.emitFile({\n type: 'chunk',\n id: metaPath,\n fileName: localPath,\n preserveSignature: 'allow-extension',\n })\n }\n },\n },\n resolveId(id) {\n if (id.endsWith('.controller'))\n\n return metaPath\n },\n\n transformInclude(id) {\n return id === metaPath\n },\n transform(code) {\n const meta = JSON.parse(code) as ServerMeta[]\n const compiler = new Pcompiler()\n\n for (const i of meta)\n compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params)\n\n return {\n code: compiler.getContent(),\n }\n },\n }\n})\n","import type { RequestType } from './types'\n\nexport class Pcompiler {\n content = ''\n classMap: Record<string, { [key: string]: string }> = {}\n constructor() { }\n\n getContent() {\n let content = ''\n\n for (const name in this.classMap) {\n content += `\n export class ${name}{\n ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}\n }`\n }\n return content\n }\n\n addMethod(className: string, methodName: string, route = '', requestType: RequestType | '' = '', params: { type: string; key: string; index: number }[] = []) {\n const url = route.replace(/\\/\\:([^\\/]*)/g, '')\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",body:{},query:{},params:{},realParam:'',method:\"${requestType}\",url:\"${url}\"}\n${params.filter(item => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}\\n${c.type === 'params' ? `ret.realParam+='/'+arg${i}\\n` : ''}`, '')}\nreturn ret\n }\n `\n }\n\n addMqMethod(className: string, methodName: string, exchange = '', routeKey = '', queue = '', params: { type: string; key: string; index: number }[] = []) {\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",exchange:\"${exchange}\",routeKey:\"${routeKey}\",queue:\"${queue}\",args:{}}\n${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}\\n`, '')}\nreturn ret\n }\n `\n }\n}\n\nfunction genParams(decorators: any[]) {\n let index = 0\n return decorators.reduce((p) => {\n return `${`${p}arg${index++}`},`\n }, '')\n}\n"],"mappings":";;;;AAAA,SAASA,eAAe;AACxB,SAASC,sBAAsB;;;ACCxB,IAAMC,YAAN,MAAMA;EACXC,UAAU;EACVC,WAAsD,CAAC;EACvDC,cAAc;EAAE;EAEhBC,aAAa;AACX,QAAIH,UAAU;AAEd,eAAWI,QAAQ,KAAKH,UAAU;AAChCD,iBAAW;uBACMI;cACTC,OAAOC,OAAO,KAAKL,SAASG,KAAK,EAAEG,OAAO,CAACC,GAAGC,MAAMD,IAAIC,CAAAA;;IAElE;AACA,WAAOT;EACT;EAEAU,UAAUC,WAAmBC,YAAoBC,QAAQ,IAAIC,cAAgC,IAAIC,SAAyD,CAAA,GAAI;AAC5J,UAAMC,MAAMH,MAAMI,QAAQ,iBAAiB,EAAA;AAC3C,QAAI,CAAC,KAAKhB,SAASU;AACjB,WAAKV,SAASU,aAAa,CAAC;AAC9B,SAAKV,SAASU,WAAWC,cAAc;MACrCA,cAAcM,UAAUH,MAAAA;kBACZJ,aAAaC,+DAA+DE,qBAAqBE;EACjHD,OAAOI,OAAOC,CAAAA,SAAQA,KAAKC,GAAG,EAAEd,OAAO,CAACC,G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,YAAMC,OAAOC,KAAKC,MAAMH,IAAAA;AACxB,YAAMI,WAAW,IAAIC,UAAAA;AAErB,iBAAWC,KAAKL;AACdG,iBAASG,UAAUD,EAAErB,MAAMqB,EAAEE,QAAQF,EAAEG,OAAOA,OAAOH,EAAEG,OAAOjB,MAAMc,EAAEI,MAAM;AAE9E,aAAO;QACLV,MAAMI,SAASO,WAAU;MAC3B;IACF;EACF;AACF,CAAA;","names":["resolve","createUnplugin","Pcompiler","content","classMap","constructor","getContent","name","Object","values","reduce","p","c","addMethod","className","methodName","route","requestType","params","url","replace","genParams","filter","item","key","i","type","addMqMethod","exchange","routeKey","queue","decorators","index","unplugin","createUnplugin","options","localPath","command","metaPath","resolve","process","cwd","replace","name","enforce","vite","configResolved","config","buildStart","emitFile","type","id","fileName","preserveSignature","resolveId","endsWith","transformInclude","transform","code","meta","JSON","parse","compiler","Pcompiler","i","addMethod","method","route","params","getContent"]}
@@ -0,0 +1,7 @@
1
+ import { PluginOption } from 'vite';
2
+
3
+ declare const _default: (options?: {
4
+ localPath?: string | undefined;
5
+ } | undefined) => PluginOption;
6
+
7
+ export { _default as default };
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/unplugin/vite.ts
22
+ var vite_exports = {};
23
+ __export(vite_exports, {
24
+ default: () => vite_default
25
+ });
26
+ module.exports = __toCommonJS(vite_exports);
27
+
28
+ // src/unplugin/unplugin.ts
29
+ var import_path = require("path");
30
+ var import_unplugin = require("unplugin");
31
+
32
+ // src/compiler.ts
33
+ var Pcompiler = class {
34
+ content = "";
35
+ classMap = {};
36
+ constructor() {
37
+ }
38
+ getContent() {
39
+ let content = "";
40
+ for (const name in this.classMap) {
41
+ content += `
42
+ export class ${name}{
43
+ ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}
44
+ }`;
45
+ }
46
+ return content;
47
+ }
48
+ addMethod(className, methodName, route = "", requestType = "", params = []) {
49
+ const url = route.replace(/\/\:([^\/]*)/g, "");
50
+ if (!this.classMap[className])
51
+ this.classMap[className] = {};
52
+ this.classMap[className][methodName] = `
53
+ ${methodName}(${genParams(params)}){
54
+ const ret={tag:"${className}-${methodName}",body:{},query:{},params:{},realParam:'',method:"${requestType}",url:"${url}"}
55
+ ${params.filter((item) => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}
56
+ ${c.type === "params" ? `ret.realParam+='/'+arg${i}
57
+ ` : ""}`, "")}
58
+ return ret
59
+ }
60
+ `;
61
+ }
62
+ addMqMethod(className, methodName, exchange = "", routeKey = "", queue = "", params = []) {
63
+ if (!this.classMap[className])
64
+ this.classMap[className] = {};
65
+ this.classMap[className][methodName] = `
66
+ ${methodName}(${genParams(params)}){
67
+ const ret={tag:"${className}-${methodName}",exchange:"${exchange}",routeKey:"${routeKey}",queue:"${queue}",args:{}}
68
+ ${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}
69
+ `, "")}
70
+ return ret
71
+ }
72
+ `;
73
+ }
74
+ };
75
+ __name(Pcompiler, "Pcompiler");
76
+ function genParams(decorators) {
77
+ let index = 0;
78
+ return decorators.reduce((p) => {
79
+ return `${`${p}arg${index++}`},`;
80
+ }, "");
81
+ }
82
+ __name(genParams, "genParams");
83
+
84
+ // src/unplugin/unplugin.ts
85
+ var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
86
+ const { localPath = "pmeta.js" } = options;
87
+ let command;
88
+ const metaPath = (0, import_path.resolve)(process.cwd(), localPath).replace(/\\/g, "/");
89
+ return {
90
+ name: "phecda-server:client",
91
+ enforce: "pre",
92
+ vite: {
93
+ configResolved(config) {
94
+ command = config.command;
95
+ },
96
+ buildStart() {
97
+ if (command === "build") {
98
+ this.emitFile({
99
+ type: "chunk",
100
+ id: metaPath,
101
+ fileName: localPath,
102
+ preserveSignature: "allow-extension"
103
+ });
104
+ }
105
+ }
106
+ },
107
+ resolveId(id) {
108
+ if (id.endsWith(".controller"))
109
+ return metaPath;
110
+ },
111
+ transformInclude(id) {
112
+ return id === metaPath;
113
+ },
114
+ transform(code) {
115
+ const meta = JSON.parse(code);
116
+ const compiler = new Pcompiler();
117
+ for (const i of meta)
118
+ compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params);
119
+ return {
120
+ code: compiler.getContent()
121
+ };
122
+ }
123
+ };
124
+ });
125
+
126
+ // src/unplugin/vite.ts
127
+ var vite_default = unplugin.vite;
128
+ // Annotate the CommonJS export names for ESM import in node:
129
+ 0 && (module.exports = {});
130
+ //# sourceMappingURL=vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/unplugin/vite.ts","../../src/unplugin/unplugin.ts","../../src/compiler.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\nimport { unplugin } from './unplugin'\nexport default unplugin.vite as (options?: { localPath?: string | undefined } | undefined) => PluginOption\n","import { resolve } from 'path'\nimport { createUnplugin } from 'unplugin'\nimport { Pcompiler } from '../compiler'\nimport type { ServerMeta } from '../types'\n\nexport const unplugin = createUnplugin((options: { localPath?: string } = {}) => {\n const { localPath = 'pmeta.js' } = options\n\n let command: string\n const metaPath = resolve(process.cwd(), localPath).replace(/\\\\/g, '/')\n\n return {\n name: 'phecda-server:client',\n enforce: 'pre',\n vite: {\n configResolved(config) {\n command = config.command\n },\n\n buildStart() {\n if (command === 'build') {\n this.emitFile({\n type: 'chunk',\n id: metaPath,\n fileName: localPath,\n preserveSignature: 'allow-extension',\n })\n }\n },\n },\n resolveId(id) {\n if (id.endsWith('.controller'))\n\n return metaPath\n },\n\n transformInclude(id) {\n return id === metaPath\n },\n transform(code) {\n const meta = JSON.parse(code) as ServerMeta[]\n const compiler = new Pcompiler()\n\n for (const i of meta)\n compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params)\n\n return {\n code: compiler.getContent(),\n }\n },\n }\n})\n","import type { RequestType } from './types'\n\nexport class Pcompiler {\n content = ''\n classMap: Record<string, { [key: string]: string }> = {}\n constructor() { }\n\n getContent() {\n let content = ''\n\n for (const name in this.classMap) {\n content += `\n export class ${name}{\n ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}\n }`\n }\n return content\n }\n\n addMethod(className: string, methodName: string, route = '', requestType: RequestType | '' = '', params: { type: string; key: string; index: number }[] = []) {\n const url = route.replace(/\\/\\:([^\\/]*)/g, '')\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",body:{},query:{},params:{},realParam:'',method:\"${requestType}\",url:\"${url}\"}\n${params.filter(item => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}\\n${c.type === 'params' ? `ret.realParam+='/'+arg${i}\\n` : ''}`, '')}\nreturn ret\n }\n `\n }\n\n addMqMethod(className: string, methodName: string, exchange = '', routeKey = '', queue = '', params: { type: string; key: string; index: number }[] = []) {\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",exchange:\"${exchange}\",routeKey:\"${routeKey}\",queue:\"${queue}\",args:{}}\n${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}\\n`, '')}\nreturn ret\n }\n `\n }\n}\n\nfunction genParams(decorators: any[]) {\n let index = 0\n return decorators.reduce((p) => {\n return `${`${p}arg${index++}`},`\n }, '')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;;;;;;ACDA,kBAAwB;AACxB,sBAA+B;;;ACCxB,IAAMA,YAAN,MAAMA;EACXC,UAAU;EACVC,WAAsD,CAAC;EACvDC,cAAc;EAAE;EAEhBC,aAAa;AACX,QAAIH,UAAU;AAEd,eAAWI,QAAQ,KAAKH,UAAU;AAChCD,iBAAW;uBACMI;cACTC,OAAOC,OAAO,KAAKL,SAASG,KAAK,EAAEG,OAAO,CAACC,GAAGC,MAAMD,IAAIC,CAAAA;;IAElE;AACA,WAAOT;EACT;EAEAU,UAAUC,WAAmBC,YAAoBC,QAAQ,IAAIC,cAAgC,IAAIC,SAAyD,CAAA,GAAI;AAC5J,UAAMC,MAAMH,MAAMI,QAAQ,iBAAiB,EAAA;AAC3C,QAAI,CAAC,KAAKhB,SAASU;AACjB,WAAKV,SAASU,aAAa,CAAC;AAC9B,SAAKV,SAASU,WAAWC,cAAc;MACrCA,cAAcM,UAAUH,MAAAA;kBACZJ,aAAaC,+DAA+DE,qBAAqBE;EACjHD,OAAOI,OAAOC,CAAAA,SAAQA,KAAKC,GAAG,EAAEd,OAAO,CAACC,GAAGC,GAAGa,MAAM,GAAGd,QAAQC,EAAEc,QAAQd,EAAEY,UAAUC;EAAMb,EAAEc,SAAS,WAAW,yBAAyBD;IAAQ,MAAM,EAAA;;;;EAIxJ;EAEAE,YAAYb,WAAmBC,YAAoBa,WAAW,IAAIC,WAAW,IAAIC,QAAQ,IAAIZ,SAAyD,CAAA,GAAI;AACxJ,QAAI,CAAC,KAAKd,SAASU;AACjB,WAAKV,SAASU,aAAa,CAAC;AAC9B,SAAKV,SAASU,WAAWC,cAAc;MACrCA,cAAcM,UAAUH,MAAAA;kBACZJ,aAAaC,yBAAyBa,uBAAuBC,oBAAoBC;EACjGZ,OAAOR,OAAO,CAACC,GAAGC,GAAGa,MAAM,GAAGd,aAAaC,EAAEY,UAAUC;GAAO,EAAA;;;;EAI9D;AACF;AAzCavB;AA2Cb,SAASmB,UAAUU,YAAmB;AACpC,MAAIC,QAAQ;AACZ,SAAOD,WAAWrB,OAAO,CAACC,MAAM;AAC9B,WAAO,GAAG,GAAGA,OAAOqB;EACtB,GAAG,EAAA;AACL;AALSX;;;ADxCF,IAAMY,eAAWC,gCAAe,CAACC,UAAkC,CAAC,MAAM;AAC/E,QAAM,EAAEC,YAAY,WAAU,IAAKD;AAEnC,MAAIE;AACJ,QAAMC,eAAWC,qBAAQC,QAAQC,IAAG,GAAIL,SAAAA,EAAWM,QAAQ,OAAO,GAAA;AAElE,SAAO;IACLC,MAAM;IACNC,SAAS;IACTC,MAAM;MACJC,eAAeC,QAAQ;AACrBV,kBAAUU,OAAOV;MACnB;MAEAW,aAAa;AACX,YAAIX,YAAY,SAAS;AACvB,eAAKY,SAAS;YACZC,MAAM;YACNC,IAAIb;YACJc,UAAUhB;YACViB,mBAAmB;UACrB,CAAA;QACF;MACF;IACF;IACAC,UAAUH,IAAI;AACZ,UAAIA,GAAGI,SAAS,aAAA;AAEd,eAAOjB;IACX;IAEAkB,iBAAiBL,IAAI;AACnB,aAAOA,OAAOb;IAChB;IACAmB,UAAUC,MAAM;AACd,YAAMC,OAAOC,KAAKC,MAAMH,IAAAA;AACxB,YAAMI,WAAW,IAAIC,UAAAA;AAErB,iBAAWC,KAAKL;AACdG,iBAASG,UAAUD,EAAErB,MAAMqB,EAAEE,QAAQF,EAAEG,OAAOA,OAAOH,EAAEG,OAAOjB,MAAMc,EAAEI,MAAM;AAE9E,aAAO;QACLV,MAAMI,SAASO,WAAU;MAC3B;IACF;EACF;AACF,CAAA;;;ADjDA,IAAA,eAAeC,SAASC;","names":["Pcompiler","content","classMap","constructor","getContent","name","Object","values","reduce","p","c","addMethod","className","methodName","route","requestType","params","url","replace","genParams","filter","item","key","i","type","addMqMethod","exchange","routeKey","queue","decorators","index","unplugin","createUnplugin","options","localPath","command","metaPath","resolve","process","cwd","replace","name","enforce","vite","configResolved","config","buildStart","emitFile","type","id","fileName","preserveSignature","resolveId","endsWith","transformInclude","transform","code","meta","JSON","parse","compiler","Pcompiler","i","addMethod","method","route","params","getContent","unplugin","vite"]}
@@ -0,0 +1,107 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/unplugin/unplugin.ts
5
+ import { resolve } from "path";
6
+ import { createUnplugin } from "unplugin";
7
+
8
+ // src/compiler.ts
9
+ var Pcompiler = class {
10
+ content = "";
11
+ classMap = {};
12
+ constructor() {
13
+ }
14
+ getContent() {
15
+ let content = "";
16
+ for (const name in this.classMap) {
17
+ content += `
18
+ export class ${name}{
19
+ ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}
20
+ }`;
21
+ }
22
+ return content;
23
+ }
24
+ addMethod(className, methodName, route = "", requestType = "", params = []) {
25
+ const url = route.replace(/\/\:([^\/]*)/g, "");
26
+ if (!this.classMap[className])
27
+ this.classMap[className] = {};
28
+ this.classMap[className][methodName] = `
29
+ ${methodName}(${genParams(params)}){
30
+ const ret={tag:"${className}-${methodName}",body:{},query:{},params:{},realParam:'',method:"${requestType}",url:"${url}"}
31
+ ${params.filter((item) => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}
32
+ ${c.type === "params" ? `ret.realParam+='/'+arg${i}
33
+ ` : ""}`, "")}
34
+ return ret
35
+ }
36
+ `;
37
+ }
38
+ addMqMethod(className, methodName, exchange = "", routeKey = "", queue = "", params = []) {
39
+ if (!this.classMap[className])
40
+ this.classMap[className] = {};
41
+ this.classMap[className][methodName] = `
42
+ ${methodName}(${genParams(params)}){
43
+ const ret={tag:"${className}-${methodName}",exchange:"${exchange}",routeKey:"${routeKey}",queue:"${queue}",args:{}}
44
+ ${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}
45
+ `, "")}
46
+ return ret
47
+ }
48
+ `;
49
+ }
50
+ };
51
+ __name(Pcompiler, "Pcompiler");
52
+ function genParams(decorators) {
53
+ let index = 0;
54
+ return decorators.reduce((p) => {
55
+ return `${`${p}arg${index++}`},`;
56
+ }, "");
57
+ }
58
+ __name(genParams, "genParams");
59
+
60
+ // src/unplugin/unplugin.ts
61
+ var unplugin = createUnplugin((options = {}) => {
62
+ const { localPath = "pmeta.js" } = options;
63
+ let command;
64
+ const metaPath = resolve(process.cwd(), localPath).replace(/\\/g, "/");
65
+ return {
66
+ name: "phecda-server:client",
67
+ enforce: "pre",
68
+ vite: {
69
+ configResolved(config) {
70
+ command = config.command;
71
+ },
72
+ buildStart() {
73
+ if (command === "build") {
74
+ this.emitFile({
75
+ type: "chunk",
76
+ id: metaPath,
77
+ fileName: localPath,
78
+ preserveSignature: "allow-extension"
79
+ });
80
+ }
81
+ }
82
+ },
83
+ resolveId(id) {
84
+ if (id.endsWith(".controller"))
85
+ return metaPath;
86
+ },
87
+ transformInclude(id) {
88
+ return id === metaPath;
89
+ },
90
+ transform(code) {
91
+ const meta = JSON.parse(code);
92
+ const compiler = new Pcompiler();
93
+ for (const i of meta)
94
+ compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params);
95
+ return {
96
+ code: compiler.getContent()
97
+ };
98
+ }
99
+ };
100
+ });
101
+
102
+ // src/unplugin/vite.ts
103
+ var vite_default = unplugin.vite;
104
+ export {
105
+ vite_default as default
106
+ };
107
+ //# sourceMappingURL=vite.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/unplugin/unplugin.ts","../../src/compiler.ts","../../src/unplugin/vite.ts"],"sourcesContent":["import { resolve } from 'path'\nimport { createUnplugin } from 'unplugin'\nimport { Pcompiler } from '../compiler'\nimport type { ServerMeta } from '../types'\n\nexport const unplugin = createUnplugin((options: { localPath?: string } = {}) => {\n const { localPath = 'pmeta.js' } = options\n\n let command: string\n const metaPath = resolve(process.cwd(), localPath).replace(/\\\\/g, '/')\n\n return {\n name: 'phecda-server:client',\n enforce: 'pre',\n vite: {\n configResolved(config) {\n command = config.command\n },\n\n buildStart() {\n if (command === 'build') {\n this.emitFile({\n type: 'chunk',\n id: metaPath,\n fileName: localPath,\n preserveSignature: 'allow-extension',\n })\n }\n },\n },\n resolveId(id) {\n if (id.endsWith('.controller'))\n\n return metaPath\n },\n\n transformInclude(id) {\n return id === metaPath\n },\n transform(code) {\n const meta = JSON.parse(code) as ServerMeta[]\n const compiler = new Pcompiler()\n\n for (const i of meta)\n compiler.addMethod(i.name, i.method, i.route?.route, i.route?.type, i.params)\n\n return {\n code: compiler.getContent(),\n }\n },\n }\n})\n","import type { RequestType } from './types'\n\nexport class Pcompiler {\n content = ''\n classMap: Record<string, { [key: string]: string }> = {}\n constructor() { }\n\n getContent() {\n let content = ''\n\n for (const name in this.classMap) {\n content += `\n export class ${name}{\n ${Object.values(this.classMap[name]).reduce((p, c) => p + c)}\n }`\n }\n return content\n }\n\n addMethod(className: string, methodName: string, route = '', requestType: RequestType | '' = '', params: { type: string; key: string; index: number }[] = []) {\n const url = route.replace(/\\/\\:([^\\/]*)/g, '')\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",body:{},query:{},params:{},realParam:'',method:\"${requestType}\",url:\"${url}\"}\n${params.filter(item => item.key).reduce((p, c, i) => `${p}ret.${c.type}.${c.key}=arg${i}\\n${c.type === 'params' ? `ret.realParam+='/'+arg${i}\\n` : ''}`, '')}\nreturn ret\n }\n `\n }\n\n addMqMethod(className: string, methodName: string, exchange = '', routeKey = '', queue = '', params: { type: string; key: string; index: number }[] = []) {\n if (!this.classMap[className])\n this.classMap[className] = {}\n this.classMap[className][methodName] = `\n ${methodName}(${genParams(params)}){\nconst ret={tag:\"${className}-${methodName}\",exchange:\"${exchange}\",routeKey:\"${routeKey}\",queue:\"${queue}\",args:{}}\n${params.reduce((p, c, i) => `${p}ret.args.${c.key}=arg${i}\\n`, '')}\nreturn ret\n }\n `\n }\n}\n\nfunction genParams(decorators: any[]) {\n let index = 0\n return decorators.reduce((p) => {\n return `${`${p}arg${index++}`},`\n }, '')\n}\n","import type { PluginOption } from 'vite'\nimport { unplugin } from './unplugin'\nexport default unplugin.vite as (options?: { localPath?: string | undefined } | undefined) => PluginOption\n"],"mappings":";;;;AAAA,SAASA,eAAe;AACxB,SAASC,sBAAsB;;;ACCxB,IAAMC,YAAN,MAAMA;EACXC,UAAU;EACVC,WAAsD,CAAC;EACvDC,cAAc;EAAE;EAEhBC,aAAa;AACX,QAAIH,UAAU;AAEd,eAAWI,QAAQ,KAAKH,UAAU;AAChCD,iBAAW;uBACMI;cACTC,OAAOC,OAAO,KAAKL,SAASG,KAAK,EAAEG,OAAO,CAACC,GAAGC,MAAMD,IAAIC,CAAAA;;IAElE;AACA,WAAOT;EACT;EAEAU,UAAUC,WAAmBC,YAAoBC,QAAQ,IAAIC,cAAgC,IAAIC,SAAyD,CAAA,GAAI;AAC5J,UAAMC,MAAMH,MAAMI,QAAQ,iBAAiB,EAAA;AAC3C,QAAI,CAAC,KAAKhB,SAASU;AACjB,WAAKV,SAASU,aAAa,CAAC;AAC9B,SAAKV,SAASU,WAAWC,cAAc;MACrCA,cAAcM,UAAUH,MAAAA;kBACZJ,aAAaC,+DAA+DE,qBAAqBE;EACjHD,OAAOI,OAAOC,CAAAA,SAAQA,KAAKC,GAAG,EAAEd,OAAO,CAACC,GAAGC,GAAGa,MAAM,GAAGd,QAAQC,EAAEc,QAAQd,EAAEY,UAAUC;EAAMb,EAAEc,SAAS,WAAW,yBAAyBD;IAAQ,MAAM,EAAA;;;;EAIxJ;EAEAE,YAAYb,WAAmBC,YAAoBa,WAAW,IAAIC,WAAW,IAAIC,QAAQ,IAAIZ,SAAyD,CAAA,GAAI;AACxJ,QAAI,CAAC,KAAKd,SAASU;AACjB,WAAKV,SAASU,aAAa,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A,eAAeC,SAASC;","names":["resolve","createUnplugin","Pcompiler","content","classMap","constructor","getContent","name","Object","values","reduce","p","c","addMethod","className","methodName","route","requestType","params","url","replace","genParams","filter","item","key","i","type","addMqMethod","exchange","routeKey","queue","decorators","index","unplugin","createUnplugin","options","localPath","command","metaPath","resolve","process","cwd","replace","name","enforce","vite","configResolved","config","buildStart","emitFile","type","id","fileName","preserveSignature","resolveId","endsWith","transformInclude","transform","code","meta","JSON","parse","compiler","Pcompiler","i","addMethod","method","route","params","getContent","unplugin","vite"]}
@@ -0,0 +1,5 @@
1
+ declare const Server: (options?: {
2
+ localPath?: string | undefined;
3
+ } | undefined) => WebpackPluginInstance;
4
+
5
+ export { Server };