@decohere/devkit 0.0.1-dev.126 → 0.0.1-dev.5
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/package.json +3 -12
- package/src/cli/action.ts +77 -0
- package/src/cli/command.ts +173 -0
- package/src/cli/index.ts +30 -0
- package/src/cli/module.type.ts +48 -0
- package/src/cli/options.ts +81 -0
- package/src/diagnostics/trace.ts +92 -0
- package/src/interop/docker/docker.ts +57 -0
- package/src/interop/errors/interop.error.ts +1 -0
- package/src/interop/git/git.ts +98 -0
- package/{types/src/interop/git/git.types.d.ts → src/interop/git/git.types.ts} +9 -6
- package/{es6/src/interop/index.js → src/interop/index.ts} +1 -0
- package/src/interop/node/node.ts +38 -0
- package/src/interop/npm/npm.ts +168 -0
- package/src/interop/npm/npm.types.ts +28 -0
- package/src/interop/pnpm/pnpm.ts +22 -0
- package/{types/src/interop/pnpm/pnpm.types.d.ts → src/interop/pnpm/pnpm.types.ts} +1 -1
- package/src/interop/shell/shell.argv.ts +31 -0
- package/src/interop/shell/shell.ts +100 -0
- package/src/interop/shell/shell.types.ts +9 -0
- package/src/interop/types/detect-package-manager.ts +45 -0
- package/src/interop/types/package-manager.ts +7 -0
- package/src/interop/yarn/yarn.ts +28 -0
- package/{types/src/interop/yarn/yarn.types.d.ts → src/interop/yarn/yarn.types.ts} +1 -1
- package/src/io/find-directories.ts +13 -0
- package/src/io/find-file.ts +37 -0
- package/src/io/watch.ts +290 -0
- package/tests/cli/command.model.spec.ts +91 -0
- package/tests/diagnostics/trace.spec.ts +319 -0
- package/tests/interop/detect-package-manager.spec.ts +70 -0
- package/tests/interop/npm.spec.ts +129 -0
- package/tests/interop/pnpm.spec.ts +30 -0
- package/tests/interop/shell.spec.ts +47 -0
- package/tests/interop/yarn.spec.ts +18 -0
- package/tests/io/find-file.spec.ts +188 -0
- package/tests/io/watch.real-fs.spec.ts +76 -0
- package/tests/io/watch.spec.ts +291 -0
- package/LICENSE +0 -15
- package/commonjs/src/cli/action.js +0 -65
- package/commonjs/src/cli/command.js +0 -127
- package/commonjs/src/cli/index.js +0 -61
- package/commonjs/src/cli/module.type.js +0 -18
- package/commonjs/src/cli/options.js +0 -115
- package/commonjs/src/diagnostics/index.js +0 -22
- package/commonjs/src/diagnostics/trace.js +0 -79
- package/commonjs/src/interop/docker/docker.js +0 -54
- package/commonjs/src/interop/errors/interop.error.js +0 -12
- package/commonjs/src/interop/git/git.js +0 -134
- package/commonjs/src/interop/git/git.types.js +0 -4
- package/commonjs/src/interop/index.js +0 -97
- package/commonjs/src/interop/node/index.js +0 -18
- package/commonjs/src/interop/node/node.js +0 -45
- package/commonjs/src/interop/npm/npm.js +0 -231
- package/commonjs/src/interop/npm/npm.types.js +0 -16
- package/commonjs/src/interop/pnpm/pnpm.js +0 -34
- package/commonjs/src/interop/pnpm/pnpm.types.js +0 -4
- package/commonjs/src/interop/shell/shell.argv.js +0 -45
- package/commonjs/src/interop/shell/shell.js +0 -105
- package/commonjs/src/interop/shell/shell.types.js +0 -4
- package/commonjs/src/interop/types/detect-package-manager.js +0 -71
- package/commonjs/src/interop/types/package-manager.js +0 -4
- package/commonjs/src/interop/yarn/yarn.js +0 -34
- package/commonjs/src/interop/yarn/yarn.types.js +0 -4
- package/commonjs/src/io/find-directories.js +0 -21
- package/commonjs/src/io/find-file.js +0 -45
- package/commonjs/src/io/index.js +0 -20
- package/commonjs/src/io/watch.js +0 -261
- package/es6/src/cli/action.js +0 -47
- package/es6/src/cli/command.js +0 -106
- package/es6/src/cli/index.js +0 -4
- package/es6/src/cli/module.type.js +0 -11
- package/es6/src/cli/options.js +0 -76
- package/es6/src/diagnostics/trace.js +0 -61
- package/es6/src/interop/docker/docker.js +0 -44
- package/es6/src/interop/errors/interop.error.js +0 -2
- package/es6/src/interop/git/git.js +0 -124
- package/es6/src/interop/git/git.types.js +0 -1
- package/es6/src/interop/node/node.js +0 -35
- package/es6/src/interop/npm/npm.js +0 -180
- package/es6/src/interop/npm/npm.types.js +0 -6
- package/es6/src/interop/pnpm/pnpm.js +0 -24
- package/es6/src/interop/pnpm/pnpm.types.js +0 -1
- package/es6/src/interop/shell/shell.argv.js +0 -35
- package/es6/src/interop/shell/shell.js +0 -95
- package/es6/src/interop/shell/shell.types.js +0 -1
- package/es6/src/interop/types/detect-package-manager.js +0 -50
- package/es6/src/interop/types/package-manager.js +0 -1
- package/es6/src/interop/yarn/yarn.js +0 -24
- package/es6/src/interop/yarn/yarn.types.js +0 -1
- package/es6/src/io/find-directories.js +0 -11
- package/es6/src/io/find-file.js +0 -27
- package/es6/src/io/watch.js +0 -238
- package/types/src/cli/action.d.ts +0 -36
- package/types/src/cli/command.d.ts +0 -34
- package/types/src/cli/index.d.ts +0 -7
- package/types/src/cli/module.type.d.ts +0 -36
- package/types/src/cli/options.d.ts +0 -28
- package/types/src/diagnostics/index.d.ts +0 -1
- package/types/src/diagnostics/trace.d.ts +0 -10
- package/types/src/interop/docker/docker.d.ts +0 -19
- package/types/src/interop/errors/interop.error.d.ts +0 -2
- package/types/src/interop/git/git.d.ts +0 -16
- package/types/src/interop/index.d.ts +0 -14
- package/types/src/interop/node/index.d.ts +0 -1
- package/types/src/interop/node/node.d.ts +0 -5
- package/types/src/interop/npm/npm.d.ts +0 -29
- package/types/src/interop/npm/npm.types.d.ts +0 -24
- package/types/src/interop/pnpm/pnpm.d.ts +0 -9
- package/types/src/interop/shell/shell.argv.d.ts +0 -5
- package/types/src/interop/shell/shell.d.ts +0 -6
- package/types/src/interop/shell/shell.types.d.ts +0 -9
- package/types/src/interop/types/detect-package-manager.d.ts +0 -4
- package/types/src/interop/types/package-manager.d.ts +0 -10
- package/types/src/interop/yarn/yarn.d.ts +0 -9
- package/types/src/io/find-directories.d.ts +0 -2
- package/types/src/io/find-file.d.ts +0 -9
- package/types/src/io/index.d.ts +0 -3
- package/types/src/io/watch.d.ts +0 -16
- /package/{es6/src/diagnostics/index.js → src/diagnostics/index.ts} +0 -0
- /package/{es6/src/interop/node/index.js → src/interop/node/index.ts} +0 -0
- /package/{es6/src/io/index.js → src/io/index.ts} +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get Trace () {
|
|
13
|
-
return _trace.Trace;
|
|
14
|
-
},
|
|
15
|
-
get timed () {
|
|
16
|
-
return _trace.timed;
|
|
17
|
-
},
|
|
18
|
-
get trace () {
|
|
19
|
-
return _trace.trace;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _trace = require("./trace.js");
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get Trace () {
|
|
13
|
-
return Trace;
|
|
14
|
-
},
|
|
15
|
-
get timed () {
|
|
16
|
-
return timed;
|
|
17
|
-
},
|
|
18
|
-
get trace () {
|
|
19
|
-
return trace;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _types = require("node:util/types");
|
|
23
|
-
const _scribe = require("@decohere/scribe");
|
|
24
|
-
/**
|
|
25
|
-
* Trace mode is toggled with FORGE_TRACE, read when a method is decorated. Raising the log level
|
|
26
|
-
* to see the output is the CLI's job at its entry point: importing this module changes nothing.
|
|
27
|
-
*/ function isTraceEnabled() {
|
|
28
|
-
return process.env.FORGE_TRACE != null;
|
|
29
|
-
}
|
|
30
|
-
function serializeArgs(args) {
|
|
31
|
-
if (args.length === 0) return "";
|
|
32
|
-
return args.map((arg)=>{
|
|
33
|
-
if (Array.isArray(arg)) return `[${arg.map(String).join(", ")}]`;
|
|
34
|
-
const s = String(arg);
|
|
35
|
-
return s.length > 60 ? `${s.slice(0, 57)}...` : s;
|
|
36
|
-
}).join(", ");
|
|
37
|
-
}
|
|
38
|
-
function wrapWithTiming(fn, className, methodName, logLevel) {
|
|
39
|
-
let logger;
|
|
40
|
-
return function(...args) {
|
|
41
|
-
if (logger == null) {
|
|
42
|
-
logger = _scribe.scribe.logger(className);
|
|
43
|
-
}
|
|
44
|
-
const log = logger;
|
|
45
|
-
const label = `${methodName}(${serializeArgs(args)})`;
|
|
46
|
-
const start = performance.now();
|
|
47
|
-
const logDuration = ()=>{
|
|
48
|
-
log[logLevel](`${label}: ${(performance.now() - start).toFixed(2)}ms`);
|
|
49
|
-
};
|
|
50
|
-
const result = fn.apply(this, args);
|
|
51
|
-
if ((0, _types.isPromise)(result)) {
|
|
52
|
-
return result.finally(logDuration);
|
|
53
|
-
}
|
|
54
|
-
logDuration();
|
|
55
|
-
return result;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function trace(target, propertyKey, descriptor) {
|
|
59
|
-
if (!isTraceEnabled()) return descriptor;
|
|
60
|
-
const className = target.constructor.name;
|
|
61
|
-
descriptor.value = wrapWithTiming(descriptor.value, className, propertyKey, "trace");
|
|
62
|
-
return descriptor;
|
|
63
|
-
}
|
|
64
|
-
function timed(target, propertyKey, descriptor) {
|
|
65
|
-
const className = target.constructor.name;
|
|
66
|
-
descriptor.value = wrapWithTiming(descriptor.value, className, propertyKey, "info");
|
|
67
|
-
return descriptor;
|
|
68
|
-
}
|
|
69
|
-
function Trace(constructor) {
|
|
70
|
-
if (!isTraceEnabled()) return;
|
|
71
|
-
const className = constructor.name;
|
|
72
|
-
for (const key of Object.getOwnPropertyNames(constructor.prototype)){
|
|
73
|
-
if (key === "constructor") continue;
|
|
74
|
-
const descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, key);
|
|
75
|
-
if (descriptor == null || typeof descriptor.value !== "function") continue;
|
|
76
|
-
descriptor.value = wrapWithTiming(descriptor.value, className, key, "trace");
|
|
77
|
-
Object.defineProperty(constructor.prototype, key, descriptor);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Docker", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Docker;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interoperror = require("../errors/interop.error.js");
|
|
12
|
-
const _shell = require("../shell/shell.js");
|
|
13
|
-
class Docker extends _shell.Shell {
|
|
14
|
-
name = "docker";
|
|
15
|
-
program = "docker";
|
|
16
|
-
async build(contextDir, options = {}) {
|
|
17
|
-
if (contextDir == null || contextDir.trim() === "") {
|
|
18
|
-
throw new _interoperror.InteropError("Docker build context is required");
|
|
19
|
-
}
|
|
20
|
-
const args = [
|
|
21
|
-
"build"
|
|
22
|
-
];
|
|
23
|
-
if (options.dockerfile) {
|
|
24
|
-
args.push("-f", options.dockerfile);
|
|
25
|
-
}
|
|
26
|
-
for (const tag of options.tags ?? []){
|
|
27
|
-
args.push("-t", tag);
|
|
28
|
-
}
|
|
29
|
-
for (const [key, value] of Object.entries(options.buildArgs ?? {})){
|
|
30
|
-
args.push("--build-arg", `${key}=${value}`);
|
|
31
|
-
}
|
|
32
|
-
for (const [id, env] of Object.entries(options.secrets ?? {})){
|
|
33
|
-
args.push("--secret", `id=${id},env=${env}`);
|
|
34
|
-
}
|
|
35
|
-
if (options.noCache) {
|
|
36
|
-
args.push("--no-cache");
|
|
37
|
-
}
|
|
38
|
-
if (options.pull) {
|
|
39
|
-
args.push("--pull");
|
|
40
|
-
}
|
|
41
|
-
args.push(contextDir);
|
|
42
|
-
return await this.run({
|
|
43
|
-
cwd: options.cwd
|
|
44
|
-
}, ...args);
|
|
45
|
-
}
|
|
46
|
-
async push(tag, options = {}) {
|
|
47
|
-
if (tag == null || tag.trim() === "") {
|
|
48
|
-
throw new _interoperror.InteropError("Docker tag is required");
|
|
49
|
-
}
|
|
50
|
-
return await this.run({
|
|
51
|
-
cwd: options.cwd
|
|
52
|
-
}, "push", tag);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Git", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Git;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interoperror = require("../errors/interop.error.js");
|
|
12
|
-
const _shell = require("../shell/shell.js");
|
|
13
|
-
const Commands = {
|
|
14
|
-
stage: "stage",
|
|
15
|
-
tag: "tag",
|
|
16
|
-
add: "add",
|
|
17
|
-
commit: "commit",
|
|
18
|
-
push: "push",
|
|
19
|
-
listFiles: "ls-files"
|
|
20
|
-
};
|
|
21
|
-
const defaultOptions = {
|
|
22
|
-
cwd: "./"
|
|
23
|
-
};
|
|
24
|
-
class Git extends _shell.Shell {
|
|
25
|
-
program = "git";
|
|
26
|
-
async getModifiedFiles(options = defaultOptions) {
|
|
27
|
-
const args = [
|
|
28
|
-
Commands.listFiles,
|
|
29
|
-
"--modified"
|
|
30
|
-
];
|
|
31
|
-
const { cwd } = options;
|
|
32
|
-
const result = await this.run({
|
|
33
|
-
cwd
|
|
34
|
-
}, ...args);
|
|
35
|
-
return result.data;
|
|
36
|
-
}
|
|
37
|
-
async getBranchName(options = defaultOptions) {
|
|
38
|
-
const { cwd } = options;
|
|
39
|
-
const args = [
|
|
40
|
-
"rev-parse",
|
|
41
|
-
"--symbolic-full-name",
|
|
42
|
-
"--abbrev-ref",
|
|
43
|
-
"HEAD"
|
|
44
|
-
];
|
|
45
|
-
const result = await this.run({
|
|
46
|
-
cwd
|
|
47
|
-
}, ...args);
|
|
48
|
-
return result.data[0];
|
|
49
|
-
}
|
|
50
|
-
async tag(tag, options = defaultOptions) {
|
|
51
|
-
const args = [
|
|
52
|
-
Commands.tag,
|
|
53
|
-
tag
|
|
54
|
-
];
|
|
55
|
-
const { cwd } = options;
|
|
56
|
-
const result = await this.run({
|
|
57
|
-
cwd
|
|
58
|
-
}, ...args);
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
async pushTag(tag, options = defaultOptions) {
|
|
62
|
-
const { cwd, remote = "origin" } = options;
|
|
63
|
-
const result = await this.run({
|
|
64
|
-
cwd
|
|
65
|
-
}, Commands.push, remote, tag);
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
async commit(message, options) {
|
|
69
|
-
const optionsAndDefaults = {
|
|
70
|
-
...defaultOptions,
|
|
71
|
-
...options
|
|
72
|
-
};
|
|
73
|
-
const { cwd, files = [], all } = optionsAndDefaults;
|
|
74
|
-
const args = [
|
|
75
|
-
Commands.commit
|
|
76
|
-
];
|
|
77
|
-
if (files.length > 0 && all) {
|
|
78
|
-
throw new _interoperror.InteropError("Cannot commit all and files at the same time");
|
|
79
|
-
}
|
|
80
|
-
if (files.length > 0) {
|
|
81
|
-
await this.stage({
|
|
82
|
-
files
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (options.all) {
|
|
86
|
-
args.push("-a");
|
|
87
|
-
}
|
|
88
|
-
args.push("-m", message);
|
|
89
|
-
const result = await this.run({
|
|
90
|
-
cwd
|
|
91
|
-
}, ...args);
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
async push(branch, options) {
|
|
95
|
-
const optionsAndDefaults = {
|
|
96
|
-
...defaultOptions,
|
|
97
|
-
...options
|
|
98
|
-
};
|
|
99
|
-
const { cwd, setUpstream } = optionsAndDefaults;
|
|
100
|
-
const args = [
|
|
101
|
-
Commands.push
|
|
102
|
-
];
|
|
103
|
-
args.push("--set-upstream", setUpstream ?? "origin");
|
|
104
|
-
args.push(branch);
|
|
105
|
-
const result = await this.run({
|
|
106
|
-
cwd
|
|
107
|
-
}, ...args);
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
async pull(branch, options = defaultOptions) {
|
|
111
|
-
const { cwd } = options;
|
|
112
|
-
return this.run({
|
|
113
|
-
cwd
|
|
114
|
-
}, "pull", "--rebase", "origin", branch);
|
|
115
|
-
}
|
|
116
|
-
async stage(options) {
|
|
117
|
-
const optionsAndDefaults = {
|
|
118
|
-
...defaultOptions,
|
|
119
|
-
...options
|
|
120
|
-
};
|
|
121
|
-
const { cwd, files = [], all } = optionsAndDefaults;
|
|
122
|
-
if (all) {
|
|
123
|
-
await this.run({
|
|
124
|
-
cwd
|
|
125
|
-
}, Commands.stage, "-a");
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
for (const file of files){
|
|
129
|
-
await this.run({
|
|
130
|
-
cwd
|
|
131
|
-
}, Commands.stage, file);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// << Git >>
|
|
2
|
-
// << Docker >>
|
|
3
|
-
"use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
function _export(target, all) {
|
|
8
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
_export(exports, {
|
|
14
|
-
get git () {
|
|
15
|
-
return _gittypes;
|
|
16
|
-
},
|
|
17
|
-
get npm () {
|
|
18
|
-
return _npmtypes;
|
|
19
|
-
},
|
|
20
|
-
get pnpm () {
|
|
21
|
-
return _pnpmtypes;
|
|
22
|
-
},
|
|
23
|
-
get shell () {
|
|
24
|
-
return _shelltypes;
|
|
25
|
-
},
|
|
26
|
-
get yarn () {
|
|
27
|
-
return _yarntypes;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
_export_star(require("./docker/docker.js"), exports);
|
|
31
|
-
_export_star(require("./git/git.js"), exports);
|
|
32
|
-
const _gittypes = /*#__PURE__*/ _interop_require_wildcard(require("./git/git.types.js"));
|
|
33
|
-
_export_star(require("./node/node.js"), exports);
|
|
34
|
-
_export_star(require("./npm/npm.js"), exports);
|
|
35
|
-
const _npmtypes = /*#__PURE__*/ _interop_require_wildcard(require("./npm/npm.types.js"));
|
|
36
|
-
_export_star(require("./pnpm/pnpm.js"), exports);
|
|
37
|
-
const _pnpmtypes = /*#__PURE__*/ _interop_require_wildcard(require("./pnpm/pnpm.types.js"));
|
|
38
|
-
_export_star(require("./shell/shell.js"), exports);
|
|
39
|
-
const _shelltypes = /*#__PURE__*/ _interop_require_wildcard(require("./shell/shell.types.js"));
|
|
40
|
-
_export_star(require("./types/detect-package-manager.js"), exports);
|
|
41
|
-
_export_star(require("./types/package-manager.js"), exports);
|
|
42
|
-
_export_star(require("./yarn/yarn.js"), exports);
|
|
43
|
-
const _yarntypes = /*#__PURE__*/ _interop_require_wildcard(require("./yarn/yarn.types.js"));
|
|
44
|
-
function _export_star(from, to) {
|
|
45
|
-
Object.keys(from).forEach(function(k) {
|
|
46
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
47
|
-
Object.defineProperty(to, k, {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function() {
|
|
50
|
-
return from[k];
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return from;
|
|
56
|
-
}
|
|
57
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
58
|
-
if (typeof WeakMap !== "function") return null;
|
|
59
|
-
var cacheBabelInterop = new WeakMap();
|
|
60
|
-
var cacheNodeInterop = new WeakMap();
|
|
61
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
62
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
63
|
-
})(nodeInterop);
|
|
64
|
-
}
|
|
65
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
66
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
67
|
-
return obj;
|
|
68
|
-
}
|
|
69
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
70
|
-
return {
|
|
71
|
-
default: obj
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
75
|
-
if (cache && cache.has(obj)) {
|
|
76
|
-
return cache.get(obj);
|
|
77
|
-
}
|
|
78
|
-
var newObj = {
|
|
79
|
-
__proto__: null
|
|
80
|
-
};
|
|
81
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
82
|
-
for(var key in obj){
|
|
83
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
84
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
85
|
-
if (desc && (desc.get || desc.set)) {
|
|
86
|
-
Object.defineProperty(newObj, key, desc);
|
|
87
|
-
} else {
|
|
88
|
-
newObj[key] = obj[key];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
newObj.default = obj;
|
|
93
|
-
if (cache) {
|
|
94
|
-
cache.set(obj, newObj);
|
|
95
|
-
}
|
|
96
|
-
return newObj;
|
|
97
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./node.js"), exports);
|
|
6
|
-
function _export_star(from, to) {
|
|
7
|
-
Object.keys(from).forEach(function(k) {
|
|
8
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
-
Object.defineProperty(to, k, {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function() {
|
|
12
|
-
return from[k];
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return from;
|
|
18
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Node", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Node;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _nodechild_process = require("node:child_process");
|
|
12
|
-
const _shell = require("../shell/shell.js");
|
|
13
|
-
class Node extends _shell.Shell {
|
|
14
|
-
program = "node";
|
|
15
|
-
async runScript(script, ...args) {
|
|
16
|
-
const spawnOpt = {
|
|
17
|
-
cwd: ".",
|
|
18
|
-
stdio: "inherit",
|
|
19
|
-
env: {
|
|
20
|
-
...process.env
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return new Promise((resolve, reject)=>{
|
|
24
|
-
const proc = (0, _nodechild_process.spawn)("node", [
|
|
25
|
-
script,
|
|
26
|
-
...args
|
|
27
|
-
], spawnOpt);
|
|
28
|
-
proc.on("exit", (code)=>{
|
|
29
|
-
if (code !== 0) {
|
|
30
|
-
reject();
|
|
31
|
-
}
|
|
32
|
-
resolve(null);
|
|
33
|
-
});
|
|
34
|
-
proc.on("close", (code)=>{
|
|
35
|
-
resolve(null);
|
|
36
|
-
if (code === 0) {
|
|
37
|
-
resolve({
|
|
38
|
-
message: `${script} completed`
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
reject(`Running '${script}' failed with code ${code}`);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|