@plugjs/plug 0.0.22 → 0.0.23
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/async.cjs.map +1 -1
- package/dist/async.mjs.map +1 -1
- package/dist/build.cjs +20 -11
- package/dist/build.cjs.map +1 -1
- package/dist/build.d.ts +2 -0
- package/dist/build.mjs +19 -11
- package/dist/build.mjs.map +1 -1
- package/dist/files.cjs.map +1 -1
- package/dist/files.d.ts +1 -1
- package/dist/files.mjs.map +1 -1
- package/dist/fork.cjs.map +1 -1
- package/dist/fork.d.ts +4 -3
- package/dist/fork.mjs.map +1 -1
- package/dist/helpers.cjs +20 -0
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.ts +34 -2
- package/dist/helpers.mjs +20 -2
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +2 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/dist/log/colors.cjs.map +1 -1
- package/dist/log/colors.d.ts +1 -1
- package/dist/log/colors.mjs.map +1 -1
- package/dist/log/emit.cjs.map +1 -1
- package/dist/log/emit.d.ts +1 -1
- package/dist/log/emit.mjs.map +1 -1
- package/dist/log/logger.cjs.map +1 -1
- package/dist/log/logger.d.ts +2 -2
- package/dist/log/logger.mjs.map +1 -1
- package/dist/log/options.cjs.map +1 -1
- package/dist/log/options.d.ts +3 -3
- package/dist/log/options.mjs.map +1 -1
- package/dist/log/report.cjs.map +1 -1
- package/dist/log/report.d.ts +3 -3
- package/dist/log/report.mjs.map +1 -1
- package/dist/log.cjs.map +1 -1
- package/dist/log.d.ts +1 -1
- package/dist/log.mjs.map +1 -1
- package/dist/paths.cjs.map +1 -1
- package/dist/paths.mjs.map +1 -1
- package/dist/pipe.cjs +1 -14
- package/dist/pipe.cjs.map +1 -1
- package/dist/pipe.d.ts +4 -20
- package/dist/pipe.mjs +1 -19
- package/dist/pipe.mjs.map +1 -1
- package/dist/plugs/copy.cjs.map +1 -1
- package/dist/plugs/copy.mjs.map +1 -1
- package/dist/plugs/coverage/analysis.cjs.map +1 -1
- package/dist/plugs/coverage/analysis.d.ts +3 -3
- package/dist/plugs/coverage/analysis.mjs.map +1 -1
- package/dist/plugs/coverage/report.cjs +1 -1
- package/dist/plugs/coverage/report.cjs.map +1 -1
- package/dist/plugs/coverage/report.d.ts +3 -3
- package/dist/plugs/coverage/report.mjs +1 -1
- package/dist/plugs/coverage/report.mjs.map +1 -1
- package/dist/plugs/coverage.cjs +1 -1
- package/dist/plugs/coverage.cjs.map +1 -1
- package/dist/plugs/coverage.d.ts +1 -1
- package/dist/plugs/coverage.mjs +1 -1
- package/dist/plugs/coverage.mjs.map +1 -1
- package/dist/plugs/debug.cjs.map +1 -1
- package/dist/plugs/debug.mjs.map +1 -1
- package/dist/plugs/esbuild/bundle-locals.d.ts +1 -1
- package/dist/plugs/esbuild/fix-extensions.cjs.map +1 -1
- package/dist/plugs/esbuild/fix-extensions.d.ts +1 -1
- package/dist/plugs/esbuild/fix-extensions.mjs.map +1 -1
- package/dist/plugs/esbuild.cjs +1 -1
- package/dist/plugs/esbuild.cjs.map +1 -1
- package/dist/plugs/esbuild.d.ts +1 -1
- package/dist/plugs/esbuild.mjs +1 -1
- package/dist/plugs/esbuild.mjs.map +1 -1
- package/dist/plugs/eslint/runner.cjs.map +1 -1
- package/dist/plugs/eslint/runner.d.ts +2 -2
- package/dist/plugs/eslint/runner.mjs.map +1 -1
- package/dist/plugs/exec.cjs +1 -1
- package/dist/plugs/exec.cjs.map +1 -1
- package/dist/plugs/exec.mjs +1 -1
- package/dist/plugs/exec.mjs.map +1 -1
- package/dist/plugs/filter.cjs.map +1 -1
- package/dist/plugs/filter.d.ts +1 -1
- package/dist/plugs/filter.mjs.map +1 -1
- package/dist/plugs/mocha/reporter.cjs +1 -1
- package/dist/plugs/mocha/reporter.cjs.map +1 -1
- package/dist/plugs/mocha/reporter.mjs +1 -1
- package/dist/plugs/mocha/reporter.mjs.map +1 -1
- package/dist/plugs/mocha/runner.cjs.map +1 -1
- package/dist/plugs/mocha/runner.d.ts +2 -2
- package/dist/plugs/mocha/runner.mjs.map +1 -1
- package/dist/plugs/rmf.cjs.map +1 -1
- package/dist/plugs/rmf.mjs.map +1 -1
- package/dist/plugs/tsc/compiler.cjs.map +1 -1
- package/dist/plugs/tsc/compiler.d.ts +1 -1
- package/dist/plugs/tsc/compiler.mjs.map +1 -1
- package/dist/plugs/tsc/options.cjs.map +1 -1
- package/dist/plugs/tsc/options.d.ts +1 -1
- package/dist/plugs/tsc/options.mjs.map +1 -1
- package/dist/plugs/tsc/report.cjs.map +1 -1
- package/dist/plugs/tsc/report.d.ts +2 -2
- package/dist/plugs/tsc/report.mjs.map +1 -1
- package/dist/plugs/tsc/runner.cjs +1 -1
- package/dist/plugs/tsc/runner.cjs.map +1 -1
- package/dist/plugs/tsc/runner.d.ts +1 -1
- package/dist/plugs/tsc/runner.mjs +1 -1
- package/dist/plugs/tsc/runner.mjs.map +1 -1
- package/dist/plugs/tsc.cjs.map +1 -1
- package/dist/plugs/tsc.mjs.map +1 -1
- package/dist/utils/asyncfs.cjs.map +1 -1
- package/dist/utils/asyncfs.mjs.map +1 -1
- package/dist/utils/caller.cjs.map +1 -1
- package/dist/utils/caller.d.ts +1 -1
- package/dist/utils/caller.mjs.map +1 -1
- package/dist/utils/walk.cjs.map +1 -1
- package/dist/utils/walk.d.ts +2 -2
- package/dist/utils/walk.mjs.map +1 -1
- package/extra/cli.mjs +1152 -51
- package/extra/ts-loader.mjs +12 -11
- package/package.json +7 -7
- package/src/async.ts +2 -1
- package/src/files.ts +3 -1
- package/src/fork.ts +8 -3
- package/src/helpers.ts +61 -4
- package/src/index.ts +4 -2
- package/src/log/colors.ts +4 -1
- package/src/log/emit.ts +4 -1
- package/src/log/logger.ts +7 -3
- package/src/log/options.ts +6 -3
- package/src/log/report.ts +5 -3
- package/src/log.ts +1 -1
- package/src/paths.ts +1 -0
- package/src/pipe.ts +9 -45
- package/src/plugs/copy.ts +3 -1
- package/src/plugs/coverage/analysis.ts +12 -7
- package/src/plugs/coverage/report.ts +13 -8
- package/src/plugs/coverage.ts +12 -5
- package/src/plugs/debug.ts +4 -2
- package/src/plugs/esbuild/bundle-locals.ts +1 -1
- package/src/plugs/esbuild/fix-extensions.ts +2 -1
- package/src/plugs/esbuild.ts +13 -5
- package/src/plugs/eslint/runner.ts +5 -3
- package/src/plugs/exec.ts +8 -4
- package/src/plugs/filter.ts +5 -2
- package/src/plugs/mocha/reporter.ts +5 -3
- package/src/plugs/mocha/runner.ts +5 -4
- package/src/plugs/rmf.ts +4 -2
- package/src/plugs/tsc/compiler.ts +3 -1
- package/src/plugs/tsc/options.ts +3 -1
- package/src/plugs/tsc/report.ts +5 -2
- package/src/plugs/tsc/runner.ts +6 -5
- package/src/plugs/tsc.ts +2 -2
- package/src/utils/asyncfs.ts +0 -1
- package/src/utils/caller.ts +4 -1
- package/src/utils/walk.ts +7 -3
- package/types/globals.d.ts +15 -0
- /package/{extra → types}/webassembly.d.ts +0 -0
package/src/plugs/exec.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
1
2
|
import path from 'node:path'
|
|
2
3
|
import reaadline from 'node:readline'
|
|
3
4
|
|
|
4
|
-
import { spawn, SpawnOptions } from 'node:child_process'
|
|
5
5
|
import { assert } from '../assert'
|
|
6
6
|
import { requireContext } from '../async'
|
|
7
|
-
import { Files } from '../files'
|
|
8
7
|
import { $p, logOptions } from '../log'
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { getCurrentWorkingDirectory, resolveDirectory } from '../paths'
|
|
9
|
+
import { install } from '../pipe'
|
|
11
10
|
import { parseOptions } from '../utils/options'
|
|
12
11
|
|
|
12
|
+
import type { Files } from '../files'
|
|
13
|
+
import type { AbsolutePath } from '../paths'
|
|
14
|
+
import type { Context, PipeParameters, Plug } from '../pipe'
|
|
15
|
+
import type { SpawnOptions } from 'node:child_process'
|
|
16
|
+
|
|
13
17
|
/** Options for executing scripts */
|
|
14
18
|
export interface ExecOptions {
|
|
15
19
|
/** Extra environment variables, or overrides for existing ones */
|
package/src/plugs/filter.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Files } from '../files'
|
|
2
2
|
import { resolveRelativeChildPath } from '../paths'
|
|
3
|
-
import {
|
|
4
|
-
import { match
|
|
3
|
+
import { install } from '../pipe'
|
|
4
|
+
import { match } from '../utils/match'
|
|
5
5
|
import { parseOptions } from '../utils/options'
|
|
6
6
|
|
|
7
|
+
import type { Context, PipeParameters, Plug } from '../pipe'
|
|
8
|
+
import type { MatchOptions } from '../utils/match'
|
|
9
|
+
|
|
7
10
|
/** Options for filtering {@link Files}. */
|
|
8
11
|
export interface FilterOptions extends MatchOptions {
|
|
9
12
|
/** The base directory for filtering, and relativising the resulting files. */
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { diffJson } from 'diff'
|
|
1
2
|
import RealMocha from 'mocha' // Mocha types pollute the global scope!
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
4
|
+
import { $blu, $grn, $gry, $ms, $red, $wht, $ylw, ERROR, NOTICE, WARN } from '../../log'
|
|
5
|
+
|
|
6
|
+
import type { Logger } from '../../log'
|
|
7
|
+
import type { AssertionError } from 'node:assert'
|
|
6
8
|
|
|
7
9
|
const _pending = '\u22EF' // middle ellipsis
|
|
8
10
|
const _success = '\u2714' // heavy check mark
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import RealMocha from 'mocha' // Mocha types pollute the global scope!
|
|
2
|
-
import { assert } from '../../assert'
|
|
3
2
|
|
|
3
|
+
import { assert } from '../../assert'
|
|
4
4
|
import { BuildFailure } from '../../failure'
|
|
5
|
-
import { Files } from '../../files'
|
|
6
5
|
import { $p, $wht, NOTICE } from '../../log'
|
|
7
6
|
import { resolveFile } from '../../paths'
|
|
8
|
-
import { Context, PipeParameters, Plug } from '../../pipe'
|
|
9
|
-
import { MochaOptions } from '../mocha'
|
|
10
7
|
import { logSymbol, PlugReporter } from './reporter'
|
|
11
8
|
|
|
9
|
+
import type { Files } from '../../files'
|
|
10
|
+
import type { Context, PipeParameters, Plug } from '../../pipe'
|
|
11
|
+
import type { MochaOptions } from '../mocha'
|
|
12
|
+
|
|
12
13
|
/** Writes some info about the current {@link Files} being passed around. */
|
|
13
14
|
export default class Mocha implements Plug<void> {
|
|
14
15
|
constructor(...args: PipeParameters<'mocha'>)
|
package/src/plugs/rmf.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Files } from '../files'
|
|
2
1
|
import { $gry, $p } from '../log'
|
|
3
|
-
import {
|
|
2
|
+
import { install } from '../pipe'
|
|
4
3
|
import { rm } from '../utils/asyncfs'
|
|
5
4
|
|
|
5
|
+
import type { Files } from '../files'
|
|
6
|
+
import type { Context, PipeParameters, Plug } from '../pipe'
|
|
7
|
+
|
|
6
8
|
declare module '../pipe' {
|
|
7
9
|
export interface Pipe {
|
|
8
10
|
/**
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import ts from 'typescript' // TypeScript does NOT support ESM modules
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { resolveAbsolutePath } from '../../paths'
|
|
4
|
+
|
|
5
|
+
import type { AbsolutePath } from '../../paths'
|
|
4
6
|
|
|
5
7
|
export class TypeScriptHost
|
|
6
8
|
implements ts.CompilerHost {
|
package/src/plugs/tsc/options.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import ts from 'typescript' // TypeScript does NOT support ESM modules
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getAbsoluteParent, resolveAbsolutePath } from '../../paths'
|
|
4
4
|
import { readFile } from '../../utils/asyncfs'
|
|
5
5
|
|
|
6
|
+
import type { AbsolutePath } from '../../paths'
|
|
7
|
+
|
|
6
8
|
/* ========================================================================== */
|
|
7
9
|
|
|
8
10
|
export type CompilerOptionsAndDiagnostics = {
|
package/src/plugs/tsc/report.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import ts from 'typescript' // TypeScript does NOT support ESM modules
|
|
2
2
|
|
|
3
|
-
import { ERROR, NOTICE,
|
|
4
|
-
import {
|
|
3
|
+
import { ERROR, NOTICE, WARN } from '../../log'
|
|
4
|
+
import { resolveAbsolutePath } from '../../paths'
|
|
5
|
+
|
|
6
|
+
import type { Report, ReportLevel, ReportRecord } from '../../log'
|
|
7
|
+
import type { AbsolutePath } from '../../paths'
|
|
5
8
|
|
|
6
9
|
function convertMessageChain(chain: ts.DiagnosticMessageChain, indent = 0): string[] {
|
|
7
10
|
const message = `${''.padStart(indent * 2)}${chain.messageText}`
|
package/src/plugs/tsc/runner.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import ts from 'typescript' // TypeScript does NOT support ESM modules
|
|
2
2
|
|
|
3
|
-
import type { ExtendedCompilerOptions } from '../tsc'
|
|
4
|
-
|
|
5
3
|
import { assertPromises } from '../../assert'
|
|
6
4
|
import { BuildFailure } from '../../failure'
|
|
7
5
|
import { Files } from '../../files'
|
|
8
6
|
import { $p, log } from '../../log'
|
|
9
|
-
import {
|
|
10
|
-
import { Context, PipeParameters, Plug } from '../../pipe'
|
|
7
|
+
import { resolveAbsolutePath, resolveFile } from '../../paths'
|
|
11
8
|
import { parseOptions } from '../../utils/options'
|
|
9
|
+
import { walk } from '../../utils/walk'
|
|
12
10
|
import { TypeScriptHost } from './compiler'
|
|
13
11
|
import { getCompilerOptions } from './options'
|
|
14
12
|
import { updateReport } from './report'
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
import type { AbsolutePath } from '../../paths'
|
|
15
|
+
import type { Context, PipeParameters, Plug } from '../../pipe'
|
|
16
|
+
import type { ExtendedCompilerOptions } from '../tsc'
|
|
16
17
|
|
|
17
18
|
/* ========================================================================== *
|
|
18
19
|
* WORKER PLUG *
|
package/src/plugs/tsc.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CompilerOptions } from 'typescript'
|
|
2
|
-
|
|
3
1
|
import { installForking } from '../fork'
|
|
4
2
|
import { requireResolve } from '../paths'
|
|
5
3
|
|
|
4
|
+
import type { CompilerOptions } from 'typescript'
|
|
5
|
+
|
|
6
6
|
/** TypeScript Compiler options with some additional properties */
|
|
7
7
|
export interface ExtendedCompilerOptions extends CompilerOptions {
|
|
8
8
|
/**
|
package/src/utils/asyncfs.ts
CHANGED
package/src/utils/caller.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { statSync } from 'node:fs'
|
|
2
2
|
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
3
4
|
import { assert } from '../assert'
|
|
4
5
|
import { $p } from '../log'
|
|
5
|
-
import {
|
|
6
|
+
import { assertAbsolutePath } from '../paths'
|
|
7
|
+
|
|
8
|
+
import type { AbsolutePath } from '../paths'
|
|
6
9
|
|
|
7
10
|
export function findCaller(of: (...args: any[]) => any): AbsolutePath {
|
|
8
11
|
const oldPrepareStackTrace = Error.prepareStackTrace
|
package/src/utils/walk.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { Dir } from 'node:fs'
|
|
2
1
|
import { basename, join } from 'node:path'
|
|
2
|
+
|
|
3
3
|
import { $p, log } from '../log'
|
|
4
|
-
import {
|
|
4
|
+
import { resolveAbsolutePath } from '../paths'
|
|
5
5
|
import { opendir, stat } from './asyncfs'
|
|
6
|
-
import { match
|
|
6
|
+
import { match } from './match'
|
|
7
|
+
|
|
8
|
+
import type { AbsolutePath } from '../paths'
|
|
9
|
+
import type { MatchOptions } from './match'
|
|
10
|
+
import type { Dir } from 'node:fs'
|
|
7
11
|
|
|
8
12
|
/** Specific options for walking a directory */
|
|
9
13
|
export interface WalkOptions extends MatchOptions {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-disable no-var */
|
|
2
|
+
|
|
3
|
+
/// <reference no-default-lib="true"/>
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use our own `__fileurl` which resolves to either `__filename`
|
|
7
|
+
* in CJS modules or `import.meta.url` in ESM modules.
|
|
8
|
+
*/
|
|
9
|
+
declare var __filename: string
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A pseudo-variable replaced by `ESBuild` resolving to either `__filename`
|
|
13
|
+
* in CJS modules, or to `import.meta.url` in ESM modules.
|
|
14
|
+
*/
|
|
15
|
+
declare var __fileurl: string
|
|
File without changes
|