Compare commits
5 Commits
342c8c1b1b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78336de068 | ||
|
|
96ebc31637 | ||
|
|
d1e37320d3 | ||
|
|
dc70b5fc26 | ||
|
|
08057d0276 |
@@ -1 +0,0 @@
|
||||
a06d094b-d1c2-4adc-8c5c-0a9986f5aea8
|
||||
@@ -1 +0,0 @@
|
||||
97f1b24f-9aff-44d4-b3af-c8a5ea6943c7
|
||||
@@ -1 +0,0 @@
|
||||
1331c103-912a-4f75-9045-03aaa69824f8
|
||||
@@ -1 +0,0 @@
|
||||
8bb6e31a-650f-4f25-9e76-72e5118f6438
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
// 需要被监听的api地址路径
|
||||
apiListPath: "F:\\desktop\\vue-class-api-tsx\\src\\core\\config\\configure.config.ts",
|
||||
apiListPath: "/Users/bmy/source/TsxVueClassApi/src/core/config/configure.config.ts",
|
||||
// 生成的service层代码存放路径
|
||||
outPutServicePath: "F:\\desktop\\vue-class-api-tsx\\src\\core\\service"
|
||||
outPutServicePath: "/Users/bmy/source/TsxVueClassApi/src/core/service"
|
||||
}
|
||||
@@ -8,9 +8,15 @@ let ServerMap = new Map();
|
||||
// 'Order' => Map(1) { 'test' => 'test' }
|
||||
// }
|
||||
let main = async () => {
|
||||
// 读取配置文件中,注释 start 和 end 中间的 对象代码
|
||||
let readApi = new readApiList(config.apiListPath)
|
||||
let res = await readApi.getFileList()
|
||||
|
||||
console.log("getFileList: ", res)
|
||||
|
||||
// 处理读取到的 字符串数组,将多个key方法进行分类归入不同的class文件中
|
||||
// 比如 Car_carList 和 Car_addCar,应该同属 Car.service.ts,而
|
||||
// carList 和 addCar 则为文件中class的方法
|
||||
res.forEach(v => {
|
||||
// [ 'Car', 'IndexTest' ]
|
||||
let key = v.split(":")[0].split("_")
|
||||
@@ -20,10 +26,8 @@ let main = async () => {
|
||||
ServerMap.get(key[0]).set(key[1],key[1])
|
||||
});
|
||||
|
||||
// 根据接口对象的配置文件,自动生成service文件和代码
|
||||
ServerMap.forEach((value,key) => {
|
||||
file.createdService(key,value)
|
||||
})
|
||||
// 根据上面的输出结果,自动生成service文件和代码
|
||||
ServerMap.forEach((value,key) => file.createdService(key,value))
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
7fcbe2a8-4ef1-42fd-8123-b5ed331cbd41
|
||||
@@ -4,8 +4,10 @@ const config = require("../config");
|
||||
class File {
|
||||
|
||||
createdService(ServiceName, ServiceMethods) {
|
||||
let fullPath = `${config.outPutServicePath}\\${ServiceName}.service.ts`
|
||||
if (!existsSync(fullPath)) {
|
||||
console.log("ServiceName: ", ServiceName);
|
||||
console.log("ServiceMethods: ", ServiceMethods);
|
||||
let fullPath = `${config.outPutServicePath}/${ServiceName}.service.ts`
|
||||
// if (!existsSync(fullPath)) {
|
||||
let mArray = Array.from(ServiceMethods, ([name, value]) => ({ name, value }));
|
||||
writeFileSync(fullPath, this.stripIndent`
|
||||
// @ts-nocheck
|
||||
@@ -29,7 +31,7 @@ class File {
|
||||
}
|
||||
}
|
||||
`)
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,59 +1,55 @@
|
||||
const { createReadStream } = require('fs')
|
||||
|
||||
class ReadApiList {
|
||||
apiListPath = "";
|
||||
lineLength = 0;
|
||||
textArr = [];
|
||||
lineBuffer = Buffer.alloc(4096);
|
||||
text = "";
|
||||
status = false;
|
||||
lineBuffer = [];
|
||||
lineLength = 0;
|
||||
stream = null
|
||||
|
||||
constructor(path) {
|
||||
this.apiListPath = path
|
||||
this.stream = createReadStream(path);
|
||||
}
|
||||
|
||||
getFileList() {
|
||||
this.text = createReadStream(this.apiListPath)
|
||||
return new Promise((s, e) => {
|
||||
this.textArr = [];
|
||||
let status = false
|
||||
this.text.on('data', (data) => {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i] == 10 || data[i] == 13) {
|
||||
if (data[i] == 10) {
|
||||
try {
|
||||
var line = this.lineBuffer.slice(0, this.lineLength);
|
||||
if (line.length != 0) {
|
||||
let str = line.toString('utf8')
|
||||
.replace(/^\s+|\s+$/g, '')
|
||||
.replace(/\'/g, "")
|
||||
.replace(/,/g, "")
|
||||
return new Promise((resolve, reject) => {
|
||||
this.stream.on('data', (data) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const byte = data[i];
|
||||
if (byte === 10 || byte === 13) { // 处理 \n 和 \r
|
||||
if (this.lineLength > 0) {
|
||||
const line = Buffer.from(this.lineBuffer.slice(0, this.lineLength)).toString('utf8');
|
||||
const cleanedLine = line.trim().replace(/'|,/g, '');
|
||||
|
||||
if (str.includes("start -")) {
|
||||
status = true
|
||||
continue;
|
||||
}
|
||||
if (str.includes("end -")) {
|
||||
status = false
|
||||
break;
|
||||
}
|
||||
if (cleanedLine.includes("start -")) {
|
||||
this.status = true;
|
||||
} else if (cleanedLine.includes("end -")) {
|
||||
this.status = false;
|
||||
|
||||
if (status) {
|
||||
// console.log("str: ", str.split(":"))
|
||||
this.textArr.push(str);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
this.lineLength = 0;
|
||||
// 去除被注释的key代码
|
||||
} else if (this.status && !cleanedLine.includes("//")) {
|
||||
this.textArr.push(cleanedLine);
|
||||
}
|
||||
}
|
||||
this.lineLength = 0; // 重置行缓冲区
|
||||
} else {
|
||||
this.lineBuffer[this.lineLength] = data[i];
|
||||
if (this.lineLength >= this.lineBuffer.length) {
|
||||
this.lineBuffer.push(byte);
|
||||
} else {
|
||||
this.lineBuffer[this.lineLength] = byte;
|
||||
}
|
||||
this.lineLength++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
s(this.textArr)
|
||||
})
|
||||
this.stream.on('end', () => {
|
||||
resolve(this.textArr);
|
||||
});
|
||||
|
||||
this.stream.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
45
bin/test/generator.js
Normal file
45
bin/test/generator.js
Normal file
@@ -0,0 +1,45 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const chokidar = require('chokidar');
|
||||
const { parse } = require('@babel/parser');
|
||||
const { codeFrameColumns } = require('@babel/code-frame');
|
||||
|
||||
// 配置常量
|
||||
const AUTO_START = '/* auto-generated-start */';
|
||||
const AUTO_END = '/* auto-generated-end */';
|
||||
const INDENT = ' '; // 缩进2空格
|
||||
|
||||
// 配置文件路径
|
||||
// const CONFIG_PATH = path.join(__dirname, '../config/dynamic-config.js');
|
||||
const CONFIG_PATH = "/Users/bmy/source/TsxVueClassApi/src/core/config/configure.config.ts";
|
||||
const TARGET_PATH = path.join(__dirname, 'templates/TargetClass.ts');
|
||||
|
||||
function generateClassMethods(keys) {
|
||||
// 读取目标文件
|
||||
let targetContent;
|
||||
try {
|
||||
targetContent = fs.readFileSync(TARGET_PATH, 'utf8');
|
||||
} catch {
|
||||
targetContent = `${AUTO_START}\n${AUTO_END}`;
|
||||
}
|
||||
|
||||
// 生成新方法代码
|
||||
const newMethods = keys.map(key =>
|
||||
`${INDENT}public ${key}() {\n${INDENT} // Auto-generated\n${INDENT}}`
|
||||
).join('\n\n');
|
||||
|
||||
// 替换标记区域
|
||||
const newContent = targetContent.replace(
|
||||
new RegExp(`${AUTO_START}([\\s\\S]*?)${AUTO_END}`),
|
||||
`${AUTO_START}\n${newMethods}\n${INDENT}${AUTO_END}`
|
||||
);
|
||||
|
||||
// 格式校验
|
||||
try {
|
||||
parse(newContent, { plugins: ['typescript'] });
|
||||
fs.writeFileSync(TARGET_PATH, newContent);
|
||||
} catch (err) {
|
||||
console.error('⚠️ 生成代码语法错误:');
|
||||
console.log(codeFrameColumns(newContent, err.loc, { highlightCode: true }));
|
||||
}
|
||||
}
|
||||
591
package-lock.json
generated
591
package-lock.json
generated
@@ -8,8 +8,10 @@
|
||||
"name": "tsx-vue-class-api",
|
||||
"version": "1.1.0",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.26.2",
|
||||
"ant-design-vue": "^1.6.5",
|
||||
"axios": "^0.20.0",
|
||||
"chokidar": "^4.0.3",
|
||||
"core-js": "^3.6.5",
|
||||
"isarray": "^2.0.5",
|
||||
"vue": "^2.6.11",
|
||||
@@ -108,79 +110,24 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.23.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
|
||||
"integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==",
|
||||
"dev": true,
|
||||
"version": "7.26.2",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@babel/code-frame/-/code-frame-7.26.2.tgz",
|
||||
"integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.23.4",
|
||||
"chalk": "^2.4.2"
|
||||
"@babel/helper-validator-identifier": "^7.25.9",
|
||||
"js-tokens": "^4.0.0",
|
||||
"picocolors": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-flag": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
"node_modules/@babel/code-frame/node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@babel/compat-data": {
|
||||
"version": "7.23.5",
|
||||
@@ -501,19 +448,19 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.23.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz",
|
||||
"integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==",
|
||||
"dev": true,
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz",
|
||||
"integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-validator-identifier": {
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz",
|
||||
"integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==",
|
||||
"dev": true,
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
|
||||
"integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
@@ -555,86 +502,14 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight": {
|
||||
"version": "7.23.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz",
|
||||
"integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"chalk": "^2.4.2",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-flag": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.23.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz",
|
||||
"integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==",
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@babel/parser/-/parser-7.26.9.tgz",
|
||||
"integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.26.9"
|
||||
},
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
},
|
||||
@@ -1959,14 +1834,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.23.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz",
|
||||
"integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==",
|
||||
"dev": true,
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@babel/types/-/types-7.26.9.tgz",
|
||||
"integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.23.4",
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
"@babel/helper-string-parser": "^7.25.9",
|
||||
"@babel/helper-validator-identifier": "^7.25.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -2168,10 +2042,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
||||
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
|
||||
"dev": true
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
|
||||
"integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.20",
|
||||
@@ -3064,28 +2939,84 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-sfc": {
|
||||
"version": "2.7.16",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz",
|
||||
"integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==",
|
||||
"node_modules/@vue/compiler-core": {
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue/compiler-core/-/compiler-core-3.5.13.tgz",
|
||||
"integrity": "sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.23.5",
|
||||
"postcss": "^8.4.14",
|
||||
"source-map": "^0.6.1"
|
||||
"@babel/parser": "^7.25.3",
|
||||
"@vue/shared": "3.5.13",
|
||||
"entities": "^4.5.0",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map-js": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-core/node_modules/entities": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"prettier": "^1.18.2 || ^2.0.0"
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-dom": {
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue/compiler-dom/-/compiler-dom-3.5.13.tgz",
|
||||
"integrity": "sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@vue/compiler-core": "3.5.13",
|
||||
"@vue/shared": "3.5.13"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-sfc": {
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue/compiler-sfc/-/compiler-sfc-3.5.13.tgz",
|
||||
"integrity": "sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.25.3",
|
||||
"@vue/compiler-core": "3.5.13",
|
||||
"@vue/compiler-dom": "3.5.13",
|
||||
"@vue/compiler-ssr": "3.5.13",
|
||||
"@vue/shared": "3.5.13",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.30.11",
|
||||
"postcss": "^8.4.48",
|
||||
"source-map-js": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-sfc/node_modules/picocolors": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"optional": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@vue/compiler-sfc/node_modules/postcss": {
|
||||
"version": "8.4.32",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz",
|
||||
"integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==",
|
||||
"version": "8.5.3",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/postcss/-/postcss-8.5.3.tgz",
|
||||
"integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@@ -3100,15 +3031,31 @@
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.7",
|
||||
"picocolors": "^1.0.0",
|
||||
"source-map-js": "^1.0.2"
|
||||
"nanoid": "^3.3.8",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-ssr": {
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue/compiler-ssr/-/compiler-ssr-3.5.13.tgz",
|
||||
"integrity": "sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.5.13",
|
||||
"@vue/shared": "3.5.13"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/component-compiler-utils": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-3.3.0.tgz",
|
||||
@@ -3163,6 +3110,15 @@
|
||||
"webpack": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/shared": {
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue/shared/-/shared-3.5.13.tgz",
|
||||
"integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@vue/web-component-wrapper": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@vue/web-component-wrapper/-/web-component-wrapper-1.3.0.tgz",
|
||||
@@ -4384,12 +4340,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/binary-extensions": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
||||
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
||||
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/bindings": {
|
||||
@@ -5011,42 +4971,18 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
],
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/chokidar/-/chokidar-4.0.3.tgz",
|
||||
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
"readdirp": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.10.0"
|
||||
"node": ">= 14.16.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/chokidar/node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/chownr": {
|
||||
@@ -7470,6 +7406,15 @@
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/estree-walker": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/estree-walker/-/estree-walker-2.0.2.tgz",
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
@@ -8387,6 +8332,31 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/fork-ts-checker-webpack-plugin/node_modules/chokidar": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/chokidar/-/chokidar-3.6.0.tgz",
|
||||
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/fork-ts-checker-webpack-plugin/node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
@@ -8402,6 +8372,19 @@
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fork-ts-checker-webpack-plugin/node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/fork-ts-checker-webpack-plugin/node_modules/has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
@@ -8411,6 +8394,19 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/fork-ts-checker-webpack-plugin/node_modules/readdirp": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/readdirp/-/readdirp-3.6.0.tgz",
|
||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"picomatch": "^2.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fork-ts-checker-webpack-plugin/node_modules/semver": {
|
||||
"version": "5.7.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
|
||||
@@ -8552,10 +8548,11 @@
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
@@ -10196,9 +10193,10 @@
|
||||
},
|
||||
"node_modules/is-binary-path": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"binary-extensions": "^2.0.0"
|
||||
},
|
||||
@@ -11314,6 +11312,18 @@
|
||||
"yallist": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.30.17",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/magic-string/-/magic-string-0.30.17.tgz",
|
||||
"integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/make-dir": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
|
||||
@@ -11988,15 +11998,16 @@
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.7",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
||||
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
|
||||
"version": "3.3.9",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/nanoid/-/nanoid-3.3.9.tgz",
|
||||
"integrity": "sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
@@ -14203,15 +14214,16 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"picomatch": "^2.2.1"
|
||||
},
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/readdirp/-/readdirp-4.1.2.tgz",
|
||||
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
"node": ">= 14.18.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/rechoir": {
|
||||
@@ -15330,9 +15342,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -16385,15 +16398,6 @@
|
||||
"integrity": "sha512-okFlQcoGTi4LQBG/PgSYblw9VOyptsz2KJZqc6qtgGdes8VktzUQkj4BI2blit072iS8VODNcMA+tvnS9dnuMA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/to-fast-properties": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||
"integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/to-object-path": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz",
|
||||
@@ -17955,6 +17959,53 @@
|
||||
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/vue/node_modules/@vue/compiler-sfc": {
|
||||
"version": "2.7.16",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz",
|
||||
"integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.23.5",
|
||||
"postcss": "^8.4.14",
|
||||
"source-map": "^0.6.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"prettier": "^1.18.2 || ^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vue/node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/vue/node_modules/postcss": {
|
||||
"version": "8.5.3",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/postcss/-/postcss-8.5.3.tgz",
|
||||
"integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.8",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/vuex": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
|
||||
@@ -18185,6 +18236,60 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/watchpack/node_modules/chokidar": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/chokidar/-/chokidar-3.6.0.tgz",
|
||||
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/watchpack/node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/watchpack/node_modules/readdirp": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/readdirp/-/readdirp-3.6.0.tgz",
|
||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"picomatch": "^2.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wbuf": {
|
||||
"version": "1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz",
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
"tinit": "bin/tinit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.26.2",
|
||||
"ant-design-vue": "^1.6.5",
|
||||
"axios": "^0.20.0",
|
||||
"chokidar": "^4.0.3",
|
||||
"core-js": "^3.6.5",
|
||||
"isarray": "^2.0.5",
|
||||
"vue": "^2.6.11",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
da7a2feb-9485-4fcf-855a-b6dbcedaad05
|
||||
@@ -1 +0,0 @@
|
||||
282d544a-c6a9-4e6d-ab20-93a15ca73330
|
||||
@@ -1 +0,0 @@
|
||||
609d9c08-74bf-4b6b-b612-c63a5bf29b24
|
||||
@@ -1 +0,0 @@
|
||||
37bbcaf2-9403-4c45-a641-e6a09bbec803
|
||||
@@ -1 +0,0 @@
|
||||
55e88823-96b5-4e92-a121-1743226e7284
|
||||
@@ -1 +0,0 @@
|
||||
e9a6fea5-8124-47ee-8764-2a2b38559e29
|
||||
@@ -1 +0,0 @@
|
||||
08d2ddbb-779b-48d9-a2f0-eff54b1a49ba
|
||||
@@ -1 +0,0 @@
|
||||
984cb101-d8c8-46fc-bdf2-404c29895807
|
||||
@@ -1 +0,0 @@
|
||||
29ff899f-7099-4b35-97d9-7eb12e8b1b67
|
||||
@@ -1 +0,0 @@
|
||||
e36141e2-2743-4aa7-89cf-e34088c48df2
|
||||
@@ -1 +0,0 @@
|
||||
88b35c97-9424-4ba5-a009-00ba813fb0fa
|
||||
@@ -1 +0,0 @@
|
||||
50ce6829-d7b9-49e3-91b2-ead60352a710
|
||||
@@ -1 +0,0 @@
|
||||
e99cbd4e-9620-464d-ad1f-a319540d4885
|
||||
@@ -2,16 +2,32 @@
|
||||
* Copyright (c) 2020. bmy
|
||||
*/
|
||||
|
||||
import { VueCustomize } from "@logic/base.type";
|
||||
import VueRouter, { Route } from 'vue-router'
|
||||
|
||||
export interface Methods {
|
||||
StartUp?(): void;
|
||||
$route: Route;
|
||||
$router: VueRouter;
|
||||
// 可添加其他需要的Vue属性,如$el/$data/$refs等
|
||||
$el?: HTMLElement;
|
||||
$data?: Record<string, any>;
|
||||
$refs?: Record<string, any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* logic 层的父类
|
||||
* 主要实现 页面公共参数和ajax方法的地方
|
||||
*/
|
||||
export class BaseLogic {
|
||||
export class BaseLogic<T> implements Methods {
|
||||
// 泛型参数T表示Vue实例的类型
|
||||
protected _?: T; // 保留this._以便向后兼容
|
||||
|
||||
$route!: Route;
|
||||
$router!: VueRouter;
|
||||
$el?: HTMLElement | undefined;
|
||||
$data?: Record<string, any> | undefined;
|
||||
|
||||
|
||||
// 保存Vue对象
|
||||
public _!: any;
|
||||
|
||||
public page: number = 1;
|
||||
public total_page: number = 1;
|
||||
@@ -26,14 +42,19 @@ export class BaseLogic {
|
||||
|
||||
// 请求参数
|
||||
public PageParams: { limit: number, page: number } = {
|
||||
limit : 10, page : 1
|
||||
limit: 10, page: 1
|
||||
}
|
||||
|
||||
/**
|
||||
* 【页面中公共的多次被用到的接口】可以在这个父类中定义,
|
||||
* 子类logic中直接使用,避免方法的冗余
|
||||
* @constructor
|
||||
*/
|
||||
public async DepartmentListRequest(): Promise<void> {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
// 组件初始化完成后调用
|
||||
StartUp?(): void;
|
||||
|
||||
// 合并Vue实例到Logic实例
|
||||
mergeVueInstance(vueInstance: T) {
|
||||
// 保存Vue实例的引用,以便在Logic实例中可以访问到Vue实例
|
||||
this._ = vueInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
d3709c65-896f-4fce-83c8-72248f572930
|
||||
@@ -6,13 +6,13 @@ import { Autowired } from "@ann/ioc.annotation";
|
||||
import { BaseLogic } from "@logic/base.logic";
|
||||
import { Methods, VueCustomize } from "@logic/base.type";
|
||||
|
||||
export class AboutLogic <T extends VueCustomize> extends BaseLogic implements Methods {
|
||||
export class AboutLogic<T extends VueCustomize> extends BaseLogic<T> implements Methods {
|
||||
|
||||
constructor(_: T) {
|
||||
super();
|
||||
this._ = _
|
||||
(this as any)._ = _; // 使用类型断言来解决TypeScript的类型检查问题
|
||||
}
|
||||
|
||||
public async StartUp (): Promise<void> {
|
||||
public async StartUp(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,39 +8,40 @@ import { UserService, ResponseType } from "@service/user.service";
|
||||
import { BaseLogic } from "@logic/base.logic";
|
||||
import { Methods, VueCustomize } from "@logic/base.type";
|
||||
|
||||
export class HomeLogic<T extends VueCustomize> extends BaseLogic implements Methods {
|
||||
export class HomeLogic<T extends VueCustomize> extends BaseLogic<T> implements Methods {
|
||||
|
||||
@Autowired()
|
||||
public readonly UserService!: UserService;
|
||||
|
||||
public title: string = "12222";
|
||||
|
||||
public List: ResponseType[] = [];
|
||||
public List: ResponseType[] = [
|
||||
{ user_id: 1, user_name: '测试1' },
|
||||
{ user_id: 2, user_name: '测试2' },
|
||||
];
|
||||
|
||||
// constructor() {
|
||||
// super();
|
||||
// }
|
||||
|
||||
constructor(_: T) {
|
||||
constructor() {
|
||||
super();
|
||||
console.log("constructor params: ", _);
|
||||
this._ = _
|
||||
}
|
||||
|
||||
/**
|
||||
* 在这里面调用需要打开页面就执行的ajax请求
|
||||
* @constructor
|
||||
* 页面初始化调用的方法
|
||||
*/
|
||||
public async StartUp (): Promise<void> {
|
||||
public async StartUp(): Promise<void> {
|
||||
// 在StartUp方法中访问$route和$router
|
||||
console.log("StartUp - this: ", this);
|
||||
console.log("StartUp - this.$route: ", this.$route);
|
||||
console.log("StartUp - this.$router: ", this.$router);
|
||||
|
||||
await this.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求首页数据
|
||||
*/
|
||||
public async getData (): Promise<void> {
|
||||
this.List = await this.UserService.UserList({ type: 1, page: 1 });
|
||||
console.log("this.List: ", this.List);
|
||||
public async getData(): Promise<void> {
|
||||
// this.List = await this.UserService.UserList({ type: 1, page: 1 });
|
||||
// console.log("this.List: ", this.List);
|
||||
|
||||
// let res = await this.UserService.login({ type: 2, page: 2 });
|
||||
// console.log("this.res: ", res);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
9b3b1288-db3f-4438-9341-a54217a9d678
|
||||
@@ -9,9 +9,9 @@ import { VueCustomize, RouterMeta } from "@logic/base.type";
|
||||
import { Autowired } from "@ann/ioc.annotation";
|
||||
|
||||
@Component
|
||||
export default class About extends VueCustomize {
|
||||
export default class About extends VueCustomize {
|
||||
|
||||
@Autowired(About)
|
||||
@Autowired()
|
||||
private logic!: AboutLogic<About>
|
||||
|
||||
private RouterMeta: RouterMeta = {
|
||||
@@ -20,16 +20,16 @@ export default class About extends VueCustomize {
|
||||
isLogin: true
|
||||
};
|
||||
|
||||
public async created () {
|
||||
public async created() {
|
||||
await this.logic.StartUp();
|
||||
};
|
||||
|
||||
// 路由拦截器
|
||||
beforeRouteEnter (to: Route, from: Route, next: (to?: RawLocation | false | ((vm: Vue) => void)) => void) {
|
||||
beforeRouteEnter(to: Route, from: Route, next: (to?: RawLocation | false | ((vm: Vue) => void)) => void) {
|
||||
next();
|
||||
}
|
||||
|
||||
protected render () {
|
||||
protected render() {
|
||||
return (
|
||||
<div class="About">
|
||||
About
|
||||
|
||||
@@ -18,13 +18,21 @@ import { VueCustomize, RouterMeta } from "@logic/base.type";
|
||||
@Component
|
||||
export default class Home extends VueCustomize {
|
||||
|
||||
// 可选:手动声明data(双重保障,也可仅靠装饰器自动声明)
|
||||
public data() {
|
||||
return {
|
||||
logic: {}, // 确保Vue2初始化时劫持该属性
|
||||
Utils: {}
|
||||
};
|
||||
}
|
||||
|
||||
public RouterMeta: RouterMeta = {
|
||||
title: '首页',
|
||||
showNav: true,
|
||||
isLogin: true
|
||||
}
|
||||
|
||||
@Autowired(Home)
|
||||
@Autowired()
|
||||
private logic!: HomeLogic<Home>
|
||||
|
||||
@Autowired()
|
||||
@@ -49,6 +57,7 @@ export default class Home extends VueCustomize {
|
||||
}
|
||||
|
||||
public back() {
|
||||
this.logic.title = "44444";
|
||||
console.log("qqqq");
|
||||
}
|
||||
|
||||
@@ -61,6 +70,15 @@ export default class Home extends VueCustomize {
|
||||
<HelloWorld msg="向HelloWorld props传参" />
|
||||
<input type="text" v-model={this.logic.title} />
|
||||
<h2>{this.logic.title}</h2>
|
||||
|
||||
{/* 显示$route和$router信息 */}
|
||||
<div class="route-info">
|
||||
<h3>路由信息:</h3>
|
||||
<p>路由路径: {this.$route?.path}</p>
|
||||
<p>路由名称: {this.$route?.name}</p>
|
||||
<p>Logic实例路由路径: {(this.logic as any).$route?.path}</p>
|
||||
</div>
|
||||
|
||||
{this.ClickButton()}
|
||||
<ul>
|
||||
{
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
d7cca889-05d9-4311-b88d-a72968fc4581
|
||||
@@ -1 +0,0 @@
|
||||
c2c6ec3b-b4b9-42f4-92b0-4e10d1e027a6
|
||||
@@ -1 +0,0 @@
|
||||
cbff3cfc-8ebf-4480-a698-e4a7c6040408
|
||||
@@ -1,14 +1,184 @@
|
||||
/*
|
||||
* Copyright (c) 2020. bmy
|
||||
*/
|
||||
import Vue from 'vue';
|
||||
|
||||
export function Autowired(params?: any) {
|
||||
return (target: any, propertyKey: string) => {
|
||||
let typeClass = Reflect.getMetadata('design:type', target, propertyKey);
|
||||
Object.defineProperty(target, propertyKey, {
|
||||
value: params ? new typeClass(new params) : new typeClass(),
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
// 1. 定义最宽松的基础类型(兼容所有场景,避开symbol索引签名限制)
|
||||
type AutowiredTarget = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
// 2. Vue组件实例专属类型(仅声明string/number索引,运行时兼容symbol)
|
||||
interface VueComponentInstance extends AutowiredTarget {
|
||||
created?: (...args: any[]) => Promise<void> | void;
|
||||
$router?: any;
|
||||
$route?: any;
|
||||
$el?: HTMLElement;
|
||||
$data?: Record<string, any>;
|
||||
}
|
||||
|
||||
// 3. Logic实例类型
|
||||
interface LogicInstance extends AutowiredTarget {
|
||||
mergeVueInstance?: <T extends VueComponentInstance>(vueInstance: T) => void;
|
||||
}
|
||||
|
||||
// 4. 通用构造函数类型
|
||||
type Constructor<T = any> = new (...args: any[]) => T;
|
||||
|
||||
/**
|
||||
* 自动注入实例装饰器
|
||||
* 适配所有场景:
|
||||
* - Vue组件的logic属性:自动创建Logic实例并合并Vue所有属性
|
||||
* - Logic类/普通类的属性:直接创建实例并挂载
|
||||
*/
|
||||
export function Autowired(params?: any) {
|
||||
return function (target: AutowiredTarget, propertyKey: string | symbol): void {
|
||||
// 获取属性对应的类构造函数
|
||||
const typeClass = Reflect.getMetadata('design:type', target, propertyKey) as Constructor;
|
||||
|
||||
// 仅对Vue组件的logic属性做特殊处理(运行时判断)
|
||||
if (propertyKey === 'logic') {
|
||||
enhanceVueLogicProperty(target as VueComponentInstance, propertyKey, typeClass);
|
||||
} else {
|
||||
// 所有其他场景(包括Logic类的属性):直接挂载实例
|
||||
mountNormalInstance(target, propertyKey, typeClass, params);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂载普通实例(适配所有非Vue组件场景)
|
||||
*/
|
||||
function mountNormalInstance(
|
||||
target: AutowiredTarget,
|
||||
propertyKey: string | symbol,
|
||||
typeClass: Constructor,
|
||||
params?: any
|
||||
): void {
|
||||
if (!typeClass) {
|
||||
console.warn(`类构造函数不存在,属性${String(propertyKey)}注入失败`);
|
||||
return;
|
||||
}
|
||||
|
||||
// 创建实例并挂载(统一用defineProperty兼容symbol)
|
||||
const instance = params ? new typeClass(params) : new typeClass();
|
||||
Object.defineProperty(target, propertyKey, {
|
||||
value: instance,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 增强Vue组件的logic属性:创建实例并合并Vue所有属性
|
||||
*/
|
||||
function enhanceVueLogicProperty(
|
||||
target: VueComponentInstance,
|
||||
propertyKey: string | symbol,
|
||||
typeClass: Constructor<LogicInstance>
|
||||
): void {
|
||||
// 保存原始created钩子
|
||||
const originalCreated: (...args: any[]) => Promise<void> | void = target.created || (() => { });
|
||||
|
||||
// 重写created钩子(显式指定this类型)
|
||||
target.created = async function (this: VueComponentInstance): Promise<void> {
|
||||
const vueInstance = this;
|
||||
|
||||
// 防御性判断
|
||||
if (!typeClass) {
|
||||
console.warn(`Logic类构造函数不存在,属性${String(propertyKey)}注入失败`);
|
||||
await originalCreated.call(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// 创建Logic实例
|
||||
const logicInstance = Vue.observable(new typeClass());
|
||||
|
||||
// 核心修复:用Object.defineProperty兼容symbol,避开TS索引检查
|
||||
Object.defineProperty(this, propertyKey, {
|
||||
value: logicInstance,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
// 合并Vue属性(仅当存在mergeVueInstance方法时)
|
||||
if (typeof logicInstance.mergeVueInstance === 'function') {
|
||||
logicInstance.mergeVueInstance(vueInstance);
|
||||
mergeVueProperties(logicInstance, vueInstance);
|
||||
resetLogicConstructor(logicInstance);
|
||||
}
|
||||
|
||||
// 执行原始created钩子
|
||||
await originalCreated.call(this);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 合并Vue实例的所有属性到Logic实例
|
||||
*/
|
||||
function mergeVueProperties(logicInstance: LogicInstance, vueInstance: VueComponentInstance): void {
|
||||
const allProps = getAllVueProperties(vueInstance);
|
||||
const excludeProps = new Set<string | symbol>(['constructor', 'prototype', '__proto__', 'mergeVueInstance']);
|
||||
|
||||
allProps.forEach(prop => {
|
||||
if (excludeProps.has(prop)) return;
|
||||
|
||||
const logicPropDesc = Object.getOwnPropertyDescriptor(logicInstance, prop);
|
||||
if (logicPropDesc && !logicPropDesc.configurable) return;
|
||||
|
||||
try {
|
||||
const vuePropDesc =
|
||||
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(vueInstance), prop) ||
|
||||
Object.getOwnPropertyDescriptor(vueInstance, prop);
|
||||
|
||||
if (vuePropDesc) {
|
||||
Object.defineProperty(logicInstance, prop, {
|
||||
...vuePropDesc,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
} else {
|
||||
// 兜底:用defineProperty赋值,兼容symbol
|
||||
Object.defineProperty(logicInstance, prop, {
|
||||
value: vueInstance[prop as keyof typeof vueInstance],
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
if (typeof prop === 'string' && !['__proto__', 'constructor'].includes(prop)) {
|
||||
console.warn(`合并属性 ${String(prop)} 失败:`, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 收集Vue实例的所有属性(包括原型链、Symbol)
|
||||
*/
|
||||
function getAllVueProperties(obj: any): Set<string | symbol> {
|
||||
const props = new Set<string | symbol>();
|
||||
let currentObj: any = obj;
|
||||
|
||||
while (currentObj && currentObj !== Object.prototype) {
|
||||
Object.getOwnPropertyNames(currentObj).forEach(prop => props.add(prop));
|
||||
Object.getOwnPropertySymbols(currentObj).forEach(prop => props.add(prop));
|
||||
currentObj = Object.getPrototypeOf(currentObj);
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置Logic实例的constructor指向
|
||||
*/
|
||||
function resetLogicConstructor(logicInstance: LogicInstance): void {
|
||||
Object.defineProperty(logicInstance, 'constructor', {
|
||||
value: logicInstance.constructor,
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
f0ed9e16-3f2b-4d50-9858-120dc2e2ae2c
|
||||
@@ -21,19 +21,28 @@ export class ConfigureConfig {
|
||||
ProdUrl: string,
|
||||
ApiList: { [key: string]: string }
|
||||
} = {
|
||||
DevUrl: 'http://127.0.0.1:8080',
|
||||
ProdUrl: 'http://127.0.0.1:9090/api',
|
||||
ApiList: {
|
||||
// start - 注释内的key都将被Node.js监听并diff取出实时编辑后的差异项,然后程序决定是否增删请求中间层xx文件中的xx方法代码【不要删除】
|
||||
UserList: '/UserList',
|
||||
// User_IndexTest: '/test',
|
||||
// Car_carList: '/test',
|
||||
// Car_addCar: '/test',
|
||||
// Index_reg: '/reg',
|
||||
// Order_test: '/test',
|
||||
// end - 注释内的key都将被Node.js监听并diff取出实时编辑后的差异项,然后程序决定是否增删请求中间层xx文件中的xx方法代码【不要删除】
|
||||
}
|
||||
};
|
||||
DevUrl: 'http://127.0.0.1:8080',
|
||||
ProdUrl: 'http://127.0.0.1:9090/api',
|
||||
ApiList: {
|
||||
// start - 下面 注释内的各个对象key 将被Nodejs实时监听,获取你key改动(增删改)后,将同步
|
||||
// start - 自动生成接口请求中间层的文件和文件内部的代码。
|
||||
// start - 注意 下面 被注释的key 将不会生成文件或代码
|
||||
|
||||
// UserList: '/UserList',
|
||||
// User_IndexTest: '/test',
|
||||
Car_carList: '/test',
|
||||
Car_addCar: '/test',
|
||||
|
||||
Index_reg: '/reg',
|
||||
Index_login: '/login',
|
||||
|
||||
Order_test: '/test',
|
||||
|
||||
// end - 上面 注释内的各个对象key 将被Nodejs实时监听,获取你key改动(增删改)后,将同步
|
||||
// end - 自动生成接口请求中间层的文件和文件内部的代码。
|
||||
// end - 注意 上面 被注释的key 将不会生成文件或代码
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Vue 插件
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
852dea68-05ee-4958-8884-27c503363732
|
||||
@@ -1 +0,0 @@
|
||||
45df40b6-06b8-4b49-9ece-3df4b113d74f
|
||||
@@ -1 +0,0 @@
|
||||
b6c30b87-ba50-4860-a92d-3dfe07d0ff5c
|
||||
21
src/core/service/Car.service.ts
Normal file
21
src/core/service/Car.service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
// @ts-nocheck
|
||||
import { GET, Mapper, POST, PUT, DELETE } from "@ann/Http.annotation";
|
||||
import { property, defaultValue, deserialize } from "@ann/JsonToClass";
|
||||
|
||||
// 建议用工具json-class-desktop生成这个类 类型
|
||||
export class ResponseType {
|
||||
@property("id")
|
||||
user_id!: number;
|
||||
}
|
||||
|
||||
export class CarService {
|
||||
|
||||
@GET()
|
||||
@Mapper(ResponseType)
|
||||
public async carList (params: object): Promise<ResponseType[]> {}
|
||||
|
||||
@GET()
|
||||
@Mapper(ResponseType)
|
||||
public async addCar (params: object): Promise<ResponseType[]> {}
|
||||
|
||||
}
|
||||
21
src/core/service/Index.service.ts
Normal file
21
src/core/service/Index.service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
// @ts-nocheck
|
||||
import { GET, Mapper, POST, PUT, DELETE } from "@ann/Http.annotation";
|
||||
import { property, defaultValue, deserialize } from "@ann/JsonToClass";
|
||||
|
||||
// 建议用工具json-class-desktop生成这个类 类型
|
||||
export class ResponseType {
|
||||
@property("id")
|
||||
user_id!: number;
|
||||
}
|
||||
|
||||
export class IndexService {
|
||||
|
||||
@GET()
|
||||
@Mapper(ResponseType)
|
||||
public async reg (params: object): Promise<ResponseType[]> {}
|
||||
|
||||
@GET()
|
||||
@Mapper(ResponseType)
|
||||
public async login (params: object): Promise<ResponseType[]> {}
|
||||
|
||||
}
|
||||
17
src/core/service/Order.service.ts
Normal file
17
src/core/service/Order.service.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
// @ts-nocheck
|
||||
import { GET, Mapper, POST, PUT, DELETE } from "@ann/Http.annotation";
|
||||
import { property, defaultValue, deserialize } from "@ann/JsonToClass";
|
||||
|
||||
// 建议用工具json-class-desktop生成这个类 类型
|
||||
export class ResponseType {
|
||||
@property("id")
|
||||
user_id!: number;
|
||||
}
|
||||
|
||||
export class OrderService {
|
||||
|
||||
@GET()
|
||||
@Mapper(ResponseType)
|
||||
public async test (params: object): Promise<ResponseType[]> {}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
6dd651dd-0493-4995-a44b-c15ccfdf75a4
|
||||
@@ -1 +0,0 @@
|
||||
d3359e2f-bc25-4e14-b202-20080d06b04a
|
||||
@@ -1 +0,0 @@
|
||||
e5b979e5-1ac3-429c-bf03-7d570eba9033
|
||||
@@ -1 +0,0 @@
|
||||
23f23313-fd2c-4dfc-aeaa-6758f2f76ec2
|
||||
@@ -56,25 +56,25 @@ module.exports = {
|
||||
errors: true
|
||||
},
|
||||
// before 这块代码都可以删除,仅仅为脚手架提供一个用于测试的接口
|
||||
before: function (app, server) {
|
||||
app.all('*', function (req, res, next) {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
res.header('Access-Control-Allow-Headers', '*');
|
||||
res.header('Access-Control-Allow-Methods', '*');
|
||||
res.header('Content-Type', 'application/json;charset=utf-8');
|
||||
next();
|
||||
});
|
||||
app.get('/UserList', function (req, res) {
|
||||
res.json({
|
||||
status: 200,
|
||||
message: '请求成功',
|
||||
result: [
|
||||
{ id: 1, name: '张三' },
|
||||
{ id: 2, name: '李四' }
|
||||
]
|
||||
});
|
||||
});
|
||||
},
|
||||
// before: function (app, server) {
|
||||
// app.all('*', function (req, res, next) {
|
||||
// res.header('Access-Control-Allow-Origin', '*');
|
||||
// res.header('Access-Control-Allow-Headers', '*');
|
||||
// res.header('Access-Control-Allow-Methods', '*');
|
||||
// res.header('Content-Type', 'application/json;charset=utf-8');
|
||||
// next();
|
||||
// });
|
||||
// app.get('/UserList', function (req, res) {
|
||||
// res.json({
|
||||
// status: 200,
|
||||
// message: '请求成功',
|
||||
// result: [
|
||||
// { id: 1, name: '张三' },
|
||||
// { id: 2, name: '李四' }
|
||||
// ]
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
// proxy: {
|
||||
// '/api': {
|
||||
// target: 'http://115.159.153.142:9010/h5',
|
||||
@@ -111,7 +111,7 @@ module.exports = {
|
||||
plugins: [
|
||||
new ProgressPlugin({
|
||||
handler: (percentage, message, ...args) => {
|
||||
console.log(`${chalk.yellow("进度: ")}${chalk.green.bold(~~(percentage * 100) + "%")} ${args[0] ? chalk.black(args[0]) : " " } ${chalk.blue.bold(message)}`)
|
||||
console.log(`${chalk.yellow("进度: ")}${chalk.green.bold(~~(percentage * 100) + "%")} ${args[0] ? chalk.black(args[0]) : " "} ${chalk.blue.bold(message)}`)
|
||||
},
|
||||
})
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user