@zwa73/dev-utils 1.0.51 → 1.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ /**生成i18n */
3
+ export declare const CmdGenI18n: (program: Command) => Command;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CmdGenI18n = void 0;
7
+ const utils_1 = require("@zwa73/utils");
8
+ const ts_morph_1 = require("ts-morph");
9
+ const UtilAst_1 = require("../UtilAst");
10
+ const fs_1 = __importDefault(require("fs"));
11
+ const pathe_1 = __importDefault(require("pathe"));
12
+ async function procFile(p, filePath) {
13
+ const date = new Date().toISOString();
14
+ const content = await fs_1.default.promises.readFile(filePath, 'utf-8');
15
+ const b = p.createSourceFile(pathe_1.default.relative(process.cwd(), filePath), content);
16
+ const ds = b.getDescendantsOfKind(ts_morph_1.SyntaxKind.TaggedTemplateExpression);
17
+ const dats = [];
18
+ for (const d of ds) {
19
+ const template = d.getTemplate();
20
+ let result = '';
21
+ let i = 0;
22
+ UtilAst_1.UtilAst.withKind(template, {
23
+ [ts_morph_1.SyntaxKind.NoSubstitutionTemplateLiteral]: (t) => result += t.getLiteralText(),
24
+ [ts_morph_1.SyntaxKind.TemplateExpression]: (t) => {
25
+ t.getChildren().forEach((c) => {
26
+ UtilAst_1.UtilAst.withKind(c, {
27
+ [ts_morph_1.SyntaxKind.TemplateHead]: (sc) => result += sc.getLiteralText(),
28
+ [ts_morph_1.SyntaxKind.SyntaxList]: (sc) => {
29
+ sc.getChildrenOfKind(ts_morph_1.SyntaxKind.TemplateSpan).forEach((span) => {
30
+ span.getChildren().forEach((ssc) => {
31
+ result += UtilAst_1.UtilAst.withKind(ssc, {
32
+ [ts_morph_1.SyntaxKind.TemplateMiddle]: (sssc) => sssc.getLiteralText(),
33
+ [ts_morph_1.SyntaxKind.TemplateTail]: (sssc) => sssc.getLiteralText(),
34
+ }) ?? String(`%${i++}`);
35
+ });
36
+ });
37
+ },
38
+ });
39
+ });
40
+ }
41
+ });
42
+ const pos = b.getLineAndColumnAtPos(d.getStart());
43
+ const dat = {
44
+ original: result,
45
+ scan_time: date,
46
+ position: `${filePath}:${pos.line}:${pos.column}`,
47
+ lang_table: {},
48
+ source: "Ast"
49
+ };
50
+ dats.push(dat);
51
+ }
52
+ return dats;
53
+ }
54
+ async function scanI18n(i18nDataDir, include, exclude) {
55
+ const filePaths = (await utils_1.UtilFT.fileSearchGlob(process.cwd(), include, { ingore: exclude }))
56
+ .filter(p => ['.ts', '.tsx'].includes(pathe_1.default.parse(p).ext));
57
+ const project = new ts_morph_1.Project();
58
+ await utils_1.SI18n.init(i18nDataDir, '*');
59
+ (await Promise.all(filePaths.map(p => procFile(project, p))))
60
+ .flat().forEach(dat => utils_1.SI18n.addOriginalText(dat));
61
+ await utils_1.SI18n.saveTable();
62
+ }
63
+ /**生成i18n */
64
+ const CmdGenI18n = (program) => program
65
+ .command("Gen-I18n")
66
+ .alias("geni18n")
67
+ .description("根据文件行为树生成i18n数据")
68
+ .option("-o, --output <path>", "输出的数据目录位置")
69
+ .option("-i, --include <glob>", "包含的glob 默认 src/**/*.macro.ts", "src/**/*.macro.ts")
70
+ .option("-g, --exclude <glob>", "忽略的glob")
71
+ .action(async (opt) => {
72
+ await scanI18n(opt.output, opt.include, opt.exclude);
73
+ });
74
+ exports.CmdGenI18n = CmdGenI18n;
@@ -10,11 +10,11 @@ const CmdGenSchema = (program) => program
10
10
  .option("-i, --include <glob>", "包含的glob 默认 src/**/*.schema.ts", "src/**/*.schema.ts")
11
11
  .option("-g, --exclude <glob>", "忽略的glob")
12
12
  .option("-p, --project <path>", "tsconfig路径 默认tsconfig.json", "tsconfig.json")
13
- .option("-o, --outDir <dir>", "schema输出路径目录 默认 ./schema/")
13
+ .option("-o, --out-dir <dir>", "schema输出路径目录 默认 ./schema/")
14
14
  .action(async (opt) => {
15
15
  await UtilDevTool_1.UtilDT.generateSchema(process.cwd(), {
16
16
  include: opt.include,
17
- exclude: opt.ignore,
17
+ exclude: opt.exclude,
18
18
  project: opt.project,
19
19
  outDir: opt.outDir,
20
20
  });
@@ -29,7 +29,7 @@ const CmdMapPath = (program) => program
29
29
  const duplicateHandling = options.duplicateHandling;
30
30
  const basePath = process.cwd();
31
31
  // 遍历当前目录下的所有文件
32
- const filePaths = utils_1.UtilFT.fileSearchRegex(basePath, regex.source, { relative: options.recursive })
32
+ const filePaths = (await utils_1.UtilFT.fileSearchRegex(basePath, regex.source, { relative: options.recursive }))
33
33
  .map((filePath) => pathe_1.default.relative(basePath, filePath))
34
34
  .filter((filePath) => excludeRegex ? (!excludeRegex.test(filePath)) : true);
35
35
  //对单个路径映射
@@ -9,6 +9,7 @@ const MapPath_1 = require("./MapPath");
9
9
  const ScanDups_1 = require("./ScanDups");
10
10
  const GenSchema_1 = require("./GenSchema");
11
11
  const ExpandMacro_1 = require("./ExpandMacro");
12
+ const GenI18n_1 = require("./GenI18n");
12
13
  async function cliRoute() {
13
14
  (0, Init_1.CmdInit)(commander_1.program);
14
15
  (0, Node_1.CmdNode)(commander_1.program);
@@ -17,6 +18,7 @@ async function cliRoute() {
17
18
  (0, ScanDups_1.CmdScanDups)(commander_1.program);
18
19
  (0, GenSchema_1.CmdGenSchema)(commander_1.program);
19
20
  (0, ExpandMacro_1.CmdExpandMacro)(commander_1.program);
21
+ (0, GenI18n_1.CmdGenI18n)(commander_1.program);
20
22
  commander_1.program.parse(process.argv);
21
23
  }
22
24
  exports.cliRoute = cliRoute;
@@ -28,9 +28,9 @@ const CmdScanDups = (program) => program
28
28
  .action(async (options) => {
29
29
  const regex = new RegExp(options.regex);
30
30
  const basePath = process.cwd();
31
- const pList = utils_1.UtilFT.fileSearchRegex(basePath, regex.source, {
31
+ const pList = (await utils_1.UtilFT.fileSearchRegex(basePath, regex.source, {
32
32
  relative: options.recursive,
33
- }).map(async (filePath) => ({ filePath, hash: await calculateHash(filePath) }));
33
+ })).map(async (filePath) => ({ filePath, hash: await calculateHash(filePath) }));
34
34
  const hashMap = (await Promise.all(pList)).reduce((obj, cur) => {
35
35
  obj[cur.hash] = (obj[cur.hash] ?? []).concat(cur.filePath);
36
36
  return obj;
@@ -0,0 +1,13 @@
1
+ import { AnyFunc } from "@zwa73/utils";
2
+ import { SyntaxKind, KindToNodeMappings, Node } from "ts-morph";
3
+ export declare namespace UtilAst {
4
+ /**匹配Node的类型进行处理 无法匹配时返回undefined
5
+ * @param node - ast节点
6
+ * @param funcMap - 处理函数映射表
7
+ */
8
+ function withKind<T extends Partial<{
9
+ [P in SyntaxKind]: ((n: KindToNodeMappings[P]) => unknown);
10
+ }>>(node: Node, funcMap: T): {
11
+ [P in keyof T]: T[P] extends AnyFunc ? ReturnType<T[P]> : never;
12
+ }[keyof T] | undefined;
13
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UtilAst = void 0;
4
+ var UtilAst;
5
+ (function (UtilAst) {
6
+ /**匹配Node的类型进行处理 无法匹配时返回undefined
7
+ * @param node - ast节点
8
+ * @param funcMap - 处理函数映射表
9
+ */
10
+ function withKind(node, funcMap) {
11
+ const kind = node.getKind();
12
+ const func = funcMap[kind];
13
+ if (func)
14
+ return func(node);
15
+ return undefined;
16
+ }
17
+ UtilAst.withKind = withKind;
18
+ })(UtilAst || (exports.UtilAst = UtilAst = {}));
@@ -55,7 +55,7 @@ var UtilDT;
55
55
  };
56
56
  if (opt?.project)
57
57
  Object.assign(compilerOptions, (await utils_1.UtilFT.loadJSONFile(opt.project)).compilerOptions);
58
- const files = utils_1.UtilFT.fileSearchGlob(dir, opt?.include ?? "**/*.schema.ts", { ingore: opt?.exclude });
58
+ const files = await utils_1.UtilFT.fileSearchGlob(dir, opt?.include ?? "**/*.schema.ts", { ingore: opt?.exclude });
59
59
  const program = TJS.getProgramFromFiles(files, compilerOptions);
60
60
  const schema = TJS.generateSchema(program, "*", settings);
61
61
  const outDir = opt?.outDir ?? pathe_1.default.join(process.cwd(), 'schema');
@@ -112,7 +112,7 @@ var UtilDT;
112
112
  * @param opt.project - tsconfig路径
113
113
  */
114
114
  async function matchNode(dir, opt) {
115
- const files = utils_1.UtilFT.fileSearchGlob(dir, opt?.include ?? "index.ts", { ingore: opt?.exclude });
115
+ const files = await utils_1.UtilFT.fileSearchGlob(dir, opt?.include ?? "index.ts", { ingore: opt?.exclude });
116
116
  await batchNode(files, opt);
117
117
  }
118
118
  UtilDT.matchNode = matchNode;
@@ -165,7 +165,7 @@ var UtilDT;
165
165
  */
166
166
  async function regionMacro(regionId, codeText, opt) {
167
167
  const plist = [];
168
- const filePaths = parseMacroPaths(opt);
168
+ const filePaths = await parseMacroPaths(opt);
169
169
  for (const filePath of filePaths) {
170
170
  const queuefunc = async () => {
171
171
  if (!(await utils_1.UtilFT.pathExists(filePath))) {
@@ -222,7 +222,7 @@ var UtilDT;
222
222
  */
223
223
  async function commentMacro(commentId, codeText, opt) {
224
224
  const plist = [];
225
- const filePaths = parseMacroPaths(opt);
225
+ const filePaths = await parseMacroPaths(opt);
226
226
  for (const filePath of filePaths) {
227
227
  const queuefunc = async () => {
228
228
  if (!(await utils_1.UtilFT.pathExists(filePath))) {
@@ -279,7 +279,7 @@ var UtilDT;
279
279
  */
280
280
  async function fileMacro(codeText, opt) {
281
281
  const plist = [];
282
- const filePaths = parseMacroPaths(opt);
282
+ const filePaths = await parseMacroPaths(opt);
283
283
  for (const filePath of filePaths) {
284
284
  const queuefunc = async () => {
285
285
  await utils_1.UtilFT.ensurePathExists(filePath);
package/dist/UtilMacro.js CHANGED
@@ -14,9 +14,9 @@ var UtilMacro;
14
14
  * @example
15
15
  */
16
16
  function exportComment(glob) {
17
- (0, QuickFunc_1.commentMacro)(/export (\S*)/, ({ filePath, matchId, execArr }) => {
17
+ (0, QuickFunc_1.commentMacro)(/export (\S*)/, async ({ filePath, matchId, execArr }) => {
18
18
  const basedir = pathe_1.default.dirname(filePath);
19
- const result = utils_1.UtilFT.fileSearchGlob(basedir, execArr[1])
19
+ const result = (await utils_1.UtilFT.fileSearchGlob(basedir, execArr[1]))
20
20
  .map((file) => pathe_1.default.relative(basedir, file))
21
21
  .map((file) => pathe_1.default.parse(file).name)
22
22
  .filter((file) => file != pathe_1.default.parse(filePath).name)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/dev-utils",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "description": "编译与调试工具",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,9 +16,10 @@
16
16
  "author": "zwa73",
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
- "@zwa73/utils": "^1.0.127",
19
+ "@zwa73/utils": "^1.0.143",
20
20
  "commander": "^11.1.0",
21
21
  "pathe": "^1.1.2",
22
+ "ts-morph": "^23.0.0",
22
23
  "ts-node": "^10.9.2",
23
24
  "tsconfig-paths": "^4.2.0",
24
25
  "typescript-json-schema": "^0.63.0"
@@ -0,0 +1,75 @@
1
+ import { Command } from "commander";
2
+ import { I18nTextData, SI18n, UtilFT } from "@zwa73/utils";
3
+ import { Project,SourceFile,SyntaxKind } from 'ts-morph';
4
+ import { UtilAst } from "@src/UtilAst";
5
+ import fs from 'fs';
6
+ import path from 'pathe';
7
+
8
+ async function procFile(p:Project,filePath:string){
9
+ const date = new Date().toISOString();
10
+ const content = await fs.promises.readFile(filePath,'utf-8');
11
+ const b = p.createSourceFile(path.relative(process.cwd(),filePath),content);
12
+ const ds = b.getDescendantsOfKind(SyntaxKind.TaggedTemplateExpression);
13
+ const dats:I18nTextData[] = [];
14
+ for(const d of ds){
15
+ const template = d.getTemplate();
16
+ let result = '';
17
+ let i=0;
18
+ UtilAst.withKind(template,{
19
+ [SyntaxKind.NoSubstitutionTemplateLiteral]:(t)=>result+=t.getLiteralText(),
20
+ [SyntaxKind.TemplateExpression]:(t)=>{
21
+ t.getChildren().forEach((c)=>{
22
+ UtilAst.withKind(c,{
23
+ [SyntaxKind.TemplateHead]:(sc)=>result += sc.getLiteralText(),
24
+ [SyntaxKind.SyntaxList]:(sc)=>{
25
+ sc.getChildrenOfKind(SyntaxKind.TemplateSpan).forEach((span)=>{
26
+ span.getChildren().forEach((ssc)=>{
27
+ result += UtilAst.withKind(ssc,{
28
+ [SyntaxKind.TemplateMiddle]:(sssc)=>sssc.getLiteralText(),
29
+ [SyntaxKind.TemplateTail] :(sssc)=>sssc.getLiteralText(),
30
+ })??String(`%${i++}`);
31
+ })
32
+ })
33
+ },
34
+ });
35
+ });
36
+ }
37
+ });
38
+ const pos = b.getLineAndColumnAtPos(d.getStart());
39
+ const dat:I18nTextData={
40
+ original:result,
41
+ scan_time:date,
42
+ position: `${filePath}:${pos.line}:${pos.column}`,
43
+ lang_table:{},
44
+ source:"Ast"
45
+ }
46
+ dats.push(dat);
47
+ }
48
+ return dats;
49
+ }
50
+
51
+ async function scanI18n(i18nDataDir:string,include:string,exclude:string){
52
+ const filePaths = (await UtilFT.fileSearchGlob(process.cwd(),include,{ingore:exclude}))
53
+ .filter(p=>['.ts','.tsx'].includes(path.parse(p).ext));
54
+ const project = new Project();
55
+ await SI18n.init(i18nDataDir,'*');
56
+ (await Promise.all(filePaths.map(p=>procFile(project,p))))
57
+ .flat().forEach(dat=>SI18n.addOriginalText(dat));
58
+ await SI18n.saveTable();
59
+ }
60
+
61
+ /**生成i18n */
62
+ export const CmdGenI18n = (program:Command) => program
63
+ .command("Gen-I18n")
64
+ .alias("geni18n")
65
+ .description("根据文件行为树生成i18n数据")
66
+ .option("-o, --output <path>" , "输出的数据目录位置")
67
+ .option("-i, --include <glob>", "包含的glob 默认 src/**/*.macro.ts","src/**/*.macro.ts")
68
+ .option("-g, --exclude <glob>", "忽略的glob")
69
+ .action(async (opt) => {
70
+ await scanI18n(
71
+ opt.output,
72
+ opt.include,
73
+ opt.exclude,
74
+ );
75
+ });
@@ -9,11 +9,11 @@ export const CmdGenSchema = (program:Command) => program
9
9
  .option("-i, --include <glob>", "包含的glob 默认 src/**/*.schema.ts","src/**/*.schema.ts")
10
10
  .option("-g, --exclude <glob>", "忽略的glob")
11
11
  .option("-p, --project <path>", "tsconfig路径 默认tsconfig.json","tsconfig.json")
12
- .option("-o, --outDir <dir>", "schema输出路径目录 默认 ./schema/")
12
+ .option("-o, --out-dir <dir>" , "schema输出路径目录 默认 ./schema/")
13
13
  .action(async (opt) => {
14
14
  await UtilDT.generateSchema(process.cwd(), {
15
15
  include: opt.include,
16
- exclude: opt.ignore,
16
+ exclude: opt.exclude,
17
17
  project: opt.project,
18
18
  outDir: opt.outDir,
19
19
  });
@@ -27,7 +27,7 @@ export const CmdMapPath = (program: Command) => program
27
27
  const duplicateHandling = options.duplicateHandling as DupMethod;
28
28
  const basePath = process.cwd();
29
29
  // 遍历当前目录下的所有文件
30
- const filePaths = UtilFT.fileSearchRegex(basePath, regex.source,{relative:options.recursive})
30
+ const filePaths = (await UtilFT.fileSearchRegex(basePath, regex.source,{relative:options.recursive}))
31
31
  .map((filePath)=>path.relative(basePath, filePath))
32
32
  .filter((filePath)=>excludeRegex ? (!excludeRegex.test(filePath)) : true);
33
33
 
@@ -7,6 +7,7 @@ import { CmdMapPath } from './MapPath';
7
7
  import { CmdScanDups } from './ScanDups';
8
8
  import { CmdGenSchema } from './GenSchema';
9
9
  import { CmdExpandMacro } from './ExpandMacro';
10
+ import { CmdGenI18n } from './GenI18n';
10
11
 
11
12
  export async function cliRoute(){
12
13
  CmdInit(program);
@@ -16,5 +17,6 @@ export async function cliRoute(){
16
17
  CmdScanDups(program);
17
18
  CmdGenSchema(program);
18
19
  CmdExpandMacro(program);
20
+ CmdGenI18n(program);
19
21
  program.parse(process.argv);
20
22
  }
@@ -26,9 +26,9 @@ export const CmdScanDups = (program: Command) => program
26
26
  .action(async (options) => {
27
27
  const regex = new RegExp(options.regex);
28
28
  const basePath = process.cwd();
29
- const pList = UtilFT.fileSearchRegex(basePath, regex.source, {
29
+ const pList = (await UtilFT.fileSearchRegex(basePath, regex.source, {
30
30
  relative: options.recursive,
31
- }).map(async (filePath) => ({ filePath, hash: await calculateHash(filePath) }));
31
+ })).map(async (filePath) => ({ filePath, hash: await calculateHash(filePath) }));
32
32
 
33
33
  const hashMap = (await Promise.all(pList)).reduce((obj,cur)=>{
34
34
  obj[cur.hash] = (obj[cur.hash]??[]).concat(cur.filePath);
package/src/UtilAst.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { AnyFunc,I18nTextData } from "@zwa73/utils";
2
+ import { SyntaxKind , KindToNodeMappings, Node} from "ts-morph";
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+ export namespace UtilAst{
11
+ /**匹配Node的类型进行处理 无法匹配时返回undefined
12
+ * @param node - ast节点
13
+ * @param funcMap - 处理函数映射表
14
+ */
15
+ export function withKind<T extends Partial<{
16
+ [P in SyntaxKind]:((n:KindToNodeMappings[P])=>unknown)
17
+ }>>(node:Node,funcMap:T):{
18
+ [P in keyof T]:T[P] extends AnyFunc ? ReturnType<T[P]> : never
19
+ }[keyof T]|undefined{
20
+ const kind = node.getKind();
21
+ const func = funcMap[kind] as any;
22
+ if(func) return func(node);
23
+ return undefined;
24
+ }
25
+ }
@@ -50,7 +50,7 @@ export async function generateSchema(dir:string,opt?:BuildSchemaOpt){
50
50
  strictNullChecks: true,
51
51
  };
52
52
  if(opt?.project) Object.assign(compilerOptions,(await UtilFT.loadJSONFile(opt.project) as any).compilerOptions);
53
- const files = UtilFT.fileSearchGlob(dir,opt?.include ?? "**/*.schema.ts",{ingore:opt?.exclude});
53
+ const files = await UtilFT.fileSearchGlob(dir,opt?.include ?? "**/*.schema.ts",{ingore:opt?.exclude});
54
54
 
55
55
  const program = TJS.getProgramFromFiles(
56
56
  files,
@@ -110,7 +110,7 @@ function coverObj(base:JObject,cover:JObject){
110
110
  * @param opt.project - tsconfig路径
111
111
  */
112
112
  export async function matchNode(dir:string,opt?:BuildMatchOpt) {
113
- const files = UtilFT.fileSearchGlob(dir,opt?.include ?? "index.ts",{ingore:opt?.exclude});
113
+ const files = await UtilFT.fileSearchGlob(dir,opt?.include ?? "index.ts",{ingore:opt?.exclude});
114
114
  await batchNode(files,opt);
115
115
  }
116
116
  /**运行所有js/ts文件
@@ -182,7 +182,7 @@ const literalRegex = (str:string)=>new RegExp(
182
182
  */
183
183
  export async function regionMacro(regionId:string|RegExp,codeText:string|((opt:CodeTextOpt)=>string|Promise<string>),opt?:MacroOpt){
184
184
  const plist:Promise<void>[] = [];
185
- const filePaths = parseMacroPaths(opt);
185
+ const filePaths = await parseMacroPaths(opt);
186
186
  for(const filePath of filePaths){
187
187
  const queuefunc = async ()=>{
188
188
  if(!(await UtilFT.pathExists(filePath))) {
@@ -239,7 +239,7 @@ export async function regionMacro(regionId:string|RegExp,codeText:string|((opt:C
239
239
  */
240
240
  export async function commentMacro(commentId:string|RegExp,codeText:string|((opt:CodeTextOpt)=>string|Promise<string>),opt?:MacroOpt){
241
241
  const plist:Promise<void>[] = [];
242
- const filePaths = parseMacroPaths(opt);
242
+ const filePaths = await parseMacroPaths(opt);
243
243
  for(const filePath of filePaths){
244
244
  const queuefunc = async ()=>{
245
245
  if(!(await UtilFT.pathExists(filePath))) {
@@ -296,7 +296,7 @@ export async function commentMacro(commentId:string|RegExp,codeText:string|((opt
296
296
  */
297
297
  export async function fileMacro(codeText:string|((opt:Omit<CodeTextOpt,'ident'|'matchId'|'execArr'>)=>string|Promise<string>),opt?:MacroOpt){
298
298
  const plist:Promise<void>[] = [];
299
- const filePaths = parseMacroPaths(opt);
299
+ const filePaths = await parseMacroPaths(opt);
300
300
  for(const filePath of filePaths){
301
301
  const queuefunc = async ()=>{
302
302
  await UtilFT.ensurePathExists(filePath);
package/src/UtilMacro.ts CHANGED
@@ -9,9 +9,9 @@ export namespace UtilMacro{
9
9
  * @example
10
10
  */
11
11
  export function exportComment(glob:string){
12
- commentMacro(/export (\S*)/,({filePath,matchId,execArr})=>{
12
+ commentMacro(/export (\S*)/,async ({filePath,matchId,execArr})=>{
13
13
  const basedir = path.dirname(filePath);
14
- const result = UtilFT.fileSearchGlob(basedir,execArr[1])
14
+ const result = (await UtilFT.fileSearchGlob(basedir,execArr[1]))
15
15
  .map((file)=>path.relative(basedir,file))
16
16
  .map((file)=>path.parse(file).name)
17
17
  .filter((file)=>file!=path.parse(filePath).name)