@plugjs/plug 0.6.117 → 0.7.1
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/dist/asserts.d.ts +1 -0
- package/dist/asserts.d.ts.map +1 -0
- package/dist/asserts.js +68 -0
- package/dist/asserts.js.map +1 -0
- package/dist/async.d.ts +2 -1
- package/dist/async.d.ts.map +1 -0
- package/dist/async.js +52 -0
- package/dist/async.js.map +1 -0
- package/dist/build.d.ts +2 -1
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +236 -0
- package/dist/build.js.map +1 -0
- package/dist/{cli.d.mts → cli.d.ts} +3 -1
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +330 -0
- package/dist/cli.js.map +1 -0
- package/dist/files.d.ts +2 -1
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +93 -0
- package/dist/files.js.map +1 -0
- package/dist/fork.d.ts +5 -4
- package/dist/fork.d.ts.map +1 -0
- package/dist/fork.js +259 -0
- package/dist/fork.js.map +1 -0
- package/dist/fs.d.ts +1 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +72 -0
- package/dist/fs.js.map +1 -0
- package/dist/globals.d.ts +4 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +2 -0
- package/dist/globals.js.map +1 -0
- package/dist/helpers.d.ts +8 -7
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +231 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +22 -21
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/colors.d.ts +2 -1
- package/dist/logging/colors.d.ts.map +1 -0
- package/dist/logging/colors.js +121 -0
- package/dist/logging/colors.js.map +1 -0
- package/dist/logging/emit.d.ts +2 -1
- package/dist/logging/emit.d.ts.map +1 -0
- package/dist/logging/emit.js +137 -0
- package/dist/logging/emit.js.map +1 -0
- package/dist/logging/github.d.ts +2 -1
- package/dist/logging/github.d.ts.map +1 -0
- package/dist/logging/github.js +46 -0
- package/dist/logging/github.js.map +1 -0
- package/dist/logging/levels.d.ts +1 -0
- package/dist/logging/levels.d.ts.map +1 -0
- package/dist/logging/levels.js +50 -0
- package/dist/logging/levels.js.map +1 -0
- package/dist/logging/logger.d.ts +4 -3
- package/dist/logging/logger.d.ts.map +1 -0
- package/dist/logging/logger.js +161 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/logging/options.d.ts +2 -1
- package/dist/logging/options.d.ts.map +1 -0
- package/dist/logging/options.js +182 -0
- package/dist/logging/options.js.map +1 -0
- package/dist/logging/report.d.ts +4 -3
- package/dist/logging/report.d.ts.map +1 -0
- package/dist/logging/report.js +346 -0
- package/dist/logging/report.js.map +1 -0
- package/dist/logging/spinner.d.ts +1 -0
- package/dist/logging/spinner.d.ts.map +1 -0
- package/dist/logging/spinner.js +70 -0
- package/dist/logging/spinner.js.map +1 -0
- package/dist/logging.d.ts +8 -7
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +66 -0
- package/dist/logging.js.map +1 -0
- package/dist/paths.d.ts +33 -13
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +223 -0
- package/dist/paths.js.map +1 -0
- package/dist/pipe.d.ts +8 -5
- package/dist/pipe.d.ts.map +1 -0
- package/dist/pipe.js +205 -0
- package/dist/pipe.js.map +1 -0
- package/dist/plugs/build.d.ts +5 -4
- package/dist/plugs/build.d.ts.map +1 -0
- package/dist/plugs/build.js +56 -0
- package/dist/plugs/build.js.map +1 -0
- package/dist/plugs/copy.d.ts +1 -0
- package/dist/plugs/copy.d.ts.map +1 -0
- package/dist/plugs/copy.js +92 -0
- package/dist/plugs/copy.js.map +1 -0
- package/dist/plugs/debug.d.ts +1 -0
- package/dist/plugs/debug.d.ts.map +1 -0
- package/dist/plugs/debug.js +25 -0
- package/dist/plugs/debug.js.map +1 -0
- package/dist/plugs/edit.d.ts +2 -1
- package/dist/plugs/edit.d.ts.map +1 -0
- package/dist/plugs/edit.js +22 -0
- package/dist/plugs/edit.js.map +1 -0
- package/dist/plugs/esbuild/bundle-locals.d.ts +1 -0
- package/dist/plugs/esbuild/bundle-locals.d.ts.map +1 -0
- package/dist/plugs/esbuild/bundle-locals.js +29 -0
- package/dist/plugs/esbuild/bundle-locals.js.map +1 -0
- package/dist/plugs/esbuild/fix-extensions.d.ts +1 -0
- package/dist/plugs/esbuild/fix-extensions.d.ts.map +1 -0
- package/dist/plugs/esbuild/fix-extensions.js +98 -0
- package/dist/plugs/esbuild/fix-extensions.js.map +1 -0
- package/dist/plugs/esbuild.d.ts +21 -2
- package/dist/plugs/esbuild.d.ts.map +1 -0
- package/dist/plugs/esbuild.js +193 -0
- package/dist/plugs/esbuild.js.map +1 -0
- package/dist/plugs/exec.d.ts +2 -1
- package/dist/plugs/exec.d.ts.map +1 -0
- package/dist/plugs/exec.js +33 -0
- package/dist/plugs/exec.js.map +1 -0
- package/dist/plugs/exports.d.ts +1 -0
- package/dist/plugs/exports.d.ts.map +1 -0
- package/dist/plugs/exports.js +110 -0
- package/dist/plugs/exports.js.map +1 -0
- package/dist/plugs/filter.d.ts +2 -1
- package/dist/plugs/filter.d.ts.map +1 -0
- package/dist/plugs/filter.js +34 -0
- package/dist/plugs/filter.js.map +1 -0
- package/dist/plugs/rmf.d.ts +1 -0
- package/dist/plugs/rmf.d.ts.map +1 -0
- package/dist/plugs/rmf.js +24 -0
- package/dist/plugs/rmf.js.map +1 -0
- package/dist/plugs.d.ts +9 -8
- package/dist/plugs.d.ts.map +1 -0
- package/dist/plugs.js +9 -0
- package/dist/plugs.js.map +1 -0
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/ansi.d.ts +1 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +10 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/caller.d.ts +2 -1
- package/dist/utils/caller.d.ts.map +1 -0
- package/dist/utils/caller.js +33 -0
- package/dist/utils/caller.js.map +1 -0
- package/dist/utils/diff.d.ts +1 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +278 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/exec.d.ts +2 -1
- package/dist/utils/exec.d.ts.map +1 -0
- package/dist/utils/exec.js +84 -0
- package/dist/utils/exec.js.map +1 -0
- package/dist/utils/jsonc.d.ts +1 -0
- package/dist/utils/jsonc.d.ts.map +1 -0
- package/dist/utils/jsonc.js +46 -0
- package/dist/utils/jsonc.js.map +1 -0
- package/dist/utils/match.d.ts +1 -0
- package/dist/utils/match.d.ts.map +1 -0
- package/dist/utils/match.js +40 -0
- package/dist/utils/match.js.map +1 -0
- package/dist/utils/options.d.ts +1 -0
- package/dist/utils/options.d.ts.map +1 -0
- package/dist/utils/options.js +17 -0
- package/dist/utils/options.js.map +1 -0
- package/dist/utils/singleton.d.ts +1 -0
- package/dist/utils/singleton.d.ts.map +1 -0
- package/dist/utils/singleton.js +20 -0
- package/dist/utils/singleton.js.map +1 -0
- package/dist/utils/walk.d.ts +3 -2
- package/dist/utils/walk.d.ts.map +1 -0
- package/dist/utils/walk.js +84 -0
- package/dist/utils/walk.js.map +1 -0
- package/dist/utils.d.ts +9 -8
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +9 -0
- package/dist/utils.js.map +1 -0
- package/package.json +28 -88
- package/src/asserts.ts +2 -2
- package/src/async.ts +3 -3
- package/src/build.ts +10 -10
- package/src/{cli.mts → cli.ts} +27 -16
- package/src/files.ts +4 -4
- package/src/fork.ts +17 -17
- package/src/globals.ts +3 -0
- package/src/helpers.ts +20 -20
- package/src/index.ts +21 -21
- package/src/logging/colors.ts +4 -4
- package/src/logging/emit.ts +6 -6
- package/src/logging/github.ts +3 -3
- package/src/logging/logger.ts +12 -12
- package/src/logging/options.ts +10 -10
- package/src/logging/report.ts +10 -10
- package/src/logging/spinner.ts +3 -3
- package/src/logging.ts +14 -14
- package/src/paths.ts +42 -23
- package/src/pipe.ts +13 -8
- package/src/plugs/build.ts +8 -8
- package/src/plugs/copy.ts +8 -8
- package/src/plugs/debug.ts +4 -4
- package/src/plugs/edit.ts +5 -5
- package/src/plugs/esbuild/fix-extensions.ts +8 -10
- package/src/plugs/esbuild.ts +88 -27
- package/src/plugs/exec.ts +6 -6
- package/src/plugs/exports.ts +32 -35
- package/src/plugs/filter.ts +7 -7
- package/src/plugs/rmf.ts +5 -5
- package/src/plugs.ts +8 -8
- package/src/types.ts +3 -3
- package/src/utils/caller.ts +4 -4
- package/src/utils/diff.ts +2 -2
- package/src/utils/exec.ts +7 -7
- package/src/utils/jsonc.ts +1 -1
- package/src/utils/walk.ts +6 -6
- package/src/utils.ts +8 -8
- package/dist/asserts.cjs +0 -86
- package/dist/asserts.cjs.map +0 -6
- package/dist/asserts.mjs +0 -58
- package/dist/asserts.mjs.map +0 -6
- package/dist/async.cjs +0 -64
- package/dist/async.cjs.map +0 -6
- package/dist/async.mjs +0 -36
- package/dist/async.mjs.map +0 -6
- package/dist/build.cjs +0 -222
- package/dist/build.cjs.map +0 -6
- package/dist/build.mjs +0 -192
- package/dist/build.mjs.map +0 -6
- package/dist/cli.mjs +0 -258
- package/dist/cli.mjs.map +0 -6
- package/dist/files.cjs +0 -113
- package/dist/files.cjs.map +0 -6
- package/dist/files.mjs +0 -93
- package/dist/files.mjs.map +0 -6
- package/dist/fork.cjs +0 -224
- package/dist/fork.cjs.map +0 -6
- package/dist/fork.mjs +0 -198
- package/dist/fork.mjs.map +0 -6
- package/dist/fs.cjs +0 -146
- package/dist/fs.cjs.map +0 -6
- package/dist/fs.mjs +0 -82
- package/dist/fs.mjs.map +0 -6
- package/dist/globals.cjs +0 -2
- package/dist/globals.cjs.map +0 -6
- package/dist/globals.mjs +0 -1
- package/dist/globals.mjs.map +0 -6
- package/dist/helpers.cjs +0 -182
- package/dist/helpers.cjs.map +0 -6
- package/dist/helpers.mjs +0 -151
- package/dist/helpers.mjs.map +0 -6
- package/dist/index.cjs +0 -114
- package/dist/index.cjs.map +0 -6
- package/dist/index.mjs +0 -48
- package/dist/index.mjs.map +0 -6
- package/dist/logging/colors.cjs +0 -136
- package/dist/logging/colors.cjs.map +0 -6
- package/dist/logging/colors.mjs +0 -99
- package/dist/logging/colors.mjs.map +0 -6
- package/dist/logging/emit.cjs +0 -134
- package/dist/logging/emit.cjs.map +0 -6
- package/dist/logging/emit.mjs +0 -106
- package/dist/logging/emit.mjs.map +0 -6
- package/dist/logging/github.cjs +0 -60
- package/dist/logging/github.cjs.map +0 -6
- package/dist/logging/github.mjs +0 -35
- package/dist/logging/github.mjs.map +0 -6
- package/dist/logging/levels.cjs +0 -69
- package/dist/logging/levels.cjs.map +0 -6
- package/dist/logging/levels.mjs +0 -35
- package/dist/logging/levels.mjs.map +0 -6
- package/dist/logging/logger.cjs +0 -165
- package/dist/logging/logger.cjs.map +0 -6
- package/dist/logging/logger.mjs +0 -139
- package/dist/logging/logger.mjs.map +0 -6
- package/dist/logging/options.cjs +0 -192
- package/dist/logging/options.cjs.map +0 -6
- package/dist/logging/options.mjs +0 -167
- package/dist/logging/options.mjs.map +0 -6
- package/dist/logging/report.cjs +0 -298
- package/dist/logging/report.cjs.map +0 -6
- package/dist/logging/report.mjs +0 -273
- package/dist/logging/report.mjs.map +0 -6
- package/dist/logging/spinner.cjs +0 -100
- package/dist/logging/spinner.cjs.map +0 -6
- package/dist/logging/spinner.mjs +0 -72
- package/dist/logging/spinner.mjs.map +0 -6
- package/dist/logging.cjs +0 -91
- package/dist/logging.cjs.map +0 -6
- package/dist/logging.mjs +0 -58
- package/dist/logging.mjs.map +0 -6
- package/dist/paths.cjs +0 -170
- package/dist/paths.cjs.map +0 -6
- package/dist/paths.mjs +0 -132
- package/dist/paths.mjs.map +0 -6
- package/dist/pipe.cjs +0 -163
- package/dist/pipe.cjs.map +0 -6
- package/dist/pipe.mjs +0 -135
- package/dist/pipe.mjs.map +0 -6
- package/dist/plugs/build.cjs +0 -73
- package/dist/plugs/build.cjs.map +0 -6
- package/dist/plugs/build.mjs +0 -47
- package/dist/plugs/build.mjs.map +0 -6
- package/dist/plugs/copy.cjs +0 -86
- package/dist/plugs/copy.cjs.map +0 -6
- package/dist/plugs/copy.mjs +0 -69
- package/dist/plugs/copy.mjs.map +0 -6
- package/dist/plugs/debug.cjs +0 -24
- package/dist/plugs/debug.cjs.map +0 -6
- package/dist/plugs/debug.mjs +0 -22
- package/dist/plugs/debug.mjs.map +0 -6
- package/dist/plugs/edit.cjs +0 -20
- package/dist/plugs/edit.cjs.map +0 -6
- package/dist/plugs/edit.mjs +0 -18
- package/dist/plugs/edit.mjs.map +0 -6
- package/dist/plugs/esbuild/bundle-locals.cjs +0 -48
- package/dist/plugs/esbuild/bundle-locals.cjs.map +0 -6
- package/dist/plugs/esbuild/bundle-locals.mjs +0 -23
- package/dist/plugs/esbuild/bundle-locals.mjs.map +0 -6
- package/dist/plugs/esbuild/fix-extensions.cjs +0 -89
- package/dist/plugs/esbuild/fix-extensions.cjs.map +0 -6
- package/dist/plugs/esbuild/fix-extensions.mjs +0 -54
- package/dist/plugs/esbuild/fix-extensions.mjs.map +0 -6
- package/dist/plugs/esbuild.cjs +0 -139
- package/dist/plugs/esbuild.cjs.map +0 -6
- package/dist/plugs/esbuild.mjs +0 -116
- package/dist/plugs/esbuild.mjs.map +0 -6
- package/dist/plugs/exec.cjs +0 -42
- package/dist/plugs/exec.cjs.map +0 -6
- package/dist/plugs/exec.mjs +0 -25
- package/dist/plugs/exec.mjs.map +0 -6
- package/dist/plugs/exports.cjs +0 -117
- package/dist/plugs/exports.cjs.map +0 -6
- package/dist/plugs/exports.mjs +0 -100
- package/dist/plugs/exports.mjs.map +0 -6
- package/dist/plugs/filter.cjs +0 -47
- package/dist/plugs/filter.cjs.map +0 -6
- package/dist/plugs/filter.mjs +0 -30
- package/dist/plugs/filter.mjs.map +0 -6
- package/dist/plugs/rmf.cjs +0 -25
- package/dist/plugs/rmf.cjs.map +0 -6
- package/dist/plugs/rmf.mjs +0 -23
- package/dist/plugs/rmf.mjs.map +0 -6
- package/dist/plugs.cjs +0 -39
- package/dist/plugs.cjs.map +0 -6
- package/dist/plugs.mjs +0 -10
- package/dist/plugs.mjs.map +0 -6
- package/dist/types.cjs +0 -19
- package/dist/types.cjs.map +0 -6
- package/dist/types.mjs +0 -1
- package/dist/types.mjs.map +0 -6
- package/dist/utils/ansi.cjs +0 -39
- package/dist/utils/ansi.cjs.map +0 -6
- package/dist/utils/ansi.mjs +0 -13
- package/dist/utils/ansi.mjs.map +0 -6
- package/dist/utils/caller.cjs +0 -57
- package/dist/utils/caller.cjs.map +0 -6
- package/dist/utils/caller.mjs +0 -32
- package/dist/utils/caller.mjs.map +0 -6
- package/dist/utils/diff.cjs +0 -282
- package/dist/utils/diff.cjs.map +0 -6
- package/dist/utils/diff.mjs +0 -256
- package/dist/utils/diff.mjs.map +0 -6
- package/dist/utils/exec.cjs +0 -113
- package/dist/utils/exec.cjs.map +0 -6
- package/dist/utils/exec.mjs +0 -78
- package/dist/utils/exec.mjs.map +0 -6
- package/dist/utils/jsonc.cjs +0 -74
- package/dist/utils/jsonc.cjs.map +0 -6
- package/dist/utils/jsonc.mjs +0 -48
- package/dist/utils/jsonc.mjs.map +0 -6
- package/dist/utils/match.cjs +0 -74
- package/dist/utils/match.cjs.map +0 -6
- package/dist/utils/match.mjs +0 -39
- package/dist/utils/match.mjs.map +0 -6
- package/dist/utils/options.cjs +0 -39
- package/dist/utils/options.cjs.map +0 -6
- package/dist/utils/options.mjs +0 -14
- package/dist/utils/options.mjs.map +0 -6
- package/dist/utils/singleton.cjs +0 -37
- package/dist/utils/singleton.cjs.map +0 -6
- package/dist/utils/singleton.mjs +0 -12
- package/dist/utils/singleton.mjs.map +0 -6
- package/dist/utils/walk.cjs +0 -98
- package/dist/utils/walk.cjs.map +0 -6
- package/dist/utils/walk.mjs +0 -73
- package/dist/utils/walk.mjs.map +0 -6
- package/dist/utils.cjs +0 -39
- package/dist/utils.cjs.map +0 -6
- package/dist/utils.mjs +0 -10
- package/dist/utils.mjs.map +0 -6
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { basename, join } from 'node:path';
|
|
2
|
+
import { opendir, stat } from "../fs.js";
|
|
3
|
+
import { $p, log } from "../logging.js";
|
|
4
|
+
import { resolveAbsolutePath } from "../paths.js";
|
|
5
|
+
import { match } from "./match.js";
|
|
6
|
+
/**
|
|
7
|
+
* Walk the specified directory, returning an asynchronous iterator over all
|
|
8
|
+
* the _relative_ files found matching the specified globs and matching options.
|
|
9
|
+
*/
|
|
10
|
+
export function walk(directory, globs, options = {}) {
|
|
11
|
+
const { maxDepth = Infinity, followSymlinks = true, allowNodeModules = false, ...opts } = options;
|
|
12
|
+
/* Make sure to also ignore node modules or dot directories if we have to */
|
|
13
|
+
const onDirectory = (dir) => {
|
|
14
|
+
// if we were told to start looking into "node_modules", or in a directory
|
|
15
|
+
// starting with ".", then we ignore any whatsoever option here!
|
|
16
|
+
if (dir === directory)
|
|
17
|
+
return true;
|
|
18
|
+
const name = basename(dir);
|
|
19
|
+
if (name === 'node_modules')
|
|
20
|
+
return !!allowNodeModules;
|
|
21
|
+
if (name.startsWith('.'))
|
|
22
|
+
return !!opts.dot;
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
25
|
+
/* Create our positive matcher to match our globs */
|
|
26
|
+
const positiveMatcher = match(globs, opts);
|
|
27
|
+
/* Do the walk! */
|
|
28
|
+
log.debug('Walking directory', $p(directory), { globs, options });
|
|
29
|
+
return walker({
|
|
30
|
+
directory,
|
|
31
|
+
relative: '',
|
|
32
|
+
matcher: positiveMatcher,
|
|
33
|
+
onDirectory,
|
|
34
|
+
followSymlinks,
|
|
35
|
+
maxDepth,
|
|
36
|
+
depth: 0,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/* Walk a directory and yield matching results until the given `maxDepth` */
|
|
40
|
+
async function* walker(args) {
|
|
41
|
+
const { directory, relative, matcher: positiveMatcher, onDirectory, followSymlinks, maxDepth, depth, } = args;
|
|
42
|
+
/* Read the directory, including file types */
|
|
43
|
+
const dir = resolveAbsolutePath(directory, relative);
|
|
44
|
+
if (!onDirectory(dir))
|
|
45
|
+
return;
|
|
46
|
+
log.trace('Reading directory', $p(dir));
|
|
47
|
+
let dirents;
|
|
48
|
+
try {
|
|
49
|
+
dirents = await opendir(dir);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error.code !== 'ENOENT')
|
|
53
|
+
throw error;
|
|
54
|
+
log.warn('Directory', $p(dir), 'not found');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
/* For each entry we determine the full path */
|
|
58
|
+
for await (const dirent of dirents) {
|
|
59
|
+
const path = join(relative, dirent.name);
|
|
60
|
+
/* If the entry is a file and matches, yield it */
|
|
61
|
+
if (dirent.isFile() && positiveMatcher(path))
|
|
62
|
+
yield path;
|
|
63
|
+
/* If the entry is a directory within our depth, walk it recursively */
|
|
64
|
+
else if (dirent.isDirectory() && (depth < maxDepth)) {
|
|
65
|
+
const children = walker({ ...args, relative: path, depth: depth + 1 });
|
|
66
|
+
for await (const child of children)
|
|
67
|
+
yield child;
|
|
68
|
+
/* If this is a symlink and we're told to check them let's see what we have */
|
|
69
|
+
}
|
|
70
|
+
else if (dirent.isSymbolicLink() && followSymlinks) {
|
|
71
|
+
const info = await stat(join(directory, path));
|
|
72
|
+
/* If the link is a file and matches, yield it */
|
|
73
|
+
if (info.isFile() && positiveMatcher(path))
|
|
74
|
+
yield path;
|
|
75
|
+
/* If the link is a directory within our depth, walk it recursively */
|
|
76
|
+
else if (info.isDirectory() && (depth < maxDepth)) {
|
|
77
|
+
const children = walker({ ...args, relative: path, depth: depth + 1 });
|
|
78
|
+
for await (const child of children)
|
|
79
|
+
yield child;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=walk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/utils/walk.ts"],"names":[],"mappings":"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"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export * from './utils/ansi';
|
|
2
|
-
export * from './utils/diff';
|
|
3
|
-
export * from './utils/exec';
|
|
4
|
-
export * from './utils/jsonc';
|
|
5
|
-
export * from './utils/match';
|
|
6
|
-
export * from './utils/options';
|
|
7
|
-
export * from './utils/singleton';
|
|
8
|
-
export * from './utils/walk';
|
|
1
|
+
export * from './utils/ansi.ts';
|
|
2
|
+
export * from './utils/diff.ts';
|
|
3
|
+
export * from './utils/exec.ts';
|
|
4
|
+
export * from './utils/jsonc.ts';
|
|
5
|
+
export * from './utils/match.ts';
|
|
6
|
+
export * from './utils/options.ts';
|
|
7
|
+
export * from './utils/singleton.ts';
|
|
8
|
+
export * from './utils/walk.ts';
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./utils/ansi.js";
|
|
2
|
+
export * from "./utils/diff.js";
|
|
3
|
+
export * from "./utils/exec.js";
|
|
4
|
+
export * from "./utils/jsonc.js";
|
|
5
|
+
export * from "./utils/match.js";
|
|
6
|
+
export * from "./utils/options.js";
|
|
7
|
+
export * from "./utils/singleton.js";
|
|
8
|
+
export * from "./utils/walk.js";
|
|
9
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,119 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plugjs/plug",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./dist/index.
|
|
6
|
-
"module": "./dist/index.mjs",
|
|
5
|
+
"main": "./dist/index.js",
|
|
7
6
|
"types": "./dist/index.d.ts",
|
|
8
7
|
"bin": {
|
|
9
|
-
"plug": "./dist/cli.
|
|
8
|
+
"plug": "./dist/cli.js"
|
|
10
9
|
},
|
|
11
10
|
"exports": {
|
|
12
11
|
".": {
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
"default": "./dist/index.cjs"
|
|
16
|
-
},
|
|
17
|
-
"import": {
|
|
18
|
-
"types": "./dist/index.d.ts",
|
|
19
|
-
"default": "./dist/index.mjs"
|
|
20
|
-
}
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
21
14
|
},
|
|
22
15
|
"./asserts": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"default": "./dist/asserts.cjs"
|
|
26
|
-
},
|
|
27
|
-
"import": {
|
|
28
|
-
"types": "./dist/asserts.d.ts",
|
|
29
|
-
"default": "./dist/asserts.mjs"
|
|
30
|
-
}
|
|
16
|
+
"types": "./dist/asserts.d.ts",
|
|
17
|
+
"default": "./dist/asserts.js"
|
|
31
18
|
},
|
|
32
19
|
"./files": {
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"default": "./dist/files.cjs"
|
|
36
|
-
},
|
|
37
|
-
"import": {
|
|
38
|
-
"types": "./dist/files.d.ts",
|
|
39
|
-
"default": "./dist/files.mjs"
|
|
40
|
-
}
|
|
20
|
+
"types": "./dist/files.d.ts",
|
|
21
|
+
"default": "./dist/files.js"
|
|
41
22
|
},
|
|
42
23
|
"./fork": {
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"default": "./dist/fork.cjs"
|
|
46
|
-
},
|
|
47
|
-
"import": {
|
|
48
|
-
"types": "./dist/fork.d.ts",
|
|
49
|
-
"default": "./dist/fork.mjs"
|
|
50
|
-
}
|
|
24
|
+
"types": "./dist/fork.d.ts",
|
|
25
|
+
"default": "./dist/fork.js"
|
|
51
26
|
},
|
|
52
27
|
"./fs": {
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
"default": "./dist/fs.cjs"
|
|
56
|
-
},
|
|
57
|
-
"import": {
|
|
58
|
-
"types": "./dist/fs.d.ts",
|
|
59
|
-
"default": "./dist/fs.mjs"
|
|
60
|
-
}
|
|
28
|
+
"types": "./dist/fs.d.ts",
|
|
29
|
+
"default": "./dist/fs.js"
|
|
61
30
|
},
|
|
62
31
|
"./globals": {
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
"default": "./dist/globals.cjs"
|
|
66
|
-
},
|
|
67
|
-
"import": {
|
|
68
|
-
"types": "./dist/globals.d.ts",
|
|
69
|
-
"default": "./dist/globals.mjs"
|
|
70
|
-
}
|
|
32
|
+
"types": "./dist/globals.d.ts",
|
|
33
|
+
"default": "./dist/globals.js"
|
|
71
34
|
},
|
|
72
35
|
"./logging": {
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
"default": "./dist/logging.cjs"
|
|
76
|
-
},
|
|
77
|
-
"import": {
|
|
78
|
-
"types": "./dist/logging.d.ts",
|
|
79
|
-
"default": "./dist/logging.mjs"
|
|
80
|
-
}
|
|
36
|
+
"types": "./dist/logging.d.ts",
|
|
37
|
+
"default": "./dist/logging.js"
|
|
81
38
|
},
|
|
82
39
|
"./paths": {
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
"default": "./dist/paths.cjs"
|
|
86
|
-
},
|
|
87
|
-
"import": {
|
|
88
|
-
"types": "./dist/paths.d.ts",
|
|
89
|
-
"default": "./dist/paths.mjs"
|
|
90
|
-
}
|
|
40
|
+
"types": "./dist/paths.d.ts",
|
|
41
|
+
"default": "./dist/paths.js"
|
|
91
42
|
},
|
|
92
43
|
"./pipe": {
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
"default": "./dist/pipe.cjs"
|
|
96
|
-
},
|
|
97
|
-
"import": {
|
|
98
|
-
"types": "./dist/pipe.d.ts",
|
|
99
|
-
"default": "./dist/pipe.mjs"
|
|
100
|
-
}
|
|
44
|
+
"types": "./dist/pipe.d.ts",
|
|
45
|
+
"default": "./dist/pipe.js"
|
|
101
46
|
},
|
|
102
47
|
"./utils": {
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
"default": "./dist/utils.cjs"
|
|
106
|
-
},
|
|
107
|
-
"import": {
|
|
108
|
-
"types": "./dist/utils.d.ts",
|
|
109
|
-
"default": "./dist/utils.mjs"
|
|
110
|
-
}
|
|
48
|
+
"types": "./dist/utils.d.ts",
|
|
49
|
+
"default": "./dist/utils.js"
|
|
111
50
|
}
|
|
112
51
|
},
|
|
113
52
|
"author": "Juit Developers <developers@juit.com>",
|
|
114
53
|
"license": "Apache-2.0",
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=22.16.0"
|
|
56
|
+
},
|
|
115
57
|
"dependencies": {
|
|
116
|
-
"@plugjs/tsrun": "^0.7.
|
|
58
|
+
"@plugjs/tsrun": "^0.7.5",
|
|
117
59
|
"@types/node": "<23",
|
|
118
60
|
"esbuild": "^0.28.1",
|
|
119
61
|
"jsonc-parser": "^3.3.1",
|
|
@@ -124,14 +66,12 @@
|
|
|
124
66
|
},
|
|
125
67
|
"files": [
|
|
126
68
|
"*.md",
|
|
127
|
-
"cli/",
|
|
128
69
|
"dist/",
|
|
129
|
-
"extra/",
|
|
130
70
|
"src/"
|
|
131
71
|
],
|
|
132
72
|
"repository": {
|
|
133
73
|
"type": "git",
|
|
134
|
-
"url": "git+
|
|
74
|
+
"url": "git+https://github.com/plugjs/plug.git"
|
|
135
75
|
},
|
|
136
76
|
"keywords": [
|
|
137
77
|
"build",
|
package/src/asserts.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* BUILD FAILURES *
|
|
3
3
|
* ========================================================================== */
|
|
4
4
|
|
|
5
|
-
import { githubAnnotation } from './logging/github'
|
|
5
|
+
import { githubAnnotation } from './logging/github.ts'
|
|
6
6
|
|
|
7
7
|
/** A symbol marking {@link BuildFailure} instances */
|
|
8
8
|
const buildFailure = Symbol.for('plugjs:plug:types:BuildFailure')
|
|
@@ -37,7 +37,7 @@ export class BuildFailure extends Error {
|
|
|
37
37
|
return new BuildFailure(undefined, errors)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
static [Symbol.hasInstance](instance: any): boolean {
|
|
40
|
+
static override [Symbol.hasInstance](instance: any): boolean {
|
|
41
41
|
return instance && instance[buildFailure] === buildFailure
|
|
42
42
|
}
|
|
43
43
|
|
package/src/async.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks'
|
|
2
2
|
|
|
3
|
-
import { assert } from './asserts'
|
|
4
|
-
import { getSingleton } from './utils/singleton'
|
|
3
|
+
import { assert } from './asserts.ts'
|
|
4
|
+
import { getSingleton } from './utils/singleton.ts'
|
|
5
5
|
|
|
6
|
-
import type { Context } from './pipe'
|
|
6
|
+
import type { Context } from './pipe.ts'
|
|
7
7
|
|
|
8
8
|
/* ========================================================================== *
|
|
9
9
|
* EXPORTED *
|
package/src/build.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { BuildFailure, assert } from './asserts'
|
|
2
|
-
import { runAsync } from './async'
|
|
3
|
-
import { $grn, $gry, $ms, $p, $plur, $t, $ylw, NOTICE, getLogger, log, logOptions } from './logging'
|
|
4
|
-
import { Context, ContextPromises, PipeImpl } from './pipe'
|
|
5
|
-
import { findCaller } from './utils/caller'
|
|
6
|
-
import { getSingleton } from './utils/singleton'
|
|
7
|
-
|
|
8
|
-
import type { Pipe } from './index'
|
|
9
|
-
import type { AbsolutePath } from './paths'
|
|
1
|
+
import { BuildFailure, assert } from './asserts.ts'
|
|
2
|
+
import { runAsync } from './async.ts'
|
|
3
|
+
import { $grn, $gry, $ms, $p, $plur, $t, $ylw, NOTICE, getLogger, log, logOptions } from './logging.ts'
|
|
4
|
+
import { Context, ContextPromises, PipeImpl } from './pipe.ts'
|
|
5
|
+
import { findCaller } from './utils/caller.ts'
|
|
6
|
+
import { getSingleton } from './utils/singleton.ts'
|
|
7
|
+
|
|
8
|
+
import type { Pipe } from './index.ts'
|
|
9
|
+
import type { AbsolutePath } from './paths.ts'
|
|
10
10
|
import type {
|
|
11
11
|
Build,
|
|
12
12
|
BuildDef,
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
TaskDef,
|
|
21
21
|
Tasks,
|
|
22
22
|
ThisBuild,
|
|
23
|
-
} from './types'
|
|
23
|
+
} from './types.ts'
|
|
24
24
|
|
|
25
25
|
/* ========================================================================== *
|
|
26
26
|
* INTERNAL UTILITIES *
|
package/src/{cli.mts → cli.ts}
RENAMED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
2
|
+
/* coverage ignore file / not tested in unit tests */
|
|
3
|
+
/* eslint-disable no-fallthrough */ // process.exit(...) is not caught
|
|
3
4
|
/* eslint-disable no-console */
|
|
4
5
|
|
|
5
6
|
import _fs from 'node:fs'
|
|
7
|
+
import _path from 'node:path'
|
|
6
8
|
|
|
7
9
|
import { main, yargsParser } from '@plugjs/tsrun'
|
|
8
10
|
|
|
9
|
-
import { BuildFailure } from './asserts'
|
|
10
|
-
import { runAsync } from './async'
|
|
11
|
-
import { invokeTasks, isBuild } from './build'
|
|
12
|
-
import { $blu, $gry, $p, $red, $t, $und, $wht } from './logging/colors'
|
|
13
|
-
import { logLevels } from './logging/levels'
|
|
14
|
-
import { logOptions } from './logging/options'
|
|
15
|
-
import { getCurrentWorkingDirectory, resolveAbsolutePath, resolveDirectory, resolveFile } from './paths'
|
|
16
|
-
import { Context } from './pipe'
|
|
11
|
+
import { BuildFailure } from './asserts.ts'
|
|
12
|
+
import { runAsync } from './async.ts'
|
|
13
|
+
import { invokeTasks, isBuild } from './build.ts'
|
|
14
|
+
import { $blu, $gry, $p, $red, $t, $und, $wht } from './logging/colors.ts'
|
|
15
|
+
import { logLevels } from './logging/levels.ts'
|
|
16
|
+
import { logOptions } from './logging/options.ts'
|
|
17
|
+
import { getCurrentWorkingDirectory, resolveAbsolutePath, resolveDirectory, resolveFile } from './paths.ts'
|
|
18
|
+
import { Context } from './pipe.ts'
|
|
17
19
|
|
|
18
|
-
import type { AbsolutePath } from './paths'
|
|
19
|
-
import type { Build } from './types'
|
|
20
|
+
import type { AbsolutePath } from './paths.ts'
|
|
21
|
+
import type { Build } from './types.ts'
|
|
20
22
|
|
|
21
23
|
/* Log levels */
|
|
22
24
|
const { TRACE, DEBUG, INFO, NOTICE, WARN, ERROR, OFF } = logLevels
|
|
@@ -26,9 +28,18 @@ const $bnd = (s: string): string => $blu($und(s))
|
|
|
26
28
|
const $gnd = (s: string): string => $gry($und(s))
|
|
27
29
|
const $wnd = (s: string): string => $wht($und(s))
|
|
28
30
|
|
|
29
|
-
/** Version
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
/** Version resolved from "package.json" */
|
|
32
|
+
function version(): string {
|
|
33
|
+
try {
|
|
34
|
+
const packageJsonPath = _path.resolve(import.meta.dirname, '..', 'package.json')
|
|
35
|
+
const packageJson = JSON.parse(_fs.readFileSync(packageJsonPath, 'utf-8'))
|
|
36
|
+
return (typeof packageJson.version === 'string' && packageJson.version)
|
|
37
|
+
? packageJson.version
|
|
38
|
+
: '0.0.0-dev'
|
|
39
|
+
} catch {
|
|
40
|
+
return '0.0.0-dev'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
32
43
|
|
|
33
44
|
/* ========================================================================== *
|
|
34
45
|
* HELP SCREEN *
|
|
@@ -49,7 +60,7 @@ function help(): void {
|
|
|
49
60
|
${$wht('-c --colors')} Force colorful output (use ${$wnd('--no-colors')} to force plain text)
|
|
50
61
|
${$wht('-l --list')} Only list the tasks defined by the build, nothing more!
|
|
51
62
|
${$wht('-h --help')} Help! You're reading it now!
|
|
52
|
-
${$wht(' --version')} Version! This one: ${version}!
|
|
63
|
+
${$wht(' --version')} Version! This one: ${version()}!
|
|
53
64
|
|
|
54
65
|
${$bnd('Properties:')}
|
|
55
66
|
|
|
@@ -163,7 +174,7 @@ export function parseCommandLine(args: string[]): CommandLineOptions {
|
|
|
163
174
|
help()
|
|
164
175
|
process.exit(0)
|
|
165
176
|
case 'version':
|
|
166
|
-
console.log(`PlugJS ${$gry('ver.')} ${$wnd(version)}`)
|
|
177
|
+
console.log(`PlugJS ${$gry('ver.')} ${$wnd(version())}`)
|
|
167
178
|
process.exit(0)
|
|
168
179
|
default:
|
|
169
180
|
console.log(`Unsupported option ${$wnd(key)} (try ${$wnd('--help')})`)
|
package/src/files.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { inspect } from 'node:util'
|
|
2
2
|
|
|
3
|
-
import { assert } from './asserts'
|
|
4
|
-
import { mkdir, writeFile } from './fs'
|
|
3
|
+
import { assert } from './asserts.ts'
|
|
4
|
+
import { mkdir, writeFile } from './fs.ts'
|
|
5
5
|
import {
|
|
6
6
|
assertRelativeChildPath,
|
|
7
7
|
getAbsoluteParent,
|
|
8
8
|
getCurrentWorkingDirectory,
|
|
9
9
|
resolveAbsolutePath,
|
|
10
|
-
} from './paths'
|
|
10
|
+
} from './paths.ts'
|
|
11
11
|
|
|
12
|
-
import type { AbsolutePath } from './paths'
|
|
12
|
+
import type { AbsolutePath } from './paths.ts'
|
|
13
13
|
|
|
14
14
|
/** The {@link FilesBuilder} interface defines a builder for {@link Files}. */
|
|
15
15
|
export interface FilesBuilder {
|
package/src/fork.ts
CHANGED
|
@@ -2,18 +2,18 @@ import { fork } from 'node:child_process'
|
|
|
2
2
|
import { Console } from 'node:console'
|
|
3
3
|
import { Writable } from 'node:stream'
|
|
4
4
|
|
|
5
|
-
import { assert, BuildFailure } from './asserts'
|
|
6
|
-
import { runAsync } from './async'
|
|
7
|
-
import { Files } from './files'
|
|
8
|
-
import { $gry, $p, $red, logOptions, NOTICE, WARN } from './logging'
|
|
9
|
-
import { emit, emitForked } from './logging/emit'
|
|
10
|
-
import { requireFilename, resolveFile } from './paths'
|
|
11
|
-
import { Context, install } from './pipe'
|
|
12
|
-
|
|
13
|
-
import type { LogLevel } from './logging'
|
|
14
|
-
import type { ForkedLogMessage } from './logging/emit'
|
|
15
|
-
import type { AbsolutePath } from './paths'
|
|
16
|
-
import type { Plug, PlugName, PlugResult } from './pipe'
|
|
5
|
+
import { assert, BuildFailure } from './asserts.ts'
|
|
6
|
+
import { runAsync } from './async.ts'
|
|
7
|
+
import { Files } from './files.ts'
|
|
8
|
+
import { $gry, $p, $red, logOptions, NOTICE, WARN } from './logging.ts'
|
|
9
|
+
import { emit, emitForked } from './logging/emit.ts'
|
|
10
|
+
import { requireFilename, resolveFile } from './paths.ts'
|
|
11
|
+
import { Context, install } from './pipe.ts'
|
|
12
|
+
|
|
13
|
+
import type { LogLevel } from './logging.ts'
|
|
14
|
+
import type { ForkedLogMessage } from './logging/emit.ts'
|
|
15
|
+
import type { AbsolutePath } from './paths.ts'
|
|
16
|
+
import type { Plug, PlugName, PlugResult } from './pipe.ts'
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Options accepted by {@link ForkingPlug}'s instrumenting how the process
|
|
@@ -79,7 +79,7 @@ export abstract class ForkingPlug implements Plug<PlugResult> {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/* Get _this_ filename to spawn */
|
|
82
|
-
const script = requireFilename(
|
|
82
|
+
const script = requireFilename(import.meta.filename)
|
|
83
83
|
context.log.debug('About to fork plug from', $p(this._scriptFile))
|
|
84
84
|
|
|
85
85
|
/* Environment variables */
|
|
@@ -90,11 +90,11 @@ export abstract class ForkingPlug implements Plug<PlugResult> {
|
|
|
90
90
|
if (this._arguments[i] == null) continue // null or undefined... optionals
|
|
91
91
|
if (typeof this._arguments[i] === 'object') {
|
|
92
92
|
if (typeof this._arguments[i].coverageDir === 'string') {
|
|
93
|
-
const dir = env
|
|
93
|
+
const dir = env['NODE_V8_COVERAGE'] = context.resolve(this._arguments[i].coverageDir)
|
|
94
94
|
context.log.debug('Forked process will produce coverage in', $p(dir))
|
|
95
95
|
}
|
|
96
96
|
if (typeof this._arguments[i].forceModule === 'string') {
|
|
97
|
-
const force = env
|
|
97
|
+
const force = env['__TS_LOADER_FORCE_TYPE'] = this._arguments[i].forceModule
|
|
98
98
|
context.log.debug('Forked process will force module type as', $p(force))
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -189,7 +189,7 @@ export abstract class ForkingPlug implements Plug<PlugResult> {
|
|
|
189
189
|
* parent process, we can safely assume we need to run our plug... So we wait
|
|
190
190
|
* for the message and respond once the plug returns _something_!
|
|
191
191
|
*/
|
|
192
|
-
if ((process.argv[1] === requireFilename(
|
|
192
|
+
if ((process.argv[1] === requireFilename(import.meta.filename)) && (process.send)) {
|
|
193
193
|
/* Save the original console, we'll replace it on "message" */
|
|
194
194
|
const originalConsole = globalThis.console
|
|
195
195
|
|
|
@@ -228,7 +228,7 @@ if ((process.argv[1] === requireFilename(__fileurl)) && (process.send)) {
|
|
|
228
228
|
|
|
229
229
|
/* Create a couple of writers for our fake "stdout" and "stderr" */
|
|
230
230
|
const makeWritable = (level: LogLevel): Writable => new class extends Writable {
|
|
231
|
-
_write(chunk: any, _: BufferEncoding, callback: (error?: Error | null) => void): void {
|
|
231
|
+
override _write(chunk: any, _: BufferEncoding, callback: (error?: Error | null) => void): void {
|
|
232
232
|
const string: string = chunk.toString()
|
|
233
233
|
const message = string.endsWith('\n') ? string.slice(0, -1) : string
|
|
234
234
|
emit.emitter({ level, taskName }, [ message ])
|
package/src/globals.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A pseudo-variable replaced by `ESBuild` resolving to either `__filename`
|
|
3
3
|
* in CJS modules, or to `import.meta.url` in ESM modules.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated As we are moving to ESM-only, this will be removed in the future.
|
|
6
|
+
* Use `import.meta.url` or `import.meta.filename` instead.
|
|
4
7
|
*/
|
|
5
8
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
9
|
declare const __fileurl: string
|
package/src/helpers.ts
CHANGED
|
@@ -2,32 +2,32 @@ import { mkdtempSync, readFileSync } from 'node:fs'
|
|
|
2
2
|
import { tmpdir } from 'node:os'
|
|
3
3
|
import { join } from 'node:path'
|
|
4
4
|
|
|
5
|
-
import { BuildFailure, assert, assertPromises } from './asserts'
|
|
6
|
-
import { requireContext } from './async'
|
|
7
|
-
import { Files } from './files'
|
|
8
|
-
import { rm } from './fs'
|
|
9
|
-
import { $gry, $p, $plur, $wht, $ylw, log } from './logging'
|
|
5
|
+
import { BuildFailure, assert, assertPromises } from './asserts.ts'
|
|
6
|
+
import { requireContext } from './async.ts'
|
|
7
|
+
import { Files } from './files.ts'
|
|
8
|
+
import { rm } from './fs.ts'
|
|
9
|
+
import { $gry, $p, $plur, $wht, $ylw, log } from './logging.ts'
|
|
10
10
|
import {
|
|
11
11
|
commonPath,
|
|
12
12
|
getAbsoluteParent,
|
|
13
13
|
getCurrentWorkingDirectory,
|
|
14
14
|
resolveDirectory,
|
|
15
15
|
resolveFile,
|
|
16
|
-
} from './paths'
|
|
17
|
-
import { PipeImpl } from './pipe'
|
|
18
|
-
import { RunBuild } from './plugs/build'
|
|
19
|
-
import { JsoncError, parseJsonc } from './utils'
|
|
20
|
-
import { execChild } from './utils/exec'
|
|
21
|
-
import { parseOptions } from './utils/options'
|
|
22
|
-
import { walk } from './utils/walk'
|
|
23
|
-
|
|
24
|
-
import type { Pipe } from './index'
|
|
25
|
-
import type { AbsolutePath } from './paths'
|
|
26
|
-
import type { Context } from './pipe'
|
|
27
|
-
import type { RunBuildOptions } from './plugs/build'
|
|
28
|
-
import type { ExecChildOptions } from './utils/exec'
|
|
29
|
-
import type { ParseOptions } from './utils/options'
|
|
30
|
-
import type { WalkOptions } from './utils/walk'
|
|
16
|
+
} from './paths.ts'
|
|
17
|
+
import { PipeImpl } from './pipe.ts'
|
|
18
|
+
import { RunBuild } from './plugs/build.ts'
|
|
19
|
+
import { JsoncError, parseJsonc } from './utils.ts'
|
|
20
|
+
import { execChild } from './utils/exec.ts'
|
|
21
|
+
import { parseOptions } from './utils/options.ts'
|
|
22
|
+
import { walk } from './utils/walk.ts'
|
|
23
|
+
|
|
24
|
+
import type { Pipe } from './index.ts'
|
|
25
|
+
import type { AbsolutePath } from './paths.ts'
|
|
26
|
+
import type { Context } from './pipe.ts'
|
|
27
|
+
import type { RunBuildOptions } from './plugs/build.ts'
|
|
28
|
+
import type { ExecChildOptions } from './utils/exec.ts'
|
|
29
|
+
import type { ParseOptions } from './utils/options.ts'
|
|
30
|
+
import type { WalkOptions } from './utils/walk.ts'
|
|
31
31
|
|
|
32
32
|
/* ========================================================================== *
|
|
33
33
|
* EXTERNAL HELPERS *
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import './globals'
|
|
1
|
+
import './globals.ts'
|
|
2
2
|
|
|
3
3
|
// This is a main constituent of our build system!
|
|
4
|
-
import type { Files } from './files'
|
|
5
|
-
import type { Plug, PlugFunction } from './pipe'
|
|
4
|
+
import type { Files } from './files.ts'
|
|
5
|
+
import type { Plug, PlugFunction } from './pipe.ts'
|
|
6
6
|
|
|
7
|
-
export { Files } from './files'
|
|
8
|
-
export type { AbsolutePath } from './paths'
|
|
9
|
-
export type { Plug, PlugFunction } from './pipe'
|
|
7
|
+
export { Files } from './files.ts'
|
|
8
|
+
export type { AbsolutePath } from './paths.ts'
|
|
9
|
+
export type { Plug, PlugFunction } from './pipe.ts'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* The {@link Pipe} interface defines a processing pipeline where multiple
|
|
@@ -25,22 +25,22 @@ export interface Pipe extends Promise<Files> {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// Submodule exports (our package.json exports)
|
|
28
|
-
export * as asserts from './asserts'
|
|
29
|
-
export * as async from './async'
|
|
30
|
-
export * as files from './files'
|
|
31
|
-
export * as fork from './fork'
|
|
32
|
-
export * as fs from './fs'
|
|
33
|
-
export * as logging from './logging'
|
|
34
|
-
export * as paths from './paths'
|
|
35
|
-
export * as pipe from './pipe'
|
|
36
|
-
export * as utils from './utils'
|
|
28
|
+
export * as asserts from './asserts.ts'
|
|
29
|
+
export * as async from './async.ts'
|
|
30
|
+
export * as files from './files.ts'
|
|
31
|
+
export * as fork from './fork.ts'
|
|
32
|
+
export * as fs from './fs.ts'
|
|
33
|
+
export * as logging from './logging.ts'
|
|
34
|
+
export * as paths from './paths.ts'
|
|
35
|
+
export * as pipe from './pipe.ts'
|
|
36
|
+
export * as utils from './utils.ts'
|
|
37
37
|
|
|
38
38
|
// Individual utilities
|
|
39
|
-
export {
|
|
40
|
-
export { $blu, $cyn, $grn, $gry, $mgt, $ms, $p, $red, $t, $und, $wht, $ylw, banner, log } from './logging'
|
|
39
|
+
export { assert, BuildFailure, fail } from './asserts.ts'
|
|
40
|
+
export { $blu, $cyn, $grn, $gry, $mgt, $ms, $p, $red, $t, $und, $wht, $ylw, banner, log } from './logging.ts'
|
|
41
41
|
|
|
42
42
|
// Our minimal exports
|
|
43
|
-
export * from './build'
|
|
44
|
-
export * from './helpers'
|
|
45
|
-
export * from './plugs'
|
|
46
|
-
export * from './types'
|
|
43
|
+
export * from './build.ts'
|
|
44
|
+
export * from './helpers.ts'
|
|
45
|
+
export * from './plugs.ts'
|
|
46
|
+
export * from './types.ts'
|