@gesslar/bedoc 1.11.0 → 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/LICENSE.txt +12 -0
- package/README.md +15 -3
- package/dist/schema/bedoc.action.json +42 -0
- package/dist/types/Action.d.ts +3 -0
- package/dist/types/Action.d.ts.map +1 -0
- package/dist/types/BeDoc.d.ts +208 -0
- package/dist/types/BeDoc.d.ts.map +1 -0
- package/dist/types/Configuration.d.ts +11 -0
- package/dist/types/Configuration.d.ts.map +1 -0
- package/dist/types/ConfigurationParameters.d.ts +3 -0
- package/dist/types/ConfigurationParameters.d.ts.map +1 -0
- package/dist/types/Conveyor.d.ts +27 -0
- package/dist/types/Conveyor.d.ts.map +1 -0
- package/dist/types/Discovery.d.ts +215 -0
- package/dist/types/Discovery.d.ts.map +1 -0
- package/dist/types/Environment.d.ts +3 -0
- package/dist/types/Environment.d.ts.map +1 -0
- package/dist/types/Logger.d.ts +47 -0
- package/dist/types/Logger.d.ts.map +1 -0
- package/dist/types/Schema.d.ts +3 -0
- package/dist/types/Schema.d.ts.map +1 -0
- package/dist/types/cli.d.ts +2 -2
- package/dist/types/cli.d.ts.map +1 -10
- package/package.json +24 -23
- package/src/Action.js +9 -0
- package/src/BeDoc.js +304 -0
- package/src/CLIOutput.js +198 -0
- package/src/{core/Configuration.js → Configuration.js} +73 -58
- package/src/{core/ConfigurationParameters.js → ConfigurationParameters.js} +35 -27
- package/src/Conveyor.js +256 -0
- package/src/Discovery.js +442 -0
- package/src/Environment.js +8 -0
- package/src/{core/Logger.js → Logger.js} +30 -18
- package/src/Schema.js +6 -0
- package/src/cli.js +86 -38
- package/tsconfig.types.json +42 -0
- package/LICENSE +0 -24
- package/dist/types/core/ActionManager.d.ts +0 -58
- package/dist/types/core/ActionManager.d.ts.map +0 -10
- package/dist/types/core/Configuration.d.ts +0 -27
- package/dist/types/core/Configuration.d.ts.map +0 -10
- package/dist/types/core/ConfigurationParameters.d.ts +0 -38
- package/dist/types/core/ConfigurationParameters.d.ts.map +0 -10
- package/dist/types/core/Conveyor.d.ts +0 -49
- package/dist/types/core/Conveyor.d.ts.map +0 -10
- package/dist/types/core/Core.d.ts +0 -48
- package/dist/types/core/Core.d.ts.map +0 -10
- package/dist/types/core/Discovery.d.ts +0 -73
- package/dist/types/core/Discovery.d.ts.map +0 -10
- package/dist/types/core/HookManager.d.ts +0 -60
- package/dist/types/core/HookManager.d.ts.map +0 -10
- package/dist/types/core/Logger.d.ts +0 -63
- package/dist/types/core/Logger.d.ts.map +0 -10
- package/dist/types/core/action/ParseManager.d.ts +0 -8
- package/dist/types/core/action/ParseManager.d.ts.map +0 -10
- package/dist/types/core/action/PrintManager.d.ts +0 -8
- package/dist/types/core/action/PrintManager.d.ts.map +0 -10
- package/dist/types/core/util/ActionUtil.d.ts +0 -35
- package/dist/types/core/util/ActionUtil.d.ts.map +0 -10
- package/dist/types/core/util/DataUtil.d.ts +0 -52
- package/dist/types/core/util/DataUtil.d.ts.map +0 -10
- package/dist/types/core/util/FDUtil.d.ts +0 -171
- package/dist/types/core/util/FDUtil.d.ts.map +0 -10
- package/dist/types/core/util/ModuleUtil.d.ts +0 -27
- package/dist/types/core/util/ModuleUtil.d.ts.map +0 -10
- package/dist/types/core/util/StringUtil.d.ts +0 -5
- package/dist/types/core/util/StringUtil.d.ts.map +0 -10
- package/dist/types/core/util/TypeSpec.d.ts +0 -42
- package/dist/types/core/util/TypeSpec.d.ts.map +0 -10
- package/dist/types/core/util/ValidUtil.d.ts +0 -29
- package/dist/types/core/util/ValidUtil.d.ts.map +0 -10
- package/src/core/ActionManager.js +0 -147
- package/src/core/ContractManager.js +0 -112
- package/src/core/Conveyor.js +0 -185
- package/src/core/Core.js +0 -166
- package/src/core/Discovery.js +0 -403
- package/src/core/HookManager.js +0 -143
- package/src/core/action/ParseManager.js +0 -7
- package/src/core/action/PrintManager.js +0 -7
- package/src/core/contract/ParseContract.js +0 -7
- package/src/core/contract/PrintContract.js +0 -7
- package/src/core/util/ActionUtil.js +0 -62
- package/src/core/util/ContractUtil.js +0 -63
- package/src/core/util/DataUtil.js +0 -540
- package/src/core/util/FDUtil.js +0 -388
- package/src/core/util/StringUtil.js +0 -11
- package/src/core/util/TypeSpec.js +0 -114
- package/src/core/util/ValidUtil.js +0 -50
package/src/cli.js
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import {Schemer} from "@gesslar/negotiator"
|
|
4
|
+
import {Data, DirectoryObject, FileObject, Glog, Sass, Tantrum, Term} from "@gesslar/toolkit"
|
|
3
5
|
import {program} from "commander"
|
|
4
|
-
import console from "node:console"
|
|
5
6
|
import process from "node:process"
|
|
6
|
-
import
|
|
7
|
+
import url from "node:url"
|
|
7
8
|
|
|
8
|
-
import BeDoc
|
|
9
|
-
import {ConfigurationParameters} from "./
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
const {loadDataFile} = ActionUtil
|
|
15
|
-
const {resolveFilename,resolveDirectory} = FDUtil
|
|
9
|
+
import BeDoc from "./BeDoc.js"
|
|
10
|
+
import {ConfigurationParameters} from "./ConfigurationParameters.js"
|
|
11
|
+
import Environment from "./Environment.js"
|
|
12
|
+
import Schema from "./Schema.js"
|
|
13
|
+
import CLIOutput from "./CLIOutput.js"
|
|
16
14
|
|
|
17
15
|
// Main entry point
|
|
18
|
-
|
|
16
|
+
void (async() => {
|
|
19
17
|
try {
|
|
18
|
+
const glog = new Glog()
|
|
19
|
+
.withName("BeDoc")
|
|
20
|
+
.withStackTrace()
|
|
21
|
+
.noDisplayName()
|
|
22
|
+
|
|
20
23
|
// Get package info
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
+
const thisPath = new DirectoryObject(url.fileURLToPath(new url.URL("..", import.meta.url)))
|
|
25
|
+
const pkgJsonFile = new FileObject("package.json", thisPath)
|
|
26
|
+
const pkgJson = await pkgJsonFile.loadData()
|
|
24
27
|
|
|
25
28
|
// Setup program
|
|
26
29
|
program
|
|
27
|
-
.name(
|
|
28
|
-
.description(
|
|
30
|
+
.name(pkgJson.name)
|
|
31
|
+
.description(pkgJson.description)
|
|
29
32
|
|
|
30
33
|
// Build CLI
|
|
31
34
|
for(const [name, parameter] of Object.entries(ConfigurationParameters)) {
|
|
@@ -46,7 +49,7 @@ const {resolveFilename,resolveDirectory} = FDUtil
|
|
|
46
49
|
|
|
47
50
|
// Add version option last
|
|
48
51
|
program.version(
|
|
49
|
-
|
|
52
|
+
pkgJson.version,
|
|
50
53
|
"-v, --version",
|
|
51
54
|
"Output the version number",
|
|
52
55
|
)
|
|
@@ -58,45 +61,90 @@ const {resolveFilename,resolveDirectory} = FDUtil
|
|
|
58
61
|
|
|
59
62
|
const sources = program._optionValueSources
|
|
60
63
|
const optionsWithSources = {}
|
|
64
|
+
|
|
61
65
|
for(const [key, value] of Object.entries(options)) {
|
|
62
66
|
const element = {
|
|
63
67
|
value,
|
|
64
68
|
source: sources[key],
|
|
65
69
|
}
|
|
70
|
+
|
|
66
71
|
optionsWithSources[key] = element
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
//
|
|
74
|
+
// Resolve and validate configuration up front, before constructing
|
|
75
|
+
// anything that depends on it. Everything downstream — CLIOutput, BeDoc,
|
|
76
|
+
// the logger — consumes this single validated config object.
|
|
77
|
+
const prjPath = new DirectoryObject()
|
|
78
|
+
const prjPkJsonFile = new FileObject("package.json", prjPath)
|
|
79
|
+
const prjPkjJson = await prjPkJsonFile.loadData()
|
|
80
|
+
const pkjBedoc = prjPkjJson?.bedoc ?? {}
|
|
81
|
+
|
|
82
|
+
const config = await BeDoc.resolveConfig({
|
|
83
|
+
options: {
|
|
84
|
+
...optionsWithSources,
|
|
85
|
+
basePath: prjPath,
|
|
86
|
+
project: pkjBedoc,
|
|
87
|
+
},
|
|
88
|
+
source: Environment.CLI,
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const cliOutput = new CLIOutput({config})
|
|
92
|
+
|
|
93
|
+
const validateBeDocSchema = await loadSchemaValidator(thisPath)
|
|
94
|
+
|
|
70
95
|
const bedoc = await BeDoc
|
|
71
96
|
.new({
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
source: Environment.CLI
|
|
97
|
+
config,
|
|
98
|
+
glog,
|
|
99
|
+
validateBeDocSchema,
|
|
100
|
+
cliOutput,
|
|
77
101
|
})
|
|
78
102
|
|
|
79
|
-
|
|
80
|
-
|
|
103
|
+
if(!(bedoc instanceof BeDoc)) {
|
|
104
|
+
if(Data.isPlainObject(bedoc)) {
|
|
105
|
+
Term.info(bedoc.message)
|
|
106
|
+
process.exit(0)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
Term.altScreen()
|
|
111
|
+
|
|
112
|
+
const result = await bedoc.processFiles()
|
|
113
|
+
|
|
114
|
+
Term.mainScreen()
|
|
115
|
+
|
|
116
|
+
cliOutput.render(false)
|
|
117
|
+
|
|
81
118
|
const errored = result.errored
|
|
82
119
|
const warned = result.warned
|
|
83
120
|
|
|
84
|
-
if(warned
|
|
85
|
-
warned.forEach(w =>
|
|
121
|
+
if(warned?.length > 0)
|
|
122
|
+
warned.forEach(w => glog.warn(w.warning))
|
|
86
123
|
|
|
87
|
-
if(errored
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if(error instanceof Error) {
|
|
91
|
-
if(error instanceof AggregateError) {
|
|
92
|
-
error.errors.forEach(e => console.error(e))
|
|
93
|
-
} else {
|
|
94
|
-
console.error(error.message, error.stack)
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
console.error("Error: %o", error)
|
|
124
|
+
if(errored?.length > 0) {
|
|
125
|
+
const errors = errored.map(e => e.error)
|
|
126
|
+
Tantrum.new("Error processing files", errors).report(true)
|
|
98
127
|
}
|
|
99
128
|
|
|
129
|
+
process.exit(0)
|
|
130
|
+
} catch(error) {
|
|
131
|
+
Term.mainScreen()
|
|
132
|
+
|
|
133
|
+
Sass.new("Starting BeDoc", error).report(true)
|
|
134
|
+
|
|
100
135
|
process.exit(1)
|
|
101
136
|
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Load the BeDoc action schema and return a validator function.
|
|
140
|
+
*
|
|
141
|
+
* @returns {Promise<Function>} AJV validator function
|
|
142
|
+
*/
|
|
143
|
+
async function loadSchemaValidator(pkgPath) {
|
|
144
|
+
const schemaFile = new FileObject(Schema.local, pkgPath)
|
|
145
|
+
if(!(await schemaFile.exists))
|
|
146
|
+
throw Sass.new(`Missing schema at ${schemaFile.path}`)
|
|
147
|
+
|
|
148
|
+
return await Schemer.fromFile(schemaFile)
|
|
149
|
+
}
|
|
102
150
|
})()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Enable JavaScript support
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"checkJs": false,
|
|
6
|
+
"maxNodeModuleJsDepth": 0,
|
|
7
|
+
// Type declaration generation
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
// Output configuration
|
|
12
|
+
"outDir": "./dist/types",
|
|
13
|
+
"rootDir": "./src",
|
|
14
|
+
// Module system
|
|
15
|
+
"module": "ES2022",
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"target": "ES2022",
|
|
18
|
+
// Strict type checking (helps generate better types)
|
|
19
|
+
"strict": false,
|
|
20
|
+
"noImplicitAny": false,
|
|
21
|
+
"strictNullChecks": false,
|
|
22
|
+
// Additional checks
|
|
23
|
+
"skipLibCheck": true,
|
|
24
|
+
"esModuleInterop": true,
|
|
25
|
+
"allowSyntheticDefaultImports": true,
|
|
26
|
+
"resolveJsonModule": true,
|
|
27
|
+
// Emit settings
|
|
28
|
+
"stripInternal": false,
|
|
29
|
+
"removeComments": false,
|
|
30
|
+
"preserveConstEnums": true
|
|
31
|
+
},
|
|
32
|
+
"include": [
|
|
33
|
+
"src/**/*.js"
|
|
34
|
+
],
|
|
35
|
+
"exclude": [
|
|
36
|
+
"node_modules",
|
|
37
|
+
"tests",
|
|
38
|
+
"work",
|
|
39
|
+
"src/types",
|
|
40
|
+
"examples/"
|
|
41
|
+
]
|
|
42
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
This is free and unencumbered software released into the public domain.
|
|
2
|
-
|
|
3
|
-
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
-
distribute this software, either in source code form or as a compiled
|
|
5
|
-
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
-
means.
|
|
7
|
-
|
|
8
|
-
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
-
of this software dedicate any and all copyright interest in the
|
|
10
|
-
software to the public domain. We make this dedication for the benefit
|
|
11
|
-
of the public at large and to the detriment of our heirs and
|
|
12
|
-
successors. We intend this dedication to be an overt act of
|
|
13
|
-
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
-
software under copyright law.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
-
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
|
|
24
|
-
For more information, please refer to <https://unlicense.org>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import Logger from './Logger'
|
|
2
|
-
import HookManager, {HookPoints} from './HookManager'
|
|
3
|
-
|
|
4
|
-
export type MetaActionType = "print" | "parse"
|
|
5
|
-
|
|
6
|
-
export interface MetaDefinition {
|
|
7
|
-
action: MetaActionType
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ParseMetaDefinition extends MetaDefinition {
|
|
11
|
-
action: "parse"
|
|
12
|
-
language: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface PrintMetaDefinition extends MetaDefinition {
|
|
16
|
-
action: "print"
|
|
17
|
-
format: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type MetaType = ParseMetaDefinition | PrintMetaDefinition
|
|
21
|
-
|
|
22
|
-
export interface ActionDefinition {
|
|
23
|
-
meta: MetaType
|
|
24
|
-
setup?: (params: { parent: ActionManager; log: Logger }) => void
|
|
25
|
-
run({ module, content }: { module: string; content: object }): Promise<string>
|
|
26
|
-
hook?: (event: string, ...args: unknown[]) => Promise<unknown>
|
|
27
|
-
|
|
28
|
-
HOOKS?: HookPoints
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface PrintActionDefinition extends ActionDefinition {
|
|
32
|
-
meta: PrintMetaDefinition
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ParseActionDefinition extends ActionDefinition {
|
|
36
|
-
meta: ParseMetaDefinition
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default class ActionManager {
|
|
40
|
-
constructor(actionDefinition: ActionDefinition, logger: Logger)
|
|
41
|
-
get action(): ActionDefinition
|
|
42
|
-
set hookManager(hookManager: HookManager)
|
|
43
|
-
get hookManager(): HookManager
|
|
44
|
-
get contract(): string
|
|
45
|
-
get meta(): MetaType
|
|
46
|
-
get log(): Logger
|
|
47
|
-
setupAction(): Promise<void>
|
|
48
|
-
runAction({ file, content }: {
|
|
49
|
-
file: string
|
|
50
|
-
content: string
|
|
51
|
-
}): Promise<string>
|
|
52
|
-
cleanupAction(): Promise<void>
|
|
53
|
-
toString(): string
|
|
54
|
-
#private
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type ActionContract = string
|
|
58
|
-
//# sourceMappingURL=ActionManager.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "ActionManager.d.ts",
|
|
4
|
-
"sourceRoot": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
"../../../src/core/ActionManager.js"
|
|
7
|
-
],
|
|
8
|
-
"names": [],
|
|
9
|
-
"mappings": "AAEA;IAQE,gDAKC;IAsBD,kBAEC;IAMD,kCAQC;IAZD,uBAEC;IAYD,oBAEC;IAED,gBAEC;IAED,eAEC;IA0CD,6BAKC;IAED;;;qBAWC;IAED,+BAMC;IAED,mBAEC;;CACF"
|
|
10
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EnvironmentType } from './Core';
|
|
2
|
-
|
|
3
|
-
interface ConfigurationOption {
|
|
4
|
-
value: unknown;
|
|
5
|
-
source: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface ConfigurationOptions {
|
|
9
|
-
[key: string]: ConfigurationOption;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface ValidateParams {
|
|
13
|
-
options: ConfigurationOptions;
|
|
14
|
-
source: EnvironmentType;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface ValidationResult {
|
|
18
|
-
status: 'success';
|
|
19
|
-
validated: boolean;
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default class Configuration {
|
|
24
|
-
validate({ options, source }: ValidateParams): Promise<ValidationResult>;
|
|
25
|
-
#private;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=Configuration.d.ts.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import TypeSpec from './util/TypeSpec';
|
|
2
|
-
|
|
3
|
-
interface PathConfig {
|
|
4
|
-
type: 'file' | 'directory';
|
|
5
|
-
mustExist: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface ConfigurationParameter {
|
|
9
|
-
short: string;
|
|
10
|
-
param?: string;
|
|
11
|
-
description: string;
|
|
12
|
-
type: TypeSpec;
|
|
13
|
-
required: boolean;
|
|
14
|
-
default?: boolean | number | string;
|
|
15
|
-
path?: PathConfig;
|
|
16
|
-
exclusiveOf?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface ConfigurationParametersType {
|
|
20
|
-
input: ConfigurationParameter;
|
|
21
|
-
exclude: ConfigurationParameter;
|
|
22
|
-
language: ConfigurationParameter;
|
|
23
|
-
format: ConfigurationParameter;
|
|
24
|
-
maxConcurrent: ConfigurationParameter;
|
|
25
|
-
hooks: ConfigurationParameter;
|
|
26
|
-
output: ConfigurationParameter;
|
|
27
|
-
parser: ConfigurationParameter;
|
|
28
|
-
printer: ConfigurationParameter;
|
|
29
|
-
hookTimeout: ConfigurationParameter;
|
|
30
|
-
mock: ConfigurationParameter;
|
|
31
|
-
config: ConfigurationParameter;
|
|
32
|
-
debug: ConfigurationParameter;
|
|
33
|
-
debugLevel: ConfigurationParameter;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const ConfigurationParameters: Readonly<ConfigurationParametersType>;
|
|
37
|
-
export const ConfigurationPriorityKeys: readonly ['exclude', 'input'];
|
|
38
|
-
//# sourceMappingURL=ConfigurationParameters.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "ConfigurationParameters.d.ts",
|
|
4
|
-
"sourceRoot": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
"../../../src/core/ConfigurationParameters.js"
|
|
7
|
-
],
|
|
8
|
-
"names": [],
|
|
9
|
-
"mappings": "AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqIE;AAEF,0DAAqE"
|
|
10
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import ActionManager from './ActionManager';
|
|
2
|
-
import Logger from './Logger';
|
|
3
|
-
import { FileMap } from './util/FDUtil';
|
|
4
|
-
|
|
5
|
-
interface ProcessResult {
|
|
6
|
-
status: 'success' | 'error' | 'warning';
|
|
7
|
-
file?: FileMap;
|
|
8
|
-
error?: Error;
|
|
9
|
-
warning?: string;
|
|
10
|
-
result?: string;
|
|
11
|
-
destFile?: string;
|
|
12
|
-
content?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ConveyResult {
|
|
16
|
-
succeeded: Array<{ input: FileMap; output: FileMap }>;
|
|
17
|
-
errored: Array<{ input: FileMap; error: Error }>;
|
|
18
|
-
warned: Array<{ input: FileMap; warning: string }>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default class Conveyor {
|
|
22
|
-
constructor(
|
|
23
|
-
parse: ActionManager,
|
|
24
|
-
print: ActionManager,
|
|
25
|
-
logger: Logger,
|
|
26
|
-
output: FileMap
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
readonly parse: ActionManager;
|
|
30
|
-
readonly print: ActionManager;
|
|
31
|
-
readonly logger: Logger;
|
|
32
|
-
readonly output: FileMap;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Processes files with a concurrency limit.
|
|
36
|
-
*
|
|
37
|
-
* @param files - List of files to process.
|
|
38
|
-
* @param maxConcurrent - Maximum number of concurrent tasks.
|
|
39
|
-
* @returns Resolves when all files are processed.
|
|
40
|
-
*/
|
|
41
|
-
convey(files: FileMap[], maxConcurrent?: number): Promise<ConveyResult>;
|
|
42
|
-
|
|
43
|
-
#succeeded: Array<{ input: FileMap; output: FileMap }>;
|
|
44
|
-
#errored: Array<{ input: FileMap; error: Error }>;
|
|
45
|
-
#warned: Array<{ input: FileMap; warning: string }>;
|
|
46
|
-
#processFile(file: FileMap): Promise<ProcessResult>;
|
|
47
|
-
#writeOutput(destFile: string, content: string): Promise<ProcessResult>;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=Conveyor.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "Conveyor.d.ts",
|
|
4
|
-
"sourceRoot": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
"../../../src/core/Conveyor.js"
|
|
7
|
-
],
|
|
8
|
-
"names": [],
|
|
9
|
-
"mappings": "AAMA;IAIE,8DAKC;IAJC,WAAkB;IAClB,WAAkB;IAClB,YAAoB;IACpB,YAAoB;IAGtB;;;;;;OAMG;IACH,qCAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CA8B3B;;CAgFF"
|
|
10
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import Logger from './Logger';
|
|
2
|
-
import ActionManager from './ActionManager';
|
|
3
|
-
import { ConveyResult} from './Conveyor';
|
|
4
|
-
|
|
5
|
-
export const Environment: Readonly<{
|
|
6
|
-
EXTENSION: 'extension';
|
|
7
|
-
NPM: 'npm';
|
|
8
|
-
ACTION: 'action';
|
|
9
|
-
CLI: 'cli';
|
|
10
|
-
}>;
|
|
11
|
-
|
|
12
|
-
export type EnvironmentType = typeof Environment[keyof typeof Environment];
|
|
13
|
-
|
|
14
|
-
interface CoreOptions {
|
|
15
|
-
debug?: boolean;
|
|
16
|
-
debugLevel?: number;
|
|
17
|
-
name?: string;
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface CoreConstructorOptions extends CoreOptions {
|
|
22
|
-
hooks?: string;
|
|
23
|
-
hooksTimeout?: number;
|
|
24
|
-
output?: string;
|
|
25
|
-
maxConcurrent?: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface NewParams {
|
|
29
|
-
options: CoreOptions;
|
|
30
|
-
source: EnvironmentType;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default class Core {
|
|
34
|
-
static new({ options, source }: NewParams): Promise<Core>;
|
|
35
|
-
|
|
36
|
-
constructor(options: CoreConstructorOptions);
|
|
37
|
-
|
|
38
|
-
readonly options: CoreConstructorOptions;
|
|
39
|
-
readonly logger: Logger;
|
|
40
|
-
readonly packageJson: Record<string, unknown>;
|
|
41
|
-
readonly debugOptions: {
|
|
42
|
-
name: string | null;
|
|
43
|
-
debugLevel: number;
|
|
44
|
-
};
|
|
45
|
-
readonly actions: Record<string, ActionManager>;
|
|
46
|
-
|
|
47
|
-
processFiles(glob: string | string[], startTime?: [number, number]): Promise<ConveyResult>;
|
|
48
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "Core.d.ts",
|
|
4
|
-
"sourceRoot": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
"../../../src/core/Core.js"
|
|
7
|
-
],
|
|
8
|
-
"names": [],
|
|
9
|
-
"mappings": "AAkBA;;;;;GAKE;AAEF;IASE;;;sBAoFC;IA5FD,0BAMC;IALC,aAAsB;IAEtB,eAAgE;IAChE,iBAAiD;IACjD;;;MAAuC;IAyFzC;;;OAsDC;CACF;mBA3KkB,aAAa"
|
|
10
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import Core from './Core';
|
|
2
|
-
import { FileMap } from './util/FDUtil';
|
|
3
|
-
import ActionManager from './ActionManager';
|
|
4
|
-
|
|
5
|
-
interface DiscoveryOptions {
|
|
6
|
-
print?: FileMap;
|
|
7
|
-
parse?: FileMap;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface ActionDefinition {
|
|
11
|
-
file: FileMap;
|
|
12
|
-
action: {
|
|
13
|
-
meta: {
|
|
14
|
-
action: string;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
contract: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface ActionMap {
|
|
22
|
-
print: ActionDefinition[];
|
|
23
|
-
parse: ActionDefinition[];
|
|
24
|
-
[key: string]: ActionDefinition[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface ValidCriteria {
|
|
28
|
-
parse: ActionDefinition[];
|
|
29
|
-
print: ActionDefinition[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default class Discovery {
|
|
33
|
-
constructor(core: Core);
|
|
34
|
-
readonly core: Core;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Discover actions from local or global node_modules
|
|
38
|
-
*
|
|
39
|
-
* @param specific Configuration options for action discovery
|
|
40
|
-
* @returns A map of discovered modules
|
|
41
|
-
*/
|
|
42
|
-
discoverActions(specific?: DiscoveryOptions): Promise<ActionMap>;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Check which actions satisfy the configuration criteria
|
|
46
|
-
*/
|
|
47
|
-
satisfyCriteria(actions: ActionMap, validatedConfig: Record<string, unknown>): ValidCriteria;
|
|
48
|
-
|
|
49
|
-
#loadModule(module: FileMap): Promise<{
|
|
50
|
-
file: FileMap;
|
|
51
|
-
actions: ActionManager[];
|
|
52
|
-
contracts: string[];
|
|
53
|
-
}>;
|
|
54
|
-
|
|
55
|
-
#getModuleExports(dirMap: FileMap): FileMap[];
|
|
56
|
-
|
|
57
|
-
#loadActionsAndContracts(
|
|
58
|
-
moduleFiles: FileMap[],
|
|
59
|
-
specific: {
|
|
60
|
-
print?: FileMap;
|
|
61
|
-
parse?: FileMap;
|
|
62
|
-
}
|
|
63
|
-
): Promise<ActionMap>;
|
|
64
|
-
|
|
65
|
-
#validMeta(
|
|
66
|
-
actionType: string,
|
|
67
|
-
toValidate: {
|
|
68
|
-
action: ActionDefinition['action'];
|
|
69
|
-
contract: ActionDefinition['contract'];
|
|
70
|
-
}
|
|
71
|
-
): boolean;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=Discovery.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "Discovery.d.ts",
|
|
4
|
-
"sourceRoot": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
"../../../src/core/Discovery.js"
|
|
7
|
-
],
|
|
8
|
-
"names": [],
|
|
9
|
-
"mappings": "AAYA;IAIE,uBAIC;IAHC,UAAgB;IAKlB;;;;;;;OAOG;IACH,0BAJG;QAAyB,KAAK,GAAtB,MAAM;QACW,KAAK,GAAtB,MAAM;KACd,GAAU,OAAO,CAAC,MAAM,CAAC,CAsE3B;IA6JD;;;MAiDC;;CA4DF"
|
|
10
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import Logger from './Logger';
|
|
2
|
-
import { FileMap } from './util/FDUtil';
|
|
3
|
-
|
|
4
|
-
export type HookEventType = 'start' | 'section_load' | 'enter' | 'exit' | 'end';
|
|
5
|
-
|
|
6
|
-
interface HookResult {
|
|
7
|
-
status?: 'success' | 'error';
|
|
8
|
-
error?: Error;
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface HooksDefinition {
|
|
13
|
-
setup?: () => Promise<void>;
|
|
14
|
-
cleanup?: () => Promise<void>;
|
|
15
|
-
start?: (...args: unknown[]) => Promise<HookResult>;
|
|
16
|
-
section_load?: (...args: unknown[]) => Promise<HookResult>;
|
|
17
|
-
enter?: (...args: unknown[]) => Promise<HookResult>;
|
|
18
|
-
exit?: (...args: unknown[]) => Promise<HookResult>;
|
|
19
|
-
end?: (...args: unknown[]) => Promise<HookResult>;
|
|
20
|
-
log?: Logger;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface HookManagerConstructorParams {
|
|
24
|
-
action: string;
|
|
25
|
-
hooksFile: FileMap;
|
|
26
|
-
logger: Logger;
|
|
27
|
-
timeOut: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const HookPoints: Readonly<Record<Uppercase<HookEventType>, HookEventType>>;
|
|
31
|
-
|
|
32
|
-
export default class HookManager {
|
|
33
|
-
static new(arg: HookManagerConstructorParams): Promise<HookManager | null>;
|
|
34
|
-
|
|
35
|
-
constructor({ action, hooksFile, logger, timeOut: timeout }: HookManagerConstructorParams);
|
|
36
|
-
|
|
37
|
-
get action(): string;
|
|
38
|
-
get hooksFile(): FileMap | null;
|
|
39
|
-
get hooks(): HooksDefinition | null;
|
|
40
|
-
get log(): Logger;
|
|
41
|
-
get timeout(): number;
|
|
42
|
-
get setup(): (() => Promise<void>) | null;
|
|
43
|
-
get cleanup(): (() => Promise<void>) | null;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Trigger a hook
|
|
47
|
-
*
|
|
48
|
-
* @param event - The type of hook to trigger
|
|
49
|
-
* @param args - The hook arguments
|
|
50
|
-
* @returns The result of the hook
|
|
51
|
-
*/
|
|
52
|
-
on(event: HookEventType, ...args: unknown[]): Promise<HookResult | undefined>;
|
|
53
|
-
|
|
54
|
-
#hooksFile: FileMap | null;
|
|
55
|
-
#log: Logger | null;
|
|
56
|
-
#hooks: HooksDefinition | null;
|
|
57
|
-
#action: string | null;
|
|
58
|
-
#timeout: number;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=HookManager.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "HookManager.d.ts",
|
|
4
|
-
"sourceRoot": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
"../../../src/core/HookManager.js"
|
|
7
|
-
],
|
|
8
|
-
"names": [],
|
|
9
|
-
"mappings": "AAUA,sCAKC;AAED;IA0CE,6CAsCC;IAzED;;;;;OAKC;IAED,kBAEC;IAED,qBAEC;IAED,iBAEC;IAED,eAEC;IAED,sBAEC;IAED,iBAEC;IAED,mBAEC;IA0CD;;;;;;OAMG;IACH,UAJW,MAAM,WACH,GAAG,EAAA,GACJ,OAAO,CAAC,GAAG,CAAC,CAsCxB;;CACF"
|
|
10
|
-
}
|