@lsby/net-core 0.0.5-beta.3 → 0.0.5-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/gen-test/bin.cjs +8 -5
- package/dist/bin/gen-test/index.cjs +8 -5
- package/dist/bin/get-type/bin.cjs +6 -3
- package/dist/bin/get-type/index.cjs +6 -3
- package/dist/cjs/bin/gen-test/bin.cjs +8 -5
- package/dist/cjs/bin/gen-test/index.cjs +8 -5
- package/dist/cjs/bin/get-type/bin.cjs +6 -3
- package/dist/cjs/bin/get-type/index.cjs +6 -3
- package/dist/esm/bin/gen-test/bin.js +1 -1
- package/dist/esm/bin/gen-test/index.js +1 -1
- package/dist/esm/bin/get-type/bin.js +1 -1
- package/dist/esm/bin/get-type/index.js +1 -1
- package/dist/esm/{chunk-FKPKFLIZ.js → chunk-553ZM42W.js} +8 -5
- package/dist/esm/{chunk-P6XNNFAN.js → chunk-EDGJJIIQ.js} +6 -3
- package/package.json +1 -1
|
@@ -203011,7 +203011,7 @@ var Log = class _Log {
|
|
|
203011
203011
|
// src/bin/gen-test/index.ts
|
|
203012
203012
|
function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
203013
203013
|
return new import_ts_fp_data2.Task(async () => {
|
|
203014
|
-
var log = new Log("@lsby
|
|
203014
|
+
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
203015
203015
|
const projectRootPath = import_node_path.default.dirname(tsconfigPath);
|
|
203016
203016
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
203017
203017
|
if (tsconfigJson.error) {
|
|
@@ -203045,7 +203045,10 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
203045
203045
|
).run();
|
|
203046
203046
|
const importCode = [];
|
|
203047
203047
|
const testCode = [];
|
|
203048
|
-
|
|
203048
|
+
for (var index = 0; index < testSourceFilesFilter.length; index++) {
|
|
203049
|
+
var testSourceFile = testSourceFilesFilter[index];
|
|
203050
|
+
if (testSourceFile == null)
|
|
203051
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
203049
203052
|
const filenameRelativeToApiFolder = import_node_path.default.relative(interfaceFolderPath, testSourceFile.fileName).replaceAll("\\", "/");
|
|
203050
203053
|
const importName = filenameRelativeToApiFolder.replaceAll("/", "_").replaceAll(".test.ts", "").replaceAll("./", "").replaceAll("-", "_");
|
|
203051
203054
|
const filenameRelativeToProjectRoot = import_node_path.default.relative(projectRootPath, testSourceFile.fileName).replaceAll("\\", "/").replaceAll(".ts", "");
|
|
@@ -203055,15 +203058,15 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
203055
203058
|
for (const node of testSourceFile.statements) {
|
|
203056
203059
|
if (import_typescript.default.isExportAssignment(node) && node.isExportEquals === void 0) {
|
|
203057
203060
|
const expression = node.expression;
|
|
203058
|
-
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\
|
|
203061
|
+
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\u6D4B\u8BD5") {
|
|
203059
203062
|
break;
|
|
203060
203063
|
}
|
|
203061
|
-
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \
|
|
203064
|
+
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \u6D4B\u8BD5`);
|
|
203062
203065
|
}
|
|
203063
203066
|
}
|
|
203064
203067
|
importCode.push(`import ${importName} from '${importPath}'`);
|
|
203065
203068
|
testCode.push(generateTestCode(importName, importName));
|
|
203066
|
-
}
|
|
203069
|
+
}
|
|
203067
203070
|
const finalTestFile = [
|
|
203068
203071
|
"import './unit-test-prefix'",
|
|
203069
203072
|
"",
|
|
@@ -203016,7 +203016,7 @@ var Log = class _Log {
|
|
|
203016
203016
|
// src/bin/gen-test/index.ts
|
|
203017
203017
|
function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
203018
203018
|
return new import_ts_fp_data2.Task(async () => {
|
|
203019
|
-
var log = new Log("@lsby
|
|
203019
|
+
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
203020
203020
|
const projectRootPath = import_node_path.default.dirname(tsconfigPath);
|
|
203021
203021
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
203022
203022
|
if (tsconfigJson.error) {
|
|
@@ -203050,7 +203050,10 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
203050
203050
|
).run();
|
|
203051
203051
|
const importCode = [];
|
|
203052
203052
|
const testCode = [];
|
|
203053
|
-
|
|
203053
|
+
for (var index = 0; index < testSourceFilesFilter.length; index++) {
|
|
203054
|
+
var testSourceFile = testSourceFilesFilter[index];
|
|
203055
|
+
if (testSourceFile == null)
|
|
203056
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
203054
203057
|
const filenameRelativeToApiFolder = import_node_path.default.relative(interfaceFolderPath, testSourceFile.fileName).replaceAll("\\", "/");
|
|
203055
203058
|
const importName = filenameRelativeToApiFolder.replaceAll("/", "_").replaceAll(".test.ts", "").replaceAll("./", "").replaceAll("-", "_");
|
|
203056
203059
|
const filenameRelativeToProjectRoot = import_node_path.default.relative(projectRootPath, testSourceFile.fileName).replaceAll("\\", "/").replaceAll(".ts", "");
|
|
@@ -203060,15 +203063,15 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
203060
203063
|
for (const node of testSourceFile.statements) {
|
|
203061
203064
|
if (import_typescript.default.isExportAssignment(node) && node.isExportEquals === void 0) {
|
|
203062
203065
|
const expression = node.expression;
|
|
203063
|
-
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\
|
|
203066
|
+
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\u6D4B\u8BD5") {
|
|
203064
203067
|
break;
|
|
203065
203068
|
}
|
|
203066
|
-
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \
|
|
203069
|
+
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \u6D4B\u8BD5`);
|
|
203067
203070
|
}
|
|
203068
203071
|
}
|
|
203069
203072
|
importCode.push(`import ${importName} from '${importPath}'`);
|
|
203070
203073
|
testCode.push(generateTestCode(importName, importName));
|
|
203071
|
-
}
|
|
203074
|
+
}
|
|
203072
203075
|
const finalTestFile = [
|
|
203073
203076
|
"import './unit-test-prefix'",
|
|
203074
203077
|
"",
|
|
@@ -203040,7 +203040,7 @@ export default Api
|
|
|
203040
203040
|
// src/bin/get-type/index.ts
|
|
203041
203041
|
function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
203042
203042
|
return new import_ts_fp_data2.Task(async () => {
|
|
203043
|
-
var log = new Log("@lsby
|
|
203043
|
+
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
203044
203044
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
203045
203045
|
if (tsconfigJson.error) {
|
|
203046
203046
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -203086,7 +203086,10 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
203086
203086
|
const check = newProject.getTypeChecker();
|
|
203087
203087
|
await log.debug("\u6210\u529F\u751F\u6210\u865A\u62DF\u9879\u76EE\u7C7B\u578B\u68C0\u67E5\u5668...").run();
|
|
203088
203088
|
const result = [];
|
|
203089
|
-
|
|
203089
|
+
for (var index = 0; index < apiSourceFiles.length; index++) {
|
|
203090
|
+
var apiSourceFile = apiSourceFiles[index];
|
|
203091
|
+
if (apiSourceFile == null)
|
|
203092
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
203090
203093
|
await log.info(`\u5904\u7406\uFF08${index + 1} / ${apiSourceFiles.length}\uFF09\uFF1A${apiSourceFile.fileName}`).run();
|
|
203091
203094
|
const apiCalcSourceFile = apiTypeCalcFiles[index]?.sourceFile;
|
|
203092
203095
|
if (apiCalcSourceFile === void 0) {
|
|
@@ -203103,7 +203106,7 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
203103
203106
|
result.push(typeString);
|
|
203104
203107
|
}
|
|
203105
203108
|
}
|
|
203106
|
-
}
|
|
203109
|
+
}
|
|
203107
203110
|
await log.debug("\u6210\u529F\u5904\u7406\u6240\u6709\u63A5\u53E3...").run();
|
|
203108
203111
|
const outputPathAbs = import_node_path.default.resolve(outputPath);
|
|
203109
203112
|
import_node_fs.default.writeFileSync(outputPathAbs, `export type InterfaceType = [${result.join(",")}]`);
|
|
@@ -203045,7 +203045,7 @@ export default Api
|
|
|
203045
203045
|
// src/bin/get-type/index.ts
|
|
203046
203046
|
function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
203047
203047
|
return new import_ts_fp_data2.Task(async () => {
|
|
203048
|
-
var log = new Log("@lsby
|
|
203048
|
+
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
203049
203049
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
203050
203050
|
if (tsconfigJson.error) {
|
|
203051
203051
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -203091,7 +203091,10 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
203091
203091
|
const check = newProject.getTypeChecker();
|
|
203092
203092
|
await log.debug("\u6210\u529F\u751F\u6210\u865A\u62DF\u9879\u76EE\u7C7B\u578B\u68C0\u67E5\u5668...").run();
|
|
203093
203093
|
const result = [];
|
|
203094
|
-
|
|
203094
|
+
for (var index = 0; index < apiSourceFiles.length; index++) {
|
|
203095
|
+
var apiSourceFile = apiSourceFiles[index];
|
|
203096
|
+
if (apiSourceFile == null)
|
|
203097
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
203095
203098
|
await log.info(`\u5904\u7406\uFF08${index + 1} / ${apiSourceFiles.length}\uFF09\uFF1A${apiSourceFile.fileName}`).run();
|
|
203096
203099
|
const apiCalcSourceFile = apiTypeCalcFiles[index]?.sourceFile;
|
|
203097
203100
|
if (apiCalcSourceFile === void 0) {
|
|
@@ -203108,7 +203111,7 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
203108
203111
|
result.push(typeString);
|
|
203109
203112
|
}
|
|
203110
203113
|
}
|
|
203111
|
-
}
|
|
203114
|
+
}
|
|
203112
203115
|
await log.debug("\u6210\u529F\u5904\u7406\u6240\u6709\u63A5\u53E3...").run();
|
|
203113
203116
|
const outputPathAbs = import_node_path.default.resolve(outputPath);
|
|
203114
203117
|
import_node_fs.default.writeFileSync(outputPathAbs, `export type InterfaceType = [${result.join(",")}]`);
|
|
@@ -203011,7 +203011,7 @@ var Log = class _Log {
|
|
|
203011
203011
|
// src/bin/gen-test/index.ts
|
|
203012
203012
|
function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
203013
203013
|
return new import_ts_fp_data2.Task(async () => {
|
|
203014
|
-
var log = new Log("@lsby
|
|
203014
|
+
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
203015
203015
|
const projectRootPath = import_node_path.default.dirname(tsconfigPath);
|
|
203016
203016
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
203017
203017
|
if (tsconfigJson.error) {
|
|
@@ -203045,7 +203045,10 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
203045
203045
|
).run();
|
|
203046
203046
|
const importCode = [];
|
|
203047
203047
|
const testCode = [];
|
|
203048
|
-
|
|
203048
|
+
for (var index = 0; index < testSourceFilesFilter.length; index++) {
|
|
203049
|
+
var testSourceFile = testSourceFilesFilter[index];
|
|
203050
|
+
if (testSourceFile == null)
|
|
203051
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
203049
203052
|
const filenameRelativeToApiFolder = import_node_path.default.relative(interfaceFolderPath, testSourceFile.fileName).replaceAll("\\", "/");
|
|
203050
203053
|
const importName = filenameRelativeToApiFolder.replaceAll("/", "_").replaceAll(".test.ts", "").replaceAll("./", "").replaceAll("-", "_");
|
|
203051
203054
|
const filenameRelativeToProjectRoot = import_node_path.default.relative(projectRootPath, testSourceFile.fileName).replaceAll("\\", "/").replaceAll(".ts", "");
|
|
@@ -203055,15 +203058,15 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
203055
203058
|
for (const node of testSourceFile.statements) {
|
|
203056
203059
|
if (import_typescript.default.isExportAssignment(node) && node.isExportEquals === void 0) {
|
|
203057
203060
|
const expression = node.expression;
|
|
203058
|
-
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\
|
|
203061
|
+
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\u6D4B\u8BD5") {
|
|
203059
203062
|
break;
|
|
203060
203063
|
}
|
|
203061
|
-
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \
|
|
203064
|
+
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \u6D4B\u8BD5`);
|
|
203062
203065
|
}
|
|
203063
203066
|
}
|
|
203064
203067
|
importCode.push(`import ${importName} from '${importPath}'`);
|
|
203065
203068
|
testCode.push(generateTestCode(importName, importName));
|
|
203066
|
-
}
|
|
203069
|
+
}
|
|
203067
203070
|
const finalTestFile = [
|
|
203068
203071
|
"import './unit-test-prefix'",
|
|
203069
203072
|
"",
|
|
@@ -203016,7 +203016,7 @@ var Log = class _Log {
|
|
|
203016
203016
|
// src/bin/gen-test/index.ts
|
|
203017
203017
|
function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
203018
203018
|
return new import_ts_fp_data2.Task(async () => {
|
|
203019
|
-
var log = new Log("@lsby
|
|
203019
|
+
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
203020
203020
|
const projectRootPath = import_node_path.default.dirname(tsconfigPath);
|
|
203021
203021
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
203022
203022
|
if (tsconfigJson.error) {
|
|
@@ -203050,7 +203050,10 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
203050
203050
|
).run();
|
|
203051
203051
|
const importCode = [];
|
|
203052
203052
|
const testCode = [];
|
|
203053
|
-
|
|
203053
|
+
for (var index = 0; index < testSourceFilesFilter.length; index++) {
|
|
203054
|
+
var testSourceFile = testSourceFilesFilter[index];
|
|
203055
|
+
if (testSourceFile == null)
|
|
203056
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
203054
203057
|
const filenameRelativeToApiFolder = import_node_path.default.relative(interfaceFolderPath, testSourceFile.fileName).replaceAll("\\", "/");
|
|
203055
203058
|
const importName = filenameRelativeToApiFolder.replaceAll("/", "_").replaceAll(".test.ts", "").replaceAll("./", "").replaceAll("-", "_");
|
|
203056
203059
|
const filenameRelativeToProjectRoot = import_node_path.default.relative(projectRootPath, testSourceFile.fileName).replaceAll("\\", "/").replaceAll(".ts", "");
|
|
@@ -203060,15 +203063,15 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
203060
203063
|
for (const node of testSourceFile.statements) {
|
|
203061
203064
|
if (import_typescript.default.isExportAssignment(node) && node.isExportEquals === void 0) {
|
|
203062
203065
|
const expression = node.expression;
|
|
203063
|
-
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\
|
|
203066
|
+
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\u6D4B\u8BD5") {
|
|
203064
203067
|
break;
|
|
203065
203068
|
}
|
|
203066
|
-
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \
|
|
203069
|
+
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \u6D4B\u8BD5`);
|
|
203067
203070
|
}
|
|
203068
203071
|
}
|
|
203069
203072
|
importCode.push(`import ${importName} from '${importPath}'`);
|
|
203070
203073
|
testCode.push(generateTestCode(importName, importName));
|
|
203071
|
-
}
|
|
203074
|
+
}
|
|
203072
203075
|
const finalTestFile = [
|
|
203073
203076
|
"import './unit-test-prefix'",
|
|
203074
203077
|
"",
|
|
@@ -203040,7 +203040,7 @@ export default Api
|
|
|
203040
203040
|
// src/bin/get-type/index.ts
|
|
203041
203041
|
function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
203042
203042
|
return new import_ts_fp_data2.Task(async () => {
|
|
203043
|
-
var log = new Log("@lsby
|
|
203043
|
+
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
203044
203044
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
203045
203045
|
if (tsconfigJson.error) {
|
|
203046
203046
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -203086,7 +203086,10 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
203086
203086
|
const check = newProject.getTypeChecker();
|
|
203087
203087
|
await log.debug("\u6210\u529F\u751F\u6210\u865A\u62DF\u9879\u76EE\u7C7B\u578B\u68C0\u67E5\u5668...").run();
|
|
203088
203088
|
const result = [];
|
|
203089
|
-
|
|
203089
|
+
for (var index = 0; index < apiSourceFiles.length; index++) {
|
|
203090
|
+
var apiSourceFile = apiSourceFiles[index];
|
|
203091
|
+
if (apiSourceFile == null)
|
|
203092
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
203090
203093
|
await log.info(`\u5904\u7406\uFF08${index + 1} / ${apiSourceFiles.length}\uFF09\uFF1A${apiSourceFile.fileName}`).run();
|
|
203091
203094
|
const apiCalcSourceFile = apiTypeCalcFiles[index]?.sourceFile;
|
|
203092
203095
|
if (apiCalcSourceFile === void 0) {
|
|
@@ -203103,7 +203106,7 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
203103
203106
|
result.push(typeString);
|
|
203104
203107
|
}
|
|
203105
203108
|
}
|
|
203106
|
-
}
|
|
203109
|
+
}
|
|
203107
203110
|
await log.debug("\u6210\u529F\u5904\u7406\u6240\u6709\u63A5\u53E3...").run();
|
|
203108
203111
|
const outputPathAbs = import_node_path.default.resolve(outputPath);
|
|
203109
203112
|
import_node_fs.default.writeFileSync(outputPathAbs, `export type InterfaceType = [${result.join(",")}]`);
|
|
@@ -203045,7 +203045,7 @@ export default Api
|
|
|
203045
203045
|
// src/bin/get-type/index.ts
|
|
203046
203046
|
function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
203047
203047
|
return new import_ts_fp_data2.Task(async () => {
|
|
203048
|
-
var log = new Log("@lsby
|
|
203048
|
+
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
203049
203049
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, import_node_fs.default.readFileSync(tsconfigPath, "utf8"));
|
|
203050
203050
|
if (tsconfigJson.error) {
|
|
203051
203051
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -203091,7 +203091,10 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
203091
203091
|
const check = newProject.getTypeChecker();
|
|
203092
203092
|
await log.debug("\u6210\u529F\u751F\u6210\u865A\u62DF\u9879\u76EE\u7C7B\u578B\u68C0\u67E5\u5668...").run();
|
|
203093
203093
|
const result = [];
|
|
203094
|
-
|
|
203094
|
+
for (var index = 0; index < apiSourceFiles.length; index++) {
|
|
203095
|
+
var apiSourceFile = apiSourceFiles[index];
|
|
203096
|
+
if (apiSourceFile == null)
|
|
203097
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
203095
203098
|
await log.info(`\u5904\u7406\uFF08${index + 1} / ${apiSourceFiles.length}\uFF09\uFF1A${apiSourceFile.fileName}`).run();
|
|
203096
203099
|
const apiCalcSourceFile = apiTypeCalcFiles[index]?.sourceFile;
|
|
203097
203100
|
if (apiCalcSourceFile === void 0) {
|
|
@@ -203108,7 +203111,7 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
203108
203111
|
result.push(typeString);
|
|
203109
203112
|
}
|
|
203110
203113
|
}
|
|
203111
|
-
}
|
|
203114
|
+
}
|
|
203112
203115
|
await log.debug("\u6210\u529F\u5904\u7406\u6240\u6709\u63A5\u53E3...").run();
|
|
203113
203116
|
const outputPathAbs = import_node_path.default.resolve(outputPath);
|
|
203114
203117
|
import_node_fs.default.writeFileSync(outputPathAbs, `export type InterfaceType = [${result.join(",")}]`);
|
|
@@ -15,7 +15,7 @@ import path from "node:path";
|
|
|
15
15
|
import { Task } from "@lsby/ts-fp-data";
|
|
16
16
|
function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
17
17
|
return new Task(async () => {
|
|
18
|
-
var log = new Log("@lsby
|
|
18
|
+
var log = new Log("@lsby:net-core").extend("gen-test");
|
|
19
19
|
const projectRootPath = path.dirname(tsconfigPath);
|
|
20
20
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, fs.readFileSync(tsconfigPath, "utf8"));
|
|
21
21
|
if (tsconfigJson.error) {
|
|
@@ -49,7 +49,10 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
49
49
|
).run();
|
|
50
50
|
const importCode = [];
|
|
51
51
|
const testCode = [];
|
|
52
|
-
|
|
52
|
+
for (var index = 0; index < testSourceFilesFilter.length; index++) {
|
|
53
|
+
var testSourceFile = testSourceFilesFilter[index];
|
|
54
|
+
if (testSourceFile == null)
|
|
55
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
53
56
|
const filenameRelativeToApiFolder = path.relative(interfaceFolderPath, testSourceFile.fileName).replaceAll("\\", "/");
|
|
54
57
|
const importName = filenameRelativeToApiFolder.replaceAll("/", "_").replaceAll(".test.ts", "").replaceAll("./", "").replaceAll("-", "_");
|
|
55
58
|
const filenameRelativeToProjectRoot = path.relative(projectRootPath, testSourceFile.fileName).replaceAll("\\", "/").replaceAll(".ts", "");
|
|
@@ -59,15 +62,15 @@ function main(tsconfigPath, interfaceFolderPath, outFilePath, filter) {
|
|
|
59
62
|
for (const node of testSourceFile.statements) {
|
|
60
63
|
if (import_typescript.default.isExportAssignment(node) && node.isExportEquals === void 0) {
|
|
61
64
|
const expression = node.expression;
|
|
62
|
-
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\
|
|
65
|
+
if (import_typescript.default.isNewExpression(expression) && expression.expression.getText() === "\u6D4B\u8BD5") {
|
|
63
66
|
break;
|
|
64
67
|
}
|
|
65
|
-
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \
|
|
68
|
+
throw new Error(`${testSourceFile.fileName}\uFF1A\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F \u6D4B\u8BD5`);
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
importCode.push(`import ${importName} from '${importPath}'`);
|
|
69
72
|
testCode.push(generateTestCode(importName, importName));
|
|
70
|
-
}
|
|
73
|
+
}
|
|
71
74
|
const finalTestFile = [
|
|
72
75
|
"import './unit-test-prefix'",
|
|
73
76
|
"",
|
|
@@ -19,7 +19,7 @@ import path from "node:path";
|
|
|
19
19
|
import { Task } from "@lsby/ts-fp-data";
|
|
20
20
|
function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
21
21
|
return new Task(async () => {
|
|
22
|
-
var log = new Log("@lsby
|
|
22
|
+
var log = new Log("@lsby:net-core").extend("gen-type");
|
|
23
23
|
const tsconfigJson = import_typescript.default.parseConfigFileTextToJson(tsconfigPath, fs.readFileSync(tsconfigPath, "utf8"));
|
|
24
24
|
if (tsconfigJson.error) {
|
|
25
25
|
throw new Error("\u65E0\u6CD5\u89E3\u6790 tsconfig.json");
|
|
@@ -65,7 +65,10 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
65
65
|
const check = newProject.getTypeChecker();
|
|
66
66
|
await log.debug("\u6210\u529F\u751F\u6210\u865A\u62DF\u9879\u76EE\u7C7B\u578B\u68C0\u67E5\u5668...").run();
|
|
67
67
|
const result = [];
|
|
68
|
-
|
|
68
|
+
for (var index = 0; index < apiSourceFiles.length; index++) {
|
|
69
|
+
var apiSourceFile = apiSourceFiles[index];
|
|
70
|
+
if (apiSourceFile == null)
|
|
71
|
+
throw new Error("\u975E\u9884\u671F\u7684\u6570\u7EC4\u8D8A\u754C");
|
|
69
72
|
await log.info(`\u5904\u7406\uFF08${index + 1} / ${apiSourceFiles.length}\uFF09\uFF1A${apiSourceFile.fileName}`).run();
|
|
70
73
|
const apiCalcSourceFile = apiTypeCalcFiles[index]?.sourceFile;
|
|
71
74
|
if (apiCalcSourceFile === void 0) {
|
|
@@ -82,7 +85,7 @@ function main(tsconfigPath, apiFolderPath, outputPath) {
|
|
|
82
85
|
result.push(typeString);
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
|
-
}
|
|
88
|
+
}
|
|
86
89
|
await log.debug("\u6210\u529F\u5904\u7406\u6240\u6709\u63A5\u53E3...").run();
|
|
87
90
|
const outputPathAbs = path.resolve(outputPath);
|
|
88
91
|
fs.writeFileSync(outputPathAbs, `export type InterfaceType = [${result.join(",")}]`);
|