@akanjs/devkit 0.0.97 → 0.0.99

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.
Files changed (65) hide show
  1. package/index.cjs +21 -0
  2. package/index.js +1 -21
  3. package/package.json +4 -4
  4. package/src/{aiEditor.mjs → aiEditor.cjs} +56 -22
  5. package/src/aiEditor.js +22 -56
  6. package/src/auth.cjs +72 -0
  7. package/src/auth.js +18 -48
  8. package/src/{builder.mjs → builder.cjs} +44 -11
  9. package/src/builder.js +11 -44
  10. package/src/{capacitorApp.mjs → capacitorApp.cjs} +42 -9
  11. package/src/capacitorApp.js +9 -42
  12. package/src/commandDecorators/{argMeta.mjs → argMeta.cjs} +34 -3
  13. package/src/commandDecorators/argMeta.js +3 -34
  14. package/src/commandDecorators/{command.mjs → command.cjs} +70 -37
  15. package/src/commandDecorators/command.js +37 -70
  16. package/src/commandDecorators/commandMeta.cjs +30 -0
  17. package/src/commandDecorators/commandMeta.js +2 -25
  18. package/src/commandDecorators/index.cjs +29 -0
  19. package/src/commandDecorators/index.js +5 -29
  20. package/src/commandDecorators/targetMeta.cjs +57 -0
  21. package/src/commandDecorators/targetMeta.js +2 -26
  22. package/src/commandDecorators/types.cjs +15 -0
  23. package/src/commandDecorators/types.js +0 -15
  24. package/src/constants.cjs +47 -0
  25. package/src/constants.js +4 -33
  26. package/src/createTunnel.cjs +49 -0
  27. package/src/createTunnel.js +4 -27
  28. package/src/{dependencyScanner.mjs → dependencyScanner.cjs} +38 -5
  29. package/src/dependencyScanner.js +5 -38
  30. package/src/{executors.mjs → executors.cjs} +123 -89
  31. package/src/executors.d.ts +1 -1
  32. package/src/executors.js +89 -123
  33. package/src/{extractDeps.mjs → extractDeps.cjs} +25 -2
  34. package/src/extractDeps.js +2 -25
  35. package/src/getCredentials.cjs +44 -0
  36. package/src/getCredentials.js +6 -39
  37. package/src/getModelFileData.cjs +66 -0
  38. package/src/getModelFileData.js +6 -39
  39. package/src/{getRelatedCnsts.mjs → getRelatedCnsts.cjs} +48 -9
  40. package/src/getRelatedCnsts.js +9 -48
  41. package/src/index.cjs +53 -0
  42. package/src/index.js +17 -53
  43. package/src/selectModel.cjs +46 -0
  44. package/src/selectModel.js +6 -39
  45. package/src/streamAi.cjs +62 -0
  46. package/src/streamAi.js +7 -30
  47. package/src/types.cjs +15 -0
  48. package/src/types.js +0 -15
  49. package/src/uploadRelease.cjs +85 -0
  50. package/src/uploadRelease.js +15 -48
  51. package/index.mjs +0 -1
  52. package/src/auth.mjs +0 -42
  53. package/src/commandDecorators/commandMeta.mjs +0 -7
  54. package/src/commandDecorators/index.mjs +0 -5
  55. package/src/commandDecorators/targetMeta.mjs +0 -33
  56. package/src/commandDecorators/types.mjs +0 -0
  57. package/src/constants.mjs +0 -18
  58. package/src/createTunnel.mjs +0 -26
  59. package/src/getCredentials.mjs +0 -11
  60. package/src/getModelFileData.mjs +0 -33
  61. package/src/index.mjs +0 -17
  62. package/src/selectModel.mjs +0 -13
  63. package/src/streamAi.mjs +0 -39
  64. package/src/types.mjs +0 -0
  65. package/src/uploadRelease.mjs +0 -52
@@ -1,6 +1,38 @@
1
- import * as fs from "fs";
2
- import * as path from "path";
3
- import * as ts from "typescript";
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var dependencyScanner_exports = {};
29
+ __export(dependencyScanner_exports, {
30
+ TypeScriptDependencyScanner: () => TypeScriptDependencyScanner
31
+ });
32
+ module.exports = __toCommonJS(dependencyScanner_exports);
33
+ var fs = __toESM(require("fs"), 1);
34
+ var path = __toESM(require("path"), 1);
35
+ var ts = __toESM(require("typescript"), 1);
4
36
  class TypeScriptDependencyScanner {
5
37
  constructor(directory) {
6
38
  this.directory = directory;
@@ -143,6 +175,7 @@ class TypeScriptDependencyScanner {
143
175
  return graph;
144
176
  }
145
177
  }
146
- export {
178
+ // Annotate the CommonJS export names for ESM import in node:
179
+ 0 && (module.exports = {
147
180
  TypeScriptDependencyScanner
148
- };
181
+ });
@@ -1,38 +1,6 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var dependencyScanner_exports = {};
29
- __export(dependencyScanner_exports, {
30
- TypeScriptDependencyScanner: () => TypeScriptDependencyScanner
31
- });
32
- module.exports = __toCommonJS(dependencyScanner_exports);
33
- var fs = __toESM(require("fs"));
34
- var path = __toESM(require("path"));
35
- var ts = __toESM(require("typescript"));
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import * as ts from "typescript";
36
4
  class TypeScriptDependencyScanner {
37
5
  constructor(directory) {
38
6
  this.directory = directory;
@@ -175,7 +143,6 @@ class TypeScriptDependencyScanner {
175
143
  return graph;
176
144
  }
177
145
  }
178
- // Annotate the CommonJS export names for ESM import in node:
179
- 0 && (module.exports = {
146
+ export {
180
147
  TypeScriptDependencyScanner
181
- });
148
+ };
@@ -1,32 +1,65 @@
1
- import { Logger } from "@akanjs/common";
2
- import {
3
- getAppConfig,
4
- getDefaultFileScan,
5
- getLibConfig
6
- } from "@akanjs/config";
7
- import chalk from "chalk";
8
- import { exec, fork, spawn } from "child_process";
9
- import dotenv from "dotenv";
10
- import fs from "fs";
11
- import fsPromise from "fs/promises";
12
- import path from "path";
13
- import { TypeScriptDependencyScanner } from "./dependencyScanner";
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var executors_exports = {};
29
+ __export(executors_exports, {
30
+ AppExecutor: () => AppExecutor,
31
+ Executor: () => Executor,
32
+ LibExecutor: () => LibExecutor,
33
+ PkgExecutor: () => PkgExecutor,
34
+ SysExecutor: () => SysExecutor,
35
+ WorkspaceExecutor: () => WorkspaceExecutor
36
+ });
37
+ module.exports = __toCommonJS(executors_exports);
38
+ var import_common = require("@akanjs/common");
39
+ var import_config = require("@akanjs/config");
40
+ var import_chalk = __toESM(require("chalk"), 1);
41
+ var import_child_process = require("child_process");
42
+ var import_dotenv = __toESM(require("dotenv"), 1);
43
+ var import_fs = __toESM(require("fs"), 1);
44
+ var import_promises = __toESM(require("fs/promises"), 1);
45
+ var import_path = __toESM(require("path"), 1);
46
+ var import_dependencyScanner = require("./dependencyScanner");
14
47
  class Executor {
15
48
  logger;
16
49
  cwdPath;
17
50
  constructor(name, cwdPath) {
18
- this.logger = new Logger(name);
51
+ this.logger = new import_common.Logger(name);
19
52
  this.cwdPath = cwdPath;
20
- if (!fs.existsSync(cwdPath))
21
- fs.mkdirSync(cwdPath, { recursive: true });
53
+ if (!import_fs.default.existsSync(cwdPath))
54
+ import_fs.default.mkdirSync(cwdPath, { recursive: true });
22
55
  }
23
56
  exec(command, options = {}) {
24
- const proc = exec(command, { cwd: this.cwdPath, ...options });
57
+ const proc = (0, import_child_process.exec)(command, { cwd: this.cwdPath, ...options });
25
58
  proc.stdout?.on("data", (data) => {
26
- Logger.raw(data.toString());
59
+ import_common.Logger.raw(data.toString());
27
60
  });
28
61
  proc.stderr?.on("data", (data) => {
29
- Logger.raw(chalk.red(data.toString()));
62
+ import_common.Logger.raw(import_chalk.default.red(data.toString()));
30
63
  });
31
64
  return new Promise((resolve, reject) => {
32
65
  proc.on("exit", (code, signal) => {
@@ -38,12 +71,12 @@ class Executor {
38
71
  });
39
72
  }
40
73
  spawn(command, args = [], options = {}) {
41
- const proc = spawn(command, args, { cwd: this.cwdPath, stdio: "inherit", ...options });
74
+ const proc = (0, import_child_process.spawn)(command, args, { cwd: this.cwdPath, stdio: "inherit", ...options });
42
75
  proc.stdout?.on("data", (data) => {
43
- Logger.raw(chalk.dim(data.toString()));
76
+ import_common.Logger.raw(import_chalk.default.dim(data.toString()));
44
77
  });
45
78
  proc.stderr?.on("data", (data) => {
46
- Logger.raw(chalk.dim(data.toString()));
79
+ import_common.Logger.raw(import_chalk.default.dim(data.toString()));
47
80
  });
48
81
  return new Promise((resolve, reject) => {
49
82
  proc.on("exit", (code, signal) => {
@@ -55,16 +88,16 @@ class Executor {
55
88
  });
56
89
  }
57
90
  fork(modulePath, args = [], options = {}) {
58
- const proc = fork(modulePath, args, {
91
+ const proc = (0, import_child_process.fork)(modulePath, args, {
59
92
  cwd: this.cwdPath,
60
93
  stdio: ["ignore", "inherit", "inherit", "ipc"],
61
94
  ...options
62
95
  });
63
96
  proc.stdout?.on("data", (data) => {
64
- Logger.raw(data.toString());
97
+ import_common.Logger.raw(data.toString());
65
98
  });
66
99
  proc.stderr?.on("data", (data) => {
67
- Logger.raw(data.toString());
100
+ import_common.Logger.raw(data.toString());
68
101
  });
69
102
  return new Promise((resolve, reject) => {
70
103
  proc.on("exit", (code, signal) => {
@@ -76,35 +109,35 @@ class Executor {
76
109
  });
77
110
  }
78
111
  #getPath(filePath) {
79
- return path.isAbsolute(filePath) ? filePath : `${this.cwdPath}/${filePath}`;
112
+ return import_path.default.isAbsolute(filePath) ? filePath : `${this.cwdPath}/${filePath}`;
80
113
  }
81
114
  mkdir(dirPath) {
82
115
  const writePath = this.#getPath(dirPath);
83
- if (!fs.existsSync(writePath))
84
- fs.mkdirSync(writePath, { recursive: true });
116
+ if (!import_fs.default.existsSync(writePath))
117
+ import_fs.default.mkdirSync(writePath, { recursive: true });
85
118
  this.logger.verbose(`Make directory ${writePath}`);
86
119
  return this;
87
120
  }
88
121
  exists(filePath) {
89
122
  const readPath = this.#getPath(filePath);
90
- return fs.existsSync(readPath);
123
+ return import_fs.default.existsSync(readPath);
91
124
  }
92
125
  writeFile(filePath, content, { overwrite = true } = {}) {
93
126
  const writePath = this.#getPath(filePath);
94
- const dir = path.dirname(writePath);
95
- if (!fs.existsSync(dir))
96
- fs.mkdirSync(dir, { recursive: true });
127
+ const dir = import_path.default.dirname(writePath);
128
+ if (!import_fs.default.existsSync(dir))
129
+ import_fs.default.mkdirSync(dir, { recursive: true });
97
130
  const contentStr = typeof content === "string" ? content : JSON.stringify(content, null, 2);
98
- if (fs.existsSync(writePath)) {
99
- const currentContent = fs.readFileSync(writePath, "utf8");
131
+ if (import_fs.default.existsSync(writePath)) {
132
+ const currentContent = import_fs.default.readFileSync(writePath, "utf8");
100
133
  if (currentContent === contentStr || !overwrite)
101
134
  this.logger.verbose(`File ${writePath} is unchanged`);
102
135
  else {
103
- fs.writeFileSync(writePath, contentStr, "utf8");
136
+ import_fs.default.writeFileSync(writePath, contentStr, "utf8");
104
137
  this.logger.verbose(`File ${writePath} is changed`);
105
138
  }
106
139
  } else {
107
- fs.writeFileSync(writePath, contentStr, "utf8");
140
+ import_fs.default.writeFileSync(writePath, contentStr, "utf8");
108
141
  this.logger.verbose(`File ${writePath} is created`);
109
142
  }
110
143
  return this;
@@ -114,22 +147,22 @@ class Executor {
114
147
  return this;
115
148
  }
116
149
  getLocalFile(filePath) {
117
- const filepath = path.isAbsolute(filePath) ? filePath : filePath.replace(this.cwdPath, "");
150
+ const filepath = import_path.default.isAbsolute(filePath) ? filePath : filePath.replace(this.cwdPath, "");
118
151
  const content = this.readFile(filepath);
119
152
  return { filepath, content };
120
153
  }
121
154
  readFile(filePath) {
122
155
  const readPath = this.#getPath(filePath);
123
- return fs.readFileSync(readPath, "utf8");
156
+ return import_fs.default.readFileSync(readPath, "utf8");
124
157
  }
125
158
  readJson(filePath) {
126
159
  const readPath = this.#getPath(filePath);
127
- return JSON.parse(fs.readFileSync(readPath, "utf8"));
160
+ return JSON.parse(import_fs.default.readFileSync(readPath, "utf8"));
128
161
  }
129
162
  async cp(srcPath, destPath) {
130
163
  const src = this.#getPath(srcPath);
131
164
  const dest = this.#getPath(destPath);
132
- await fsPromise.cp(src, dest, { recursive: true });
165
+ await import_promises.default.cp(src, dest, { recursive: true });
133
166
  }
134
167
  log(msg) {
135
168
  this.logger.info(msg);
@@ -162,9 +195,9 @@ class Executor {
162
195
  const result = getContent.default(scanResult ?? null, dict);
163
196
  if (result === null)
164
197
  return;
165
- const filename = typeof result === "object" ? result.filename : path.basename(targetPath).replace(".js", ".ts");
198
+ const filename = typeof result === "object" ? result.filename : import_path.default.basename(targetPath).replace(".js", ".ts");
166
199
  const content = typeof result === "object" ? result.content : result;
167
- const dirname = path.dirname(targetPath);
200
+ const dirname = import_path.default.dirname(targetPath);
168
201
  const convertedTargetPath = Object.entries(dict).reduce(
169
202
  (path2, [key, value]) => path2.replace(new RegExp(`__${key}__`, "g"), value),
170
203
  `${dirname}/${filename}`
@@ -172,7 +205,7 @@ class Executor {
172
205
  this.logger.verbose(`Apply template ${templatePath} to ${convertedTargetPath}`);
173
206
  this.writeFile(convertedTargetPath, content);
174
207
  } else if (targetPath.endsWith(".template")) {
175
- const content = await fsPromise.readFile(templatePath, "utf8");
208
+ const content = await import_promises.default.readFile(templatePath, "utf8");
176
209
  const convertedTargetPath = Object.entries(dict).reduce(
177
210
  (path2, [key, value]) => path2.replace(new RegExp(`__${key}__`, "g"), value),
178
211
  targetPath.slice(0, -9)
@@ -193,26 +226,26 @@ class Executor {
193
226
  overwrite = true
194
227
  }) {
195
228
  const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`.replace(".ts", ".js");
196
- if (fs.statSync(templatePath).isFile()) {
197
- const filename = path.basename(templatePath);
229
+ if (import_fs.default.statSync(templatePath).isFile()) {
230
+ const filename = import_path.default.basename(templatePath);
198
231
  await this.#applyTemplateFile(
199
- { templatePath, targetPath: path.join(basePath, filename), scanResult, overwrite },
232
+ { templatePath, targetPath: import_path.default.join(basePath, filename), scanResult, overwrite },
200
233
  dict
201
234
  );
202
235
  } else {
203
- const subdirs = await fsPromise.readdir(templatePath);
236
+ const subdirs = await import_promises.default.readdir(templatePath);
204
237
  await Promise.all(
205
238
  subdirs.map(async (subdir) => {
206
- const subpath = path.join(templatePath, subdir);
207
- if (fs.statSync(subpath).isFile())
239
+ const subpath = import_path.default.join(templatePath, subdir);
240
+ if (import_fs.default.statSync(subpath).isFile())
208
241
  await this.#applyTemplateFile(
209
- { templatePath: subpath, targetPath: path.join(basePath, subdir), scanResult, overwrite },
242
+ { templatePath: subpath, targetPath: import_path.default.join(basePath, subdir), scanResult, overwrite },
210
243
  dict
211
244
  );
212
245
  else
213
246
  await this.applyTemplate({
214
- basePath: path.join(basePath, subdir),
215
- template: path.join(template, subdir),
247
+ basePath: import_path.default.join(basePath, subdir),
248
+ template: import_path.default.join(template, subdir),
216
249
  scanResult,
217
250
  dict,
218
251
  overwrite
@@ -231,11 +264,11 @@ class WorkspaceExecutor extends Executor {
231
264
  this.repoName = repoName;
232
265
  }
233
266
  static fromRoot() {
234
- const repoName = path.basename(process.cwd());
267
+ const repoName = import_path.default.basename(process.cwd());
235
268
  return new WorkspaceExecutor({ workspaceRoot: process.cwd(), repoName });
236
269
  }
237
270
  getBaseDevEnv() {
238
- const envFile = dotenv.parse(this.readFile(".env"));
271
+ const envFile = import_dotenv.default.parse(this.readFile(".env"));
239
272
  const appName = process.env.NEXT_PUBLIC_APP_NAME ?? envFile.NEXT_PUBLIC_APP_NAME;
240
273
  const repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? envFile.NEXT_PUBLIC_REPO_NAME;
241
274
  if (!repoName)
@@ -304,13 +337,13 @@ class WorkspaceExecutor extends Executor {
304
337
  async getDirInModule(basePath, name) {
305
338
  const AVOID_DIRS = ["__lib", "__scalar", `_${name}`];
306
339
  const getDirs = async (dirname, maxDepth = 3, results = [], prefix = "") => {
307
- const dirs = await fsPromise.readdir(dirname);
340
+ const dirs = await import_promises.default.readdir(dirname);
308
341
  await Promise.all(
309
342
  dirs.map(async (dir) => {
310
343
  if (AVOID_DIRS.includes(dir))
311
344
  return;
312
- const dirPath = path.join(dirname, dir);
313
- if (fs.lstatSync(dirPath).isDirectory()) {
345
+ const dirPath = import_path.default.join(dirname, dir);
346
+ if (import_fs.default.lstatSync(dirPath).isDirectory()) {
314
347
  results.push(`${name}/${prefix}${dir}`);
315
348
  if (maxDepth > 0)
316
349
  await getDirs(dirPath, maxDepth - 1, results, `${prefix}${dir}/`);
@@ -331,14 +364,14 @@ class WorkspaceExecutor extends Executor {
331
364
  async #getDirHasFile(basePath, targetFilename) {
332
365
  const AVOID_DIRS = ["node_modules", "dist", "public", "./next"];
333
366
  const getDirs = async (dirname, maxDepth = 3, results = [], prefix = "") => {
334
- const dirs = await fsPromise.readdir(dirname);
367
+ const dirs = await import_promises.default.readdir(dirname);
335
368
  await Promise.all(
336
369
  dirs.map(async (dir) => {
337
370
  if (AVOID_DIRS.includes(dir))
338
371
  return;
339
- const dirPath = path.join(dirname, dir);
340
- if (fs.lstatSync(dirPath).isDirectory()) {
341
- const hasTargetFile = fs.existsSync(path.join(dirPath, targetFilename));
372
+ const dirPath = import_path.default.join(dirname, dir);
373
+ if (import_fs.default.lstatSync(dirPath).isDirectory()) {
374
+ const hasTargetFile = import_fs.default.existsSync(import_path.default.join(dirPath, targetFilename));
342
375
  if (hasTargetFile)
343
376
  results.push(`${prefix}${dir}`);
344
377
  if (maxDepth > 0)
@@ -378,7 +411,7 @@ class SysExecutor extends Executor {
378
411
  this.type = type;
379
412
  }
380
413
  async getConfig(command) {
381
- return this.type === "app" ? await getAppConfig(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "app", name: this.name, command }) : await getLibConfig(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "lib", name: this.name, command });
414
+ return this.type === "app" ? await (0, import_config.getAppConfig)(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "app", name: this.name, command }) : await (0, import_config.getLibConfig)(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "lib", name: this.name, command });
382
415
  }
383
416
  async getModules() {
384
417
  const path2 = this.type === "app" ? `apps/${this.name}/lib` : `libs/${this.name}/lib`;
@@ -391,7 +424,7 @@ class SysExecutor extends Executor {
391
424
  if (libScanResults[this.name])
392
425
  return libScanResults[this.name];
393
426
  const rootPackageJson = this.readJson(`${this.workspace.workspaceRoot}/package.json`);
394
- const scanner = new TypeScriptDependencyScanner(this.cwdPath);
427
+ const scanner = new import_dependencyScanner.TypeScriptDependencyScanner(this.cwdPath);
395
428
  const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
396
429
  const pkgPathSet = new Set(
397
430
  Object.keys(tsconfig.compilerOptions.paths).filter((path2) => tsconfig.compilerOptions.paths[path2].some((resolve) => resolve.startsWith("pkgs/"))).map((path2) => path2.replace("/*", ""))
@@ -408,17 +441,17 @@ class SysExecutor extends Executor {
408
441
  const pathSplitLength = path2.split("/").length;
409
442
  return tsconfig.compilerOptions.paths[path2][0].split("/").slice(1, 1 + pathSplitLength).join("/");
410
443
  }).filter((libName) => libName !== this.name);
411
- if (!fs.existsSync(`${this.cwdPath}/lib/__scalar`))
412
- fs.mkdirSync(`${this.cwdPath}/lib/__scalar`, { recursive: true });
413
- const files = getDefaultFileScan();
414
- const dirnames = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter(
415
- (name) => fs.lstatSync(`${this.cwdPath}/lib/${name}`).isDirectory()
444
+ if (!import_fs.default.existsSync(`${this.cwdPath}/lib/__scalar`))
445
+ import_fs.default.mkdirSync(`${this.cwdPath}/lib/__scalar`, { recursive: true });
446
+ const files = (0, import_config.getDefaultFileScan)();
447
+ const dirnames = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter(
448
+ (name) => import_fs.default.lstatSync(`${this.cwdPath}/lib/${name}`).isDirectory()
416
449
  );
417
450
  const databaseDirs = dirnames.filter((name) => !name.startsWith("_"));
418
451
  const serviceDirs = dirnames.filter((name) => name.startsWith("_") && !name.startsWith("__"));
419
452
  await Promise.all(
420
453
  databaseDirs.map(async (name) => {
421
- const filenames = await fsPromise.readdir(path.join(this.cwdPath, "lib", name));
454
+ const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib", name));
422
455
  filenames.forEach((filename) => {
423
456
  if (filename.endsWith(".constant.ts"))
424
457
  files.constants.databases.push(name);
@@ -440,7 +473,7 @@ class SysExecutor extends Executor {
440
473
  await Promise.all(
441
474
  serviceDirs.map(async (dirname) => {
442
475
  const name = dirname.slice(1);
443
- const filenames = await fsPromise.readdir(path.join(this.cwdPath, "lib", dirname));
476
+ const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib", dirname));
444
477
  filenames.forEach((filename) => {
445
478
  if (filename.endsWith(".dictionary.ts"))
446
479
  files.dictionary.services.push(name);
@@ -455,12 +488,12 @@ class SysExecutor extends Executor {
455
488
  });
456
489
  })
457
490
  );
458
- const scalarDirs = (await fsPromise.readdir(`${this.cwdPath}/lib/__scalar`)).filter(
491
+ const scalarDirs = (await import_promises.default.readdir(`${this.cwdPath}/lib/__scalar`)).filter(
459
492
  (name) => !name.startsWith("_")
460
493
  );
461
494
  await Promise.all(
462
495
  scalarDirs.map(async (name) => {
463
- const filenames = await fsPromise.readdir(path.join(this.cwdPath, "lib/__scalar", name));
496
+ const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib/__scalar", name));
464
497
  filenames.forEach((filename) => {
465
498
  if (filename.endsWith(".constant.ts"))
466
499
  files.constants.scalars.push(name);
@@ -535,32 +568,32 @@ class SysExecutor extends Executor {
535
568
  return scanResult;
536
569
  }
537
570
  getLocalFile(filePath) {
538
- const filepath = path.isAbsolute(filePath) ? filePath : `${this.type}s/${this.name}/${filePath}`;
571
+ const filepath = import_path.default.isAbsolute(filePath) ? filePath : `${this.type}s/${this.name}/${filePath}`;
539
572
  const content = this.workspace.readFile(filepath);
540
573
  return { filepath, content };
541
574
  }
542
575
  async getDatabaseModules() {
543
- const databaseModules = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.constant.ts`));
576
+ const databaseModules = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.constant.ts`));
544
577
  return databaseModules;
545
578
  }
546
579
  async getServiceModules() {
547
- const serviceModules = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.service.ts`));
580
+ const serviceModules = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.service.ts`));
548
581
  return serviceModules;
549
582
  }
550
583
  async getScalarModules() {
551
- const scalarModules = (await fsPromise.readdir(`${this.cwdPath}/lib/__scalar`)).filter((name) => !name.startsWith("_")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/__scalar/${name}/${name}.constant.ts`));
584
+ const scalarModules = (await import_promises.default.readdir(`${this.cwdPath}/lib/__scalar`)).filter((name) => !name.startsWith("_")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/__scalar/${name}/${name}.constant.ts`));
552
585
  return scalarModules;
553
586
  }
554
587
  async getViewComponents() {
555
- const viewComponents = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.View.tsx`));
588
+ const viewComponents = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.View.tsx`));
556
589
  return viewComponents;
557
590
  }
558
591
  async getUnitComponents() {
559
- const unitComponents = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.Unit.tsx`));
592
+ const unitComponents = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.Unit.tsx`));
560
593
  return unitComponents;
561
594
  }
562
595
  async getTemplateComponents() {
563
- const templateComponents = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.Template.tsx`));
596
+ const templateComponents = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.Template.tsx`));
564
597
  return templateComponents;
565
598
  }
566
599
  async getViewsSourceCode() {
@@ -606,7 +639,7 @@ class AppExecutor extends SysExecutor {
606
639
  return new AppExecutor({ workspace: executor.workspace, name });
607
640
  }
608
641
  async getConfig(command) {
609
- return await getAppConfig(this.cwdPath, {
642
+ return await (0, import_config.getAppConfig)(this.cwdPath, {
610
643
  ...this.workspace.getBaseDevEnv(),
611
644
  type: "app",
612
645
  name: this.name,
@@ -615,13 +648,13 @@ class AppExecutor extends SysExecutor {
615
648
  }
616
649
  async syncAssets(libDeps) {
617
650
  const projectPublicLibPath = `${this.cwdPath}/public/libs`;
618
- if (fs.existsSync(projectPublicLibPath))
619
- await fsPromise.rm(projectPublicLibPath, { recursive: true });
620
- const targetDeps = libDeps.filter((dep) => fs.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
621
- await Promise.all(targetDeps.map((dep) => fsPromise.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })));
651
+ if (import_fs.default.existsSync(projectPublicLibPath))
652
+ await import_promises.default.rm(projectPublicLibPath, { recursive: true });
653
+ const targetDeps = libDeps.filter((dep) => import_fs.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
654
+ await Promise.all(targetDeps.map((dep) => import_promises.default.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })));
622
655
  await Promise.all(
623
656
  targetDeps.map(
624
- (dep) => fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
657
+ (dep) => import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
625
658
  recursive: true
626
659
  })
627
660
  )
@@ -642,7 +675,7 @@ class LibExecutor extends SysExecutor {
642
675
  return new LibExecutor({ workspace: executor.workspace, name });
643
676
  }
644
677
  async getConfig(command) {
645
- return await getLibConfig(this.cwdPath, {
678
+ return await (0, import_config.getLibConfig)(this.cwdPath, {
646
679
  ...this.workspace.getBaseDevEnv(),
647
680
  type: "lib",
648
681
  name: this.name,
@@ -670,7 +703,7 @@ class PkgExecutor extends Executor {
670
703
  tsconfig = this.getTsConfig(`${this.cwdPath}/tsconfig.json`)
671
704
  } = {}) {
672
705
  const rootPackageJson = this.readJson(`${this.workspace.workspaceRoot}/package.json`);
673
- const scanner = new TypeScriptDependencyScanner(this.cwdPath);
706
+ const scanner = new import_dependencyScanner.TypeScriptDependencyScanner(this.cwdPath);
674
707
  const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
675
708
  const pkgPathSet = new Set(
676
709
  Object.keys(tsconfig.compilerOptions.paths).filter((path2) => tsconfig.compilerOptions.paths[path2].some((resolve) => resolve.startsWith("pkgs/"))).map((path2) => path2.replace("/*", ""))
@@ -688,11 +721,12 @@ class PkgExecutor extends Executor {
688
721
  return pkgScanResult;
689
722
  }
690
723
  }
691
- export {
724
+ // Annotate the CommonJS export names for ESM import in node:
725
+ 0 && (module.exports = {
692
726
  AppExecutor,
693
727
  Executor,
694
728
  LibExecutor,
695
729
  PkgExecutor,
696
730
  SysExecutor,
697
731
  WorkspaceExecutor
698
- };
732
+ });
@@ -52,7 +52,7 @@ export declare class WorkspaceExecutor extends Executor {
52
52
  getBaseDevEnv(): {
53
53
  repoName: string;
54
54
  serveDomain: string;
55
- env: "testing" | "local" | "debug" | "develop" | "main";
55
+ env: "debug" | "testing" | "local" | "develop" | "main";
56
56
  name?: string | undefined;
57
57
  };
58
58
  scan(): Promise<WorkspaceScanResult>;