depflow 3.0.0-dev.10 → 3.0.0-dev.12
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 +513 -117
- package/dist/builder/Builder.d.ts +279 -0
- package/dist/builder/Builder.js +391 -0
- package/dist/builder/Builder.js.map +1 -0
- package/dist/cli/Actions.d.ts +187 -0
- package/dist/cli/Actions.js +793 -0
- package/dist/cli/Actions.js.map +1 -0
- package/dist/cli/CLI.d.ts +170 -0
- package/dist/cli/CLI.js +231 -0
- package/dist/cli/CLI.js.map +1 -0
- package/dist/cli/DepflowCLI.d.ts +62 -0
- package/dist/cli/DepflowCLI.js +229 -0
- package/dist/cli/DepflowCLI.js.map +1 -0
- package/dist/cli/Flags.d.ts +106 -0
- package/dist/cli/Flags.js +125 -0
- package/dist/cli/Flags.js.map +1 -0
- package/dist/cli/bin.js +63 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/config/Config.d.ts +690 -0
- package/dist/config/Config.js +45 -0
- package/dist/config/Config.js.map +1 -0
- package/dist/config/ImportMap.d.ts +60 -0
- package/dist/config/ImportMap.js +66 -0
- package/dist/config/ImportMap.js.map +1 -0
- package/dist/config/JsonSchema.d.ts +12 -0
- package/dist/config/JsonSchema.js +26 -0
- package/dist/config/JsonSchema.js.map +1 -0
- package/dist/config/Settings.d.ts +201 -0
- package/dist/config/Settings.js +191 -0
- package/dist/config/Settings.js.map +1 -0
- package/dist/config/TSConfig.d.ts +73 -0
- package/dist/config/TSConfig.js +73 -0
- package/dist/config/TSConfig.js.map +1 -0
- package/dist/config/codecs/JsonCodec.d.ts +30 -0
- package/dist/config/codecs/JsonCodec.js +31 -0
- package/dist/config/codecs/JsonCodec.js.map +1 -0
- package/dist/config/codecs/YamlCodec.d.ts +62 -0
- package/dist/config/codecs/YamlCodec.js +89 -0
- package/dist/config/codecs/YamlCodec.js.map +1 -0
- package/dist/dependency/DepUtils.d.ts +78 -0
- package/dist/dependency/DepUtils.js +122 -0
- package/dist/dependency/DepUtils.js.map +1 -0
- package/dist/dependency/Dependency.d.ts +81 -0
- package/dist/dependency/Dependency.js +71 -0
- package/dist/dependency/Dependency.js.map +1 -0
- package/dist/dependency/Git.d.ts +75 -0
- package/dist/dependency/Git.js +97 -0
- package/dist/dependency/Git.js.map +1 -0
- package/dist/dependency/GitDependency.d.ts +30 -0
- package/dist/dependency/GitDependency.js +79 -0
- package/dist/dependency/GitDependency.js.map +1 -0
- package/dist/dependency/NpmDependency.d.ts +27 -0
- package/dist/dependency/NpmDependency.js +91 -0
- package/dist/dependency/NpmDependency.js.map +1 -0
- package/{build/support/PathResolver → dist/resolve}/AliasCompiler.d.ts +18 -5
- package/{build/support/PathResolver → dist/resolve}/AliasCompiler.js +31 -9
- package/dist/resolve/AliasCompiler.js.map +1 -0
- package/{build/support/PathResolver → dist/resolve}/PathResolver.d.ts +25 -8
- package/dist/resolve/PathResolver.js +133 -0
- package/dist/resolve/PathResolver.js.map +1 -0
- package/dist/resolve/PathRewriter.d.ts +24 -0
- package/{build/support/PathResolver → dist/resolve}/PathRewriter.js +21 -11
- package/dist/resolve/PathRewriter.js.map +1 -0
- package/{build → dist}/schema/Config/Builder.d.ts +114 -49
- package/dist/schema/Config/Builder.js +78 -0
- package/dist/schema/Config/Builder.js.map +1 -0
- package/{build → dist}/schema/Config/Config.d.ts +169 -78
- package/dist/schema/Config/Config.js +62 -0
- package/dist/schema/Config/Config.js.map +1 -0
- package/{build → dist}/schema/Config/Dependency.d.ts +219 -89
- package/dist/schema/Config/Dependency.js +80 -0
- package/dist/schema/Config/Dependency.js.map +1 -0
- package/{build → dist}/schema/Config/Extractor.d.ts +41 -17
- package/dist/schema/Config/Extractor.js +43 -0
- package/dist/schema/Config/Extractor.js.map +1 -0
- package/{build → dist}/schema/Config/Resolver.d.ts +25 -8
- package/dist/schema/Config/Resolver.js +43 -0
- package/dist/schema/Config/Resolver.js.map +1 -0
- package/{build → dist}/schema/Config/Transform.d.ts +22 -5
- package/dist/schema/Config/Transform.js +51 -0
- package/dist/schema/Config/Transform.js.map +1 -0
- package/dist/schema/Defaults.d.ts +20 -0
- package/dist/schema/Defaults.js +24 -0
- package/dist/schema/Defaults.js.map +1 -0
- package/dist/schema/ImportMap.d.ts +30 -0
- package/dist/schema/ImportMap.js +28 -0
- package/dist/schema/ImportMap.js.map +1 -0
- package/{build → dist}/schema/TSConfig.d.ts +23 -9
- package/dist/schema/TSConfig.js +39 -0
- package/dist/schema/TSConfig.js.map +1 -0
- package/{build → dist}/schema/schema.d.ts +11 -2
- package/{build → dist}/schema/schema.js +11 -2
- package/dist/schema/schema.js.map +1 -0
- package/dist/task/Command.d.ts +287 -0
- package/dist/task/Command.js +404 -0
- package/dist/task/Command.js.map +1 -0
- package/dist/task/Group.d.ts +15 -0
- package/dist/task/Group.js +29 -0
- package/dist/task/Group.js.map +1 -0
- package/dist/task/OutputPolicy.d.ts +262 -0
- package/dist/task/OutputPolicy.js +364 -0
- package/dist/task/OutputPolicy.js.map +1 -0
- package/dist/task/Task.d.ts +210 -0
- package/dist/task/Task.js +312 -0
- package/dist/task/Task.js.map +1 -0
- package/package.json +14 -10
- package/.gitignore +0 -7
- package/build/cli/DepFLowCLI.d.ts +0 -16
- package/build/cli/DepFLowCLI.js +0 -254
- package/build/cli/DepFLowCLI.js.map +0 -1
- package/build/cli/bin.js +0 -38
- package/build/cli/bin.js.map +0 -1
- package/build/config/Config.d.ts +0 -28
- package/build/config/Config.js +0 -46
- package/build/config/Config.js.map +0 -1
- package/build/config/ImportMap.d.ts +0 -51
- package/build/config/ImportMap.js +0 -97
- package/build/config/ImportMap.js.map +0 -1
- package/build/config/TSConfig.d.ts +0 -54
- package/build/config/TSConfig.js +0 -104
- package/build/config/TSConfig.js.map +0 -1
- package/build/schema/Config/Builder.js +0 -48
- package/build/schema/Config/Builder.js.map +0 -1
- package/build/schema/Config/Config.js +0 -20
- package/build/schema/Config/Config.js.map +0 -1
- package/build/schema/Config/Dependency.js +0 -25
- package/build/schema/Config/Dependency.js.map +0 -1
- package/build/schema/Config/Extractor.js +0 -25
- package/build/schema/Config/Extractor.js.map +0 -1
- package/build/schema/Config/Resolver.js +0 -25
- package/build/schema/Config/Resolver.js.map +0 -1
- package/build/schema/Config/Transform.js +0 -27
- package/build/schema/Config/Transform.js.map +0 -1
- package/build/schema/ImportMap.d.ts +0 -22
- package/build/schema/ImportMap.js +0 -12
- package/build/schema/ImportMap.js.map +0 -1
- package/build/schema/TSConfig.js +0 -19
- package/build/schema/TSConfig.js.map +0 -1
- package/build/schema/schema.js.map +0 -1
- package/build/support/Builder/Builder.d.ts +0 -46
- package/build/support/Builder/Builder.js +0 -116
- package/build/support/Builder/Builder.js.map +0 -1
- package/build/support/Dependency/Dependency.d.ts +0 -38
- package/build/support/Dependency/Dependency.js +0 -14
- package/build/support/Dependency/Dependency.js.map +0 -1
- package/build/support/Dependency/GitDependency.d.ts +0 -20
- package/build/support/Dependency/GitDependency.js +0 -67
- package/build/support/Dependency/GitDependency.js.map +0 -1
- package/build/support/Dependency/NpmDependency.d.ts +0 -18
- package/build/support/Dependency/NpmDependency.js +0 -65
- package/build/support/Dependency/NpmDependency.js.map +0 -1
- package/build/support/Git.d.ts +0 -53
- package/build/support/Git.js +0 -86
- package/build/support/Git.js.map +0 -1
- package/build/support/PathResolver/AliasCompiler.js.map +0 -1
- package/build/support/PathResolver/PathResolver.js +0 -105
- package/build/support/PathResolver/PathResolver.js.map +0 -1
- package/build/support/PathResolver/PathRewriter.d.ts +0 -18
- package/build/support/PathResolver/PathRewriter.js.map +0 -1
- package/build/support/PathResolver/Utils.d.ts +0 -36
- package/build/support/PathResolver/Utils.js +0 -45
- package/build/support/PathResolver/Utils.js.map +0 -1
- package/build/support/Task/Command.d.ts +0 -49
- package/build/support/Task/Command.js +0 -100
- package/build/support/Task/Command.js.map +0 -1
- package/build/support/Task/Task.d.ts +0 -84
- package/build/support/Task/Task.js +0 -145
- package/build/support/Task/Task.js.map +0 -1
- package/build/support/Utils.d.ts +0 -40
- package/build/support/Utils.js +0 -138
- package/build/support/Utils.js.map +0 -1
- package/build/support/Validator.d.ts +0 -22
- package/build/support/Validator.js +0 -28
- package/build/support/Validator.js.map +0 -1
- /package/{build → dist}/cli/bin.d.ts +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>.
|
|
3
|
+
* @description Schema definition for import map files: imports and scope mappings.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import Schema from '@netfeez/schema';
|
|
7
|
+
export declare const ImportMap: Schema<{
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly additional: true;
|
|
10
|
+
readonly default: {};
|
|
11
|
+
readonly keys: {
|
|
12
|
+
readonly imports: {
|
|
13
|
+
readonly type: "object";
|
|
14
|
+
readonly additional: true;
|
|
15
|
+
readonly default: {};
|
|
16
|
+
readonly description: "Mapping of bare specifiers to their resolved URLs or paths.";
|
|
17
|
+
};
|
|
18
|
+
readonly scopes: {
|
|
19
|
+
readonly type: "object";
|
|
20
|
+
readonly additional: true;
|
|
21
|
+
readonly default: {};
|
|
22
|
+
readonly description: "Scope-based mappings of bare specifiers to their resolved URLs or paths.";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
readonly description: "Structure of an import map file.";
|
|
26
|
+
}>;
|
|
27
|
+
export declare namespace ImportMap {
|
|
28
|
+
type Root = typeof ImportMap.infer;
|
|
29
|
+
}
|
|
30
|
+
export default ImportMap;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>.
|
|
3
|
+
* @description Schema definition for import map files: imports and scope mappings.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import Schema from '@netfeez/schema';
|
|
7
|
+
export const ImportMap = new Schema({
|
|
8
|
+
type: 'object',
|
|
9
|
+
additional: true,
|
|
10
|
+
default: {},
|
|
11
|
+
keys: {
|
|
12
|
+
imports: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
additional: true,
|
|
15
|
+
default: {},
|
|
16
|
+
description: 'Mapping of bare specifiers to their resolved URLs or paths.'
|
|
17
|
+
},
|
|
18
|
+
scopes: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
additional: true,
|
|
21
|
+
default: {},
|
|
22
|
+
description: 'Scope-based mappings of bare specifiers to their resolved URLs or paths.'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
description: 'Structure of an import map file.'
|
|
26
|
+
});
|
|
27
|
+
export default ImportMap;
|
|
28
|
+
//# sourceMappingURL=ImportMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportMap.js","sourceRoot":"","sources":["../../src/schema/ImportMap.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC;IAChC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,EAAE;IACX,IAAI,EAAE;QACF,OAAO,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,6DAA6D;SAC7E;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,0EAA0E;SAC1F;KACJ;IACD,WAAW,EAAE,kCAAkC;CAClD,CAAC,CAAC;AAMH,eAAe,SAAS,CAAC"}
|
|
@@ -1,51 +1,65 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>.
|
|
3
|
+
* @description Schema definitions for tsconfig files: compiler options and path mappings.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import Schema from '@netfeez/schema';
|
|
2
7
|
export declare const CompilerOptions: Schema<{
|
|
3
8
|
readonly type: "object";
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
9
|
+
readonly additional: true;
|
|
10
|
+
readonly keys: {
|
|
6
11
|
readonly rootDir: {
|
|
7
12
|
readonly type: "string";
|
|
13
|
+
readonly description: "Root directory of the TypeScript source files.";
|
|
8
14
|
};
|
|
9
15
|
readonly outDir: {
|
|
10
16
|
readonly type: "string";
|
|
17
|
+
readonly description: "Output directory for the compiled files.";
|
|
11
18
|
};
|
|
12
19
|
readonly paths: {
|
|
13
20
|
readonly type: "object";
|
|
14
|
-
readonly
|
|
21
|
+
readonly additional: {
|
|
15
22
|
readonly type: "array";
|
|
16
23
|
readonly items: {
|
|
17
24
|
readonly type: "string";
|
|
18
25
|
};
|
|
19
26
|
};
|
|
27
|
+
readonly description: "Path mapping aliases used by TypeScript to resolve modules.";
|
|
20
28
|
};
|
|
21
29
|
};
|
|
30
|
+
readonly description: "TypeScript compiler options.";
|
|
22
31
|
}>;
|
|
23
32
|
export declare const TSConfig: Schema<{
|
|
24
33
|
readonly type: "object";
|
|
25
|
-
readonly
|
|
26
|
-
readonly
|
|
34
|
+
readonly additional: true;
|
|
35
|
+
readonly keys: {
|
|
27
36
|
readonly compilerOptions: {
|
|
28
37
|
readonly type: "object";
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
38
|
+
readonly additional: true;
|
|
39
|
+
readonly keys: {
|
|
31
40
|
readonly rootDir: {
|
|
32
41
|
readonly type: "string";
|
|
42
|
+
readonly description: "Root directory of the TypeScript source files.";
|
|
33
43
|
};
|
|
34
44
|
readonly outDir: {
|
|
35
45
|
readonly type: "string";
|
|
46
|
+
readonly description: "Output directory for the compiled files.";
|
|
36
47
|
};
|
|
37
48
|
readonly paths: {
|
|
38
49
|
readonly type: "object";
|
|
39
|
-
readonly
|
|
50
|
+
readonly additional: {
|
|
40
51
|
readonly type: "array";
|
|
41
52
|
readonly items: {
|
|
42
53
|
readonly type: "string";
|
|
43
54
|
};
|
|
44
55
|
};
|
|
56
|
+
readonly description: "Path mapping aliases used by TypeScript to resolve modules.";
|
|
45
57
|
};
|
|
46
58
|
};
|
|
59
|
+
readonly description: "The compiler options object of the tsconfig file.";
|
|
47
60
|
};
|
|
48
61
|
};
|
|
62
|
+
readonly description: "Structure of a tsconfig.json file.";
|
|
49
63
|
}>;
|
|
50
64
|
export declare namespace TSConfig {
|
|
51
65
|
namespace Root {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>.
|
|
3
|
+
* @description Schema definitions for tsconfig files: compiler options and path mappings.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import Schema from '@netfeez/schema';
|
|
7
|
+
export const CompilerOptions = new Schema({
|
|
8
|
+
type: 'object',
|
|
9
|
+
additional: true,
|
|
10
|
+
keys: {
|
|
11
|
+
rootDir: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'Root directory of the TypeScript source files.'
|
|
14
|
+
},
|
|
15
|
+
outDir: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'Output directory for the compiled files.'
|
|
18
|
+
},
|
|
19
|
+
paths: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
additional: { type: 'array', items: { type: 'string' } },
|
|
22
|
+
description: 'Path mapping aliases used by TypeScript to resolve modules.'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
description: 'TypeScript compiler options.'
|
|
26
|
+
});
|
|
27
|
+
export const TSConfig = new Schema({
|
|
28
|
+
type: 'object',
|
|
29
|
+
additional: true,
|
|
30
|
+
keys: {
|
|
31
|
+
compilerOptions: {
|
|
32
|
+
...CompilerOptions.definition,
|
|
33
|
+
description: 'The compiler options object of the tsconfig file.'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
description: 'Structure of a tsconfig.json file.'
|
|
37
|
+
});
|
|
38
|
+
export default TSConfig;
|
|
39
|
+
//# sourceMappingURL=TSConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TSConfig.js","sourceRoot":"","sources":["../../src/schema/TSConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC;IACtC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE;QACF,OAAO,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,gDAAgD;SAChE;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,0CAA0C;SAC1D;QACD,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;YACxD,WAAW,EAAE,6DAA6D;SAC7E;KACJ;IACD,WAAW,EAAE,8BAA8B;CAC9C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC;IAC/B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE;QACF,eAAe,EAAE;YACb,GAAG,eAAe,CAAC,UAAU;YAC7B,WAAW,EAAE,mDAAmD;SACnE;KACJ;IACD,WAAW,EAAE,oCAAoC;CACpD,CAAC,CAAC;AASH,eAAe,QAAQ,CAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>.
|
|
3
|
+
* @description Aggregates every schema definition under the shared schema namespace.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
import _TSConfig from './TSConfig.js';
|
|
2
7
|
import _ImportMap from './ImportMap.js';
|
|
3
8
|
import _Config from './Config/Config.js';
|
|
4
9
|
import _Resolver, { Target as _Target } from './Config/Resolver.js';
|
|
5
10
|
import _Transform, { GlobalTransform as _GlobalTransform } from './Config/Transform.js';
|
|
6
11
|
import _Extractor from './Config/Extractor.js';
|
|
7
|
-
import _Builder from './Config/Builder.js';
|
|
12
|
+
import _Builder, { BuilderEntry as _BuilderEntry, RunEntry as _RunEntry, ExtractEntry as _ExtractEntry, TransformEntry as _TransformEntry } from './Config/Builder.js';
|
|
8
13
|
import _Dependency from './Config/Dependency.js';
|
|
9
14
|
export { TSConfig } from './TSConfig.js';
|
|
10
15
|
export { ImportMap } from './ImportMap.js';
|
|
@@ -12,7 +17,7 @@ export { Config } from './Config/Config.js';
|
|
|
12
17
|
export { Resolver, Target } from './Config/Resolver.js';
|
|
13
18
|
export { Transform, GlobalTransform } from './Config/Transform.js';
|
|
14
19
|
export { Extractor } from './Config/Extractor.js';
|
|
15
|
-
export { Builder } from './Config/Builder.js';
|
|
20
|
+
export { Builder, BuilderEntry, RunEntry, ExtractEntry, TransformEntry } from './Config/Builder.js';
|
|
16
21
|
export { Dependency } from './Config/Dependency.js';
|
|
17
22
|
export declare namespace schema {
|
|
18
23
|
export import TSConfig = _TSConfig;
|
|
@@ -24,6 +29,10 @@ export declare namespace schema {
|
|
|
24
29
|
export import GlobalTransform = _GlobalTransform;
|
|
25
30
|
export import Extractor = _Extractor;
|
|
26
31
|
export import Builder = _Builder;
|
|
32
|
+
export import BuilderEntry = _BuilderEntry;
|
|
33
|
+
export import RunEntry = _RunEntry;
|
|
34
|
+
export import ExtractEntry = _ExtractEntry;
|
|
35
|
+
export import TransformEntry = _TransformEntry;
|
|
27
36
|
export import Dependency = _Dependency;
|
|
28
37
|
}
|
|
29
38
|
export default schema;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>.
|
|
3
|
+
* @description Aggregates every schema definition under the shared schema namespace.
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
1
6
|
import _TSConfig from './TSConfig.js';
|
|
2
7
|
import _ImportMap from './ImportMap.js';
|
|
3
8
|
import _Config from './Config/Config.js';
|
|
4
9
|
import _Resolver, { Target as _Target } from './Config/Resolver.js';
|
|
5
10
|
import _Transform, { GlobalTransform as _GlobalTransform } from './Config/Transform.js';
|
|
6
11
|
import _Extractor from './Config/Extractor.js';
|
|
7
|
-
import _Builder from './Config/Builder.js';
|
|
12
|
+
import _Builder, { BuilderEntry as _BuilderEntry, RunEntry as _RunEntry, ExtractEntry as _ExtractEntry, TransformEntry as _TransformEntry } from './Config/Builder.js';
|
|
8
13
|
import _Dependency from './Config/Dependency.js';
|
|
9
14
|
export { TSConfig } from './TSConfig.js';
|
|
10
15
|
export { ImportMap } from './ImportMap.js';
|
|
@@ -12,7 +17,7 @@ export { Config } from './Config/Config.js';
|
|
|
12
17
|
export { Resolver, Target } from './Config/Resolver.js';
|
|
13
18
|
export { Transform, GlobalTransform } from './Config/Transform.js';
|
|
14
19
|
export { Extractor } from './Config/Extractor.js';
|
|
15
|
-
export { Builder } from './Config/Builder.js';
|
|
20
|
+
export { Builder, BuilderEntry, RunEntry, ExtractEntry, TransformEntry } from './Config/Builder.js';
|
|
16
21
|
export { Dependency } from './Config/Dependency.js';
|
|
17
22
|
export var schema;
|
|
18
23
|
(function (schema) {
|
|
@@ -25,6 +30,10 @@ export var schema;
|
|
|
25
30
|
schema.GlobalTransform = _GlobalTransform;
|
|
26
31
|
schema.Extractor = _Extractor;
|
|
27
32
|
schema.Builder = _Builder;
|
|
33
|
+
schema.BuilderEntry = _BuilderEntry;
|
|
34
|
+
schema.RunEntry = _RunEntry;
|
|
35
|
+
schema.ExtractEntry = _ExtractEntry;
|
|
36
|
+
schema.TransformEntry = _TransformEntry;
|
|
28
37
|
schema.Dependency = _Dependency;
|
|
29
38
|
})(schema || (schema = {}));
|
|
30
39
|
export default schema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,SAAS,MAAM,eAAe,CAAC;AACtC,OAAO,UAAU,MAAM,gBAAgB,CAAC;AACxC,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,SAAS,EAAE,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,UAAU,EAAE,EAAE,eAAe,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,QAAQ,EAAE,EACb,YAAY,IAAI,aAAa,EAC7B,QAAQ,IAAI,SAAS,EACrB,YAAY,IAAI,aAAa,EAC7B,cAAc,IAAI,eAAe,EACpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,WAAW,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,KAAW,MAAM,CAetB;AAfD,WAAiB,MAAM;IACL,OAAA,QAAQ,GAAG,SAAU,CAAA;IACrB,OAAA,SAAS,GAAG,UAAW,CAAA;IACvB,OAAA,MAAM,GAAG,OAAQ,CAAA;IACjB,OAAA,QAAQ,GAAG,SAAU,CAAA;IACrB,OAAA,MAAM,GAAG,OAAQ,CAAA;IACjB,OAAA,SAAS,GAAG,UAAW,CAAA;IACvB,OAAA,eAAe,GAAG,gBAAiB,CAAA;IACnC,OAAA,SAAS,GAAG,UAAW,CAAA;IACvB,OAAA,OAAO,GAAG,QAAS,CAAA;IACnB,OAAA,YAAY,GAAG,aAAc,CAAA;IAC7B,OAAA,QAAQ,GAAG,SAAU,CAAA;IACrB,OAAA,YAAY,GAAG,aAAc,CAAA;IAC7B,OAAA,cAAc,GAAG,eAAgB,CAAA;IACjC,OAAA,UAAU,GAAG,WAAY,CAAA;AAC3C,CAAC,EAfgB,MAAM,KAAN,MAAM,QAetB;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author NetFeez <netfeez.dev@gmail.com>.
|
|
3
|
+
* @description Runs one instruction, as a script in a shared shell or as its own process, streaming its
|
|
4
|
+
* output and settling exactly one verdict for it.
|
|
5
|
+
* @license Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
import { ChildProcessWithoutNullStreams } from "node:child_process";
|
|
8
|
+
import { Events } from "@netfeez/common";
|
|
9
|
+
export declare class Command extends Events<Command.EventMap> {
|
|
10
|
+
/**
|
|
11
|
+
* Monotonic source of the markers written into the shell, so two commands executed in the same
|
|
12
|
+
* millisecond can never share one, and a marker can never be replayed by a later command.
|
|
13
|
+
*/
|
|
14
|
+
private static vToken;
|
|
15
|
+
/**
|
|
16
|
+
* The shells already read by a command, so the reader of a shell shared by the instructions of a
|
|
17
|
+
* task is attached once instead of once per instruction.
|
|
18
|
+
*/
|
|
19
|
+
private static vShells;
|
|
20
|
+
protected readonly mode: Command.Mode;
|
|
21
|
+
protected readonly shell: Command.Shell | null;
|
|
22
|
+
protected readonly script: string;
|
|
23
|
+
protected readonly program: Command.Program;
|
|
24
|
+
/** The sentinel the shell writes once the instruction finished, carrying its exit status. */
|
|
25
|
+
protected readonly marker: string;
|
|
26
|
+
protected child: Command.Process | null;
|
|
27
|
+
protected settled: boolean;
|
|
28
|
+
protected startedAt: number;
|
|
29
|
+
protected output: string;
|
|
30
|
+
protected errors: string;
|
|
31
|
+
protected outputCursor: number;
|
|
32
|
+
protected errorsCursor: number;
|
|
33
|
+
private vOrdinal;
|
|
34
|
+
private constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Creates a command that runs a script in an already running shell.
|
|
37
|
+
* @param shell - The shell the script is written to, or `null` when the shell of the task is gone.
|
|
38
|
+
* @param script - The shell script to run.
|
|
39
|
+
* @returns The command, not yet started.
|
|
40
|
+
*
|
|
41
|
+
* @remarks The shell is not owned by the command: it outlives it, so the death of a command is
|
|
42
|
+
* never the death of the shell, and a shell that dies is reported by the task that owns it. A
|
|
43
|
+
* command with no shell fails as soon as it runs, instead of waiting for output that can never
|
|
44
|
+
* come.
|
|
45
|
+
*
|
|
46
|
+
* @remarks The ordinal travels with every line the command emits, so the task never has to invent
|
|
47
|
+
* which of its instructions a line belongs to.
|
|
48
|
+
*
|
|
49
|
+
* @param ordinal - The position of the instruction inside its task, starting at 1.
|
|
50
|
+
*/
|
|
51
|
+
static inShell(shell: Command.Shell | null, script: string, ordinal?: number): Command;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a command that runs a program in a process of its own, where nothing in the arguments
|
|
54
|
+
* nor in the working directory can be reinterpreted by a shell.
|
|
55
|
+
* @param program - The program to run.
|
|
56
|
+
* @param ordinal - The position of the instruction inside its task, starting at 1.
|
|
57
|
+
* @returns The command, not yet started.
|
|
58
|
+
*/
|
|
59
|
+
static asProgram(program: Command.Program, ordinal?: number): Command;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a shell for running scripts, started in the given working directory.
|
|
62
|
+
* @param cwd - The working directory the shell is started in, so a script never needs to `cd` into
|
|
63
|
+
* the folder the task belongs to reach it.
|
|
64
|
+
* @returns The shell process.
|
|
65
|
+
*
|
|
66
|
+
* @remarks The shell leads its own process group where the platform allows it, so the task owning
|
|
67
|
+
* it can take down the whole tree of processes a script left behind. It holds the event loop while
|
|
68
|
+
* the task runs, and the task releases it when it is done, so a task in flight is never cut short.
|
|
69
|
+
*
|
|
70
|
+
* @remarks The arguments of the shell are its own, never a string to be interpreted: `cmd.exe` is
|
|
71
|
+
* started quiet (`/Q`) and without the autorun registry entries (`/D`), so it neither greets itself
|
|
72
|
+
* nor echoes the orders it is given. The greeting a shell still writes is dropped by
|
|
73
|
+
* {@link Command.prepare}.
|
|
74
|
+
*/
|
|
75
|
+
static createShell(cwd: string): Command.Shell;
|
|
76
|
+
/**
|
|
77
|
+
* Silences a shell and waits until it answers, so nothing the shell says about itself is ever read as
|
|
78
|
+
* the output of an instruction.
|
|
79
|
+
* @param shell - The shell to prepare, the one {@link Command.createShell} started.
|
|
80
|
+
* @returns A promise resolving once the shell reported itself ready, or once it is gone.
|
|
81
|
+
*
|
|
82
|
+
* @remarks A shell reading its orders from a pipe narrates them: `cmd.exe` writes its banner and its
|
|
83
|
+
* prompt to stdout before and after every order, and both belong to the shell, not to the
|
|
84
|
+
* instruction that follows. The prompt is reduced to a blank line, and everything the shell wrote
|
|
85
|
+
* before the first instruction took it over is dropped by {@link Command.reader}, so the first
|
|
86
|
+
* instruction starts from a shell that only speaks when spoken to. A shell that is already gone
|
|
87
|
+
* resolves too: the instruction is the one that reports it, not this handshake.
|
|
88
|
+
*
|
|
89
|
+
* The handshake ends on the readiness marker or on the death of the shell, never on the orders
|
|
90
|
+
* having been written: a write that succeeded says nothing about what the shell already said.
|
|
91
|
+
*/
|
|
92
|
+
static prepare(shell: Command.Shell): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* The single reader of a shell, attached the first time anything reads it and kept for its whole life.
|
|
95
|
+
* @param shell - The shell to read.
|
|
96
|
+
* @returns The state of the reader, holding whoever is reading the shell right now.
|
|
97
|
+
*
|
|
98
|
+
* @remarks A shell is read through one pair of listeners for its whole life, and what it produced goes
|
|
99
|
+
* to the command reading it, or to nobody while the shell is only talking to itself. The handover is
|
|
100
|
+
* therefore a single assignment, which nothing can slip into: a reader attached to the shell by one
|
|
101
|
+
* instruction and detached by the next leaves a window in which the trailing prompt of the shell is
|
|
102
|
+
* read as the output of the instruction that follows it.
|
|
103
|
+
**/
|
|
104
|
+
protected static reader(shell: Command.Shell): Command.ShellState;
|
|
105
|
+
/**
|
|
106
|
+
* Takes down a process and every process it started.
|
|
107
|
+
* @param child - The process to take down.
|
|
108
|
+
* @returns void
|
|
109
|
+
**/
|
|
110
|
+
static terminate(child: Command.Process): void;
|
|
111
|
+
/**
|
|
112
|
+
* The human readable form of a program, used to describe it when it fails.
|
|
113
|
+
* @param program - The program to format.
|
|
114
|
+
* @returns The program followed by its arguments.
|
|
115
|
+
**/
|
|
116
|
+
static format(program: Command.Program): string;
|
|
117
|
+
/** The human readable form of this instruction, used to describe it when it fails. **/
|
|
118
|
+
get label(): string;
|
|
119
|
+
/** The position of this instruction inside its task, starting at 1, carried by every line it emits. **/
|
|
120
|
+
get ordinal(): number;
|
|
121
|
+
/**
|
|
122
|
+
* Starts the command, emitting a `log` event per stdout line, an `err` event per stderr line and
|
|
123
|
+
* a single `end` event carrying the verdict.
|
|
124
|
+
* @returns void
|
|
125
|
+
*
|
|
126
|
+
* @remarks The verdict is settled exactly once: on the status line the shell writes, on the exit
|
|
127
|
+
* of the process, on a spawn failure, or when the command is killed.
|
|
128
|
+
*/
|
|
129
|
+
exec(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Takes the command down, carrying why into its verdict.
|
|
132
|
+
* @param reason - Why the command is being killed, carried into its verdict.
|
|
133
|
+
* @returns void
|
|
134
|
+
*
|
|
135
|
+
* @remarks A program is taken down along with every process it started. A script cannot be: it
|
|
136
|
+
* shares the shell with the rest of the task, so the task that owns the shell is the one that takes
|
|
137
|
+
* the shell down when the run ends.
|
|
138
|
+
*/
|
|
139
|
+
kill(reason?: Command.Reason): void;
|
|
140
|
+
/**
|
|
141
|
+
* Runs the script in the shell, followed by the sentinel that carries its exit status.
|
|
142
|
+
* @returns void
|
|
143
|
+
**/
|
|
144
|
+
protected execInShell(): void;
|
|
145
|
+
/**
|
|
146
|
+
* Runs the program in a process of its own, started in its own working directory.
|
|
147
|
+
* @returns void
|
|
148
|
+
**/
|
|
149
|
+
protected execAsProgram(): void;
|
|
150
|
+
/**
|
|
151
|
+
* Consumes a stdout chunk, emitting the lines it closes, and stops at the sentinel when the
|
|
152
|
+
* command is a script.
|
|
153
|
+
* @param data - The raw chunk written to stdout.
|
|
154
|
+
* @returns void
|
|
155
|
+
**/
|
|
156
|
+
protected readonly onStdout: (data: Buffer) => void;
|
|
157
|
+
/**
|
|
158
|
+
* The status line the shell wrote, as the index it starts at and the exit status it carries.
|
|
159
|
+
* @param output - The output collected so far.
|
|
160
|
+
* @returns The status, `null` when the line is not there yet, or a null code when it carries none.
|
|
161
|
+
*
|
|
162
|
+
* @remarks Only a whole line that is the sentinel counts, and the sentinel carries a random
|
|
163
|
+
* suffix, so nothing an instruction prints can stand for the shell reporting its status.
|
|
164
|
+
**/
|
|
165
|
+
protected sentinel(output: string): {
|
|
166
|
+
index: number;
|
|
167
|
+
code: number | null;
|
|
168
|
+
} | null;
|
|
169
|
+
/**
|
|
170
|
+
* Consumes a stderr chunk, emitting the lines it closes.
|
|
171
|
+
* @param data - The raw chunk written to stderr.
|
|
172
|
+
* @returns void
|
|
173
|
+
**/
|
|
174
|
+
protected readonly onStderr: (data: Buffer) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Absorbs the failure of writing into a shell that is already gone, which is how a sentinel that
|
|
177
|
+
* will never arrive announces itself.
|
|
178
|
+
* @returns void
|
|
179
|
+
**/
|
|
180
|
+
protected readonly onStdinError: () => void;
|
|
181
|
+
/**
|
|
182
|
+
* Emits the lines both streams have closed since the last call.
|
|
183
|
+
* @param final - Whether the remaining partial line is emitted too, as nothing else will come.
|
|
184
|
+
* @returns void
|
|
185
|
+
**/
|
|
186
|
+
protected stream(final?: boolean): void;
|
|
187
|
+
/**
|
|
188
|
+
* Emits the complete lines a buffer holds from a given cursor, each carrying the ordinal of the
|
|
189
|
+
* instruction it belongs to.
|
|
190
|
+
* @param buffer - The accumulated output of the stream.
|
|
191
|
+
* @param cursor - Where the previous call stopped.
|
|
192
|
+
* @param event - The event each line is emitted with.
|
|
193
|
+
* @param final - Whether the trailing partial line is emitted as well.
|
|
194
|
+
* @returns The position the cursor reached.
|
|
195
|
+
**/
|
|
196
|
+
protected emitLines(buffer: string, cursor: number, event: 'log' | 'err', final: boolean): number;
|
|
197
|
+
/**
|
|
198
|
+
* Settles the verdict of the command, exactly once, detaching every listener it attached.
|
|
199
|
+
* @param outcome - The status, signal and reason the command ended with.
|
|
200
|
+
* @returns void
|
|
201
|
+
**/
|
|
202
|
+
protected settle(outcome: {
|
|
203
|
+
code: number | null;
|
|
204
|
+
signal: NodeJS.Signals | null;
|
|
205
|
+
reason: Command.Reason | null;
|
|
206
|
+
}): void;
|
|
207
|
+
/**
|
|
208
|
+
* The line the shell writes once the previous instruction finished, in its own dialect.
|
|
209
|
+
* @param marker - The sentinel of the command.
|
|
210
|
+
* @returns The line carrying the exit status of the instruction.
|
|
211
|
+
**/
|
|
212
|
+
protected static sentinel(marker: string): string;
|
|
213
|
+
/**
|
|
214
|
+
* The orders that turn a fresh shell into one that only reports what an instruction produced.
|
|
215
|
+
* @param marker - The readiness marker of this shell.
|
|
216
|
+
* @returns The lines, in the dialect of the shell.
|
|
217
|
+
*
|
|
218
|
+
* @remarks `cmd.exe` greets itself with a banner and a prompt, and echoes every order it is given;
|
|
219
|
+
* `/Q` already silences the echo, and reducing the prompt to a newline leaves nothing else the
|
|
220
|
+
* reader of an instruction has to tell apart from its output. `bash` reading from a pipe is quiet on
|
|
221
|
+
* its own, so it only has to say it is ready.
|
|
222
|
+
**/
|
|
223
|
+
protected static warmup(marker: string): string;
|
|
224
|
+
/**
|
|
225
|
+
* A marker no other order of this process can carry, taken from a monotonic counter.
|
|
226
|
+
* @returns The marker of the next order written into a shell.
|
|
227
|
+
*
|
|
228
|
+
* @remarks The random suffix keeps a marker from being replayed by an instruction that happens to
|
|
229
|
+
* print it, and the counter keeps two orders written in the same millisecond from sharing one.
|
|
230
|
+
**/
|
|
231
|
+
protected static token(): string;
|
|
232
|
+
}
|
|
233
|
+
export declare namespace Command {
|
|
234
|
+
type Emitter = Events.Emitter<EventMap>;
|
|
235
|
+
type Process = ChildProcessWithoutNullStreams;
|
|
236
|
+
type Shell = ChildProcessWithoutNullStreams;
|
|
237
|
+
type Mode = 'shell' | 'program';
|
|
238
|
+
type Reason = 'stopped' | 'timeout' | 'shell' | 'spawn' | 'protocol';
|
|
239
|
+
/** The options a command is created with, either a shell and a script or a program. */
|
|
240
|
+
interface Options {
|
|
241
|
+
shell?: Command.Shell;
|
|
242
|
+
script?: string;
|
|
243
|
+
program?: Command.Program;
|
|
244
|
+
/** The position of the instruction inside its task, starting at 1, carried by every line it emits. */
|
|
245
|
+
ordinal?: number;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* The reader of a shell that outlives the instruction reading it: the command in flight, the probe
|
|
249
|
+
* waiting for the shell to report itself ready, or neither while the shell is between instructions.
|
|
250
|
+
*/
|
|
251
|
+
interface ShellState {
|
|
252
|
+
/** The command reading the shell right now, or `null` when no instruction is running. */
|
|
253
|
+
reader: Command | null;
|
|
254
|
+
/** Told about every chunk that arrives while no instruction is reading the shell. */
|
|
255
|
+
probe: ((text: string) => void) | null;
|
|
256
|
+
/** Whether the shell already reported itself ready. */
|
|
257
|
+
ready: boolean;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* A program to run as a process of its own, where neither the executable, its arguments nor its
|
|
261
|
+
* working directory go through a shell.
|
|
262
|
+
*/
|
|
263
|
+
interface Program {
|
|
264
|
+
executable: string;
|
|
265
|
+
args?: string[];
|
|
266
|
+
cwd?: string;
|
|
267
|
+
}
|
|
268
|
+
/** How an instruction ended, in the only form a task needs to turn it into a verdict. */
|
|
269
|
+
interface Verdict {
|
|
270
|
+
code: number | null;
|
|
271
|
+
signal: NodeJS.Signals | null;
|
|
272
|
+
reason: Reason | null;
|
|
273
|
+
output: string;
|
|
274
|
+
error: string;
|
|
275
|
+
time: number;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The events of a command: a line of stdout, a line of stderr, both carrying the ordinal of the
|
|
279
|
+
* instruction they belong to, and the single verdict that settles it.
|
|
280
|
+
*/
|
|
281
|
+
type EventMap = {
|
|
282
|
+
log: [message: string, ordinal: number];
|
|
283
|
+
err: [message: string, ordinal: number];
|
|
284
|
+
end: [verdict: Verdict];
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
export default Command;
|