prodex 2.0.1 → 2.1.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 +367 -146
- package/dist/app/dependency-source-provider.d.ts +2 -0
- package/dist/app/dependency-source-provider.js +66 -0
- package/dist/app/entry-resolver.d.ts +7 -0
- package/dist/app/entry-resolver.js +26 -0
- package/dist/app/execute-run.d.ts +2 -2
- package/dist/app/execute-run.js +138 -37
- package/dist/app/git-source-provider.d.ts +4 -0
- package/dist/app/git-source-provider.js +551 -0
- package/dist/app/grep-source-provider.d.ts +2 -0
- package/dist/app/grep-source-provider.js +226 -0
- package/dist/app/planner.d.ts +12 -0
- package/dist/app/planner.js +106 -0
- package/dist/app/planners/attachment-options.d.ts +2 -0
- package/dist/app/planners/attachment-options.js +39 -0
- package/dist/app/planners/git-plan.d.ts +13 -0
- package/dist/app/planners/git-plan.js +141 -0
- package/dist/app/planners/grep-plan.d.ts +13 -0
- package/dist/app/planners/grep-plan.js +115 -0
- package/dist/app/planners/list-utils.d.ts +1 -0
- package/dist/app/planners/list-utils.js +6 -0
- package/dist/app/planners/pack-plan.d.ts +13 -0
- package/dist/app/planners/pack-plan.js +65 -0
- package/dist/app/planners/scope-plan.d.ts +17 -0
- package/dist/app/planners/scope-plan.js +143 -0
- package/dist/app/planners/trace-plan.d.ts +13 -0
- package/dist/app/planners/trace-plan.js +77 -0
- package/dist/app/source-collector.d.ts +5 -0
- package/dist/app/source-collector.js +33 -0
- package/dist/app/target-resolver.d.ts +7 -0
- package/dist/app/target-resolver.js +110 -0
- package/dist/cli/cli-input.js +70 -19
- package/dist/cli/flag-specs.d.ts +7 -3
- package/dist/cli/flag-specs.js +58 -8
- package/dist/cli/help-specs.d.ts +205 -0
- package/dist/cli/help-specs.js +136 -0
- package/dist/cli/help.js +107 -28
- package/dist/cli/report-command.js +35 -23
- package/dist/commands/{run-command.d.ts → git-command.d.ts} +3 -3
- package/dist/commands/git-command.js +7 -0
- package/dist/commands/grep-command.d.ts +11 -0
- package/dist/commands/grep-command.js +7 -0
- package/dist/commands/pack-command.d.ts +11 -0
- package/dist/commands/pack-command.js +7 -0
- package/dist/commands/scope-command.d.ts +12 -0
- package/dist/commands/scope-command.js +7 -0
- package/dist/commands/shared-runner.d.ts +12 -0
- package/dist/commands/shared-runner.js +30 -0
- package/dist/commands/trace-command.d.ts +11 -0
- package/dist/commands/trace-command.js +7 -0
- package/dist/config/default-config.js +7 -11
- package/dist/config/load.d.ts +1 -0
- package/dist/config/load.js +269 -4
- package/dist/config/migration/detect.d.ts +2 -1
- package/dist/config/migration/detect.js +10 -2
- package/dist/config/migration/messages.js +12 -11
- package/dist/config/migration/transform.js +77 -32
- package/dist/filesystem/binary.d.ts +2 -0
- package/dist/filesystem/binary.js +30 -0
- package/dist/filesystem/entry-discovery.d.ts +14 -0
- package/dist/filesystem/entry-discovery.js +78 -0
- package/dist/filesystem/file-set.d.ts +7 -0
- package/dist/filesystem/file-set.js +57 -0
- package/dist/filesystem/glob-scan.d.ts +6 -2
- package/dist/filesystem/glob-scan.js +12 -7
- package/dist/filesystem/path-patterns.d.ts +20 -0
- package/dist/filesystem/path-patterns.js +70 -0
- package/dist/index.js +51 -29
- package/dist/output/markdown-sections.d.ts +5 -0
- package/dist/output/markdown-sections.js +103 -0
- package/dist/output/markdown-toc.d.ts +31 -0
- package/dist/output/markdown-toc.js +287 -0
- package/dist/output/markdown.d.ts +5 -8
- package/dist/output/markdown.js +80 -127
- package/dist/output/produce-output.d.ts +4 -1
- package/dist/output/produce-output.js +6 -7
- package/dist/output/render-helpers.d.ts +4 -0
- package/dist/output/render-helpers.js +14 -0
- package/dist/output/text.d.ts +2 -2
- package/dist/output/text.js +47 -8
- package/dist/resolvers/js/resolve-alias.js +10 -41
- package/dist/resolvers/php/bindings.js +6 -6
- package/dist/resolvers/php/extract-imports.d.ts +19 -7
- package/dist/resolvers/php/extract-imports.js +146 -26
- package/dist/resolvers/php/php-resolver.js +55 -24
- package/dist/resolvers/php/psr4.d.ts +1 -1
- package/dist/resolvers/php/psr4.js +7 -1
- package/dist/runtime/shell-command-runner.d.ts +5 -0
- package/dist/runtime/shell-command-runner.js +118 -0
- package/dist/tracing/collect-trace.d.ts +10 -0
- package/dist/tracing/collect-trace.js +23 -0
- package/dist/tracing/exclude.d.ts +0 -5
- package/dist/tracing/exclude.js +16 -12
- package/dist/tracing/follow-chain.js +2 -2
- package/dist/types/app.types.d.ts +37 -8
- package/dist/types/artifact.types.d.ts +50 -0
- package/dist/types/artifact.types.js +2 -0
- package/dist/types/cli.types.d.ts +52 -4
- package/dist/types/config.types.d.ts +37 -20
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/output.types.d.ts +12 -3
- package/dist/types/planner.types.d.ts +76 -0
- package/dist/types/planner.types.js +2 -0
- package/dist/types/resolver.types.d.ts +1 -1
- package/dist/types/tracing.types.d.ts +0 -11
- package/package.json +2 -2
- package/schema/prodex.schema.json +59 -41
- package/dist/app/run-plans.d.ts +0 -11
- package/dist/app/run-plans.js +0 -61
- package/dist/commands/profiles-command.d.ts +0 -6
- package/dist/commands/profiles-command.js +0 -16
- package/dist/commands/run-command.js +0 -17
- package/dist/config/build-config.d.ts +0 -13
- package/dist/config/build-config.js +0 -127
- package/dist/tracing/include-files.d.ts +0 -2
- package/dist/tracing/include-files.js +0 -36
- package/dist/tracing/trace-run.d.ts +0 -2
- package/dist/tracing/trace-run.js +0 -21
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
"definitions": {
|
|
5
5
|
"ProdexConfigFile": {
|
|
6
6
|
"type": "object",
|
|
7
|
-
"additionalProperties": false,
|
|
8
7
|
"properties": {
|
|
9
8
|
"$schema": {
|
|
10
9
|
"type": "string"
|
|
@@ -13,39 +12,40 @@
|
|
|
13
12
|
"type": "number"
|
|
14
13
|
},
|
|
15
14
|
"output": {
|
|
16
|
-
"$ref": "#/definitions/
|
|
15
|
+
"$ref": "#/definitions/ProdexConfigFileOutput"
|
|
17
16
|
},
|
|
18
|
-
"
|
|
17
|
+
"exclude": {
|
|
19
18
|
"type": "array",
|
|
20
19
|
"items": {
|
|
21
20
|
"type": "string"
|
|
22
21
|
}
|
|
23
22
|
},
|
|
24
|
-
"
|
|
25
|
-
"type": "
|
|
26
|
-
"
|
|
23
|
+
"aliases": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": {
|
|
27
26
|
"type": "string"
|
|
28
27
|
}
|
|
29
28
|
},
|
|
30
|
-
"
|
|
31
|
-
"type": "
|
|
32
|
-
"items": {
|
|
33
|
-
"type": "string"
|
|
34
|
-
}
|
|
29
|
+
"depth": {
|
|
30
|
+
"type": "number"
|
|
35
31
|
},
|
|
36
|
-
"
|
|
37
|
-
"
|
|
32
|
+
"maxFiles": {
|
|
33
|
+
"type": "number"
|
|
38
34
|
},
|
|
39
|
-
"
|
|
40
|
-
"
|
|
35
|
+
"scopes": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": {
|
|
38
|
+
"$ref": "#/definitions/ProdexScope"
|
|
39
|
+
}
|
|
41
40
|
}
|
|
42
41
|
},
|
|
43
42
|
"required": [
|
|
44
43
|
"$schema",
|
|
45
44
|
"version"
|
|
46
|
-
]
|
|
45
|
+
],
|
|
46
|
+
"additionalProperties": false
|
|
47
47
|
},
|
|
48
|
-
"
|
|
48
|
+
"ProdexConfigFileOutput": {
|
|
49
49
|
"type": "object",
|
|
50
50
|
"properties": {
|
|
51
51
|
"dir": {
|
|
@@ -64,52 +64,70 @@
|
|
|
64
64
|
},
|
|
65
65
|
"additionalProperties": false
|
|
66
66
|
},
|
|
67
|
-
"
|
|
67
|
+
"ProdexScope": {
|
|
68
68
|
"type": "object",
|
|
69
69
|
"properties": {
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"name": {
|
|
71
|
+
"type": "string"
|
|
72
72
|
},
|
|
73
|
-
"
|
|
74
|
-
"type": "
|
|
73
|
+
"entry": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"items": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
}
|
|
75
78
|
},
|
|
76
|
-
"
|
|
77
|
-
"type": "
|
|
79
|
+
"include": {
|
|
80
|
+
"type": "array",
|
|
81
|
+
"items": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"exclude": {
|
|
86
|
+
"type": "array",
|
|
87
|
+
"items": {
|
|
88
|
+
"type": "string"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"grep": {
|
|
92
|
+
"$ref": "#/definitions/ProdexGrepScopeConfig"
|
|
78
93
|
}
|
|
79
94
|
},
|
|
80
95
|
"additionalProperties": false
|
|
81
96
|
},
|
|
82
|
-
"
|
|
83
|
-
"type": "object",
|
|
84
|
-
"additionalProperties": {
|
|
85
|
-
"type": "string"
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"DeepPartial<indexed-type-731470504-74242-74263-731470504-74138-74264-731470504-0-218439<string,def-alias-184175265-335-446-184175265-0-743>>": {
|
|
89
|
-
"type": "object",
|
|
90
|
-
"additionalProperties": {
|
|
91
|
-
"$ref": "#/definitions/DeepPartial%3CProdexProfile%3E"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"DeepPartial<ProdexProfile>": {
|
|
97
|
+
"ProdexGrepScopeConfig": {
|
|
95
98
|
"type": "object",
|
|
96
99
|
"properties": {
|
|
97
|
-
"
|
|
100
|
+
"query": {
|
|
98
101
|
"type": "string"
|
|
99
102
|
},
|
|
100
|
-
"
|
|
103
|
+
"any": {
|
|
101
104
|
"type": "array",
|
|
102
105
|
"items": {
|
|
103
106
|
"type": "string"
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
|
-
"
|
|
109
|
+
"all": {
|
|
107
110
|
"type": "array",
|
|
108
111
|
"items": {
|
|
109
112
|
"type": "string"
|
|
110
113
|
}
|
|
111
114
|
},
|
|
112
|
-
"
|
|
115
|
+
"regex": {
|
|
116
|
+
"type": "string"
|
|
117
|
+
},
|
|
118
|
+
"not": {
|
|
119
|
+
"type": "array",
|
|
120
|
+
"items": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"within": {
|
|
125
|
+
"type": "array",
|
|
126
|
+
"items": {
|
|
127
|
+
"type": "string"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"skip": {
|
|
113
131
|
"type": "array",
|
|
114
132
|
"items": {
|
|
115
133
|
"type": "string"
|
package/dist/app/run-plans.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ProdexFlags, RunPlan } from "../types";
|
|
2
|
-
export interface CreateRunPlansResult {
|
|
3
|
-
plans: RunPlan[];
|
|
4
|
-
warnings: string[];
|
|
5
|
-
errors: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare function createRunPlans(params: {
|
|
8
|
-
rootArg?: string;
|
|
9
|
-
flags?: Partial<ProdexFlags>;
|
|
10
|
-
cwd?: string;
|
|
11
|
-
}): CreateRunPlansResult;
|
package/dist/app/run-plans.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRunPlans = createRunPlans;
|
|
4
|
-
const build_config_1 = require("../config/build-config");
|
|
5
|
-
const project_context_1 = require("./project-context");
|
|
6
|
-
function createRunPlans(params) {
|
|
7
|
-
const project = (0, project_context_1.loadProjectContext)(params.rootArg, params.cwd);
|
|
8
|
-
const warnings = [...project.warnings];
|
|
9
|
-
const errors = [...project.errors];
|
|
10
|
-
const flags = params.flags ?? {};
|
|
11
|
-
if (errors.length)
|
|
12
|
-
return { plans: [], warnings, errors };
|
|
13
|
-
const profileNames = resolveProfileNames(flags, project.config.profiles ?? {}, errors);
|
|
14
|
-
if (errors.length)
|
|
15
|
-
return { plans: [], warnings, errors };
|
|
16
|
-
const plans = [];
|
|
17
|
-
for (const profileName of profileNames.length ? profileNames : [undefined]) {
|
|
18
|
-
const runFlags = flagsForProfileRun(flags, profileName);
|
|
19
|
-
const built = (0, build_config_1.buildConfig)({
|
|
20
|
-
root: project.root,
|
|
21
|
-
userConfig: project.config,
|
|
22
|
-
flags: runFlags,
|
|
23
|
-
profileName,
|
|
24
|
-
});
|
|
25
|
-
warnings.push(...built.warnings);
|
|
26
|
-
errors.push(...built.errors);
|
|
27
|
-
if (!built.config)
|
|
28
|
-
continue;
|
|
29
|
-
plans.push({
|
|
30
|
-
root: project.root,
|
|
31
|
-
config: built.config,
|
|
32
|
-
flags: runFlags,
|
|
33
|
-
outputName: built.config.name,
|
|
34
|
-
profile: profileName,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return { plans, warnings, errors };
|
|
38
|
-
}
|
|
39
|
-
function resolveProfileNames(flags, profiles, errors) {
|
|
40
|
-
if (flags.allProfiles) {
|
|
41
|
-
const names = Object.keys(profiles);
|
|
42
|
-
if (!names.length)
|
|
43
|
-
errors.push("No profiles are defined in prodex.json.");
|
|
44
|
-
return names;
|
|
45
|
-
}
|
|
46
|
-
if (Array.isArray(flags.profiles) && flags.profiles.length)
|
|
47
|
-
return unique(flags.profiles);
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
function flagsForProfileRun(flags, profile) {
|
|
51
|
-
if (!profile)
|
|
52
|
-
return flags;
|
|
53
|
-
return {
|
|
54
|
-
...flags,
|
|
55
|
-
profiles: undefined,
|
|
56
|
-
allProfiles: false,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function unique(values) {
|
|
60
|
-
return [...new Set(values.map((value) => value.trim()).filter(Boolean))];
|
|
61
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.profilesCommand = profilesCommand;
|
|
4
|
-
const project_context_1 = require("../app/project-context");
|
|
5
|
-
function profilesCommand(rootArg, cwd = process.cwd()) {
|
|
6
|
-
const project = (0, project_context_1.loadProjectContext)(rootArg, cwd);
|
|
7
|
-
const warnings = [...project.warnings];
|
|
8
|
-
const errors = [...project.errors];
|
|
9
|
-
if (errors.length)
|
|
10
|
-
return { profiles: [], warnings, errors };
|
|
11
|
-
return {
|
|
12
|
-
profiles: Object.keys(project.config.profiles ?? {}).sort(),
|
|
13
|
-
warnings,
|
|
14
|
-
errors,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runCommand = runCommand;
|
|
4
|
-
const execute_run_1 = require("../app/execute-run");
|
|
5
|
-
const run_plans_1 = require("../app/run-plans");
|
|
6
|
-
async function runCommand(params) {
|
|
7
|
-
const planned = (0, run_plans_1.createRunPlans)(params);
|
|
8
|
-
const warnings = [...planned.warnings];
|
|
9
|
-
const errors = [...planned.errors];
|
|
10
|
-
if (errors.length)
|
|
11
|
-
return { runs: [], warnings, errors };
|
|
12
|
-
const runs = [];
|
|
13
|
-
for (const plan of planned.plans) {
|
|
14
|
-
runs.push(await (0, execute_run_1.executeRun)(plan));
|
|
15
|
-
}
|
|
16
|
-
return { runs, warnings, errors };
|
|
17
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DeepPartial, ProdexConfig, ProdexConfigFile, ProdexFlags } from "../types";
|
|
2
|
-
export interface ConfigBuildResult {
|
|
3
|
-
config?: ProdexConfig;
|
|
4
|
-
warnings: string[];
|
|
5
|
-
errors: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare function buildConfig(params: {
|
|
8
|
-
root: string;
|
|
9
|
-
userConfig: ProdexConfigFile;
|
|
10
|
-
flags?: Partial<ProdexFlags>;
|
|
11
|
-
profileName?: string;
|
|
12
|
-
}): ConfigBuildResult;
|
|
13
|
-
export declare function deepMerge<T extends Record<string, any>>(base: T, patch: DeepPartial<T>): T;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.buildConfig = buildConfig;
|
|
7
|
-
exports.deepMerge = deepMerge;
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const default_config_1 = require("./default-config");
|
|
10
|
-
const path_2 = require("../filesystem/path");
|
|
11
|
-
const string_list_1 = require("./string-list");
|
|
12
|
-
function buildConfig(params) {
|
|
13
|
-
const warnings = [];
|
|
14
|
-
const errors = [];
|
|
15
|
-
const base = deepMerge(default_config_1.DEFAULT_PRODEX_CONFIG, params.userConfig || {});
|
|
16
|
-
const profile = params.profileName ? base.profiles?.[params.profileName] : undefined;
|
|
17
|
-
if (params.profileName && !profile) {
|
|
18
|
-
errors.push(`Unknown profile "${params.profileName}".`);
|
|
19
|
-
return { warnings, errors };
|
|
20
|
-
}
|
|
21
|
-
const layered = applyProfileLayer(base, profile);
|
|
22
|
-
const config = toRuntimeConfig(layered, params.root, params.flags, profile, params.profileName);
|
|
23
|
-
normalizeRuntimeConfig(config, warnings);
|
|
24
|
-
validateRuntimeConfig(config, errors);
|
|
25
|
-
return { config, warnings, errors };
|
|
26
|
-
}
|
|
27
|
-
function applyProfileLayer(config, profile) {
|
|
28
|
-
if (!profile)
|
|
29
|
-
return config;
|
|
30
|
-
const patch = {};
|
|
31
|
-
if (profile.entry)
|
|
32
|
-
patch.entry = profile.entry;
|
|
33
|
-
if (profile.include)
|
|
34
|
-
patch.include = profile.include;
|
|
35
|
-
if (profile.exclude)
|
|
36
|
-
patch.exclude = profile.exclude;
|
|
37
|
-
return deepMerge(config, patch);
|
|
38
|
-
}
|
|
39
|
-
function toRuntimeConfig(fileConfig, root, flags, profile, profileName) {
|
|
40
|
-
const output = {
|
|
41
|
-
...default_config_1.DEFAULT_PRODEX_CONFIG.output,
|
|
42
|
-
...fileConfig.output,
|
|
43
|
-
};
|
|
44
|
-
const resolve = {
|
|
45
|
-
...default_config_1.DEFAULT_PRODEX_CONFIG.resolve,
|
|
46
|
-
...fileConfig.resolve,
|
|
47
|
-
};
|
|
48
|
-
const cfg = {
|
|
49
|
-
...fileConfig,
|
|
50
|
-
output,
|
|
51
|
-
resolve,
|
|
52
|
-
entry: fileConfig.entry ?? [],
|
|
53
|
-
include: fileConfig.include ?? [],
|
|
54
|
-
exclude: fileConfig.exclude ?? [],
|
|
55
|
-
profiles: fileConfig.profiles ?? {},
|
|
56
|
-
root,
|
|
57
|
-
name: flags?.name ?? profile?.name ?? profileName,
|
|
58
|
-
};
|
|
59
|
-
applyExplicitFlags(cfg, flags);
|
|
60
|
-
return cfg;
|
|
61
|
-
}
|
|
62
|
-
function applyExplicitFlags(cfg, flags) {
|
|
63
|
-
if (!flags)
|
|
64
|
-
return;
|
|
65
|
-
if (flags.format !== undefined)
|
|
66
|
-
cfg.output.format = flags.format;
|
|
67
|
-
if (flags.name !== undefined && flags.name !== null)
|
|
68
|
-
cfg.name = (0, path_2.sanitizeFileName)(flags.name);
|
|
69
|
-
if (flags.maxDepth !== undefined && flags.maxDepth !== null)
|
|
70
|
-
cfg.resolve.maxDepth = flags.maxDepth;
|
|
71
|
-
if (flags.maxFiles !== undefined && flags.maxFiles !== null)
|
|
72
|
-
cfg.resolve.maxFiles = flags.maxFiles;
|
|
73
|
-
if (flags.entry !== undefined)
|
|
74
|
-
cfg.entry = flags.entry;
|
|
75
|
-
if (flags.include !== undefined)
|
|
76
|
-
cfg.include = flags.include;
|
|
77
|
-
if (flags.exclude !== undefined)
|
|
78
|
-
cfg.exclude = flags.exclude;
|
|
79
|
-
}
|
|
80
|
-
function normalizeRuntimeConfig(cfg, warnings) {
|
|
81
|
-
cfg.root = path_1.default.resolve(cfg.root);
|
|
82
|
-
cfg.output.dir = (0, path_2.normalizePath)(String(cfg.output.dir || "prodex"));
|
|
83
|
-
cfg.name = cfg.name ? (0, path_2.sanitizeFileName)(String(cfg.name)) : undefined;
|
|
84
|
-
cfg.entry = normalizePatterns(cfg.entry, warnings, "entry");
|
|
85
|
-
cfg.include = normalizePatterns(cfg.include, warnings, "include");
|
|
86
|
-
cfg.exclude = normalizePatterns(cfg.exclude, warnings, "exclude");
|
|
87
|
-
cfg.resolve.aliases = cfg.resolve.aliases ?? {};
|
|
88
|
-
cfg.profiles = cfg.profiles ?? {};
|
|
89
|
-
}
|
|
90
|
-
function normalizePatterns(value, warnings, field) {
|
|
91
|
-
const normalized = [];
|
|
92
|
-
for (const item of (0, string_list_1.toStringList)(value))
|
|
93
|
-
normalized.push((0, path_2.normalizePath)(item));
|
|
94
|
-
if (!Array.isArray(value) && value !== undefined && typeof value !== "string") {
|
|
95
|
-
warnings.push(`${field} should be a string array; ignoring invalid value.`);
|
|
96
|
-
}
|
|
97
|
-
return normalized;
|
|
98
|
-
}
|
|
99
|
-
function validateRuntimeConfig(cfg, errors) {
|
|
100
|
-
if (!["md", "txt"].includes(cfg.output.format)) {
|
|
101
|
-
errors.push(`output.format must be "md" or "txt".`);
|
|
102
|
-
}
|
|
103
|
-
if (!Number.isFinite(cfg.resolve.maxDepth) || cfg.resolve.maxDepth < 0) {
|
|
104
|
-
errors.push("resolve.maxDepth must be a non-negative number.");
|
|
105
|
-
}
|
|
106
|
-
if (!Number.isFinite(cfg.resolve.maxFiles) || cfg.resolve.maxFiles < 0) {
|
|
107
|
-
errors.push("resolve.maxFiles must be a non-negative number.");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function deepMerge(base, patch) {
|
|
111
|
-
const out = Array.isArray(base) ? [...base] : { ...base };
|
|
112
|
-
for (const [key, value] of Object.entries(patch || {})) {
|
|
113
|
-
if (value === undefined)
|
|
114
|
-
continue;
|
|
115
|
-
const current = base[key];
|
|
116
|
-
if (Array.isArray(value))
|
|
117
|
-
out[key] = [...value];
|
|
118
|
-
else if (isPlainObject(value) && isPlainObject(current))
|
|
119
|
-
out[key] = deepMerge(current, value);
|
|
120
|
-
else
|
|
121
|
-
out[key] = value;
|
|
122
|
-
}
|
|
123
|
-
return out;
|
|
124
|
-
}
|
|
125
|
-
function isPlainObject(value) {
|
|
126
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
127
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.applyIncludes = applyIncludes;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const glob_scan_1 = require("../filesystem/glob-scan");
|
|
10
|
-
const path_2 = require("../filesystem/path");
|
|
11
|
-
const trace_stats_1 = require("./trace-stats");
|
|
12
|
-
async function applyIncludes(cfg, files) {
|
|
13
|
-
const { include, root } = cfg;
|
|
14
|
-
const absoluteFiles = [];
|
|
15
|
-
const patterns = [];
|
|
16
|
-
for (const raw of include) {
|
|
17
|
-
const candidate = String(raw ?? "").trim();
|
|
18
|
-
if (!candidate)
|
|
19
|
-
continue;
|
|
20
|
-
const normalized = (0, path_2.normalizePath)(candidate);
|
|
21
|
-
if (path_1.default.isAbsolute(normalized)) {
|
|
22
|
-
try {
|
|
23
|
-
if (fs_1.default.statSync(normalized).isFile()) {
|
|
24
|
-
absoluteFiles.push(path_1.default.resolve(normalized));
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
// Treat unreadable absolute paths as glob patterns so include handling stays consistent.
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
patterns.push(normalized);
|
|
33
|
-
}
|
|
34
|
-
const scan = await (0, glob_scan_1.globScan)(patterns, { cwd: root });
|
|
35
|
-
return (0, trace_stats_1.unique)([...files, ...absoluteFiles, ...scan.files]);
|
|
36
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runTrace = runTrace;
|
|
4
|
-
const follow_chain_1 = require("./follow-chain");
|
|
5
|
-
const include_files_1 = require("./include-files");
|
|
6
|
-
const naming_1 = require("../output/naming");
|
|
7
|
-
const produce_output_1 = require("../output/produce-output");
|
|
8
|
-
async function runTrace({ cfg, opts }) {
|
|
9
|
-
const entries = opts.entries ?? [];
|
|
10
|
-
const result = entries.length ? await (0, follow_chain_1.followChain)(entries, cfg) : undefined;
|
|
11
|
-
const files = await (0, include_files_1.applyIncludes)(cfg, result?.files ?? []);
|
|
12
|
-
if (!files.length) {
|
|
13
|
-
return { entries, files: [], stats: result?.stats };
|
|
14
|
-
}
|
|
15
|
-
const outputPath = await (0, produce_output_1.produceOutput)({
|
|
16
|
-
name: opts.outputName ?? (0, naming_1.smartNaming)(entries),
|
|
17
|
-
files,
|
|
18
|
-
cfg,
|
|
19
|
-
});
|
|
20
|
-
return { outputPath, entries, files, stats: result?.stats };
|
|
21
|
-
}
|