@akanjs/devkit 0.0.39 → 0.0.40
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/index.d.ts +24 -0
- package/index.js +21 -1950
- package/package.json +2 -20
- package/src/aiEditor.d.ts +10 -0
- package/src/aiEditor.js +61 -0
- package/src/auth.d.ts +12 -0
- package/src/auth.js +79 -0
- package/src/baseDevEnv.d.ts +12 -0
- package/src/baseDevEnv.js +50 -0
- package/src/capacitorApp.d.ts +27 -0
- package/src/capacitorApp.js +186 -0
- package/src/constants.d.ts +21 -0
- package/src/constants.js +47 -0
- package/src/createTunnel.d.ts +8 -0
- package/src/createTunnel.js +47 -0
- package/src/dependencyScanner.d.ts +11 -0
- package/src/dependencyScanner.js +171 -0
- package/src/executors.d.ts +279 -0
- package/src/executors.js +715 -0
- package/src/extractDeps.d.ts +7 -0
- package/src/extractDeps.js +114 -0
- package/src/getCredentials.d.ts +18 -0
- package/src/getCredentials.js +43 -0
- package/src/getDependencies.d.ts +6 -0
- package/src/getDependencies.js +67 -0
- package/src/getModelFileData.d.ts +17 -0
- package/src/getModelFileData.js +67 -0
- package/src/getRelatedCnsts.d.ts +11 -0
- package/src/getRelatedCnsts.js +145 -0
- package/src/index.d.ts +101 -0
- package/src/index.js +55 -0
- package/src/installExternalLib.d.ts +8 -0
- package/src/installExternalLib.js +34 -0
- package/src/selectModel.d.ts +3 -0
- package/src/selectModel.js +50 -0
- package/src/streamAi.d.ts +7 -0
- package/src/streamAi.js +69 -0
- package/src/types.d.ts +20 -0
- package/src/types.js +15 -0
- package/src/uploadRelease.d.ts +11 -0
- package/src/uploadRelease.js +82 -0
|
@@ -0,0 +1,114 @@
|
|
|
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var extractDeps_exports = {};
|
|
30
|
+
__export(extractDeps_exports, {
|
|
31
|
+
extractDependencies: () => extractDependencies
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(extractDeps_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
const NODE_NATIVE_MODULE_SET = /* @__PURE__ */ new Set([
|
|
36
|
+
"assert",
|
|
37
|
+
"async_hooks",
|
|
38
|
+
"buffer",
|
|
39
|
+
"child_process",
|
|
40
|
+
"cluster",
|
|
41
|
+
"console",
|
|
42
|
+
"constants",
|
|
43
|
+
"crypto",
|
|
44
|
+
"dgram",
|
|
45
|
+
"dns",
|
|
46
|
+
"domain",
|
|
47
|
+
"events",
|
|
48
|
+
"fs",
|
|
49
|
+
"http",
|
|
50
|
+
"http2",
|
|
51
|
+
"https",
|
|
52
|
+
"inspector",
|
|
53
|
+
"module",
|
|
54
|
+
"net",
|
|
55
|
+
"os",
|
|
56
|
+
"path",
|
|
57
|
+
"perf_hooks",
|
|
58
|
+
"process",
|
|
59
|
+
"punycode",
|
|
60
|
+
"querystring",
|
|
61
|
+
"readline",
|
|
62
|
+
"repl",
|
|
63
|
+
"stream",
|
|
64
|
+
"string_decoder",
|
|
65
|
+
"timers",
|
|
66
|
+
"tls",
|
|
67
|
+
"trace_events",
|
|
68
|
+
"tty",
|
|
69
|
+
"url",
|
|
70
|
+
"util",
|
|
71
|
+
"v8",
|
|
72
|
+
"vm",
|
|
73
|
+
"wasi",
|
|
74
|
+
"worker_threads",
|
|
75
|
+
"zlib"
|
|
76
|
+
]);
|
|
77
|
+
const extractDependencies = /* @__PURE__ */ __name((bundlePath, pacakgeJson, defaultDependencies = []) => {
|
|
78
|
+
if (!pacakgeJson.dependencies) throw new Error("No dependencies found in package.json");
|
|
79
|
+
const code = fs.readFileSync(bundlePath, "utf8");
|
|
80
|
+
const dependencies = new Set(defaultDependencies);
|
|
81
|
+
const existingDependencies = /* @__PURE__ */ new Set([
|
|
82
|
+
...Object.keys(pacakgeJson.dependencies ?? {}),
|
|
83
|
+
...Object.keys(pacakgeJson.devDependencies ?? {})
|
|
84
|
+
]);
|
|
85
|
+
const versionObj = {
|
|
86
|
+
...pacakgeJson.dependencies ?? {},
|
|
87
|
+
...pacakgeJson.devDependencies ?? {}
|
|
88
|
+
};
|
|
89
|
+
const requireRegex = /require\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g;
|
|
90
|
+
let requireMatch;
|
|
91
|
+
while ((requireMatch = requireRegex.exec(code)) !== null) {
|
|
92
|
+
const moduleName = requireMatch[1];
|
|
93
|
+
const moduleNameParts = moduleName.split("/");
|
|
94
|
+
const subModuleLength = moduleNameParts.length;
|
|
95
|
+
for (let i = 0; i < subModuleLength; i++) {
|
|
96
|
+
const libName = moduleNameParts.slice(0, i + 1).join("/");
|
|
97
|
+
if (!NODE_NATIVE_MODULE_SET.has(libName) && existingDependencies.has(libName)) dependencies.add(libName);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return Object.fromEntries([
|
|
101
|
+
...dependencies
|
|
102
|
+
].sort().map((dep) => {
|
|
103
|
+
const version = versionObj[dep];
|
|
104
|
+
if (!version) throw new Error(`No version found for ${dep}`);
|
|
105
|
+
return [
|
|
106
|
+
dep,
|
|
107
|
+
version
|
|
108
|
+
];
|
|
109
|
+
}));
|
|
110
|
+
}, "extractDependencies");
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
extractDependencies
|
|
114
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AppExecutor } from './executors.js';
|
|
2
|
+
import 'next';
|
|
3
|
+
import 'child_process';
|
|
4
|
+
import './types.js';
|
|
5
|
+
|
|
6
|
+
interface AppSecret {
|
|
7
|
+
mongo: {
|
|
8
|
+
account: {
|
|
9
|
+
user: {
|
|
10
|
+
username: string;
|
|
11
|
+
password: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare const getCredentials: (app: AppExecutor, environment: string) => AppSecret;
|
|
17
|
+
|
|
18
|
+
export { type AppSecret, getCredentials };
|
|
@@ -0,0 +1,43 @@
|
|
|
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getCredentials_exports = {};
|
|
30
|
+
__export(getCredentials_exports, {
|
|
31
|
+
getCredentials: () => getCredentials
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getCredentials_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_js_yaml = __toESM(require("js-yaml"));
|
|
36
|
+
const getCredentials = /* @__PURE__ */ __name((app, environment) => {
|
|
37
|
+
const secret = import_js_yaml.default.load(import_fs.default.readFileSync(`${app.workspace.workspaceRoot}/infra/app/values/${app.name}-secret.yaml`, "utf-8"));
|
|
38
|
+
return secret[environment];
|
|
39
|
+
}, "getCredentials");
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
getCredentials
|
|
43
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getDependencies_exports = {};
|
|
20
|
+
__export(getDependencies_exports, {
|
|
21
|
+
getDependencies: () => getDependencies
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getDependencies_exports);
|
|
24
|
+
var import_devkit = require("@nx/devkit");
|
|
25
|
+
const addLibDepSet = /* @__PURE__ */ __name((depName, { libDepSet, npmDepSet, dependencies }) => {
|
|
26
|
+
const deps = dependencies[depName];
|
|
27
|
+
if (!deps) throw new Error(`No dependencies found for project or library ${depName}`);
|
|
28
|
+
for (const dep of deps) {
|
|
29
|
+
if (dep.target.startsWith("npm:")) npmDepSet.add(dep.target);
|
|
30
|
+
else if (libDepSet.has(dep.target)) continue;
|
|
31
|
+
else {
|
|
32
|
+
libDepSet.add(dep.target);
|
|
33
|
+
addLibDepSet(dep.target, {
|
|
34
|
+
libDepSet,
|
|
35
|
+
npmDepSet,
|
|
36
|
+
dependencies
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, "addLibDepSet");
|
|
41
|
+
const getDependencies = /* @__PURE__ */ __name(async (projectName) => {
|
|
42
|
+
const graph = await (0, import_devkit.createProjectGraphAsync)();
|
|
43
|
+
const [libDepSet, npmDepSet] = [
|
|
44
|
+
/* @__PURE__ */ new Set(),
|
|
45
|
+
/* @__PURE__ */ new Set()
|
|
46
|
+
];
|
|
47
|
+
const dependencies = graph.dependencies;
|
|
48
|
+
const projectDeps = dependencies[projectName];
|
|
49
|
+
if (!projectDeps) throw new Error(`No dependencies found for project ${projectName}`);
|
|
50
|
+
addLibDepSet(projectName, {
|
|
51
|
+
libDepSet,
|
|
52
|
+
npmDepSet,
|
|
53
|
+
dependencies
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
libDeps: [
|
|
57
|
+
...libDepSet.values()
|
|
58
|
+
],
|
|
59
|
+
npmDeps: [
|
|
60
|
+
...npmDepSet.values()
|
|
61
|
+
].map((depName) => depName.replace("npm:", ""))
|
|
62
|
+
};
|
|
63
|
+
}, "getDependencies");
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
getDependencies
|
|
67
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ModelFileData {
|
|
2
|
+
moduleType: "lib" | "app";
|
|
3
|
+
moduleName: string;
|
|
4
|
+
modelName: string;
|
|
5
|
+
constantFilePath: string;
|
|
6
|
+
importModelNames: string[];
|
|
7
|
+
hasImportScalar: boolean;
|
|
8
|
+
importLibNames: string[];
|
|
9
|
+
constantFileStr: string;
|
|
10
|
+
unitFilePath: string;
|
|
11
|
+
unitFileStr: string;
|
|
12
|
+
viewFilePath: string;
|
|
13
|
+
viewFileStr: string;
|
|
14
|
+
}
|
|
15
|
+
declare const getModelFileData: (modulePath: string, modelName: string) => ModelFileData;
|
|
16
|
+
|
|
17
|
+
export { getModelFileData };
|
|
@@ -0,0 +1,67 @@
|
|
|
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getModelFileData_exports = {};
|
|
30
|
+
__export(getModelFileData_exports, {
|
|
31
|
+
getModelFileData: () => getModelFileData
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getModelFileData_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
const getModelFileData = /* @__PURE__ */ __name((modulePath, modelName) => {
|
|
36
|
+
const moduleType = modulePath.startsWith("apps") ? "app" : "lib";
|
|
37
|
+
const moduleName = modulePath.split("/")[1];
|
|
38
|
+
const constantFilePath = `${modulePath}/lib/${modelName}/${modelName}.constant.ts`;
|
|
39
|
+
const unitFilePath = `${modulePath}/lib/${modelName}/${modelName}.Unit.tsx`;
|
|
40
|
+
const viewFilePath = `${modulePath}/lib/${modelName}/${modelName}.View.tsx`;
|
|
41
|
+
const constantFileStr = import_fs.default.readFileSync(constantFilePath, "utf8");
|
|
42
|
+
const unitFileStr = import_fs.default.readFileSync(unitFilePath, "utf8");
|
|
43
|
+
const viewFileStr = import_fs.default.readFileSync(viewFilePath, "utf8");
|
|
44
|
+
const constantFileLines = constantFileStr.split("\n");
|
|
45
|
+
const importLibNames = constantFileLines.filter((line) => line.startsWith("import { cnst as ")).map((line) => line.split("cnst as ")[1].split(" ")[0]);
|
|
46
|
+
const importLocalPaths = constantFileLines.filter((line) => line.startsWith("import { ") && line.includes('from "../')).map((line) => line.split("from ")[1].split('"')[1]);
|
|
47
|
+
const importModelNames = importLocalPaths.map((path) => path.split("/")[1]).filter((name) => !name.startsWith("_"));
|
|
48
|
+
const hasImportScalar = !!importLocalPaths.map((path) => path.split("/")[1]).filter((name) => name.startsWith("_")).length;
|
|
49
|
+
return {
|
|
50
|
+
moduleType,
|
|
51
|
+
moduleName,
|
|
52
|
+
modelName,
|
|
53
|
+
constantFilePath,
|
|
54
|
+
unitFilePath,
|
|
55
|
+
viewFilePath,
|
|
56
|
+
importModelNames,
|
|
57
|
+
hasImportScalar,
|
|
58
|
+
importLibNames,
|
|
59
|
+
constantFileStr,
|
|
60
|
+
unitFileStr,
|
|
61
|
+
viewFileStr
|
|
62
|
+
};
|
|
63
|
+
}, "getModelFileData");
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
getModelFileData
|
|
67
|
+
});
|
|
@@ -0,0 +1,145 @@
|
|
|
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getRelatedCnsts_exports = {};
|
|
30
|
+
__export(getRelatedCnsts_exports, {
|
|
31
|
+
getRelatedCnsts: () => getRelatedCnsts
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getRelatedCnsts_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_ora = __toESM(require("ora"));
|
|
36
|
+
var ts = __toESM(require("typescript"));
|
|
37
|
+
const getRelatedCnsts = /* @__PURE__ */ __name((constantFilePath) => {
|
|
38
|
+
const tsConfigPath = `./tsconfig.json`;
|
|
39
|
+
const configFile = ts.readConfigFile(tsConfigPath, (path) => {
|
|
40
|
+
return ts.sys.readFile(path);
|
|
41
|
+
});
|
|
42
|
+
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, import_fs.default.realpathSync(tsConfigPath).replace(/[^/\\]+$/, ""));
|
|
43
|
+
const propertyMap = /* @__PURE__ */ new Map();
|
|
44
|
+
function findPropertyOriginAll(filePath) {
|
|
45
|
+
const program = ts.createProgram([
|
|
46
|
+
filePath
|
|
47
|
+
], parsedConfig.options);
|
|
48
|
+
const checker = program.getTypeChecker();
|
|
49
|
+
const source = program.getSourceFile(filePath);
|
|
50
|
+
if (!source) return null;
|
|
51
|
+
function visit(node) {
|
|
52
|
+
if (!source) return;
|
|
53
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
54
|
+
const left = node.expression;
|
|
55
|
+
const right = node.name;
|
|
56
|
+
const { line } = ts.getLineAndCharacterOfPosition(source, node.getStart());
|
|
57
|
+
//!Field.Prop 거르기가 빡세네.
|
|
58
|
+
const sourceLines = source.getFullText().split("\n");
|
|
59
|
+
if (ts.isIdentifier(left) && sourceLines.length && (sourceLines[line].includes(`@Field.Prop(() => ${left.text}.${right.text}`) || sourceLines[line].includes(`base.Filter(${left.text}.${right.text},`))) {
|
|
60
|
+
const symbol = checker.getSymbolAtLocation(right);
|
|
61
|
+
if (symbol?.declarations && symbol.declarations.length > 0) {
|
|
62
|
+
const key = symbol.declarations[0].getSourceFile().fileName.split("/").pop()?.split(".")[0] ?? "";
|
|
63
|
+
const property = propertyMap.get(key);
|
|
64
|
+
const isScalar = symbol.declarations[0].getSourceFile().fileName.includes("_");
|
|
65
|
+
const filePath2 = symbol.declarations[0].getSourceFile().fileName.replace(`${ts.sys.getCurrentDirectory()}/`, "");
|
|
66
|
+
if (property) {
|
|
67
|
+
propertyMap.set(`${left.text}.${right.text}`, {
|
|
68
|
+
filePath: filePath2,
|
|
69
|
+
isLibModule: true,
|
|
70
|
+
isImport: false,
|
|
71
|
+
libName: left.text,
|
|
72
|
+
isScalar
|
|
73
|
+
});
|
|
74
|
+
} else propertyMap.set(key, {
|
|
75
|
+
filePath: filePath2,
|
|
76
|
+
isLibModule: true,
|
|
77
|
+
isImport: false,
|
|
78
|
+
libName: left.text,
|
|
79
|
+
isScalar
|
|
80
|
+
});
|
|
81
|
+
findPropertyOriginAll(filePath2);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} else if (ts.isImportDeclaration(node)) {
|
|
85
|
+
const importPath = node.moduleSpecifier.getText().slice(1, -1);
|
|
86
|
+
if (importPath.startsWith(".")) {
|
|
87
|
+
const resolved = ts.resolveModuleName(importPath, filePath, parsedConfig.options, ts.sys).resolvedModule?.resolvedFileName;
|
|
88
|
+
const moduleName = importPath.split("/").pop()?.split(".")[0] ?? "";
|
|
89
|
+
const property = propertyMap.get(moduleName);
|
|
90
|
+
const isScalar = importPath.includes("_");
|
|
91
|
+
if (moduleName && resolved && (!property || property.filePath !== resolved)) {
|
|
92
|
+
propertyMap.set(moduleName, {
|
|
93
|
+
filePath: resolved,
|
|
94
|
+
isLibModule: false,
|
|
95
|
+
isImport: true,
|
|
96
|
+
isScalar
|
|
97
|
+
});
|
|
98
|
+
findPropertyOriginAll(resolved);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
ts.forEachChild(node, visit);
|
|
103
|
+
}
|
|
104
|
+
__name(visit, "visit");
|
|
105
|
+
visit(source);
|
|
106
|
+
return propertyMap;
|
|
107
|
+
}
|
|
108
|
+
__name(findPropertyOriginAll, "findPropertyOriginAll");
|
|
109
|
+
function findPropertyOrigin(filePath, aliasName, libName) {
|
|
110
|
+
const program = ts.createProgram([
|
|
111
|
+
filePath
|
|
112
|
+
], parsedConfig.options);
|
|
113
|
+
const checker = program.getTypeChecker();
|
|
114
|
+
const source = program.getSourceFile(filePath);
|
|
115
|
+
const propertyMap2 = /* @__PURE__ */ new Map();
|
|
116
|
+
if (!source) return null;
|
|
117
|
+
function visit(node) {
|
|
118
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
119
|
+
const left = node.expression;
|
|
120
|
+
const right = node.name;
|
|
121
|
+
if (ts.isIdentifier(left) && left.text === aliasName && right.text === libName) {
|
|
122
|
+
const symbol = checker.getSymbolAtLocation(right);
|
|
123
|
+
if (symbol?.declarations && symbol.declarations.length > 0) {
|
|
124
|
+
return symbol.declarations[0].getSourceFile().fileName;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return ts.forEachChild(node, visit) || null;
|
|
129
|
+
}
|
|
130
|
+
__name(visit, "visit");
|
|
131
|
+
return visit(source);
|
|
132
|
+
}
|
|
133
|
+
__name(findPropertyOrigin, "findPropertyOrigin");
|
|
134
|
+
const spinner = (0, import_ora.default)("Finding property origin...");
|
|
135
|
+
spinner.start();
|
|
136
|
+
const paths = findPropertyOriginAll(constantFilePath);
|
|
137
|
+
spinner.succeed("property origin found.");
|
|
138
|
+
return {
|
|
139
|
+
paths
|
|
140
|
+
};
|
|
141
|
+
}, "getRelatedCnsts");
|
|
142
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
+
0 && (module.exports = {
|
|
144
|
+
getRelatedCnsts
|
|
145
|
+
});
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export { baseDevEnv, getSshTunnelOptions } from './baseDevEnv.js';
|
|
2
|
+
export { createTunnel } from './createTunnel.js';
|
|
3
|
+
export { AppSecret, getCredentials } from './getCredentials.js';
|
|
4
|
+
export { getDependencies } from './getDependencies.js';
|
|
5
|
+
export { uploadRelease } from './uploadRelease.js';
|
|
6
|
+
export { getModelFileData } from './getModelFileData.js';
|
|
7
|
+
export { getRelatedCnsts } from './getRelatedCnsts.js';
|
|
8
|
+
export { selectModel } from './selectModel.js';
|
|
9
|
+
export { streamAi } from './streamAi.js';
|
|
10
|
+
import { AppExecutor, LibExecutor, SysExecutor, PkgExecutor, WorkspaceExecutor } from './executors.js';
|
|
11
|
+
export { DistAppExecutor, DistLibExecutor, DistPkgExecutor, Executor } from './executors.js';
|
|
12
|
+
export { TypeScriptDependencyScanner } from './dependencyScanner.js';
|
|
13
|
+
export { AkanGlobalConfig, HostConfig, akanCloudBackendUrl, akanCloudClientUrl, akanCloudHost, basePath, configPath, defaultAkanGlobalConfig, defaultHostConfig } from './constants.js';
|
|
14
|
+
export { getAkanGlobalConfig, getHostConfig, getSelf, setAkanGlobalConfig, setHostConfig } from './auth.js';
|
|
15
|
+
export { PackageJson, TsConfigJson } from './types.js';
|
|
16
|
+
export { CapacitorApp } from './capacitorApp.js';
|
|
17
|
+
export { extractDependencies } from './extractDeps.js';
|
|
18
|
+
export { installExternalLib } from './installExternalLib.js';
|
|
19
|
+
import 'tunnel-ssh';
|
|
20
|
+
import 'next';
|
|
21
|
+
import 'child_process';
|
|
22
|
+
import '@trapezedev/project';
|
|
23
|
+
import '@trapezedev/project/dist/android/project';
|
|
24
|
+
import '@trapezedev/project/dist/ios/project';
|
|
25
|
+
|
|
26
|
+
type Type<T = any> = new (...args: any[]) => T;
|
|
27
|
+
|
|
28
|
+
declare const argTypes: readonly ["Option"];
|
|
29
|
+
type ArgType = (typeof argTypes)[number];
|
|
30
|
+
declare const internalArgTypes: readonly ["Workspace", "App", "Lib", "Sys", "Pkg"];
|
|
31
|
+
type InternalArgType = (typeof internalArgTypes)[number];
|
|
32
|
+
interface ArgsOption {
|
|
33
|
+
type?: "string" | "number" | "boolean";
|
|
34
|
+
flag?: string;
|
|
35
|
+
desc?: string;
|
|
36
|
+
default?: string | number | boolean;
|
|
37
|
+
nullable?: boolean;
|
|
38
|
+
example?: string | number | boolean;
|
|
39
|
+
enum?: (string | number)[] | readonly (string | number)[];
|
|
40
|
+
ask?: string;
|
|
41
|
+
}
|
|
42
|
+
interface ArgMeta {
|
|
43
|
+
name: string;
|
|
44
|
+
argsOption: ArgsOption;
|
|
45
|
+
key: string;
|
|
46
|
+
idx: number;
|
|
47
|
+
type: ArgType;
|
|
48
|
+
}
|
|
49
|
+
interface InternalArgMeta {
|
|
50
|
+
key: string;
|
|
51
|
+
idx: number;
|
|
52
|
+
type: InternalArgType;
|
|
53
|
+
option?: {
|
|
54
|
+
nullable?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
declare const getArgMetas: (command: Type, key: string) => [(ArgMeta | InternalArgMeta)[], ArgMeta[], InternalArgMeta[]];
|
|
58
|
+
declare const Option: (name: string, argsOption?: ArgsOption) => (prototype: object, key: string, idx: number) => void;
|
|
59
|
+
declare const App: (option?: {
|
|
60
|
+
nullable?: boolean;
|
|
61
|
+
}) => (prototype: object, key: string, idx: number) => void;
|
|
62
|
+
type App = AppExecutor;
|
|
63
|
+
declare const Lib: (option?: {
|
|
64
|
+
nullable?: boolean;
|
|
65
|
+
}) => (prototype: object, key: string, idx: number) => void;
|
|
66
|
+
type Lib = LibExecutor;
|
|
67
|
+
declare const Sys: (option?: {
|
|
68
|
+
nullable?: boolean;
|
|
69
|
+
}) => (prototype: object, key: string, idx: number) => void;
|
|
70
|
+
type Sys = SysExecutor;
|
|
71
|
+
declare const Pkg: (option?: {
|
|
72
|
+
nullable?: boolean;
|
|
73
|
+
}) => (prototype: object, key: string, idx: number) => void;
|
|
74
|
+
type Pkg = PkgExecutor;
|
|
75
|
+
declare const Workspace: (option?: {
|
|
76
|
+
nullable?: boolean;
|
|
77
|
+
}) => (prototype: object, key: string, idx: number) => void;
|
|
78
|
+
type Workspace = WorkspaceExecutor;
|
|
79
|
+
|
|
80
|
+
declare const Commands: () => (target: Type) => void;
|
|
81
|
+
|
|
82
|
+
interface TargetMeta {
|
|
83
|
+
key: string;
|
|
84
|
+
descriptor: PropertyDescriptor;
|
|
85
|
+
targetOption: TargetOption;
|
|
86
|
+
}
|
|
87
|
+
declare const getTargetMetas: (command: Type) => TargetMeta[];
|
|
88
|
+
interface TargetOption {
|
|
89
|
+
type: "public" | "cloud" | "dev";
|
|
90
|
+
short?: string | true;
|
|
91
|
+
devOnly?: boolean;
|
|
92
|
+
}
|
|
93
|
+
declare const Target: {
|
|
94
|
+
Public: (targetOption?: Omit<TargetOption, "type">) => (prototype: object, key: string, descriptor: PropertyDescriptor) => void;
|
|
95
|
+
Cloud: (targetOption?: Omit<TargetOption, "type">) => (prototype: object, key: string, descriptor: PropertyDescriptor) => void;
|
|
96
|
+
Dev: (targetOption?: Omit<TargetOption, "type">) => (prototype: object, key: string, descriptor: PropertyDescriptor) => void;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
declare const runCommands: (...commands: Type[]) => Promise<void>;
|
|
100
|
+
|
|
101
|
+
export { App, AppExecutor, type ArgMeta, type ArgType, Commands, type InternalArgMeta, type InternalArgType, Lib, LibExecutor, Option, Pkg, PkgExecutor, Sys, SysExecutor, Target, type Type, Workspace, WorkspaceExecutor, argTypes, getArgMetas, getTargetMetas, internalArgTypes, runCommands };
|
package/src/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var src_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
|
17
|
+
__reExport(src_exports, require("./baseDevEnv"), module.exports);
|
|
18
|
+
__reExport(src_exports, require("./createTunnel"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./getCredentials"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./getDependencies"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./uploadRelease"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./getModelFileData"), module.exports);
|
|
23
|
+
__reExport(src_exports, require("./getRelatedCnsts"), module.exports);
|
|
24
|
+
__reExport(src_exports, require("./selectModel"), module.exports);
|
|
25
|
+
__reExport(src_exports, require("./streamAi"), module.exports);
|
|
26
|
+
__reExport(src_exports, require("./executors"), module.exports);
|
|
27
|
+
__reExport(src_exports, require("./dependencyScanner"), module.exports);
|
|
28
|
+
__reExport(src_exports, require("./constants"), module.exports);
|
|
29
|
+
__reExport(src_exports, require("./auth"), module.exports);
|
|
30
|
+
__reExport(src_exports, require("./types"), module.exports);
|
|
31
|
+
__reExport(src_exports, require("./capacitorApp"), module.exports);
|
|
32
|
+
__reExport(src_exports, require("./extractDeps"), module.exports);
|
|
33
|
+
__reExport(src_exports, require("./commandDecorators"), module.exports);
|
|
34
|
+
__reExport(src_exports, require("./installExternalLib"), module.exports);
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
...require("./baseDevEnv"),
|
|
38
|
+
...require("./createTunnel"),
|
|
39
|
+
...require("./getCredentials"),
|
|
40
|
+
...require("./getDependencies"),
|
|
41
|
+
...require("./uploadRelease"),
|
|
42
|
+
...require("./getModelFileData"),
|
|
43
|
+
...require("./getRelatedCnsts"),
|
|
44
|
+
...require("./selectModel"),
|
|
45
|
+
...require("./streamAi"),
|
|
46
|
+
...require("./executors"),
|
|
47
|
+
...require("./dependencyScanner"),
|
|
48
|
+
...require("./constants"),
|
|
49
|
+
...require("./auth"),
|
|
50
|
+
...require("./types"),
|
|
51
|
+
...require("./capacitorApp"),
|
|
52
|
+
...require("./extractDeps"),
|
|
53
|
+
...require("./commandDecorators"),
|
|
54
|
+
...require("./installExternalLib")
|
|
55
|
+
});
|