@bemedev/codebase 0.1.2 → 0.2.0
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/README.md +8 -8
- package/lib/_virtual/_rolldown/runtime.cjs +23 -0
- package/lib/analyse.cjs +48 -62
- package/lib/analyse.cjs.map +1 -1
- package/lib/analyse.d.ts +21 -3
- package/lib/analyse.js +45 -60
- package/lib/analyse.js.map +1 -1
- package/lib/analyse.utils.cjs +154 -205
- package/lib/analyse.utils.cjs.map +1 -1
- package/lib/analyse.utils.d.ts +1 -2
- package/lib/analyse.utils.js +153 -203
- package/lib/analyse.utils.js.map +1 -1
- package/lib/cli/cli.cjs +28 -27
- package/lib/cli/cli.cjs.map +1 -1
- package/lib/cli/cli.d.ts +0 -1
- package/lib/cli/cli.js +25 -24
- package/lib/cli/cli.js.map +1 -1
- package/lib/cli/constants.cjs +6 -5
- package/lib/cli/constants.cjs.map +1 -1
- package/lib/cli/constants.d.ts +0 -1
- package/lib/cli/constants.js +5 -3
- package/lib/cli/constants.js.map +1 -1
- package/lib/cli/index.cjs +6 -6
- package/lib/cli/index.cjs.map +1 -1
- package/lib/cli/index.d.ts +0 -1
- package/lib/cli/index.js +7 -4
- package/lib/cli/index.js.map +1 -1
- package/lib/constants.cjs +26 -28
- package/lib/constants.cjs.map +1 -1
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +24 -26
- package/lib/constants.js.map +1 -1
- package/lib/exports.cjs +51 -72
- package/lib/exports.cjs.map +1 -1
- package/lib/exports.d.ts +1 -2
- package/lib/exports.js +49 -70
- package/lib/exports.js.map +1 -1
- package/lib/functions/add.cjs +71 -84
- package/lib/functions/add.cjs.map +1 -1
- package/lib/functions/add.d.ts +1 -2
- package/lib/functions/add.js +68 -82
- package/lib/functions/add.js.map +1 -1
- package/lib/functions/generate.cjs +53 -56
- package/lib/functions/generate.cjs.map +1 -1
- package/lib/functions/generate.d.ts +1 -2
- package/lib/functions/generate.js +51 -54
- package/lib/functions/generate.js.map +1 -1
- package/lib/functions/index.cjs +11 -16
- package/lib/functions/index.d.ts +0 -1
- package/lib/functions/index.js +5 -5
- package/lib/functions/init.cjs +68 -97
- package/lib/functions/init.cjs.map +1 -1
- package/lib/functions/init.d.ts +1 -2
- package/lib/functions/init.js +66 -95
- package/lib/functions/init.js.map +1 -1
- package/lib/functions/remove.cjs +85 -103
- package/lib/functions/remove.cjs.map +1 -1
- package/lib/functions/remove.d.ts +1 -2
- package/lib/functions/remove.js +82 -101
- package/lib/functions/remove.js.map +1 -1
- package/lib/helpers.cjs +32 -38
- package/lib/helpers.cjs.map +1 -1
- package/lib/helpers.d.ts +3 -4
- package/lib/helpers.js +30 -36
- package/lib/helpers.js.map +1 -1
- package/lib/imports.cjs +88 -118
- package/lib/imports.cjs.map +1 -1
- package/lib/imports.d.ts +2 -3
- package/lib/imports.js +86 -116
- package/lib/imports.js.map +1 -1
- package/lib/index.cjs +22 -24
- package/lib/index.d.ts +4 -4
- package/lib/index.js +8 -6
- package/lib/schemas.cjs +53 -63
- package/lib/schemas.cjs.map +1 -1
- package/lib/schemas.d.ts +5 -2
- package/lib/schemas.js +43 -35
- package/lib/schemas.js.map +1 -1
- package/lib/types.d.ts +0 -1
- package/lib/utils.cjs +9 -10
- package/lib/utils.cjs.map +1 -1
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +8 -8
- package/lib/utils.js.map +1 -1
- package/package.json +56 -44
- package/CHANGE_LOG.md +0 -143
- package/lib/analyse.d.ts.map +0 -1
- package/lib/analyse.utils.d.ts.map +0 -1
- package/lib/cli/cli.d.ts.map +0 -1
- package/lib/cli/constants.d.ts.map +0 -1
- package/lib/cli/index.d.ts.map +0 -1
- package/lib/constants.d.ts.map +0 -1
- package/lib/exports.d.ts.map +0 -1
- package/lib/functions/add.d.ts.map +0 -1
- package/lib/functions/generate.d.ts.map +0 -1
- package/lib/functions/index.cjs.map +0 -1
- package/lib/functions/index.d.ts.map +0 -1
- package/lib/functions/index.js.map +0 -1
- package/lib/functions/init.d.ts.map +0 -1
- package/lib/functions/remove.d.ts.map +0 -1
- package/lib/helpers.d.ts.map +0 -1
- package/lib/imports.d.ts.map +0 -1
- package/lib/index.cjs.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/schemas.d.ts.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/utils.d.ts.map +0 -1
package/lib/cli/constants.d.ts
CHANGED
package/lib/cli/constants.js
CHANGED
package/lib/cli/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../src/cli/constants.ts"],"sourcesContent":["export const BIN = 'codebase';\n"],"
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../src/cli/constants.ts"],"sourcesContent":["export const BIN = 'codebase';\n"],"mappings":";AAAA,MAAa,MAAM"}
|
package/lib/cli/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_cli_cli = require("./cli.cjs");
|
|
4
|
+
//#region src/cli/index.ts
|
|
5
|
+
(0, require("cmd-ts").run)(require_cli_cli.cli, process.argv.slice(2));
|
|
6
|
+
//#endregion
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
var cli_cli = require('./cli.cjs');
|
|
6
|
-
|
|
7
|
-
cmdTs.run(cli_cli.cli, process.argv.slice(2));
|
|
8
|
-
//# sourceMappingURL=index.cjs.map
|
|
8
|
+
//# sourceMappingURL=index.cjs.map
|
package/lib/cli/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { run } from 'cmd-ts';\nimport { cli } from './cli';\n\nrun(cli, process.argv.slice(2));\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["cli"],"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { run } from 'cmd-ts';\nimport { cli } from './cli';\n\nrun(cli, process.argv.slice(2));\n"],"mappings":";;;;2BAKIA,gBAAAA,KAAK,QAAQ,KAAK,MAAM,EAAE,CAAC"}
|
package/lib/cli/index.d.ts
CHANGED
package/lib/cli/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { cli } from "./cli.js";
|
|
3
|
+
import { run } from "cmd-ts";
|
|
4
|
+
//#region src/cli/index.ts
|
|
5
5
|
run(cli, process.argv.slice(2));
|
|
6
|
-
//#
|
|
6
|
+
//#endregion
|
|
7
|
+
export {};
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
package/lib/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { run } from 'cmd-ts';\nimport { cli } from './cli';\n\nrun(cli, process.argv.slice(2));\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { run } from 'cmd-ts';\nimport { cli } from './cli';\n\nrun(cli, process.argv.slice(2));\n"],"mappings":";;;;AAKA,IAAI,KAAK,QAAQ,KAAK,MAAM,EAAE,CAAC"}
|
package/lib/constants.cjs
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const SRC_DIR = path.join(process.cwd(),
|
|
6
|
-
const CODEBASE_FILE = path.join(process.cwd(),
|
|
7
|
-
const _REPLACER =
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let path = require("path");
|
|
4
|
+
//#region src/constants.ts
|
|
5
|
+
const SRC_DIR = (0, path.join)(process.cwd(), "src");
|
|
6
|
+
const CODEBASE_FILE = (0, path.join)(process.cwd(), ".codebase.json");
|
|
7
|
+
const _REPLACER = "-|||-";
|
|
8
8
|
const REPLACERS = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[new RegExp('\\`', 'g'), '`'],
|
|
18
|
-
[_REPLACER, ''],
|
|
19
|
-
],
|
|
9
|
+
code: [
|
|
10
|
+
["\\`", `${_REPLACER}w`],
|
|
11
|
+
["`", "\\`"],
|
|
12
|
+
["${", `$${_REPLACER}{`],
|
|
13
|
+
["\\s", `${_REPLACER}s`],
|
|
14
|
+
["\\w", `${_REPLACER}w`]
|
|
15
|
+
],
|
|
16
|
+
init: [[/* @__PURE__ */ new RegExp("\\`", "g"), "`"], [_REPLACER, ""]]
|
|
20
17
|
};
|
|
21
|
-
const PATH_KEY =
|
|
22
|
-
const JSON_FILE_NAME =
|
|
23
|
-
const PATH_PROPERTY =
|
|
24
|
-
const FILES_PROPERTY =
|
|
18
|
+
const PATH_KEY = "#bemedev/*";
|
|
19
|
+
const JSON_FILE_NAME = ".bemedev.json";
|
|
20
|
+
const PATH_PROPERTY = "path";
|
|
21
|
+
const FILES_PROPERTY = "files";
|
|
25
22
|
const PROPERTIES = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
PATH: "path",
|
|
24
|
+
FILES: "files",
|
|
25
|
+
CODEBASE_ANALYSIS: "CODEBASE_ANALYSIS",
|
|
26
|
+
STATS: "STATS"
|
|
30
27
|
};
|
|
31
|
-
|
|
28
|
+
//#endregion
|
|
32
29
|
exports.CODEBASE_FILE = CODEBASE_FILE;
|
|
33
30
|
exports.FILES_PROPERTY = FILES_PROPERTY;
|
|
34
31
|
exports.JSON_FILE_NAME = JSON_FILE_NAME;
|
|
@@ -37,4 +34,5 @@ exports.PATH_PROPERTY = PATH_PROPERTY;
|
|
|
37
34
|
exports.PROPERTIES = PROPERTIES;
|
|
38
35
|
exports.REPLACERS = REPLACERS;
|
|
39
36
|
exports.SRC_DIR = SRC_DIR;
|
|
40
|
-
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=constants.cjs.map
|
package/lib/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["../src/constants.ts"],"sourcesContent":["import { join } from 'node:path';\n\nexport const SRC_DIR = join(process.cwd(), 'src');\nexport const CODEBASE_FILE = join(process.cwd(), '.codebase.json');\n\nconst _REPLACER = '-|||-';\n\nexport const REPLACERS = {\n code: [\n ['\\\\`', `${_REPLACER}w`],\n ['`', '\\\\`'],\n ['${', `$${_REPLACER}{`],\n ['\\\\s', `${_REPLACER}s`],\n ['\\\\w', `${_REPLACER}w`],\n ],\n init: [\n [new RegExp('\\\\`', 'g'), '`'],\n [_REPLACER, ''],\n ],\n} as const;\n\nexport const PATH_KEY = '#bemedev/*';\nexport const JSON_FILE_NAME = '.bemedev.json';\n\nexport const PATH_PROPERTY = 'path';\nexport const FILES_PROPERTY = 'files';\n\nexport const PROPERTIES = {\n PATH: 'path',\n FILES: 'files',\n CODEBASE_ANALYSIS: 'CODEBASE_ANALYSIS',\n STATS: 'STATS',\n} as const;\n"],"
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import { join } from 'node:path';\n\nexport const SRC_DIR = join(process.cwd(), 'src');\nexport const CODEBASE_FILE = join(process.cwd(), '.codebase.json');\n\nconst _REPLACER = '-|||-';\n\nexport const REPLACERS = {\n code: [\n ['\\\\`', `${_REPLACER}w`],\n ['`', '\\\\`'],\n ['${', `$${_REPLACER}{`],\n ['\\\\s', `${_REPLACER}s`],\n ['\\\\w', `${_REPLACER}w`],\n ],\n init: [\n [new RegExp('\\\\`', 'g'), '`'],\n [_REPLACER, ''],\n ],\n} as const;\n\nexport const PATH_KEY = '#bemedev/*';\nexport const JSON_FILE_NAME = '.bemedev.json';\n\nexport const PATH_PROPERTY = 'path';\nexport const FILES_PROPERTY = 'files';\n\nexport const PROPERTIES = {\n PATH: 'path',\n FILES: 'files',\n CODEBASE_ANALYSIS: 'CODEBASE_ANALYSIS',\n STATS: 'STATS',\n} as const;\n"],"mappings":";;;;AAEA,MAAa,WAAA,GAAA,KAAA,MAAe,QAAQ,KAAK,EAAE,MAAM;AACjD,MAAa,iBAAA,GAAA,KAAA,MAAqB,QAAQ,KAAK,EAAE,iBAAiB;AAElE,MAAM,YAAY;AAElB,MAAa,YAAY;CACvB,MAAM;EACJ,CAAC,OAAO,GAAG,UAAU,GAAG;EACxB,CAAC,KAAK,MAAM;EACZ,CAAC,MAAM,IAAI,UAAU,GAAG;EACxB,CAAC,OAAO,GAAG,UAAU,GAAG;EACxB,CAAC,OAAO,GAAG,UAAU,GAAG;EACzB;CACD,MAAM,CACJ,iBAAC,IAAI,OAAO,OAAO,IAAI,EAAE,IAAI,EAC7B,CAAC,WAAW,GAAG,CAChB;CACF;AAED,MAAa,WAAW;AACxB,MAAa,iBAAiB;AAE9B,MAAa,gBAAgB;AAC7B,MAAa,iBAAiB;AAE9B,MAAa,aAAa;CACxB,MAAM;CACN,OAAO;CACP,mBAAmB;CACnB,OAAO;CACR"}
|
package/lib/constants.d.ts
CHANGED
package/lib/constants.js
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
import { join } from
|
|
2
|
-
|
|
3
|
-
const SRC_DIR = join(process.cwd(),
|
|
4
|
-
const CODEBASE_FILE = join(process.cwd(),
|
|
5
|
-
const _REPLACER =
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
//#region src/constants.ts
|
|
3
|
+
const SRC_DIR = join(process.cwd(), "src");
|
|
4
|
+
const CODEBASE_FILE = join(process.cwd(), ".codebase.json");
|
|
5
|
+
const _REPLACER = "-|||-";
|
|
6
6
|
const REPLACERS = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
[new RegExp('\\`', 'g'), '`'],
|
|
16
|
-
[_REPLACER, ''],
|
|
17
|
-
],
|
|
7
|
+
code: [
|
|
8
|
+
["\\`", `${_REPLACER}w`],
|
|
9
|
+
["`", "\\`"],
|
|
10
|
+
["${", `$${_REPLACER}{`],
|
|
11
|
+
["\\s", `${_REPLACER}s`],
|
|
12
|
+
["\\w", `${_REPLACER}w`]
|
|
13
|
+
],
|
|
14
|
+
init: [[/* @__PURE__ */ new RegExp("\\`", "g"), "`"], [_REPLACER, ""]]
|
|
18
15
|
};
|
|
19
|
-
const PATH_KEY =
|
|
20
|
-
const JSON_FILE_NAME =
|
|
21
|
-
const PATH_PROPERTY =
|
|
22
|
-
const FILES_PROPERTY =
|
|
16
|
+
const PATH_KEY = "#bemedev/*";
|
|
17
|
+
const JSON_FILE_NAME = ".bemedev.json";
|
|
18
|
+
const PATH_PROPERTY = "path";
|
|
19
|
+
const FILES_PROPERTY = "files";
|
|
23
20
|
const PROPERTIES = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
PATH: "path",
|
|
22
|
+
FILES: "files",
|
|
23
|
+
CODEBASE_ANALYSIS: "CODEBASE_ANALYSIS",
|
|
24
|
+
STATS: "STATS"
|
|
28
25
|
};
|
|
29
|
-
|
|
26
|
+
//#endregion
|
|
30
27
|
export { CODEBASE_FILE, FILES_PROPERTY, JSON_FILE_NAME, PATH_KEY, PATH_PROPERTY, PROPERTIES, REPLACERS, SRC_DIR };
|
|
31
|
-
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=constants.js.map
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["import { join } from 'node:path';\n\nexport const SRC_DIR = join(process.cwd(), 'src');\nexport const CODEBASE_FILE = join(process.cwd(), '.codebase.json');\n\nconst _REPLACER = '-|||-';\n\nexport const REPLACERS = {\n code: [\n ['\\\\`', `${_REPLACER}w`],\n ['`', '\\\\`'],\n ['${', `$${_REPLACER}{`],\n ['\\\\s', `${_REPLACER}s`],\n ['\\\\w', `${_REPLACER}w`],\n ],\n init: [\n [new RegExp('\\\\`', 'g'), '`'],\n [_REPLACER, ''],\n ],\n} as const;\n\nexport const PATH_KEY = '#bemedev/*';\nexport const JSON_FILE_NAME = '.bemedev.json';\n\nexport const PATH_PROPERTY = 'path';\nexport const FILES_PROPERTY = 'files';\n\nexport const PROPERTIES = {\n PATH: 'path',\n FILES: 'files',\n CODEBASE_ANALYSIS: 'CODEBASE_ANALYSIS',\n STATS: 'STATS',\n} as const;\n"],"
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import { join } from 'node:path';\n\nexport const SRC_DIR = join(process.cwd(), 'src');\nexport const CODEBASE_FILE = join(process.cwd(), '.codebase.json');\n\nconst _REPLACER = '-|||-';\n\nexport const REPLACERS = {\n code: [\n ['\\\\`', `${_REPLACER}w`],\n ['`', '\\\\`'],\n ['${', `$${_REPLACER}{`],\n ['\\\\s', `${_REPLACER}s`],\n ['\\\\w', `${_REPLACER}w`],\n ],\n init: [\n [new RegExp('\\\\`', 'g'), '`'],\n [_REPLACER, ''],\n ],\n} as const;\n\nexport const PATH_KEY = '#bemedev/*';\nexport const JSON_FILE_NAME = '.bemedev.json';\n\nexport const PATH_PROPERTY = 'path';\nexport const FILES_PROPERTY = 'files';\n\nexport const PROPERTIES = {\n PATH: 'path',\n FILES: 'files',\n CODEBASE_ANALYSIS: 'CODEBASE_ANALYSIS',\n STATS: 'STATS',\n} as const;\n"],"mappings":";;AAEA,MAAa,UAAU,KAAK,QAAQ,KAAK,EAAE,MAAM;AACjD,MAAa,gBAAgB,KAAK,QAAQ,KAAK,EAAE,iBAAiB;AAElE,MAAM,YAAY;AAElB,MAAa,YAAY;CACvB,MAAM;EACJ,CAAC,OAAO,GAAG,UAAU,GAAG;EACxB,CAAC,KAAK,MAAM;EACZ,CAAC,MAAM,IAAI,UAAU,GAAG;EACxB,CAAC,OAAO,GAAG,UAAU,GAAG;EACxB,CAAC,OAAO,GAAG,UAAU,GAAG;EACzB;CACD,MAAM,CACJ,iBAAC,IAAI,OAAO,OAAO,IAAI,EAAE,IAAI,EAC7B,CAAC,WAAW,GAAG,CAChB;CACF;AAED,MAAa,WAAW;AACxB,MAAa,iBAAiB;AAE9B,MAAa,gBAAgB;AAC7B,MAAa,iBAAiB;AAE9B,MAAa,aAAa;CACxB,MAAM;CACN,OAAO;CACP,mBAAmB;CACnB,OAAO;CACR"}
|
package/lib/exports.cjs
CHANGED
|
@@ -1,75 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let ts_morph = require("ts-morph");
|
|
4
|
+
//#region src/exports.ts
|
|
5
5
|
const analyzeExports = (sourceFile) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
else if (decl.getKind() === tsMorph.SyntaxKind.InterfaceDeclaration) {
|
|
52
|
-
declarationKind = 'interface';
|
|
53
|
-
}
|
|
54
|
-
else if (decl.getKind() === tsMorph.SyntaxKind.TypeAliasDeclaration) {
|
|
55
|
-
declarationKind = 'type';
|
|
56
|
-
}
|
|
57
|
-
else if (decl.getKind() === tsMorph.SyntaxKind.VariableDeclaration) {
|
|
58
|
-
declarationKind = 'variable';
|
|
59
|
-
}
|
|
60
|
-
else if (decl.getKind() === tsMorph.SyntaxKind.EnumDeclaration) {
|
|
61
|
-
declarationKind = 'enum';
|
|
62
|
-
}
|
|
63
|
-
exports$1.push({
|
|
64
|
-
name,
|
|
65
|
-
kind: name === 'default' ? 'default' : 'named',
|
|
66
|
-
text: decl.getText(),
|
|
67
|
-
declarationKind,
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
return exports$1;
|
|
6
|
+
const exports = [];
|
|
7
|
+
sourceFile.getExportDeclarations().forEach((exportDecl) => {
|
|
8
|
+
const moduleSpecifier = exportDecl.getModuleSpecifierValue();
|
|
9
|
+
const exportText = exportDecl.getText();
|
|
10
|
+
exportDecl.getNamedExports().forEach((namedExport) => {
|
|
11
|
+
exports.push({
|
|
12
|
+
name: namedExport.getName(),
|
|
13
|
+
kind: "named",
|
|
14
|
+
text: exportText,
|
|
15
|
+
moduleSpecifier
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
if (exportDecl.isNamespaceExport()) exports.push({
|
|
19
|
+
name: "*",
|
|
20
|
+
kind: "namespace",
|
|
21
|
+
text: exportText,
|
|
22
|
+
moduleSpecifier
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
sourceFile.getExportAssignments().forEach((exportAssignment) => {
|
|
26
|
+
if (exportAssignment.isExportEquals()) exports.push({
|
|
27
|
+
name: "default",
|
|
28
|
+
kind: "default",
|
|
29
|
+
text: exportAssignment.getText()
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
sourceFile.getExportedDeclarations().forEach((declarations, name) => {
|
|
33
|
+
declarations.forEach((decl) => {
|
|
34
|
+
let declarationKind;
|
|
35
|
+
if (decl.getKind() === ts_morph.SyntaxKind.FunctionDeclaration) declarationKind = "function";
|
|
36
|
+
else if (decl.getKind() === ts_morph.SyntaxKind.ClassDeclaration) declarationKind = "class";
|
|
37
|
+
else if (decl.getKind() === ts_morph.SyntaxKind.InterfaceDeclaration) declarationKind = "interface";
|
|
38
|
+
else if (decl.getKind() === ts_morph.SyntaxKind.TypeAliasDeclaration) declarationKind = "type";
|
|
39
|
+
else if (decl.getKind() === ts_morph.SyntaxKind.VariableDeclaration) declarationKind = "variable";
|
|
40
|
+
else if (decl.getKind() === ts_morph.SyntaxKind.EnumDeclaration) declarationKind = "enum";
|
|
41
|
+
exports.push({
|
|
42
|
+
name,
|
|
43
|
+
kind: name === "default" ? "default" : "named",
|
|
44
|
+
text: decl.getText(),
|
|
45
|
+
declarationKind
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return exports;
|
|
72
50
|
};
|
|
73
|
-
|
|
51
|
+
//#endregion
|
|
74
52
|
exports.analyzeExports = analyzeExports;
|
|
75
|
-
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=exports.cjs.map
|
package/lib/exports.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.cjs","sources":["../src/exports.ts"],"sourcesContent":["import { SourceFile, SyntaxKind } from 'ts-morph';\nimport type { ExportInfo } from './schemas';\n\nexport const analyzeExports = (sourceFile: SourceFile) => {\n const exports: ExportInfo[] = [];\n\n // Export declarations (export ...)\n sourceFile.getExportDeclarations().forEach(exportDecl => {\n const moduleSpecifier = exportDecl.getModuleSpecifierValue();\n const exportText = exportDecl.getText();\n\n // Named exports\n const namedExports = exportDecl.getNamedExports();\n namedExports.forEach(namedExport => {\n exports.push({\n name: namedExport.getName(),\n kind: 'named',\n text: exportText,\n moduleSpecifier,\n });\n });\n\n // Namespace export (export * from '...')\n if (exportDecl.isNamespaceExport()) {\n exports.push({\n name: '*',\n kind: 'namespace',\n text: exportText,\n moduleSpecifier,\n });\n }\n });\n\n // Export assignments (export = ...)\n sourceFile.getExportAssignments().forEach(exportAssignment => {\n if (exportAssignment.isExportEquals()) {\n exports.push({\n name: 'default',\n kind: 'default',\n text: exportAssignment.getText(),\n });\n }\n });\n\n // Exported declarations (export function, export class, etc.)\n sourceFile.getExportedDeclarations().forEach((declarations, name) => {\n declarations.forEach(decl => {\n let declarationKind: ExportInfo['declarationKind'];\n\n if (decl.getKind() === SyntaxKind.FunctionDeclaration) {\n declarationKind = 'function';\n } else if (decl.getKind() === SyntaxKind.ClassDeclaration) {\n declarationKind = 'class';\n } else if (decl.getKind() === SyntaxKind.InterfaceDeclaration) {\n declarationKind = 'interface';\n } else if (decl.getKind() === SyntaxKind.TypeAliasDeclaration) {\n declarationKind = 'type';\n } else if (decl.getKind() === SyntaxKind.VariableDeclaration) {\n declarationKind = 'variable';\n } else if (decl.getKind() === SyntaxKind.EnumDeclaration) {\n declarationKind = 'enum';\n }\n\n exports.push({\n name,\n kind: name === 'default' ? 'default' : 'named',\n text: decl.getText(),\n declarationKind,\n });\n });\n });\n\n return exports;\n};\n"],"
|
|
1
|
+
{"version":3,"file":"exports.cjs","names":["SyntaxKind"],"sources":["../src/exports.ts"],"sourcesContent":["import { SourceFile, SyntaxKind } from 'ts-morph';\nimport type { ExportInfo } from './schemas';\n\nexport const analyzeExports = (sourceFile: SourceFile) => {\n const exports: ExportInfo[] = [];\n\n // Export declarations (export ...)\n sourceFile.getExportDeclarations().forEach(exportDecl => {\n const moduleSpecifier = exportDecl.getModuleSpecifierValue();\n const exportText = exportDecl.getText();\n\n // Named exports\n const namedExports = exportDecl.getNamedExports();\n namedExports.forEach(namedExport => {\n exports.push({\n name: namedExport.getName(),\n kind: 'named',\n text: exportText,\n moduleSpecifier,\n });\n });\n\n // Namespace export (export * from '...')\n if (exportDecl.isNamespaceExport()) {\n exports.push({\n name: '*',\n kind: 'namespace',\n text: exportText,\n moduleSpecifier,\n });\n }\n });\n\n // Export assignments (export = ...)\n sourceFile.getExportAssignments().forEach(exportAssignment => {\n if (exportAssignment.isExportEquals()) {\n exports.push({\n name: 'default',\n kind: 'default',\n text: exportAssignment.getText(),\n });\n }\n });\n\n // Exported declarations (export function, export class, etc.)\n sourceFile.getExportedDeclarations().forEach((declarations, name) => {\n declarations.forEach(decl => {\n let declarationKind: ExportInfo['declarationKind'];\n\n if (decl.getKind() === SyntaxKind.FunctionDeclaration) {\n declarationKind = 'function';\n } else if (decl.getKind() === SyntaxKind.ClassDeclaration) {\n declarationKind = 'class';\n } else if (decl.getKind() === SyntaxKind.InterfaceDeclaration) {\n declarationKind = 'interface';\n } else if (decl.getKind() === SyntaxKind.TypeAliasDeclaration) {\n declarationKind = 'type';\n } else if (decl.getKind() === SyntaxKind.VariableDeclaration) {\n declarationKind = 'variable';\n } else if (decl.getKind() === SyntaxKind.EnumDeclaration) {\n declarationKind = 'enum';\n }\n\n exports.push({\n name,\n kind: name === 'default' ? 'default' : 'named',\n text: decl.getText(),\n declarationKind,\n });\n });\n });\n\n return exports;\n};\n"],"mappings":";;;;AAGA,MAAa,kBAAkB,eAA2B;CACxD,MAAM,UAAwB,EAAE;AAGhC,YAAW,uBAAuB,CAAC,SAAQ,eAAc;EACvD,MAAM,kBAAkB,WAAW,yBAAyB;EAC5D,MAAM,aAAa,WAAW,SAAS;AAGlB,aAAW,iBAAiB,CACpC,SAAQ,gBAAe;AAClC,WAAQ,KAAK;IACX,MAAM,YAAY,SAAS;IAC3B,MAAM;IACN,MAAM;IACN;IACD,CAAC;IACF;AAGF,MAAI,WAAW,mBAAmB,CAChC,SAAQ,KAAK;GACX,MAAM;GACN,MAAM;GACN,MAAM;GACN;GACD,CAAC;GAEJ;AAGF,YAAW,sBAAsB,CAAC,SAAQ,qBAAoB;AAC5D,MAAI,iBAAiB,gBAAgB,CACnC,SAAQ,KAAK;GACX,MAAM;GACN,MAAM;GACN,MAAM,iBAAiB,SAAS;GACjC,CAAC;GAEJ;AAGF,YAAW,yBAAyB,CAAC,SAAS,cAAc,SAAS;AACnE,eAAa,SAAQ,SAAQ;GAC3B,IAAI;AAEJ,OAAI,KAAK,SAAS,KAAKA,SAAAA,WAAW,oBAChC,mBAAkB;YACT,KAAK,SAAS,KAAKA,SAAAA,WAAW,iBACvC,mBAAkB;YACT,KAAK,SAAS,KAAKA,SAAAA,WAAW,qBACvC,mBAAkB;YACT,KAAK,SAAS,KAAKA,SAAAA,WAAW,qBACvC,mBAAkB;YACT,KAAK,SAAS,KAAKA,SAAAA,WAAW,oBACvC,mBAAkB;YACT,KAAK,SAAS,KAAKA,SAAAA,WAAW,gBACvC,mBAAkB;AAGpB,WAAQ,KAAK;IACX;IACA,MAAM,SAAS,YAAY,YAAY;IACvC,MAAM,KAAK,SAAS;IACpB;IACD,CAAC;IACF;GACF;AAEF,QAAO"}
|
package/lib/exports.d.ts
CHANGED
|
@@ -4,6 +4,5 @@ export declare const analyzeExports: (sourceFile: SourceFile) => {
|
|
|
4
4
|
kind: "default" | "named" | "namespace";
|
|
5
5
|
text?: string | undefined;
|
|
6
6
|
moduleSpecifier?: string | undefined;
|
|
7
|
-
declarationKind?: "function" | "
|
|
7
|
+
declarationKind?: "function" | "class" | "variable" | "interface" | "type" | "enum" | "const" | "let" | undefined;
|
|
8
8
|
}[];
|
|
9
|
-
//# sourceMappingURL=exports.d.ts.map
|
package/lib/exports.js
CHANGED
|
@@ -1,73 +1,52 @@
|
|
|
1
|
-
import { SyntaxKind } from
|
|
2
|
-
|
|
1
|
+
import { SyntaxKind } from "ts-morph";
|
|
2
|
+
//#region src/exports.ts
|
|
3
3
|
const analyzeExports = (sourceFile) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
else if (decl.getKind() === SyntaxKind.InterfaceDeclaration) {
|
|
50
|
-
declarationKind = 'interface';
|
|
51
|
-
}
|
|
52
|
-
else if (decl.getKind() === SyntaxKind.TypeAliasDeclaration) {
|
|
53
|
-
declarationKind = 'type';
|
|
54
|
-
}
|
|
55
|
-
else if (decl.getKind() === SyntaxKind.VariableDeclaration) {
|
|
56
|
-
declarationKind = 'variable';
|
|
57
|
-
}
|
|
58
|
-
else if (decl.getKind() === SyntaxKind.EnumDeclaration) {
|
|
59
|
-
declarationKind = 'enum';
|
|
60
|
-
}
|
|
61
|
-
exports$1.push({
|
|
62
|
-
name,
|
|
63
|
-
kind: name === 'default' ? 'default' : 'named',
|
|
64
|
-
text: decl.getText(),
|
|
65
|
-
declarationKind,
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
return exports$1;
|
|
4
|
+
const exports = [];
|
|
5
|
+
sourceFile.getExportDeclarations().forEach((exportDecl) => {
|
|
6
|
+
const moduleSpecifier = exportDecl.getModuleSpecifierValue();
|
|
7
|
+
const exportText = exportDecl.getText();
|
|
8
|
+
exportDecl.getNamedExports().forEach((namedExport) => {
|
|
9
|
+
exports.push({
|
|
10
|
+
name: namedExport.getName(),
|
|
11
|
+
kind: "named",
|
|
12
|
+
text: exportText,
|
|
13
|
+
moduleSpecifier
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
if (exportDecl.isNamespaceExport()) exports.push({
|
|
17
|
+
name: "*",
|
|
18
|
+
kind: "namespace",
|
|
19
|
+
text: exportText,
|
|
20
|
+
moduleSpecifier
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
sourceFile.getExportAssignments().forEach((exportAssignment) => {
|
|
24
|
+
if (exportAssignment.isExportEquals()) exports.push({
|
|
25
|
+
name: "default",
|
|
26
|
+
kind: "default",
|
|
27
|
+
text: exportAssignment.getText()
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
sourceFile.getExportedDeclarations().forEach((declarations, name) => {
|
|
31
|
+
declarations.forEach((decl) => {
|
|
32
|
+
let declarationKind;
|
|
33
|
+
if (decl.getKind() === SyntaxKind.FunctionDeclaration) declarationKind = "function";
|
|
34
|
+
else if (decl.getKind() === SyntaxKind.ClassDeclaration) declarationKind = "class";
|
|
35
|
+
else if (decl.getKind() === SyntaxKind.InterfaceDeclaration) declarationKind = "interface";
|
|
36
|
+
else if (decl.getKind() === SyntaxKind.TypeAliasDeclaration) declarationKind = "type";
|
|
37
|
+
else if (decl.getKind() === SyntaxKind.VariableDeclaration) declarationKind = "variable";
|
|
38
|
+
else if (decl.getKind() === SyntaxKind.EnumDeclaration) declarationKind = "enum";
|
|
39
|
+
exports.push({
|
|
40
|
+
name,
|
|
41
|
+
kind: name === "default" ? "default" : "named",
|
|
42
|
+
text: decl.getText(),
|
|
43
|
+
declarationKind
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
return exports;
|
|
70
48
|
};
|
|
71
|
-
|
|
49
|
+
//#endregion
|
|
72
50
|
export { analyzeExports };
|
|
73
|
-
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=exports.js.map
|
package/lib/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sources":["../src/exports.ts"],"sourcesContent":["import { SourceFile, SyntaxKind } from 'ts-morph';\nimport type { ExportInfo } from './schemas';\n\nexport const analyzeExports = (sourceFile: SourceFile) => {\n const exports: ExportInfo[] = [];\n\n // Export declarations (export ...)\n sourceFile.getExportDeclarations().forEach(exportDecl => {\n const moduleSpecifier = exportDecl.getModuleSpecifierValue();\n const exportText = exportDecl.getText();\n\n // Named exports\n const namedExports = exportDecl.getNamedExports();\n namedExports.forEach(namedExport => {\n exports.push({\n name: namedExport.getName(),\n kind: 'named',\n text: exportText,\n moduleSpecifier,\n });\n });\n\n // Namespace export (export * from '...')\n if (exportDecl.isNamespaceExport()) {\n exports.push({\n name: '*',\n kind: 'namespace',\n text: exportText,\n moduleSpecifier,\n });\n }\n });\n\n // Export assignments (export = ...)\n sourceFile.getExportAssignments().forEach(exportAssignment => {\n if (exportAssignment.isExportEquals()) {\n exports.push({\n name: 'default',\n kind: 'default',\n text: exportAssignment.getText(),\n });\n }\n });\n\n // Exported declarations (export function, export class, etc.)\n sourceFile.getExportedDeclarations().forEach((declarations, name) => {\n declarations.forEach(decl => {\n let declarationKind: ExportInfo['declarationKind'];\n\n if (decl.getKind() === SyntaxKind.FunctionDeclaration) {\n declarationKind = 'function';\n } else if (decl.getKind() === SyntaxKind.ClassDeclaration) {\n declarationKind = 'class';\n } else if (decl.getKind() === SyntaxKind.InterfaceDeclaration) {\n declarationKind = 'interface';\n } else if (decl.getKind() === SyntaxKind.TypeAliasDeclaration) {\n declarationKind = 'type';\n } else if (decl.getKind() === SyntaxKind.VariableDeclaration) {\n declarationKind = 'variable';\n } else if (decl.getKind() === SyntaxKind.EnumDeclaration) {\n declarationKind = 'enum';\n }\n\n exports.push({\n name,\n kind: name === 'default' ? 'default' : 'named',\n text: decl.getText(),\n declarationKind,\n });\n });\n });\n\n return exports;\n};\n"],"
|
|
1
|
+
{"version":3,"file":"exports.js","names":[],"sources":["../src/exports.ts"],"sourcesContent":["import { SourceFile, SyntaxKind } from 'ts-morph';\nimport type { ExportInfo } from './schemas';\n\nexport const analyzeExports = (sourceFile: SourceFile) => {\n const exports: ExportInfo[] = [];\n\n // Export declarations (export ...)\n sourceFile.getExportDeclarations().forEach(exportDecl => {\n const moduleSpecifier = exportDecl.getModuleSpecifierValue();\n const exportText = exportDecl.getText();\n\n // Named exports\n const namedExports = exportDecl.getNamedExports();\n namedExports.forEach(namedExport => {\n exports.push({\n name: namedExport.getName(),\n kind: 'named',\n text: exportText,\n moduleSpecifier,\n });\n });\n\n // Namespace export (export * from '...')\n if (exportDecl.isNamespaceExport()) {\n exports.push({\n name: '*',\n kind: 'namespace',\n text: exportText,\n moduleSpecifier,\n });\n }\n });\n\n // Export assignments (export = ...)\n sourceFile.getExportAssignments().forEach(exportAssignment => {\n if (exportAssignment.isExportEquals()) {\n exports.push({\n name: 'default',\n kind: 'default',\n text: exportAssignment.getText(),\n });\n }\n });\n\n // Exported declarations (export function, export class, etc.)\n sourceFile.getExportedDeclarations().forEach((declarations, name) => {\n declarations.forEach(decl => {\n let declarationKind: ExportInfo['declarationKind'];\n\n if (decl.getKind() === SyntaxKind.FunctionDeclaration) {\n declarationKind = 'function';\n } else if (decl.getKind() === SyntaxKind.ClassDeclaration) {\n declarationKind = 'class';\n } else if (decl.getKind() === SyntaxKind.InterfaceDeclaration) {\n declarationKind = 'interface';\n } else if (decl.getKind() === SyntaxKind.TypeAliasDeclaration) {\n declarationKind = 'type';\n } else if (decl.getKind() === SyntaxKind.VariableDeclaration) {\n declarationKind = 'variable';\n } else if (decl.getKind() === SyntaxKind.EnumDeclaration) {\n declarationKind = 'enum';\n }\n\n exports.push({\n name,\n kind: name === 'default' ? 'default' : 'named',\n text: decl.getText(),\n declarationKind,\n });\n });\n });\n\n return exports;\n};\n"],"mappings":";;AAGA,MAAa,kBAAkB,eAA2B;CACxD,MAAM,UAAwB,EAAE;AAGhC,YAAW,uBAAuB,CAAC,SAAQ,eAAc;EACvD,MAAM,kBAAkB,WAAW,yBAAyB;EAC5D,MAAM,aAAa,WAAW,SAAS;AAGlB,aAAW,iBAAiB,CACpC,SAAQ,gBAAe;AAClC,WAAQ,KAAK;IACX,MAAM,YAAY,SAAS;IAC3B,MAAM;IACN,MAAM;IACN;IACD,CAAC;IACF;AAGF,MAAI,WAAW,mBAAmB,CAChC,SAAQ,KAAK;GACX,MAAM;GACN,MAAM;GACN,MAAM;GACN;GACD,CAAC;GAEJ;AAGF,YAAW,sBAAsB,CAAC,SAAQ,qBAAoB;AAC5D,MAAI,iBAAiB,gBAAgB,CACnC,SAAQ,KAAK;GACX,MAAM;GACN,MAAM;GACN,MAAM,iBAAiB,SAAS;GACjC,CAAC;GAEJ;AAGF,YAAW,yBAAyB,CAAC,SAAS,cAAc,SAAS;AACnE,eAAa,SAAQ,SAAQ;GAC3B,IAAI;AAEJ,OAAI,KAAK,SAAS,KAAK,WAAW,oBAChC,mBAAkB;YACT,KAAK,SAAS,KAAK,WAAW,iBACvC,mBAAkB;YACT,KAAK,SAAS,KAAK,WAAW,qBACvC,mBAAkB;YACT,KAAK,SAAS,KAAK,WAAW,qBACvC,mBAAkB;YACT,KAAK,SAAS,KAAK,WAAW,oBACvC,mBAAkB;YACT,KAAK,SAAS,KAAK,WAAW,gBACvC,mBAAkB;AAGpB,WAAQ,KAAK;IACX;IACA,MAAM,SAAS,YAAY,YAAY;IACvC,MAAM,KAAK,SAAS;IACpB;IACD,CAAC;IACF;GACF;AAEF,QAAO"}
|