@plugjs/plug 0.0.12 → 0.0.15
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/{types → dist}/assert.d.ts +0 -0
- package/dist/async.cjs +20 -19
- package/dist/async.cjs.map +1 -1
- package/dist/async.d.ts +20 -0
- package/dist/async.mjs +18 -17
- package/dist/async.mjs.map +1 -1
- package/dist/build.cjs +144 -110
- package/dist/build.cjs.map +2 -2
- package/dist/build.d.ts +12 -0
- package/dist/build.mjs +146 -112
- package/dist/build.mjs.map +2 -2
- package/dist/files.cjs +2 -16
- package/dist/files.cjs.map +1 -1
- package/{types → dist}/files.d.ts +3 -10
- package/dist/files.mjs +3 -17
- package/dist/files.mjs.map +1 -1
- package/dist/fork.cjs +28 -40
- package/dist/fork.cjs.map +1 -1
- package/dist/fork.d.ts +36 -0
- package/dist/fork.mjs +29 -40
- package/dist/fork.mjs.map +1 -1
- package/dist/helpers.cjs +61 -63
- package/dist/helpers.cjs.map +2 -2
- package/dist/helpers.d.ts +21 -0
- package/dist/helpers.mjs +61 -64
- package/dist/helpers.mjs.map +2 -2
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/log/colors.cjs +3 -1
- package/dist/log/colors.cjs.map +1 -1
- package/{types → dist}/log/colors.d.ts +2 -2
- package/dist/log/colors.mjs +3 -1
- package/dist/log/colors.mjs.map +1 -1
- package/{types → dist}/log/emit.d.ts +1 -1
- package/{types → dist}/log/levels.d.ts +0 -0
- package/dist/log/logger.cjs +4 -0
- package/dist/log/logger.cjs.map +1 -1
- package/{types → dist}/log/logger.d.ts +4 -1
- package/dist/log/logger.mjs +4 -0
- package/dist/log/logger.mjs.map +1 -1
- package/{types → dist}/log/options.d.ts +1 -1
- package/dist/log/report.cjs +4 -13
- package/dist/log/report.cjs.map +1 -1
- package/{types → dist}/log/report.d.ts +36 -4
- package/dist/log/report.mjs +3 -12
- package/dist/log/report.mjs.map +1 -1
- package/{types → dist}/log/spinner.d.ts +0 -0
- package/dist/log.cjs +1 -1
- package/dist/log.cjs.map +1 -1
- package/{types → dist}/log.d.ts +6 -6
- package/dist/log.mjs +2 -2
- package/dist/log.mjs.map +1 -1
- package/{types → dist}/paths.d.ts +0 -0
- package/dist/pipe.cjs +41 -34
- package/dist/pipe.cjs.map +1 -1
- package/dist/pipe.d.ts +182 -0
- package/dist/pipe.mjs +38 -32
- package/dist/pipe.mjs.map +1 -1
- package/dist/plugs/copy.cjs +15 -25
- package/dist/plugs/copy.cjs.map +2 -2
- package/dist/plugs/copy.d.ts +28 -0
- package/dist/plugs/copy.mjs +15 -17
- package/dist/plugs/copy.mjs.map +2 -2
- package/{types → dist}/plugs/coverage/analysis.d.ts +2 -2
- package/dist/plugs/coverage/report.cjs +4 -2
- package/dist/plugs/coverage/report.cjs.map +1 -1
- package/{types → dist}/plugs/coverage/report.d.ts +3 -3
- package/dist/plugs/coverage/report.mjs +4 -2
- package/dist/plugs/coverage/report.mjs.map +1 -1
- package/dist/plugs/coverage.cjs +23 -27
- package/dist/plugs/coverage.cjs.map +1 -1
- package/dist/plugs/coverage.d.ts +49 -0
- package/dist/plugs/coverage.mjs +24 -20
- package/dist/plugs/coverage.mjs.map +1 -1
- package/dist/plugs/debug.cjs +8 -37
- package/dist/plugs/debug.cjs.map +1 -1
- package/dist/plugs/debug.d.ts +7 -0
- package/dist/plugs/debug.mjs +24 -20
- package/dist/plugs/debug.mjs.map +1 -1
- package/{types → dist}/plugs/esbuild/bundle-locals.d.ts +0 -0
- package/{types → dist}/plugs/esbuild/fix-extensions.d.ts +0 -0
- package/dist/plugs/esbuild/fix-extensions.mjs +1 -1
- package/dist/plugs/esbuild/fix-extensions.mjs.map +1 -1
- package/dist/plugs/esbuild.cjs +14 -25
- package/dist/plugs/esbuild.cjs.map +1 -1
- package/dist/plugs/esbuild.d.ts +18 -0
- package/dist/plugs/esbuild.mjs +14 -17
- package/dist/plugs/esbuild.mjs.map +1 -1
- package/dist/plugs/eslint/runner.cjs +5 -6
- package/dist/plugs/eslint/runner.cjs.map +1 -1
- package/dist/plugs/eslint/runner.d.ts +8 -0
- package/dist/plugs/eslint/runner.mjs +6 -7
- package/dist/plugs/eslint/runner.mjs.map +1 -1
- package/dist/{task.cjs → plugs/eslint.cjs} +7 -24
- package/dist/plugs/eslint.cjs.map +6 -0
- package/dist/plugs/eslint.d.ts +34 -0
- package/dist/plugs/eslint.mjs +5 -0
- package/dist/plugs/eslint.mjs.map +6 -0
- package/dist/plugs/exec.cjs +20 -24
- package/dist/plugs/exec.cjs.map +1 -1
- package/dist/plugs/exec.d.ts +90 -0
- package/dist/plugs/exec.mjs +20 -23
- package/dist/plugs/exec.mjs.map +1 -1
- package/dist/plugs/filter.cjs +9 -19
- package/dist/plugs/filter.cjs.map +1 -1
- package/dist/plugs/filter.d.ts +29 -0
- package/dist/plugs/filter.mjs +10 -12
- package/dist/plugs/filter.mjs.map +1 -1
- package/dist/plugs/mocha/reporter.cjs +19 -6
- package/dist/plugs/mocha/reporter.cjs.map +1 -1
- package/{types → dist}/plugs/mocha/reporter.d.ts +0 -2
- package/dist/plugs/mocha/reporter.mjs +18 -4
- package/dist/plugs/mocha/reporter.mjs.map +1 -1
- package/dist/plugs/mocha/runner.cjs +4 -5
- package/dist/plugs/mocha/runner.cjs.map +1 -1
- package/dist/plugs/mocha/runner.d.ts +8 -0
- package/dist/plugs/mocha/runner.mjs +5 -6
- package/dist/plugs/mocha/runner.mjs.map +1 -1
- package/dist/plugs/mocha.cjs +22 -0
- package/dist/plugs/mocha.cjs.map +6 -0
- package/{types/plugs/mocha/runner.d.ts → dist/plugs/mocha.d.ts} +9 -8
- package/dist/plugs/mocha.mjs +5 -0
- package/dist/plugs/mocha.mjs.map +6 -0
- package/dist/plugs/rmf.cjs +4 -32
- package/dist/plugs/rmf.cjs.map +1 -1
- package/dist/plugs/rmf.d.ts +11 -0
- package/dist/plugs/rmf.mjs +25 -20
- package/dist/plugs/rmf.mjs.map +1 -1
- package/{types → dist}/plugs/tsc/compiler.d.ts +1 -1
- package/{types → dist}/plugs/tsc/options.d.ts +1 -1
- package/{types → dist}/plugs/tsc/report.d.ts +2 -2
- package/dist/plugs/tsc/runner.cjs +12 -11
- package/dist/plugs/tsc/runner.cjs.map +1 -1
- package/dist/plugs/tsc/runner.d.ts +8 -0
- package/dist/plugs/tsc/runner.mjs +12 -11
- package/dist/plugs/tsc/runner.mjs.map +1 -1
- package/dist/plugs/tsc.cjs +7 -0
- package/dist/plugs/tsc.cjs.map +6 -0
- package/dist/plugs/tsc.d.ts +36 -0
- package/dist/plugs/tsc.mjs +15 -0
- package/dist/plugs/tsc.mjs.map +6 -0
- package/dist/plugs.cjs +3 -5
- package/dist/plugs.cjs.map +1 -1
- package/dist/plugs.d.ts +10 -0
- package/dist/plugs.mjs +3 -5
- package/dist/plugs.mjs.map +1 -1
- package/dist/types.cjs +19 -0
- package/dist/types.cjs.map +6 -0
- package/dist/types.d.ts +72 -0
- package/dist/types.mjs +1 -0
- package/dist/types.mjs.map +6 -0
- package/{types → dist}/utils/asyncfs.d.ts +0 -0
- package/dist/utils/caller.cjs +8 -11
- package/dist/utils/caller.cjs.map +2 -2
- package/dist/utils/caller.d.ts +2 -0
- package/dist/utils/caller.mjs +8 -11
- package/dist/utils/caller.mjs.map +2 -2
- package/{types → dist}/utils/match.d.ts +0 -0
- package/dist/utils/options.cjs +4 -6
- package/dist/utils/options.cjs.map +1 -1
- package/dist/utils/options.d.ts +16 -0
- package/dist/utils/options.mjs +4 -6
- package/dist/utils/options.mjs.map +1 -1
- package/{types → dist}/utils/walk.d.ts +2 -2
- package/extra/cli.mjs +31 -20
- package/extra/ts-loader.mjs +6 -5
- package/package.json +10 -10
- package/src/async.ts +27 -19
- package/src/files.ts +6 -30
- package/src/fork.ts +35 -76
- package/src/helpers.ts +89 -101
- package/src/index.ts +10 -15
- package/src/log/colors.ts +4 -3
- package/src/log/emit.ts +4 -4
- package/src/log/logger.ts +12 -4
- package/src/log/options.ts +1 -1
- package/src/log/report.ts +10 -24
- package/src/log/spinner.ts +3 -3
- package/src/log.ts +9 -9
- package/src/paths.ts +1 -1
- package/src/pipe.ts +191 -178
- package/src/plugs/copy.ts +40 -31
- package/src/plugs/coverage/analysis.ts +4 -4
- package/src/plugs/coverage/report.ts +9 -6
- package/src/plugs/coverage.ts +68 -55
- package/src/plugs/debug.ts +22 -27
- package/src/plugs/esbuild/fix-extensions.ts +2 -2
- package/src/plugs/esbuild.ts +42 -46
- package/src/plugs/eslint/runner.ts +16 -31
- package/src/plugs/eslint.ts +42 -0
- package/src/plugs/exec.ts +93 -82
- package/src/plugs/filter.ts +42 -27
- package/src/plugs/mocha/reporter.ts +19 -5
- package/src/plugs/mocha/runner.ts +12 -38
- package/src/plugs/mocha.ts +41 -0
- package/src/plugs/rmf.ts +21 -25
- package/src/plugs/tsc/compiler.ts +1 -1
- package/src/plugs/tsc/options.ts +2 -2
- package/src/plugs/tsc/report.ts +2 -2
- package/src/plugs/tsc/runner.ts +24 -30
- package/src/plugs/tsc.ts +45 -0
- package/src/plugs.ts +10 -25
- package/src/types.ts +123 -0
- package/src/utils/caller.ts +11 -22
- package/src/utils/options.ts +49 -17
- package/src/utils/walk.ts +4 -4
- package/dist/run.cjs +0 -90
- package/dist/run.cjs.map +0 -6
- package/dist/run.mjs +0 -65
- package/dist/run.mjs.map +0 -6
- package/dist/task.cjs.map +0 -6
- package/dist/task.mjs +0 -14
- package/dist/task.mjs.map +0 -6
- package/src/run.ts +0 -159
- package/src/task.ts +0 -26
- package/types/async.d.ts +0 -20
- package/types/build.d.ts +0 -56
- package/types/fork.d.ts +0 -57
- package/types/helpers.d.ts +0 -43
- package/types/index.d.ts +0 -14
- package/types/pipe.d.ts +0 -152
- package/types/plugs/copy.d.ts +0 -27
- package/types/plugs/coverage.d.ts +0 -46
- package/types/plugs/debug.d.ts +0 -14
- package/types/plugs/esbuild.d.ts +0 -23
- package/types/plugs/eslint/runner.d.ts +0 -22
- package/types/plugs/exec.d.ts +0 -90
- package/types/plugs/filter.d.ts +0 -23
- package/types/plugs/rmf.d.ts +0 -15
- package/types/plugs/tsc/runner.d.ts +0 -13
- package/types/plugs.d.ts +0 -17
- package/types/run.d.ts +0 -89
- package/types/task.d.ts +0 -15
- package/types/utils/caller.d.ts +0 -7
- package/types/utils/options.d.ts +0 -15
package/dist/task.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// task.ts
|
|
2
|
-
var TaskImpl = class {
|
|
3
|
-
constructor(context, _definition) {
|
|
4
|
-
this.context = context;
|
|
5
|
-
this._definition = _definition;
|
|
6
|
-
}
|
|
7
|
-
async call(self, run) {
|
|
8
|
-
return await this._definition.call(self, self, run) || void 0;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
TaskImpl
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=task.mjs.map
|
package/dist/task.mjs.map
DELETED
package/src/run.ts
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { sep } from 'node:path'
|
|
2
|
-
import { Files, FilesBuilder } from './files.js'
|
|
3
|
-
import { createReport, getLevelNumber, getLogger, Logger, LogLevelString, Report } from './log.js'
|
|
4
|
-
import { AbsolutePath, getCurrentWorkingDirectory, resolveAbsolutePath } from './paths.js'
|
|
5
|
-
import { Pipe, PipeImpl } from './pipe.js'
|
|
6
|
-
import { ParseOptions, parseOptions } from './utils/options.js'
|
|
7
|
-
import { walk, WalkOptions } from './utils/walk.js'
|
|
8
|
-
|
|
9
|
-
/** The {@link FindOptions} interface defines the options for finding files. */
|
|
10
|
-
export interface FindOptions extends WalkOptions {
|
|
11
|
-
/**
|
|
12
|
-
* The directory where to start looking for files according to the rules
|
|
13
|
-
* specified in {@link Run.resolve}.
|
|
14
|
-
*/
|
|
15
|
-
directory?: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The {@link Run} interface defines the context in which a {@link Task} is
|
|
20
|
-
* invoked.
|
|
21
|
-
*
|
|
22
|
-
* Runs keep track of the invocation stack (to avoid circular dependencies) and
|
|
23
|
-
* of the cached results for {@link Task} invocations.
|
|
24
|
-
*/
|
|
25
|
-
export interface Run {
|
|
26
|
-
/**
|
|
27
|
-
* The _name_ of the task associated with this {@link Run} (if one is).
|
|
28
|
-
*
|
|
29
|
-
* Tasks can have different names in different builds, this refers to the
|
|
30
|
-
* _task name_ in the build being executed.
|
|
31
|
-
*/
|
|
32
|
-
readonly taskName: string
|
|
33
|
-
/** The absolute file name of the build */
|
|
34
|
-
readonly buildFile: AbsolutePath,
|
|
35
|
-
/** For convenience, the directory of the build file */
|
|
36
|
-
readonly buildDir: AbsolutePath,
|
|
37
|
-
/** The {@link Logger} associated with this instance. */
|
|
38
|
-
readonly log: Logger
|
|
39
|
-
|
|
40
|
-
/** Set the logging level within this {@link Run} */
|
|
41
|
-
setLogLevel(level: LogLevelString): void
|
|
42
|
-
|
|
43
|
-
/** Call another {@link Task} from this one. */
|
|
44
|
-
call(name: string): Promise<Files | undefined>
|
|
45
|
-
|
|
46
|
-
/** Create a new {@link Report} with the given _title_ */
|
|
47
|
-
report(title: string): Report
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Resolve a path in the context of this {@link Run}.
|
|
51
|
-
*
|
|
52
|
-
* If the path starts with `@...` it is considered to be relative to the
|
|
53
|
-
* _directory containing the build file where the task was defined_, otherwise
|
|
54
|
-
* it will be relative to the {@link process.cwd | current working directory}.
|
|
55
|
-
*/
|
|
56
|
-
resolve(...paths: string[]): AbsolutePath
|
|
57
|
-
|
|
58
|
-
/** Create a {@link FilesBuilder} cloning an existing {@link Files}. */
|
|
59
|
-
files(files: Files): FilesBuilder
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Create a {@link FilesBuilder} instance resolving the directory specified
|
|
63
|
-
* according to the rules specified in {@link Run.resolve}.
|
|
64
|
-
*/
|
|
65
|
-
files(...paths: string[]): FilesBuilder
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Find files according to the globs and {@link FindOptions} specified.
|
|
69
|
-
*/
|
|
70
|
-
find(glob: string, ...args: ParseOptions<FindOptions>): Pipe & Promise<Files>
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Create a new {@link Pipe} wrapping the specified {@link Files}.
|
|
74
|
-
*/
|
|
75
|
-
pipe(files: Files | Promise<Files>): Pipe & Promise<Files>
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Constructor options for our default {@link Run} implementation */
|
|
79
|
-
export interface RunConstructionOptions {
|
|
80
|
-
readonly taskName: string,
|
|
81
|
-
readonly buildDir: AbsolutePath,
|
|
82
|
-
readonly buildFile: AbsolutePath,
|
|
83
|
-
readonly log?: Logger,
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** Our default {@link Run} implementation */
|
|
87
|
-
export class RunImpl implements Run {
|
|
88
|
-
readonly taskName: string
|
|
89
|
-
readonly buildFile: AbsolutePath
|
|
90
|
-
readonly buildDir: AbsolutePath
|
|
91
|
-
readonly log: Logger
|
|
92
|
-
|
|
93
|
-
constructor(options: RunConstructionOptions)
|
|
94
|
-
|
|
95
|
-
constructor({ taskName, buildDir, buildFile, log }: RunConstructionOptions) {
|
|
96
|
-
this.taskName = taskName
|
|
97
|
-
this.buildDir = buildDir
|
|
98
|
-
this.buildFile = buildFile
|
|
99
|
-
this.log = log || getLogger(taskName)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** Set the logging level within this {@link Run} */
|
|
103
|
-
setLogLevel(level: LogLevelString): void {
|
|
104
|
-
this.log.level = getLevelNumber(level)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
report(title: string): Report {
|
|
108
|
-
return createReport(title, this.taskName)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
resolve(path?: string, ...paths: string[]): AbsolutePath {
|
|
112
|
-
// Paths starting with "@" are relative to the build file directory
|
|
113
|
-
if (path && path.startsWith('@')) {
|
|
114
|
-
// We can have paths like "@/../foo/bar" or "@../foo/bar"... both are ok
|
|
115
|
-
const components = path.substring(1).split(sep).filter((s) => !!s)
|
|
116
|
-
return resolveAbsolutePath(this.buildDir, ...components, ...paths)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// No path? Resolve to the CWD!
|
|
120
|
-
if (! path) return getCurrentWorkingDirectory()
|
|
121
|
-
|
|
122
|
-
// For all the rest, normal resolution!
|
|
123
|
-
return resolveAbsolutePath(getCurrentWorkingDirectory(), path, ...paths)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
files(files: Files): FilesBuilder
|
|
127
|
-
files(...paths: string[]): FilesBuilder
|
|
128
|
-
files(first: Files | string | undefined, ...paths: string[]): FilesBuilder {
|
|
129
|
-
if (typeof first === 'string') {
|
|
130
|
-
return Files.builder(this.resolve(first, ...paths))
|
|
131
|
-
} else if (first) {
|
|
132
|
-
return Files.builder(first)
|
|
133
|
-
} else {
|
|
134
|
-
return Files.builder(this.resolve())
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
find(glob: string, ...args: ParseOptions<FindOptions>): Pipe & Promise<Files> {
|
|
139
|
-
const { params, options: { directory, ...options } } = parseOptions(args, {})
|
|
140
|
-
|
|
141
|
-
const promise = Promise.resolve().then(async () => {
|
|
142
|
-
const builder = this.files(directory || '.')
|
|
143
|
-
for await (const file of walk(builder.directory, [ glob, ...params ], options)) {
|
|
144
|
-
builder.unchecked(file)
|
|
145
|
-
}
|
|
146
|
-
return builder.build()
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
return this.pipe(promise)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
pipe(files: Files | Promise<Files>): Pipe & Promise<Files> {
|
|
153
|
-
return new PipeImpl(files, this)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
call(name: string): Promise<Files | undefined> {
|
|
157
|
-
throw new Error(`Unable to call task "${name}"`)
|
|
158
|
-
}
|
|
159
|
-
}
|
package/src/task.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { BuildContext, TaskDefinition, ThisBuild } from './build.js'
|
|
2
|
-
import type { Files } from './files.js'
|
|
3
|
-
import type { Run } from './run.js'
|
|
4
|
-
|
|
5
|
-
/* ========================================================================== *
|
|
6
|
-
* TASK *
|
|
7
|
-
* ========================================================================== */
|
|
8
|
-
|
|
9
|
-
export interface Task<T extends Files | undefined = Files | undefined> {
|
|
10
|
-
/** The {@link BuildContext} of where this task was originally defined */
|
|
11
|
-
readonly context: BuildContext
|
|
12
|
-
|
|
13
|
-
/** Invoked by the {@link Run} when actually executing this {@link Task} */
|
|
14
|
-
call(thisBuild: ThisBuild<any>, run: Run): Promise<T>
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class TaskImpl implements Task<Files | undefined> {
|
|
18
|
-
constructor(
|
|
19
|
-
readonly context: BuildContext,
|
|
20
|
-
private readonly _definition: TaskDefinition<any>,
|
|
21
|
-
) {}
|
|
22
|
-
|
|
23
|
-
async call(self: ThisBuild<any>, run: Run): Promise<Files | undefined> {
|
|
24
|
-
return (await this._definition.call(self, self, run)) || undefined
|
|
25
|
-
}
|
|
26
|
-
}
|
package/types/async.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Run } from './run.js';
|
|
2
|
-
/**
|
|
3
|
-
* Run the specified `callback` associating the specified {@link Run} and task
|
|
4
|
-
* name with the current asynchronous invocation context.
|
|
5
|
-
*/
|
|
6
|
-
export declare function runAsync<T>(run: Run, task: string, callback: () => Promise<T>): Promise<T>;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the _task name_ associated with the current asynchronous invocation
|
|
9
|
-
* context or `undefined`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function currentTask(): string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Returns the {@link Run} associated with the current asynchronous invocation
|
|
14
|
-
* context or `undefined`.
|
|
15
|
-
*/
|
|
16
|
-
export declare function currentRun(): Run | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Return an array of all _task names_ currently running
|
|
19
|
-
*/
|
|
20
|
-
export declare function runningTasks(): string[];
|
package/types/build.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Files } from './files.js';
|
|
2
|
-
import { AbsolutePath } from './paths.js';
|
|
3
|
-
import { Pipe } from './pipe.js';
|
|
4
|
-
import { Run } from './run.js';
|
|
5
|
-
import { Task } from './task.js';
|
|
6
|
-
/**
|
|
7
|
-
* The {@link BuildContext} interface exposes the _internal_ representation of
|
|
8
|
-
* a build file, including all {@link Task | Tasks}.
|
|
9
|
-
*/
|
|
10
|
-
export declare type BuildContext = {
|
|
11
|
-
/** The absolute file name of the build */
|
|
12
|
-
readonly buildFile: AbsolutePath;
|
|
13
|
-
/** For convenience, the directory of the build file */
|
|
14
|
-
readonly buildDir: AbsolutePath;
|
|
15
|
-
/** A record of all tasks keyed by name */
|
|
16
|
-
readonly tasks: Readonly<Record<string, Task>>;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* A {@link TaskDefinition} is a _function_ defining a {@link Task}.
|
|
20
|
-
*/
|
|
21
|
-
export declare type TaskDefinition<B> = (this: ThisBuild<B>, self: ThisBuild<B>, run: Run) => Files | undefined | void | Promise<Files | undefined | void>;
|
|
22
|
-
/**
|
|
23
|
-
* A {@link TaskCall} describes a _function_ calling a {@link Task}, and
|
|
24
|
-
* it is exposed to outside users of the {@link Build}.
|
|
25
|
-
*/
|
|
26
|
-
export declare type TaskCall<T extends Files | undefined> = ((run?: Run) => Promise<Run>) & {
|
|
27
|
-
readonly task: Task<T>;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* A {@link Build} is a collection of {@link TaskCall | TaskCalls}, as produced
|
|
31
|
-
* by the {@link build} function from a {@link BuildDefinition}.
|
|
32
|
-
*/
|
|
33
|
-
export declare type Build<B> = {
|
|
34
|
-
[K in keyof B]: B[K] extends TaskCall<infer T> ? TaskCall<T> : B[K] extends () => Files | Promise<Files> ? TaskCall<Files> : B[K] extends () => undefined | void | Promise<undefined | void> ? TaskCall<undefined> : never;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* The type supplied as `this` to a {@link TaskDefinition} when invoking it.
|
|
38
|
-
*/
|
|
39
|
-
export declare type ThisBuild<B> = {
|
|
40
|
-
[K in keyof B]: B[K] extends () => Files | Promise<Files> ? () => Pipe & Promise<Files> : B[K] extends () => undefined | void | Promise<undefined | void> ? () => Promise<undefined> : B[K] extends TaskCall<infer T> ? () => T : never;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* A {@link BuildDefinition} is a collection of
|
|
44
|
-
* {@link TaskDefinition | TaskDefinitions} that the {@link build} function will
|
|
45
|
-
* use to create a {@link Build}.
|
|
46
|
-
*
|
|
47
|
-
* A {@link BuildDefinition} can also include other {@link TaskCall | TaskCalls},
|
|
48
|
-
* thus giving the ability to extend other {@link Build | Builds}.
|
|
49
|
-
*/
|
|
50
|
-
export declare type BuildDefinition<B> = {
|
|
51
|
-
[K in keyof B]: TaskDefinition<B> | TaskCall<Files | undefined>;
|
|
52
|
-
};
|
|
53
|
-
/** Check if the specified build is actually a {@link Build} */
|
|
54
|
-
export declare function isBuild(build: any): build is Build<any>;
|
|
55
|
-
/** Create a new {@link Build} from its {@link BuildDefinition}. */
|
|
56
|
-
export declare function build<D extends BuildDefinition<D>>(definition: D & ThisType<ThisBuild<D>>): Build<D>;
|
package/types/fork.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Files } from './files.js';
|
|
2
|
-
import { LogOptions } from './log.js';
|
|
3
|
-
import { AbsolutePath } from './paths.js';
|
|
4
|
-
import { Plug, PlugName } from './pipe.js';
|
|
5
|
-
import { Run } from './run.js';
|
|
6
|
-
/** Fork data, from parent to child process */
|
|
7
|
-
export interface ForkData {
|
|
8
|
-
/** Script name for the Plug to execute */
|
|
9
|
-
scriptFile: AbsolutePath;
|
|
10
|
-
/** Plug constructor arguments */
|
|
11
|
-
constructorArgs: any[];
|
|
12
|
-
/** Task name (for logs) */
|
|
13
|
-
taskName: string;
|
|
14
|
-
/** Build file name */
|
|
15
|
-
buildFile: AbsolutePath;
|
|
16
|
-
/** Build directory */
|
|
17
|
-
buildDir: AbsolutePath;
|
|
18
|
-
/** Files directory */
|
|
19
|
-
filesDir: AbsolutePath;
|
|
20
|
-
/** All files to pipe */
|
|
21
|
-
filesList: AbsolutePath[];
|
|
22
|
-
/** Options for our logger in the child process */
|
|
23
|
-
logOpts: Partial<LogOptions>;
|
|
24
|
-
}
|
|
25
|
-
/** Fork result, from child to parent process */
|
|
26
|
-
export interface ForkResult {
|
|
27
|
-
/** If this is `true` we _might_ have `filesDir` and `filesList` */
|
|
28
|
-
failed: boolean;
|
|
29
|
-
/** Files directory of the result */
|
|
30
|
-
filesDir?: AbsolutePath | undefined;
|
|
31
|
-
/** All files returned by the plug */
|
|
32
|
-
filesList?: AbsolutePath[] | undefined;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Install a _forking_ {@link Plug} in the {@link Pipe}, in other words
|
|
36
|
-
* execute the plug in a separate process.
|
|
37
|
-
*
|
|
38
|
-
* As a contract, if the _last non-null_ parameter of the constructor is an
|
|
39
|
-
* object and contains the key `coverageDir`, the process will be forked with
|
|
40
|
-
* the approptiately resolved `NODE_V8_COVERAGE` environment variable.
|
|
41
|
-
*
|
|
42
|
-
* Also, forking plugs require some special attention:
|
|
43
|
-
*
|
|
44
|
-
* * plug functions are not supported, only classes implementing the
|
|
45
|
-
* {@link Plug} interface can be used with this.
|
|
46
|
-
*
|
|
47
|
-
* * the class itself _MUST_ be exported as the _default_ export for the
|
|
48
|
-
* `scriptFile` specified below. This is to simplify interoperability between
|
|
49
|
-
* CommonJS and ESM modules as we use dynamic `import(...)` statements.
|
|
50
|
-
*/
|
|
51
|
-
export declare function installForking(plugName: PlugName, scriptFile: AbsolutePath): void;
|
|
52
|
-
export declare abstract class ForkingPlug implements Plug<Files | undefined> {
|
|
53
|
-
private readonly _scriptFile;
|
|
54
|
-
private readonly _arguments;
|
|
55
|
-
constructor(_scriptFile: AbsolutePath, _arguments: any[]);
|
|
56
|
-
pipe(files: Files, run: Run): Promise<Files | undefined>;
|
|
57
|
-
}
|
package/types/helpers.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { AbsolutePath } from './paths.js';
|
|
2
|
-
import { Files, FilesBuilder } from './files.js';
|
|
3
|
-
import { LogLevelString } from './log.js';
|
|
4
|
-
import { Pipe } from './pipe.js';
|
|
5
|
-
import { FindOptions } from './run.js';
|
|
6
|
-
import { ParseOptions } from './utils/options.js';
|
|
7
|
-
/**
|
|
8
|
-
* Recursively remove the specified directory _**(use with care)**_.
|
|
9
|
-
*/
|
|
10
|
-
export declare function rmrf(directory: string): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Set the current _log level_.
|
|
13
|
-
*
|
|
14
|
-
* The _level_ will be applied _only_ within the execution of the current task.
|
|
15
|
-
*/
|
|
16
|
-
export declare function setLogLevel(level: LogLevelString): void;
|
|
17
|
-
/**
|
|
18
|
-
* Resolve a path into an {@link AbsolutePath}.
|
|
19
|
-
*
|
|
20
|
-
* If the path starts with `@...` it is considered to be relative to the
|
|
21
|
-
* _directory containing the build file where the task was defined_, otherwise
|
|
22
|
-
* it will be relative to the {@link process.cwd | current working directory}.
|
|
23
|
-
*/
|
|
24
|
-
export declare function resolve(...paths: string[]): AbsolutePath;
|
|
25
|
-
/**
|
|
26
|
-
* Create a new {@link Files} instance.
|
|
27
|
-
*/
|
|
28
|
-
export declare function files(files: Files): FilesBuilder;
|
|
29
|
-
export declare function files(directory: string, ...paths: string[]): FilesBuilder;
|
|
30
|
-
/**
|
|
31
|
-
* Merge multiple {@link Files} instance.
|
|
32
|
-
*/
|
|
33
|
-
export declare function merge(args: (Files | Promise<Files>)[]): Promise<Files> & Pipe;
|
|
34
|
-
/**
|
|
35
|
-
* Find files according to the globs and {@link FindOptions} specified.
|
|
36
|
-
*/
|
|
37
|
-
export declare function find(glob: string, ...args: ParseOptions<FindOptions>): Pipe & Promise<Files>;
|
|
38
|
-
/** Create a {@link Pipe} from a {@link Files} instance. */
|
|
39
|
-
export declare function pipe(files: Files | Promise<Files>): Pipe & Promise<Files>;
|
|
40
|
-
/** Return an absolute path of the file if it exist on disk */
|
|
41
|
-
export declare function isFile(...paths: string[]): AbsolutePath | undefined;
|
|
42
|
-
/** Return an absolute path of the file if it exist on disk */
|
|
43
|
-
export declare function isDirectory(...paths: string[]): AbsolutePath | undefined;
|
package/types/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference path="../extra/webassembly.d.ts" />
|
|
2
|
-
export * from './assert.js';
|
|
3
|
-
export * from './build.js';
|
|
4
|
-
export * from './plugs.js';
|
|
5
|
-
export * from './log.js';
|
|
6
|
-
export * from './helpers.js';
|
|
7
|
-
export type { MatchOptions, MatchResult } from './utils/match.js';
|
|
8
|
-
export type { ParseOptions } from './utils/options.js';
|
|
9
|
-
export type { WalkOptions } from './utils/walk.js';
|
|
10
|
-
export type { AbsolutePath } from './paths.js';
|
|
11
|
-
export type { Files, FilesBuilder } from './files.js';
|
|
12
|
-
export type { FindOptions, Run } from './run.js';
|
|
13
|
-
export type { Pipe, Plug, PlugFunction } from './pipe.js';
|
|
14
|
-
export type { Task } from './task.js';
|
package/types/pipe.d.ts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { Files } from './files.js';
|
|
2
|
-
import { Run } from './run.js';
|
|
3
|
-
/**
|
|
4
|
-
* The {@link Plug} interface describes an extension mechanism for our build.
|
|
5
|
-
*/
|
|
6
|
-
export interface Plug<T extends Files | undefined> {
|
|
7
|
-
pipe(files: Files, run: Run): T | Promise<T>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A type identifying a {@link Plug} as a `function`
|
|
11
|
-
*/
|
|
12
|
-
export declare type PlugFunction<T extends Files | undefined> = Plug<T>['pipe'];
|
|
13
|
-
/**
|
|
14
|
-
* A {@link Pipe} represents a sequence of operations performed by
|
|
15
|
-
* a series of {@link Plug | Plugs}.
|
|
16
|
-
*/
|
|
17
|
-
export interface Pipe {
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* The {@link Pipe} abstract class exposes the prototype upon which all
|
|
21
|
-
* extension plugs will be installed on.
|
|
22
|
-
*/
|
|
23
|
-
export declare abstract class Pipe implements Pipe {
|
|
24
|
-
abstract plug(plug: Plug<Files> | PlugFunction<Files>): Pipe & Promise<Files>;
|
|
25
|
-
abstract plug(plug: Plug<undefined> | PlugFunction<undefined>): Promise<undefined>;
|
|
26
|
-
}
|
|
27
|
-
/** Implementation of our {@link Pipe}. */
|
|
28
|
-
export declare class PipeImpl<T extends Files | undefined> extends Pipe implements Promise<T> {
|
|
29
|
-
#private;
|
|
30
|
-
constructor(start: T | Promise<T>, run: Run);
|
|
31
|
-
plug<T extends Files | undefined>(arg: Plug<T> | PlugFunction<T>): Pipe & Promise<T>;
|
|
32
|
-
then<T1 = T, T2 = never>(onfulfilled?: ((value: T) => T1 | PromiseLike<T1>) | null | undefined, onrejected?: ((reason: any) => T2 | PromiseLike<T2>) | null | undefined): Promise<T1 | T2>;
|
|
33
|
-
catch<T0 = never>(onrejected?: ((reason: any) => T0 | PromiseLike<T0>) | null | undefined): Promise<T0 | T>;
|
|
34
|
-
finally(onfinally?: (() => void) | null | undefined): Promise<T>;
|
|
35
|
-
[Symbol.toStringTag]: string;
|
|
36
|
-
}
|
|
37
|
-
/** The names which can be installed as direct plugs. */
|
|
38
|
-
export declare type PlugName = string & Exclude<keyof Pipe, 'plug' | keyof Promise<Files>>;
|
|
39
|
-
/** A convenience type identifying a {@link Plug} constructor. */
|
|
40
|
-
export declare type PlugConstructor = new (...args: any) => Plug<Files | undefined>;
|
|
41
|
-
/** Convert the resulting type of a {@link Plug} for use in a {@link Pipe} */
|
|
42
|
-
declare type PlugReturnForPipe<T> = T extends Plug<infer R> ? R extends Files ? Promise<Files> & Pipe : R extends undefined ? Promise<undefined> : never : never;
|
|
43
|
-
/**
|
|
44
|
-
* Map constructors into an array of all known overloads.
|
|
45
|
-
*
|
|
46
|
-
* This is a _royal_ pain in the ass, as we need to distinguish between
|
|
47
|
-
* all possible number of overloads of a constructor... Limit to 5 of them!
|
|
48
|
-
*
|
|
49
|
-
* Also, the empty constructor (when specified in the overloads) will simply
|
|
50
|
-
* match the first case (most overloads) and generate functions somewhat like
|
|
51
|
-
*
|
|
52
|
-
* (...args: unknown[]) => never
|
|
53
|
-
* (...args: unknown[]) => never
|
|
54
|
-
* (...args: unknown[]) => never
|
|
55
|
-
* () => PlugReturnForPipe<R3>
|
|
56
|
-
* (arg: Options) => PlugReturnForPipe<R4>
|
|
57
|
-
*
|
|
58
|
-
* Somehow inferring the result to `Function` or the right type and ANDing all
|
|
59
|
-
* those together here doesn't work, so we create this array and we'll AND
|
|
60
|
-
* all its members in the PipeExtension<...> type.
|
|
61
|
-
*/
|
|
62
|
-
declare type PlugConstructorOverloads<T extends PlugConstructor> = T extends {
|
|
63
|
-
new (...args: infer A0): infer R0;
|
|
64
|
-
new (...args: infer A1): infer R1;
|
|
65
|
-
new (...args: infer A2): infer R2;
|
|
66
|
-
new (...args: infer A3): infer R3;
|
|
67
|
-
new (...args: infer A4): infer R4;
|
|
68
|
-
} ? [
|
|
69
|
-
R0 extends Plug<Files | undefined> ? ((...args: A0) => PlugReturnForPipe<R0>) : Function,
|
|
70
|
-
R1 extends Plug<Files | undefined> ? ((...args: A1) => PlugReturnForPipe<R1>) : Function,
|
|
71
|
-
R2 extends Plug<Files | undefined> ? ((...args: A2) => PlugReturnForPipe<R2>) : Function,
|
|
72
|
-
R3 extends Plug<Files | undefined> ? ((...args: A3) => PlugReturnForPipe<R3>) : Function,
|
|
73
|
-
R4 extends Plug<Files | undefined> ? ((...args: A4) => PlugReturnForPipe<R4>) : Function
|
|
74
|
-
] : T extends {
|
|
75
|
-
new (...args: infer A0): infer R0;
|
|
76
|
-
new (...args: infer A1): infer R1;
|
|
77
|
-
new (...args: infer A2): infer R2;
|
|
78
|
-
new (...args: infer A3): infer R3;
|
|
79
|
-
} ? [
|
|
80
|
-
R0 extends Plug<Files | undefined> ? (...args: A0) => PlugReturnForPipe<R0> : Function,
|
|
81
|
-
R1 extends Plug<Files | undefined> ? (...args: A1) => PlugReturnForPipe<R1> : Function,
|
|
82
|
-
R2 extends Plug<Files | undefined> ? (...args: A2) => PlugReturnForPipe<R2> : Function,
|
|
83
|
-
R3 extends Plug<Files | undefined> ? (...args: A3) => PlugReturnForPipe<R3> : Function
|
|
84
|
-
] : T extends {
|
|
85
|
-
new (...args: infer A0): infer R0;
|
|
86
|
-
new (...args: infer A1): infer R1;
|
|
87
|
-
new (...args: infer A2): infer R2;
|
|
88
|
-
} ? [
|
|
89
|
-
R0 extends Plug<Files | undefined> ? (...args: A0) => PlugReturnForPipe<R0> : Function,
|
|
90
|
-
R1 extends Plug<Files | undefined> ? (...args: A1) => PlugReturnForPipe<R1> : Function,
|
|
91
|
-
R2 extends Plug<Files | undefined> ? (...args: A2) => PlugReturnForPipe<R2> : Function
|
|
92
|
-
] : T extends {
|
|
93
|
-
new (...args: infer A0): infer R0;
|
|
94
|
-
new (...args: infer A1): infer R1;
|
|
95
|
-
} ? [
|
|
96
|
-
R0 extends Plug<Files | undefined> ? (...args: A0) => PlugReturnForPipe<R0> : Function,
|
|
97
|
-
R1 extends Plug<Files | undefined> ? (...args: A1) => PlugReturnForPipe<R1> : Function
|
|
98
|
-
] : T extends {
|
|
99
|
-
new (...args: infer A0): infer R0;
|
|
100
|
-
} ? [
|
|
101
|
-
R0 extends Plug<Files | undefined> ? (...args: A0) => PlugReturnForPipe<R0> : Function
|
|
102
|
-
] : never;
|
|
103
|
-
/**
|
|
104
|
-
* A convenience type to easily annotate installed {@link Plug Plugs}.
|
|
105
|
-
*
|
|
106
|
-
* See also {@link install}.
|
|
107
|
-
*
|
|
108
|
-
* ```
|
|
109
|
-
* export class Write implements Plug {
|
|
110
|
-
* // ... the plug implementation lives here
|
|
111
|
-
* }
|
|
112
|
-
*
|
|
113
|
-
* install('write', Write)
|
|
114
|
-
*
|
|
115
|
-
* declare module '../pipe' {
|
|
116
|
-
* export interface Pipe {
|
|
117
|
-
* write: PipeExtension<typeof Write>
|
|
118
|
-
* }
|
|
119
|
-
* }
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
export declare type PipeExtension<T extends PlugConstructor, A = PlugConstructorOverloads<T>> = A extends readonly [infer First, ...infer Rest] ? First & PipeExtension<T, Rest> : A extends readonly [infer Only] ? Only : Function;
|
|
123
|
-
/**
|
|
124
|
-
* Install a {@link Plug} into our {@link Pipe} prototype, and return a static
|
|
125
|
-
* creator function for the {@link Plug} itself.
|
|
126
|
-
*
|
|
127
|
-
* This allows our shorthand syntax for well-defined plugs such as:
|
|
128
|
-
*
|
|
129
|
-
* ```
|
|
130
|
-
* find('./src', '*.ts').write('./target')
|
|
131
|
-
* // Nicer and easier than...
|
|
132
|
-
* find('./src', '*.ts').plug(new Write('./target'))
|
|
133
|
-
* ```
|
|
134
|
-
*
|
|
135
|
-
* Use this alongside interface merging like:
|
|
136
|
-
*
|
|
137
|
-
* ```
|
|
138
|
-
* export class Write implements Plug {
|
|
139
|
-
* // ... the plug implementation lives here
|
|
140
|
-
* }
|
|
141
|
-
*
|
|
142
|
-
* install('write', Write)
|
|
143
|
-
*
|
|
144
|
-
* declare module '../pipe' {
|
|
145
|
-
* export interface Pipe {
|
|
146
|
-
* write: PipeExtension<typeof Write>
|
|
147
|
-
* }
|
|
148
|
-
* }
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
export declare function install<C extends PlugConstructor>(name: PlugName, ctor: C): void;
|
|
152
|
-
export {};
|
package/types/plugs/copy.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Files } from '../files.js';
|
|
2
|
-
import { Plug } from '../pipe.js';
|
|
3
|
-
import { Run } from '../run.js';
|
|
4
|
-
/** Options for copying files */
|
|
5
|
-
export interface CopyOptions {
|
|
6
|
-
/** Whether to allow overwriting or not (default `false`). */
|
|
7
|
-
overwrite?: boolean;
|
|
8
|
-
/** If specified, use this `mode` (octal string) when creating files. */
|
|
9
|
-
mode?: string | number;
|
|
10
|
-
/** If specified, use this `mode` (octal string) when creating directories. */
|
|
11
|
-
dirMode?: string | number;
|
|
12
|
-
/** If specified, this function will be invoked to rename files. */
|
|
13
|
-
rename?: (relative: string) => string;
|
|
14
|
-
}
|
|
15
|
-
/** Copy the curent {@link Files} to a different directory */
|
|
16
|
-
export declare class Copy implements Plug<Files> {
|
|
17
|
-
private readonly _directory;
|
|
18
|
-
private readonly _options;
|
|
19
|
-
constructor(directory: string, options?: CopyOptions);
|
|
20
|
-
pipe(files: Files, run: Run): Promise<Files>;
|
|
21
|
-
}
|
|
22
|
-
declare module '../pipe.js' {
|
|
23
|
-
interface Pipe {
|
|
24
|
-
/** Copy the curent {@link Files} to a different directory */
|
|
25
|
-
copy: PipeExtension<typeof Copy>;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Files } from '../files.js';
|
|
2
|
-
import { Plug } from '../pipe.js';
|
|
3
|
-
import { Run } from '../run.js';
|
|
4
|
-
import { SourceMapBias } from './coverage/analysis.js';
|
|
5
|
-
/** Options to analyse coverage reports */
|
|
6
|
-
export interface CoverageOptions {
|
|
7
|
-
/** The bias for source map analisys (defaults to `greatest_lower_bound`) */
|
|
8
|
-
sourceMapBias?: SourceMapBias;
|
|
9
|
-
/** Minimum _overall_ coverage (as a percentage) */
|
|
10
|
-
minimumCoverage?: number;
|
|
11
|
-
/** Optimal _overall_ coverage (as a percentage) */
|
|
12
|
-
optimalCoverage?: number;
|
|
13
|
-
/** Minimum _per-file_ coverage (as a percentage) */
|
|
14
|
-
minimumFileCoverage?: number;
|
|
15
|
-
/** Optimal _per-file_ coverage (as a percentage) */
|
|
16
|
-
optimalFileCoverage?: number;
|
|
17
|
-
}
|
|
18
|
-
export interface CoverageReportOptions extends CoverageOptions {
|
|
19
|
-
/** If specified, a JSON and HTML report will be written to this directory */
|
|
20
|
-
reportDir: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The {@link Coverage} plug type is inferred from the constructor, so this
|
|
24
|
-
* type helps to declare the correct types as we can't really infer them from
|
|
25
|
-
* `typeof Coverage`...
|
|
26
|
-
*/
|
|
27
|
-
declare type CoverageConstructor = {
|
|
28
|
-
new (coverageDir: string): Coverage<CoverageOptions>;
|
|
29
|
-
new (coverageDir: string, options: CoverageOptions): Coverage<CoverageOptions>;
|
|
30
|
-
new (coverageDir: string, options: CoverageReportOptions): Coverage<CoverageReportOptions>;
|
|
31
|
-
};
|
|
32
|
-
/** Analyse coverage using files generated by V8/NodeJS. */
|
|
33
|
-
export declare class Coverage<T extends CoverageOptions | CoverageReportOptions> implements Plug<T extends CoverageReportOptions ? Files : undefined> {
|
|
34
|
-
private readonly _coverageDir;
|
|
35
|
-
private readonly _options;
|
|
36
|
-
constructor(coverageDir: string);
|
|
37
|
-
constructor(coverageDir: string, options?: T);
|
|
38
|
-
pipe(files: Files, run: Run): Promise<T extends CoverageReportOptions ? Files : undefined>;
|
|
39
|
-
}
|
|
40
|
-
declare module '../pipe.js' {
|
|
41
|
-
interface Pipe {
|
|
42
|
-
/** Analyse coverage using files generated by V8/NodeJS. */
|
|
43
|
-
coverage: PipeExtension<CoverageConstructor>;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export {};
|
package/types/plugs/debug.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Files } from '../files.js';
|
|
2
|
-
import { Plug } from '../pipe.js';
|
|
3
|
-
import { Run } from '../run.js';
|
|
4
|
-
/** Writes some info about the current {@link Files} being passed around. */
|
|
5
|
-
export declare class Debug implements Plug<Files> {
|
|
6
|
-
constructor();
|
|
7
|
-
pipe(files: Files, run: Run): Promise<Files>;
|
|
8
|
-
}
|
|
9
|
-
declare module '../pipe.js' {
|
|
10
|
-
interface Pipe {
|
|
11
|
-
/** Writes some info about the current {@link Files} being passed around. */
|
|
12
|
-
debug: PipeExtension<typeof Debug>;
|
|
13
|
-
}
|
|
14
|
-
}
|
package/types/plugs/esbuild.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BuildOptions } from 'esbuild';
|
|
2
|
-
import { Files } from '../files.js';
|
|
3
|
-
import { Plug } from '../pipe.js';
|
|
4
|
-
import { Run } from '../run.js';
|
|
5
|
-
export declare type ESBuildOptions = Omit<BuildOptions, 'absWorkingDir' | 'entryPoints' | 'watch'>;
|
|
6
|
-
/**
|
|
7
|
-
* Transpile and bundle files with {@link https://esbuild.github.io/ | esbuild}.
|
|
8
|
-
*/
|
|
9
|
-
export declare class ESBuild implements Plug<Files> {
|
|
10
|
-
private readonly _options;
|
|
11
|
-
constructor(options: ESBuildOptions);
|
|
12
|
-
pipe(files: Files, run: Run): Promise<Files>;
|
|
13
|
-
}
|
|
14
|
-
declare module '../pipe.js' {
|
|
15
|
-
interface Pipe {
|
|
16
|
-
/**
|
|
17
|
-
* Transpile and bundle files with {@link https://esbuild.github.io/ esbuild}.
|
|
18
|
-
*/
|
|
19
|
-
esbuild: PipeExtension<typeof ESBuild>;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export * from './esbuild/bundle-locals.js';
|
|
23
|
-
export * from './esbuild/fix-extensions.js';
|