@idlebox/node 1.4.9 → 1.4.11
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/lib/autoindex.d.ts +76 -76
- package/lib/autoindex.d.ts.map +1 -1
- package/lib/autoindex.js +65 -65
- package/lib/autoindex.js.map +1 -1
- package/lib/child_process/lateError.d.ts.map +1 -1
- package/lib/child_process/lateError.js.map +1 -1
- package/lib/child_process/respawn.js +1 -3
- package/lib/child_process/respawn.js.map +1 -1
- package/lib/error/types.d.ts.map +1 -1
- package/lib/error/types.js.map +1 -1
- package/lib/lifecycle/register.d.ts +1 -0
- package/lib/lifecycle/register.d.ts.map +1 -1
- package/lib/lifecycle/register.js +32 -13
- package/lib/lifecycle/register.js.map +1 -1
- package/lib/path-resolve/lrelative.js +2 -2
- package/lib/path-resolve/lrelative.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/autoindex.ts +113 -113
- package/src/child_process/lateError.ts +3 -12
- package/src/child_process/respawn.ts +1 -5
- package/src/error/types.ts +1 -3
- package/src/lifecycle/register.ts +35 -14
- package/src/path-resolve/lrelative.ts +2 -2
- package/src/stream/loggerStream.ts +2 -2
package/src/autoindex.ts
CHANGED
|
@@ -3,151 +3,151 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
5
|
/* asyncLoad.ts */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// Identifiers
|
|
7
|
+
export type { AsyncMainFunction } from './asyncLoad.js';
|
|
8
|
+
export { executeMainFunction } from './asyncLoad.js';
|
|
9
9
|
/* preload.ts */
|
|
10
|
-
|
|
10
|
+
// Identifiers
|
|
11
11
|
/* child_process/error.ts */
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
// Identifiers
|
|
13
|
+
export { checkChildProcessResult } from './child_process/error.js';
|
|
14
14
|
/* child_process/execa.ts */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
// Identifiers
|
|
16
|
+
export type { ICommand } from './child_process/execa.js';
|
|
17
|
+
export { spawnWithoutOutputSync } from './child_process/execa.js';
|
|
18
|
+
export { spawnWithoutOutput } from './child_process/execa.js';
|
|
19
|
+
export { spawnGetOutputSync } from './child_process/execa.js';
|
|
20
|
+
export { spawnGetOutput } from './child_process/execa.js';
|
|
21
|
+
export { spawnGetEverything } from './child_process/execa.js';
|
|
22
22
|
/* cli-io/output.ts */
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// Identifiers
|
|
24
|
+
export { printLine } from './cli-io/output.js';
|
|
25
25
|
/* child_process/lateError.ts */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// Identifiers
|
|
27
|
+
export type { ISpawnOptions } from './child_process/lateError.js';
|
|
28
|
+
export type { ExecaReturnValue } from './child_process/lateError.js';
|
|
29
|
+
export { execLazyError } from './child_process/lateError.js';
|
|
30
30
|
/* error/linux.ts */
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
// Identifiers
|
|
32
|
+
export { LinuxError } from './error/linux.js';
|
|
33
33
|
/* error/types.ts */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
// Identifiers
|
|
35
|
+
export type { OpenSSLException } from './error/types.js';
|
|
36
|
+
export { isModuleResolutionError } from './error/types.js';
|
|
37
|
+
export { isNotExistsError } from './error/types.js';
|
|
38
|
+
export { isExistsError } from './error/types.js';
|
|
39
|
+
export { isTypeError } from './error/types.js';
|
|
40
|
+
export { isFileTypeError } from './error/types.js';
|
|
41
|
+
export { isNodeError } from './error/types.js';
|
|
42
|
+
// References
|
|
43
|
+
export * from '@idlebox/node-error-codes';
|
|
44
44
|
/* fs/exists.ts */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
// Identifiers
|
|
46
|
+
export { existsSync } from './fs/exists.js';
|
|
47
|
+
export { exists } from './fs/exists.js';
|
|
48
|
+
export { readFileIfExists } from './fs/exists.js';
|
|
49
49
|
/* environment/getEnvironment.ts */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
// Identifiers
|
|
51
|
+
export type { IEnvironmentResult } from './environment/getEnvironment.js';
|
|
52
|
+
export { getEnvironment } from './environment/getEnvironment.js';
|
|
53
|
+
export { deleteEnvironment } from './environment/getEnvironment.js';
|
|
54
|
+
export { cleanupEnvironment } from './environment/getEnvironment.js';
|
|
55
55
|
/* environment/pathEnvironment.ts */
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
// Identifiers
|
|
57
|
+
export { PATH_SEPARATOR } from './environment/pathEnvironment.js';
|
|
58
|
+
export { PathEnvironment } from './environment/pathEnvironment.js';
|
|
59
59
|
/* environment/findBinary.ts */
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
// Identifiers
|
|
61
|
+
export { findBinary } from './environment/findBinary.js';
|
|
62
62
|
/* child_process/respawn.ts */
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
// Identifiers
|
|
64
|
+
export { spawnRecreateEventHandlers } from './child_process/respawn.js';
|
|
65
|
+
export { trySpawnInScope } from './child_process/respawn.js';
|
|
66
|
+
export { respawnInScope } from './child_process/respawn.js';
|
|
67
67
|
/* crypto/md5.ts */
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
// Identifiers
|
|
69
|
+
export { md5 } from './crypto/md5.js';
|
|
70
70
|
/* crypto/sha256.ts */
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
// Identifiers
|
|
72
|
+
export { sha256 } from './crypto/sha256.js';
|
|
73
73
|
/* environment/npmConfig.ts */
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
// Identifiers
|
|
75
|
+
export { getNpmConfigValue } from './environment/npmConfig.js';
|
|
76
76
|
/* events/dumpEventEmitter.ts */
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
// Identifiers
|
|
78
|
+
export { dumpEventEmitterEmit } from './events/dumpEventEmitter.js';
|
|
79
79
|
/* fs/commandExists.ts */
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
// Identifiers
|
|
81
|
+
export { commandInPath } from './fs/commandExists.js';
|
|
82
|
+
export { commandInPathSync } from './fs/commandExists.js';
|
|
83
83
|
/* fs/emptyDir.ts */
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// Identifiers
|
|
85
|
+
export { emptyDir } from './fs/emptyDir.js';
|
|
86
86
|
/* fs/ensureDir.ts */
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
// Identifiers
|
|
88
|
+
export { ensureDirExists } from './fs/ensureDir.js';
|
|
89
|
+
export { ensureParentExists } from './fs/ensureDir.js';
|
|
90
90
|
/* fs/tempFolder.ts */
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
// Identifiers
|
|
92
|
+
export { createTempFolder } from './fs/tempFolder.js';
|
|
93
93
|
/* fs/weiteChanged.ts */
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
// Identifiers
|
|
95
|
+
export { writeFileIfChangeSync } from './fs/weiteChanged.js';
|
|
96
|
+
export { writeFileIfChange } from './fs/weiteChanged.js';
|
|
97
97
|
/* lifecycle/register.ts */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
// Identifiers
|
|
99
|
+
export { shutdown } from './lifecycle/register.js';
|
|
100
|
+
export { registerNodejsExitHandler } from './lifecycle/register.js';
|
|
101
|
+
export { die } from './lifecycle/register.js';
|
|
102
102
|
/* log/terminal.ts */
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
// Identifiers
|
|
104
|
+
export { WrappedTerminalConsole } from './log/terminal.js';
|
|
105
105
|
/* path-resolve/findUp.ts */
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
// Identifiers
|
|
107
|
+
export type { IFindOptions } from './path-resolve/findUp.js';
|
|
108
|
+
export { findUpUntil } from './path-resolve/findUp.js';
|
|
109
|
+
export { findUpUntilSync } from './path-resolve/findUp.js';
|
|
110
110
|
/* path-resolve/findPackageRoot.ts */
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
// Identifiers
|
|
112
|
+
export { findPackageRoot } from './path-resolve/findPackageRoot.js';
|
|
113
113
|
/* path-resolve/getAllUp.ts */
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
// Identifiers
|
|
115
|
+
export { getAllPathUpToRoot } from './path-resolve/getAllUp.js';
|
|
116
116
|
/* path-resolve/lrelative.ts */
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
// Identifiers
|
|
118
|
+
export { lrelative } from './path-resolve/lrelative.js';
|
|
119
119
|
/* path-resolve/nodeResolvePathArray.ts */
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
// Identifiers
|
|
121
|
+
export { nodeResolvePathArray } from './path-resolve/nodeResolvePathArray.js';
|
|
122
122
|
/* path-resolve/resolvePath.ts */
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
// Identifiers
|
|
124
|
+
export type { ResolvePathFunction } from './path-resolve/resolvePath.js';
|
|
125
|
+
export type { JoinPathFunction } from './path-resolve/resolvePath.js';
|
|
126
|
+
export { resolvePath } from './path-resolve/resolvePath.js';
|
|
127
|
+
export type { NormalizePathFunction } from './path-resolve/resolvePath.js';
|
|
128
|
+
export { normalizePath } from './path-resolve/resolvePath.js';
|
|
129
|
+
export { osTempDir } from './path-resolve/resolvePath.js';
|
|
130
|
+
export { relativePath } from './path-resolve/resolvePath.js';
|
|
131
131
|
/* stream/blackHoleStream.ts */
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
// Identifiers
|
|
133
|
+
export { BlackHoleStream } from './stream/blackHoleStream.js';
|
|
134
134
|
/* stream/streamPromise.ts */
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
// Identifiers
|
|
136
|
+
export { streamPromise } from './stream/streamPromise.js';
|
|
137
|
+
export { streamHasEnd } from './stream/streamPromise.js';
|
|
138
138
|
/* stream/collectingStream.ts */
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
// Identifiers
|
|
140
|
+
export { streamToBuffer } from './stream/collectingStream.js';
|
|
141
|
+
export { RawCollectingStream } from './stream/collectingStream.js';
|
|
142
|
+
export { CollectingStream } from './stream/collectingStream.js';
|
|
143
143
|
/* stream/disposableStream.ts */
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
// Identifiers
|
|
145
|
+
export { disposableStream } from './stream/disposableStream.js';
|
|
146
146
|
/* stream/drainStream.ts */
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
// Identifiers
|
|
148
|
+
export { drainStream } from './stream/drainStream.js';
|
|
149
149
|
/* stream/loggerStream.ts */
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
// Identifiers
|
|
151
|
+
export type { LogFunction } from './stream/loggerStream.js';
|
|
152
|
+
export { LoggerStream } from './stream/loggerStream.js';
|
|
153
|
+
export { HexDumpLoggerStream } from './stream/loggerStream.js';
|
|
@@ -2,10 +2,7 @@ import { execa, type Options as ExecaOptions, type Result } from 'execa';
|
|
|
2
2
|
import { printLine } from '../cli-io/output.js';
|
|
3
3
|
import { checkChildProcessResult } from './error.js';
|
|
4
4
|
|
|
5
|
-
export type ISpawnOptions = Omit<
|
|
6
|
-
ExecaOptions,
|
|
7
|
-
'lines' | 'reject' | 'stdio' | 'encoding' | 'all' | 'stderr' | 'verbose'
|
|
8
|
-
> & {
|
|
5
|
+
export type ISpawnOptions = Omit<ExecaOptions, 'lines' | 'reject' | 'stdio' | 'encoding' | 'all' | 'stderr' | 'verbose'> & {
|
|
9
6
|
verbose?: boolean;
|
|
10
7
|
};
|
|
11
8
|
type ISpawnConst = {
|
|
@@ -17,9 +14,7 @@ type ISpawnConst = {
|
|
|
17
14
|
|
|
18
15
|
type ConvStdout<T extends ISpawnOptions> = T['stdout'] extends 'inherit' ? Omit<T, 'stdout'> & { stdout: 'pipe' } : T;
|
|
19
16
|
|
|
20
|
-
export type ExecaReturnValue<options extends ISpawnOptions> = Result<
|
|
21
|
-
ConvStdout<Omit<options, 'verbose'>> & ISpawnConst
|
|
22
|
-
>;
|
|
17
|
+
export type ExecaReturnValue<options extends ISpawnOptions> = Result<ConvStdout<Omit<options, 'verbose'>> & ISpawnConst>;
|
|
23
18
|
|
|
24
19
|
type NoStdio = Omit<ISpawnOptions, 'stdio'> & { stdio?: never };
|
|
25
20
|
|
|
@@ -27,11 +22,7 @@ type NoStdio = Omit<ISpawnOptions, 'stdio'> & { stdio?: never };
|
|
|
27
22
|
* 运行命令,如果出错,则输出缓冲的stderr(如果stdout是inherit,也同时输出stdout)
|
|
28
23
|
* 如果程序正常结束,则程序向stderr输出的内容直接丢弃(如果stdout是inherit,也同时丢弃)
|
|
29
24
|
*/
|
|
30
|
-
export function execLazyError<T extends NoStdio = NoStdio>(
|
|
31
|
-
cmd: string,
|
|
32
|
-
args: string[],
|
|
33
|
-
spawnOptions: T
|
|
34
|
-
): Promise<ExecaReturnValue<T>> {
|
|
25
|
+
export function execLazyError<T extends NoStdio = NoStdio>(cmd: string, args: string[], spawnOptions: T): Promise<ExecaReturnValue<T>> {
|
|
35
26
|
let all = false;
|
|
36
27
|
let { stdout, verbose, ...others } = spawnOptions;
|
|
37
28
|
|
|
@@ -113,11 +113,7 @@ function execLinux(cmds: string[]): never {
|
|
|
113
113
|
process.execve!(unshare, args);
|
|
114
114
|
console.error('[Linux] execve failed.');
|
|
115
115
|
} catch (err: any) {
|
|
116
|
-
if (
|
|
117
|
-
err.code === 'MODULE_NOT_FOUND' ||
|
|
118
|
-
err.code === 'ERR_MODULE_NOT_FOUND' ||
|
|
119
|
-
err.code === 'UNDECLARED_DEPENDENCY'
|
|
120
|
-
) {
|
|
116
|
+
if (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_MODULE_NOT_FOUND' || err.code === 'UNDECLARED_DEPENDENCY') {
|
|
121
117
|
spawnSimulate(unshare, args);
|
|
122
118
|
} else {
|
|
123
119
|
console.error('[Linux] <%s> execve failed:', err.code, err);
|
package/src/error/types.ts
CHANGED
|
@@ -15,9 +15,7 @@ export interface OpenSSLException extends Error {
|
|
|
15
15
|
* MODULE_NOT_FOUND: require() not found
|
|
16
16
|
* ERR_MODULE_NOT_FOUND: import() not found
|
|
17
17
|
*/
|
|
18
|
-
export function isModuleResolutionError(
|
|
19
|
-
ex: unknown,
|
|
20
|
-
): ex is NodeException<NodeError.MODULE_NOT_FOUND | NodeError.ERR_MODULE_NOT_FOUND> {
|
|
18
|
+
export function isModuleResolutionError(ex: unknown): ex is NodeException<NodeError.MODULE_NOT_FOUND | NodeError.ERR_MODULE_NOT_FOUND> {
|
|
21
19
|
return isNodeError(ex) && (ex.code === NodeError.MODULE_NOT_FOUND || ex.code === NodeError.ERR_MODULE_NOT_FOUND);
|
|
22
20
|
}
|
|
23
21
|
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noDebugger: debug file */
|
|
2
|
+
|
|
3
|
+
import { AppExit, ensureDisposeGlobal, ensureGlobalObject, prettyPrintError } from '@idlebox/common';
|
|
2
4
|
import { createRequire, syncBuiltinESMExports } from 'node:module';
|
|
5
|
+
import { basename } from 'node:path';
|
|
3
6
|
import process from 'node:process';
|
|
4
7
|
|
|
5
8
|
const originalExit = process.exit;
|
|
9
|
+
const prefix = process.stderr.isTTY ? '' : `<${title()} ${process.pid}> `;
|
|
10
|
+
const hasInspect = process.argv.some((arg) => arg.startsWith('--inspect=') || arg.startsWith('--inspect-brk=') || arg === '--inspect' || arg === '--inspect-brk');
|
|
11
|
+
|
|
12
|
+
function title() {
|
|
13
|
+
if (process.title && process.title !== 'node') {
|
|
14
|
+
return process.title;
|
|
15
|
+
}
|
|
16
|
+
return basename(process.argv[1] || '') || 'node';
|
|
17
|
+
}
|
|
6
18
|
|
|
7
19
|
class Exit extends AppExit {
|
|
8
20
|
constructor(code: number) {
|
|
@@ -10,8 +22,10 @@ class Exit extends AppExit {
|
|
|
10
22
|
}
|
|
11
23
|
}
|
|
12
24
|
|
|
13
|
-
|
|
25
|
+
const shuttingDown = false;
|
|
14
26
|
export function shutdown(exitCode: number): never {
|
|
27
|
+
if (hasInspect) debugger;
|
|
28
|
+
|
|
15
29
|
if (exitCode) {
|
|
16
30
|
process.exitCode = exitCode;
|
|
17
31
|
}
|
|
@@ -28,20 +42,18 @@ export function shutdown(exitCode: number): never {
|
|
|
28
42
|
throw new Exit(code);
|
|
29
43
|
}
|
|
30
44
|
|
|
31
|
-
const exitHandler = Symbol('exithandler/registed');
|
|
32
|
-
|
|
33
45
|
/**
|
|
34
46
|
* 注册nodejs退出处理器
|
|
35
47
|
*/
|
|
36
48
|
export function registerNodejsExitHandler() {
|
|
37
|
-
|
|
49
|
+
ensureGlobalObject('exithandler/register', _real_register);
|
|
38
50
|
}
|
|
39
51
|
function _real_register() {
|
|
40
52
|
process.on('SIGINT', () => {
|
|
41
|
-
console.
|
|
53
|
+
console.error(`\n${prefix}Received SIGINT. Exiting gracefully...`);
|
|
42
54
|
|
|
43
55
|
if (shuttingDown) {
|
|
44
|
-
console.error(
|
|
56
|
+
console.error(`Exiting immediately.`);
|
|
45
57
|
originalExit(1);
|
|
46
58
|
}
|
|
47
59
|
|
|
@@ -49,20 +61,25 @@ function _real_register() {
|
|
|
49
61
|
});
|
|
50
62
|
|
|
51
63
|
process.on('SIGTERM', () => {
|
|
52
|
-
console.
|
|
64
|
+
console.error(`${prefix}Received SIGTERM. Exiting gracefully...`);
|
|
53
65
|
shutdown(0);
|
|
54
66
|
});
|
|
55
67
|
|
|
56
|
-
process.on('beforeExit',
|
|
68
|
+
process.on('beforeExit', (code) => {
|
|
69
|
+
console.error(`${prefix}Process beforeExit with code: ${code}`);
|
|
70
|
+
shutdown(code);
|
|
71
|
+
});
|
|
57
72
|
|
|
58
73
|
process.on('unhandledRejection', (reason, _promise) => {
|
|
74
|
+
if (hasInspect) debugger;
|
|
75
|
+
|
|
59
76
|
if (reason instanceof Error) {
|
|
60
77
|
if (reason instanceof AppExit) {
|
|
61
78
|
return;
|
|
62
79
|
}
|
|
63
|
-
prettyPrintError(
|
|
80
|
+
prettyPrintError(`${prefix}Unhandled Rejection`, reason);
|
|
64
81
|
} else {
|
|
65
|
-
console.error(
|
|
82
|
+
console.error(`${prefix}Unhandled Rejection / error type unknown:`, reason);
|
|
66
83
|
}
|
|
67
84
|
shutdown(1);
|
|
68
85
|
});
|
|
@@ -75,13 +92,16 @@ function _real_register() {
|
|
|
75
92
|
if (error instanceof AppExit) {
|
|
76
93
|
return;
|
|
77
94
|
}
|
|
78
|
-
|
|
95
|
+
|
|
96
|
+
if (hasInspect) debugger;
|
|
97
|
+
|
|
98
|
+
prettyPrintError(`${prefix}Uncaught Exception`, error);
|
|
79
99
|
shutdown(1);
|
|
80
100
|
}
|
|
81
101
|
|
|
82
102
|
if (process.hasUncaughtExceptionCaptureCallback()) {
|
|
83
103
|
process.on('uncaughtException', uncaughtException);
|
|
84
|
-
throw new Error(
|
|
104
|
+
throw new Error(`${prefix} [uncaught exception capture] callback already registered by other module`);
|
|
85
105
|
}
|
|
86
106
|
process.setUncaughtExceptionCaptureCallback(uncaughtException);
|
|
87
107
|
|
|
@@ -92,6 +112,7 @@ function _real_register() {
|
|
|
92
112
|
* @deprecated 仅用于测试
|
|
93
113
|
*/
|
|
94
114
|
export function die(message: string): never {
|
|
95
|
-
|
|
115
|
+
debugger;
|
|
116
|
+
console.error(`${prefix}DIE!`, message);
|
|
96
117
|
shutdown(1);
|
|
97
118
|
}
|
|
@@ -7,8 +7,8 @@ export function lrelative(from: string, to: string) {
|
|
|
7
7
|
if (!isAbsolute(to)) {
|
|
8
8
|
throw new Error(`lrelative: to is not absolute: ${to}`);
|
|
9
9
|
}
|
|
10
|
-
const fa = from.split(/[
|
|
11
|
-
const ta = to.split(/[
|
|
10
|
+
const fa = from.split(/[/\\]/g).filter((e) => e);
|
|
11
|
+
const ta = to.split(/[/\\]/g).filter((e) => e);
|
|
12
12
|
const f = ta.pop();
|
|
13
13
|
while (fa[0] === ta[0]) {
|
|
14
14
|
fa.shift();
|
|
@@ -7,7 +7,7 @@ export class LoggerStream extends Transform {
|
|
|
7
7
|
|
|
8
8
|
constructor(
|
|
9
9
|
private readonly logFn: LogFunction,
|
|
10
|
-
prefix?: string
|
|
10
|
+
prefix?: string,
|
|
11
11
|
) {
|
|
12
12
|
super();
|
|
13
13
|
this.prefix = prefix ? `${prefix} %s` : '%s';
|
|
@@ -39,7 +39,7 @@ export class HexDumpLoggerStream extends Transform {
|
|
|
39
39
|
|
|
40
40
|
constructor(
|
|
41
41
|
private readonly logFn: LogFunction,
|
|
42
|
-
prefix?: string
|
|
42
|
+
prefix?: string,
|
|
43
43
|
) {
|
|
44
44
|
super();
|
|
45
45
|
this.prefix = prefix ? `${prefix} ` : '';
|