@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.
@@ -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/net-core").extend("gen-test");
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
- testSourceFilesFilter.forEach(async (testSourceFile, index) => {
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() === "\u63A5\u53E3\u7C7B\u578B") {
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 \u63A5\u53E3\u7C7B\u578B`);
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/net-core").extend("gen-test");
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
- testSourceFilesFilter.forEach(async (testSourceFile, index) => {
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() === "\u63A5\u53E3\u7C7B\u578B") {
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 \u63A5\u53E3\u7C7B\u578B`);
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/net-core").extend("gen-type");
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
- apiSourceFiles.forEach(async (apiSourceFile, index) => {
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/net-core").extend("gen-type");
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
- apiSourceFiles.forEach(async (apiSourceFile, index) => {
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/net-core").extend("gen-test");
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
- testSourceFilesFilter.forEach(async (testSourceFile, index) => {
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() === "\u63A5\u53E3\u7C7B\u578B") {
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 \u63A5\u53E3\u7C7B\u578B`);
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/net-core").extend("gen-test");
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
- testSourceFilesFilter.forEach(async (testSourceFile, index) => {
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() === "\u63A5\u53E3\u7C7B\u578B") {
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 \u63A5\u53E3\u7C7B\u578B`);
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/net-core").extend("gen-type");
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
- apiSourceFiles.forEach(async (apiSourceFile, index) => {
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/net-core").extend("gen-type");
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
- apiSourceFiles.forEach(async (apiSourceFile, index) => {
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(",")}]`);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "../../chunk-FKPKFLIZ.js";
4
+ } from "../../chunk-553ZM42W.js";
5
5
  import "../../chunk-PLIWJ5OD.js";
6
6
  import "../../chunk-PLYBVQKK.js";
7
7
  import "../../chunk-VBXJIVYU.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  main
3
- } from "../../chunk-FKPKFLIZ.js";
3
+ } from "../../chunk-553ZM42W.js";
4
4
  import "../../chunk-PLIWJ5OD.js";
5
5
  import "../../chunk-PLYBVQKK.js";
6
6
  import "../../chunk-VBXJIVYU.js";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "../../chunk-P6XNNFAN.js";
4
+ } from "../../chunk-EDGJJIIQ.js";
5
5
  import "../../chunk-DVQ4V2GS.js";
6
6
  import "../../chunk-PLIWJ5OD.js";
7
7
  import "../../chunk-PLYBVQKK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  main
3
- } from "../../chunk-P6XNNFAN.js";
3
+ } from "../../chunk-EDGJJIIQ.js";
4
4
  import "../../chunk-DVQ4V2GS.js";
5
5
  import "../../chunk-PLIWJ5OD.js";
6
6
  import "../../chunk-PLYBVQKK.js";
@@ -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/net-core").extend("gen-test");
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
- testSourceFilesFilter.forEach(async (testSourceFile, index) => {
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() === "\u63A5\u53E3\u7C7B\u578B") {
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 \u63A5\u53E3\u7C7B\u578B`);
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/net-core").extend("gen-type");
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
- apiSourceFiles.forEach(async (apiSourceFile, index) => {
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(",")}]`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsby/net-core",
3
- "version": "0.0.5-beta.3",
3
+ "version": "0.0.5-beta.5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "require": "./dist/cjs/index.cjs",