@effect/platform-node 0.1.1 → 0.3.0
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/Command.d.ts +111 -0
- package/Command.d.ts.map +1 -0
- package/Command.js +103 -0
- package/Command.js.map +1 -0
- package/CommandExecutor.d.ts +44 -0
- package/CommandExecutor.d.ts.map +1 -0
- package/CommandExecutor.js +23 -0
- package/CommandExecutor.js.map +1 -0
- package/NodeContext.d.ts +16 -0
- package/NodeContext.d.ts.map +1 -0
- package/NodeContext.js +24 -0
- package/NodeContext.js.map +1 -0
- package/internal/commandExecutor.d.ts +2 -0
- package/internal/commandExecutor.d.ts.map +1 -0
- package/internal/commandExecutor.js +145 -0
- package/internal/commandExecutor.js.map +1 -0
- package/internal/error.d.ts +2 -0
- package/internal/error.d.ts.map +1 -0
- package/internal/error.js +44 -0
- package/internal/error.js.map +1 -0
- package/internal/fileSystem.js +28 -62
- package/internal/fileSystem.js.map +1 -1
- package/internal/path.js +16 -10
- package/internal/path.js.map +1 -1
- package/internal/runtime.js +2 -2
- package/internal/runtime.js.map +1 -1
- package/internal/sink.js +3 -3
- package/internal/sink.js.map +1 -1
- package/internal/stream.js +6 -1
- package/internal/stream.js.map +1 -1
- package/mjs/Command.mjs +85 -0
- package/mjs/Command.mjs.map +1 -0
- package/mjs/CommandExecutor.mjs +13 -0
- package/mjs/CommandExecutor.mjs.map +1 -0
- package/mjs/NodeContext.mjs +15 -0
- package/mjs/NodeContext.mjs.map +1 -0
- package/mjs/internal/commandExecutor.mjs +136 -0
- package/mjs/internal/commandExecutor.mjs.map +1 -0
- package/mjs/internal/error.mjs +37 -0
- package/mjs/internal/error.mjs.map +1 -0
- package/mjs/internal/fileSystem.mjs +28 -62
- package/mjs/internal/fileSystem.mjs.map +1 -1
- package/mjs/internal/path.mjs +16 -10
- package/mjs/internal/path.mjs.map +1 -1
- package/mjs/internal/runtime.mjs +2 -2
- package/mjs/internal/runtime.mjs.map +1 -1
- package/mjs/internal/sink.mjs +3 -3
- package/mjs/internal/sink.mjs.map +1 -1
- package/mjs/internal/stream.mjs +6 -1
- package/mjs/internal/stream.mjs.map +1 -1
- package/package.json +5 -5
- package/src/Command.ts +114 -0
- package/src/CommandExecutor.ts +49 -0
- package/src/NodeContext.ts +26 -0
- package/src/internal/commandExecutor.ts +202 -0
- package/src/internal/error.ts +51 -0
- package/src/internal/fileSystem.ts +28 -76
- package/src/internal/path.ts +8 -8
- package/src/internal/runtime.ts +2 -2
- package/src/internal/sink.ts +3 -3
- package/src/internal/stream.ts +6 -1
package/Command.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
export type {
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @category model
|
|
8
|
+
*/
|
|
9
|
+
Command,
|
|
10
|
+
/**
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
* @category model
|
|
13
|
+
*/
|
|
14
|
+
CommandInput,
|
|
15
|
+
/**
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @category model
|
|
18
|
+
*/
|
|
19
|
+
CommandOutput,
|
|
20
|
+
/**
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
* @category model
|
|
23
|
+
*/
|
|
24
|
+
PipedCommand,
|
|
25
|
+
/**
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
* @category model
|
|
28
|
+
*/
|
|
29
|
+
StandardCommand } from "@effect/platform/Command";
|
|
30
|
+
export {
|
|
31
|
+
/**
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
* @category combinators
|
|
34
|
+
*/
|
|
35
|
+
env,
|
|
36
|
+
/**
|
|
37
|
+
* @since 1.0.0
|
|
38
|
+
* @category execution
|
|
39
|
+
*/
|
|
40
|
+
exitCode,
|
|
41
|
+
/**
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
* @category combinators
|
|
44
|
+
*/
|
|
45
|
+
feed,
|
|
46
|
+
/**
|
|
47
|
+
* @since 1.0.0
|
|
48
|
+
* @category combinators
|
|
49
|
+
*/
|
|
50
|
+
flatten,
|
|
51
|
+
/**
|
|
52
|
+
* @since 1.0.0
|
|
53
|
+
* @category refinements
|
|
54
|
+
*/
|
|
55
|
+
isCommand,
|
|
56
|
+
/**
|
|
57
|
+
* @since 1.0.0
|
|
58
|
+
* @category execution
|
|
59
|
+
*/
|
|
60
|
+
lines,
|
|
61
|
+
/**
|
|
62
|
+
* @since 1.0.0
|
|
63
|
+
* @category constructors
|
|
64
|
+
*/
|
|
65
|
+
make,
|
|
66
|
+
/**
|
|
67
|
+
* @since 1.0.0
|
|
68
|
+
* @category combinators
|
|
69
|
+
*/
|
|
70
|
+
pipeTo,
|
|
71
|
+
/**
|
|
72
|
+
* @since 1.0.0
|
|
73
|
+
* @category execution
|
|
74
|
+
*/
|
|
75
|
+
start,
|
|
76
|
+
/**
|
|
77
|
+
* @since 1.0.0
|
|
78
|
+
* @category combinators
|
|
79
|
+
*/
|
|
80
|
+
stderr,
|
|
81
|
+
/**
|
|
82
|
+
* @since 1.0.0
|
|
83
|
+
* @category combinators
|
|
84
|
+
*/
|
|
85
|
+
stdin,
|
|
86
|
+
/**
|
|
87
|
+
* @since 1.0.0
|
|
88
|
+
* @category combinators
|
|
89
|
+
*/
|
|
90
|
+
stdout,
|
|
91
|
+
/**
|
|
92
|
+
* @since 1.0.0
|
|
93
|
+
* @category execution
|
|
94
|
+
*/
|
|
95
|
+
stream,
|
|
96
|
+
/**
|
|
97
|
+
* @since 1.0.0
|
|
98
|
+
* @category execution
|
|
99
|
+
*/
|
|
100
|
+
streamLines,
|
|
101
|
+
/**
|
|
102
|
+
* @since 1.0.0
|
|
103
|
+
* @category execution
|
|
104
|
+
*/
|
|
105
|
+
string,
|
|
106
|
+
/**
|
|
107
|
+
* @since 1.0.0
|
|
108
|
+
* @category combinators
|
|
109
|
+
*/
|
|
110
|
+
workingDirectory } from "@effect/platform/Command";
|
|
111
|
+
//# sourceMappingURL=Command.d.ts.map
|
package/Command.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["./src/Command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY;AACV;;;GAGG;AACH,OAAO;AACP;;;GAGG;AACH,YAAY;AACZ;;;GAGG;AACH,aAAa;AACb;;;GAGG;AACH,YAAY;AACZ;;;GAGG;AACH,eAAe,EAChB,MAAM,0BAA0B,CAAA;AAEjC,OAAO;AACL;;;GAGG;AACH,GAAG;AACH;;;GAGG;AACH,QAAQ;AACR;;;GAGG;AACH,IAAI;AACJ;;;GAGG;AACH,OAAO;AACP;;;GAGG;AACH,SAAS;AACT;;;GAGG;AACH,KAAK;AACL;;;GAGG;AACH,IAAI;AACJ;;;GAGG;AACH,MAAM;AACN;;;GAGG;AACH,KAAK;AACL;;;GAGG;AACH,MAAM;AACN;;;GAGG;AACH,KAAK;AACL;;;GAGG;AACH,MAAM;AACN;;;GAGG;AACH,MAAM;AACN;;;GAGG;AACH,WAAW;AACX;;;GAGG;AACH,MAAM;AACN;;;GAGG;AACH,gBAAgB,EACjB,MAAM,0BAA0B,CAAA"}
|
package/Command.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "env", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Command.env;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "exitCode", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _Command.exitCode;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "feed", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _Command.feed;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "flatten", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _Command.flatten;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "isCommand", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _Command.isCommand;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "lines", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _Command.lines;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "make", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _Command.make;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "pipeTo", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _Command.pipeTo;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "start", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _Command.start;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "stderr", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _Command.stderr;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "stdin", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _Command.stdin;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "stdout", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _Command.stdout;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "stream", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _Command.stream;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "streamLines", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _Command.streamLines;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "string", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _Command.string;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "workingDirectory", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _Command.workingDirectory;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
var _Command = /*#__PURE__*/require("@effect/platform/Command");
|
|
103
|
+
//# sourceMappingURL=Command.js.map
|
package/Command.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.js","names":["_Command","require"],"sources":["./src/Command.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAAA,QAAA,gBAAAC,OAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import type { Layer } from "@effect/io/Layer";
|
|
5
|
+
import type { CommandExecutor } from "@effect/platform/CommandExecutor";
|
|
6
|
+
import type { FileSystem } from "@effect/platform/FileSystem";
|
|
7
|
+
export type {
|
|
8
|
+
/**
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
* @category models
|
|
11
|
+
*/
|
|
12
|
+
ExitCode,
|
|
13
|
+
/**
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
* @category models
|
|
16
|
+
*/
|
|
17
|
+
Process,
|
|
18
|
+
/**
|
|
19
|
+
* @since 1.0.0
|
|
20
|
+
* @category models
|
|
21
|
+
*/
|
|
22
|
+
ProcessId,
|
|
23
|
+
/**
|
|
24
|
+
* @since 1.0.0
|
|
25
|
+
* @category symbols
|
|
26
|
+
*/
|
|
27
|
+
ProcessTypeId,
|
|
28
|
+
/**
|
|
29
|
+
* @since 1.0.0
|
|
30
|
+
* @category models
|
|
31
|
+
*/
|
|
32
|
+
Signal } from "@effect/platform/CommandExecutor";
|
|
33
|
+
export {
|
|
34
|
+
/**
|
|
35
|
+
* @since 1.0.0
|
|
36
|
+
* @category tag
|
|
37
|
+
*/
|
|
38
|
+
CommandExecutor } from "@effect/platform/CommandExecutor";
|
|
39
|
+
/**
|
|
40
|
+
* @since 1.0.0
|
|
41
|
+
* @category layer
|
|
42
|
+
*/
|
|
43
|
+
export declare const layer: Layer<FileSystem, never, CommandExecutor>;
|
|
44
|
+
//# sourceMappingURL=CommandExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandExecutor.d.ts","sourceRoot":"","sources":["./src/CommandExecutor.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE7D,YAAY;AACV;;;GAGG;AACH,QAAQ;AACR;;;GAGG;AACH,OAAO;AACP;;;GAGG;AACH,SAAS;AACT;;;GAGG;AACH,aAAa;AACb;;;GAGG;AACH,MAAM,EACP,MAAM,kCAAkC,CAAA;AAEzC,OAAO;AACL;;;GAGG;AACH,eAAe,EAChB,MAAM,kCAAkC,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,eAAe,CAAkB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CommandExecutor", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CommandExecutor.CommandExecutor;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.layer = void 0;
|
|
13
|
+
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/internal/commandExecutor"));
|
|
14
|
+
var _CommandExecutor = /*#__PURE__*/require("@effect/platform/CommandExecutor");
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
/**
|
|
18
|
+
* @since 1.0.0
|
|
19
|
+
* @category layer
|
|
20
|
+
*/
|
|
21
|
+
const layer = internal.layer;
|
|
22
|
+
exports.layer = layer;
|
|
23
|
+
//# sourceMappingURL=CommandExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandExecutor.js","names":["internal","_interopRequireWildcard","require","_CommandExecutor","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","layer","exports"],"sources":["./src/CommandExecutor.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;AAIA,IAAAA,QAAA,gBAAAC,uBAAA,eAAAC,OAAA;AAgCA,IAAAC,gBAAA,gBAAAD,OAAA;AAMyC,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAEzC;;;;AAIO,MAAMW,KAAK,GAA8C1B,QAAQ,CAAC0B,KAAK;AAAAC,OAAA,CAAAD,KAAA,GAAAA,KAAA"}
|
package/NodeContext.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as Layer from "@effect/io/Layer";
|
|
2
|
+
import * as CommandExecutor from "@effect/platform-node/CommandExecutor";
|
|
3
|
+
import * as Console from "@effect/platform-node/Console";
|
|
4
|
+
import * as FileSystem from "@effect/platform-node/FileSystem";
|
|
5
|
+
import * as Path from "@effect/platform-node/Path";
|
|
6
|
+
/**
|
|
7
|
+
* @since 1.0.0
|
|
8
|
+
* @category models
|
|
9
|
+
*/
|
|
10
|
+
export type NodeContext = Console.Console | CommandExecutor.CommandExecutor | FileSystem.FileSystem | Path.Path;
|
|
11
|
+
/**
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
* @category layer
|
|
14
|
+
*/
|
|
15
|
+
export declare const layer: Layer.Layer<never, never, NodeContext>;
|
|
16
|
+
//# sourceMappingURL=NodeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeContext.d.ts","sourceRoot":"","sources":["./src/NodeContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,eAAe,MAAM,uCAAuC,CAAA;AACxE,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAA;AACxD,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAA;AAC9D,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAA;AAElD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,GAAG,eAAe,CAAC,eAAe,GAAG,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAA;AAE/G;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAKxD,CAAA"}
|
package/NodeContext.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.layer = void 0;
|
|
7
|
+
var Layer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Layer"));
|
|
8
|
+
var CommandExecutor = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/CommandExecutor"));
|
|
9
|
+
var Console = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/Console"));
|
|
10
|
+
var FileSystem = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/FileSystem"));
|
|
11
|
+
var Path = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/Path"));
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
/**
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @since 1.0.0
|
|
20
|
+
* @category layer
|
|
21
|
+
*/
|
|
22
|
+
const layer = /*#__PURE__*/Layer.merge(Layer.provideMerge(FileSystem.layer, CommandExecutor.layer))( /*#__PURE__*/Layer.merge(Path.layer)( /*#__PURE__*/Layer.merge(FileSystem.layer)(Console.layer)));
|
|
23
|
+
exports.layer = layer;
|
|
24
|
+
//# sourceMappingURL=NodeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeContext.js","names":["Layer","_interopRequireWildcard","require","CommandExecutor","Console","FileSystem","Path","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","layer","merge","provideMerge","exports"],"sources":["./src/NodeContext.ts"],"sourcesContent":[null],"mappings":";;;;;;AAIA,IAAAA,KAAA,gBAAAC,uBAAA,eAAAC,OAAA;AACA,IAAAC,eAAA,gBAAAF,uBAAA,eAAAC,OAAA;AACA,IAAAE,OAAA,gBAAAH,uBAAA,eAAAC,OAAA;AACA,IAAAG,UAAA,gBAAAJ,uBAAA,eAAAC,OAAA;AACA,IAAAI,IAAA,gBAAAL,uBAAA,eAAAC,OAAA;AAAkD,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OA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7B,KAAK,CAAC8B,KAAK,CAACzB,UAAU,CAACwB,KAAK,CAAC,CAD7BzB,OAAO,CAACyB,KAAK,GAId;AAAAG,OAAA,CAAAH,KAAA,GAAAA,KAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandExecutor.d.ts","sourceRoot":"","sources":["../src/internal/commandExecutor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.layer = void 0;
|
|
7
|
+
var _Function = /*#__PURE__*/require("@effect/data/Function");
|
|
8
|
+
var Option = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Option"));
|
|
9
|
+
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect"));
|
|
10
|
+
var Layer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Layer"));
|
|
11
|
+
var _error = /*#__PURE__*/require("@effect/platform-node/internal/error");
|
|
12
|
+
var _sink = /*#__PURE__*/require("@effect/platform-node/internal/sink");
|
|
13
|
+
var _stream = /*#__PURE__*/require("@effect/platform-node/internal/stream");
|
|
14
|
+
var Command = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Command"));
|
|
15
|
+
var CommandExecutor = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/CommandExecutor"));
|
|
16
|
+
var FileSystem = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/FileSystem"));
|
|
17
|
+
var Sink = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/stream/Sink"));
|
|
18
|
+
var Stream = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/stream/Stream"));
|
|
19
|
+
var ChildProcess = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("node:child_process"));
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
+
const inputToStdioOption = stdin => Option.match(stdin, {
|
|
23
|
+
onNone: () => "inherit",
|
|
24
|
+
onSome: () => "pipe"
|
|
25
|
+
});
|
|
26
|
+
const outputToStdioOption = output => typeof output === "string" ? output : "pipe";
|
|
27
|
+
const toError = err => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));
|
|
28
|
+
const toPlatformError = (method, error, command) => {
|
|
29
|
+
const flattened = Command.flatten(command).reduce((acc, curr) => {
|
|
30
|
+
const command = `${curr.command} ${curr.args.join(" ")}`;
|
|
31
|
+
return acc.length === 0 ? command : `${acc} | ${command}`;
|
|
32
|
+
}, "");
|
|
33
|
+
return (0, _error.handleErrnoException)("Command", method)(error, [flattened]);
|
|
34
|
+
};
|
|
35
|
+
const runCommand = fileSystem => command => {
|
|
36
|
+
switch (command._tag) {
|
|
37
|
+
case "StandardCommand":
|
|
38
|
+
{
|
|
39
|
+
return Effect.tap(process => Option.match(command.stdin, {
|
|
40
|
+
onNone: () => Effect.unit,
|
|
41
|
+
onSome: stdin => Effect.forkDaemon(Stream.run(stdin, process.stdin))
|
|
42
|
+
}))(Effect.flatMap(env => Effect.asyncInterrupt(resume => {
|
|
43
|
+
const handle = ChildProcess.spawn(command.command, command.args, {
|
|
44
|
+
stdio: [inputToStdioOption(command.stdin), outputToStdioOption(command.stdout), outputToStdioOption(command.stderr)],
|
|
45
|
+
cwd: Option.getOrElse(command.cwd, _Function.constUndefined),
|
|
46
|
+
env: {
|
|
47
|
+
...env,
|
|
48
|
+
...Object.fromEntries(command.env)
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
// If starting the process throws an error, make sure to capture it
|
|
52
|
+
handle.on("error", err => {
|
|
53
|
+
handle.kill("SIGKILL");
|
|
54
|
+
resume(Effect.fail(toPlatformError("spawn", err, command)));
|
|
55
|
+
});
|
|
56
|
+
// If the process is assigned a process identifier, then we know it
|
|
57
|
+
// was spawned successfully
|
|
58
|
+
if (handle.pid) {
|
|
59
|
+
let stdin = Sink.drain();
|
|
60
|
+
if (handle.stdin !== null) {
|
|
61
|
+
stdin = (0, _sink.fromWritable)(() => handle.stdin, err => toPlatformError("toWritable", toError(err), command));
|
|
62
|
+
}
|
|
63
|
+
const exitCode = Effect.asyncInterrupt(resume => {
|
|
64
|
+
handle.on("exit", (code, signal) => {
|
|
65
|
+
if (code !== null) {
|
|
66
|
+
resume(Effect.succeed(CommandExecutor.ExitCode(code)));
|
|
67
|
+
} else {
|
|
68
|
+
// If code is `null`, then `signal` must be defined. See the NodeJS
|
|
69
|
+
// documentation for the `"exit"` event on a `child_process`.
|
|
70
|
+
// https://nodejs.org/api/child_process.html#child_process_event_exit
|
|
71
|
+
resume(Effect.fail(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command)));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// Make sure to terminate the running process if the fiber is
|
|
75
|
+
// terminated
|
|
76
|
+
return Effect.sync(() => {
|
|
77
|
+
handle.kill("SIGKILL");
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
const isRunning = Effect.sync(() => handle.exitCode === null && handle.signalCode === null && !handle.killed);
|
|
81
|
+
const kill = (signal = "SIGTERM") => Effect.asyncInterrupt(resume => {
|
|
82
|
+
handle.kill(signal);
|
|
83
|
+
handle.on("exit", () => {
|
|
84
|
+
resume(Effect.unit);
|
|
85
|
+
});
|
|
86
|
+
// Make sure to terminate the running process if the fiber
|
|
87
|
+
// is terminated
|
|
88
|
+
return Effect.sync(() => {
|
|
89
|
+
handle.kill("SIGKILL");
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
resume(Effect.sync(() => {
|
|
93
|
+
const pid = CommandExecutor.ProcessId(handle.pid);
|
|
94
|
+
const stderr = (0, _stream.fromReadable)(() => handle.stderr, err => toPlatformError("fromReadable(stderr)", toError(err), command));
|
|
95
|
+
let stdout = (0, _stream.fromReadable)(() => handle.stdout, err => toPlatformError("fromReadable(stdout)", toError(err), command));
|
|
96
|
+
// TODO: add Sink.isSink
|
|
97
|
+
if (typeof command.stdout !== "string") {
|
|
98
|
+
stdout = Stream.transduce(stdout, command.stdout);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
[CommandExecutor.ProcessTypeId]: CommandExecutor.ProcessTypeId,
|
|
102
|
+
pid,
|
|
103
|
+
exitCode,
|
|
104
|
+
isRunning,
|
|
105
|
+
kill,
|
|
106
|
+
stdin,
|
|
107
|
+
stderr,
|
|
108
|
+
stdout
|
|
109
|
+
};
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
return Effect.async(resume => {
|
|
113
|
+
if (handle.pid) {
|
|
114
|
+
handle.kill("SIGTERM");
|
|
115
|
+
}
|
|
116
|
+
handle.on("exit", () => {
|
|
117
|
+
resume(Effect.unit);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}))(Effect.zipRight(Effect.sync(() => globalThis.process.env))(
|
|
121
|
+
// Validate that the directory is accessible
|
|
122
|
+
Option.match(command.cwd, {
|
|
123
|
+
onNone: () => Effect.unit,
|
|
124
|
+
onSome: dir => fileSystem.access(dir)
|
|
125
|
+
}))));
|
|
126
|
+
}
|
|
127
|
+
case "PipedCommand":
|
|
128
|
+
{
|
|
129
|
+
const flattened = Command.flatten(command);
|
|
130
|
+
if (flattened.length === 1) {
|
|
131
|
+
return runCommand(fileSystem)(flattened[0]);
|
|
132
|
+
}
|
|
133
|
+
const head = flattened[0];
|
|
134
|
+
const tail = flattened.slice(1);
|
|
135
|
+
const initial = tail.slice(0, tail.length - 1);
|
|
136
|
+
const last = tail[tail.length - 1];
|
|
137
|
+
const stream = initial.reduce((stdin, command) => Stream.flatMap(process => process.stdout)(runCommand(fileSystem)(Command.stdin(command, stdin))), Stream.flatMap(process => process.stdout)(runCommand(fileSystem)(head)));
|
|
138
|
+
return runCommand(fileSystem)(Command.stdin(last, stream));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/** @internal */
|
|
143
|
+
const layer = /*#__PURE__*/Layer.effect(CommandExecutor.CommandExecutor, /*#__PURE__*/Effect.map(fileSystem => CommandExecutor.makeExecutor(runCommand(fileSystem)))(FileSystem.FileSystem));
|
|
144
|
+
exports.layer = layer;
|
|
145
|
+
//# sourceMappingURL=commandExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandExecutor.js","names":["_Function","require","Option","_interopRequireWildcard","Effect","Layer","_error","_sink","_stream","Command","CommandExecutor","FileSystem","Sink","Stream","ChildProcess","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","inputToStdioOption","stdin","match","onNone","onSome","outputToStdioOption","output","toError","err","globalThis","Error","String","toPlatformError","method","error","command","flattened","flatten","reduce","acc","curr","args","join","length","handleErrnoException","runCommand","fileSystem","_tag","tap","process","unit","forkDaemon","run","flatMap","env","asyncInterrupt","resume","handle","spawn","stdio","stdout","stderr","cwd","getOrElse","constUndefined","fromEntries","on","kill","fail","pid","drain","fromWritable","exitCode","code","signal","succeed","ExitCode","sync","isRunning","signalCode","killed","ProcessId","fromReadable","transduce","ProcessTypeId","async","zipRight","dir","access","head","tail","slice","initial","last","stream","layer","effect","map","makeExecutor","exports"],"sources":["../src/internal/commandExecutor.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,SAAA,gBAAAC,OAAA;AACA,IAAAC,MAAA,gBAAAC,uBAAA,eAAAF,OAAA;AACA,IAAAG,MAAA,gBAAAD,uBAAA,eAAAF,OAAA;AACA,IAAAI,KAAA,gBAAAF,uBAAA,eAAAF,OAAA;AACA,IAAAK,MAAA,gBAAAL,OAAA;AACA,IAAAM,KAAA,gBAAAN,OAAA;AACA,IAAAO,OAAA,gBAAAP,OAAA;AACA,IAAAQ,OAAA,gBAAAN,uBAAA,eAAAF,OAAA;AACA,IAAAS,eAAA,gBAAAP,uBAAA,eAAAF,OAAA;AAEA,IAAAU,UAAA,gBAAAR,uBAAA,eAAAF,OAAA;AACA,IAAAW,IAAA,gBAAAT,uBAAA,eAAAF,OAAA;AACA,IAAAY,MAAA,gBAAAV,uBAAA,eAAAF,OAAA;AACA,IAAAa,YAAA,gBAAAX,uBAAA,eAAAF,OAAA;AAAkD,SAAAc,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAb,wBAAAiB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBA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
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleErrnoException = void 0;
|
|
7
|
+
var _Error = /*#__PURE__*/require("@effect/platform/Error");
|
|
8
|
+
/** @internal */
|
|
9
|
+
const handleErrnoException = (module, method) => (err, [path]) => {
|
|
10
|
+
let reason = "Unknown";
|
|
11
|
+
switch (err.code) {
|
|
12
|
+
case "ENOENT":
|
|
13
|
+
reason = "NotFound";
|
|
14
|
+
break;
|
|
15
|
+
case "EACCES":
|
|
16
|
+
reason = "PermissionDenied";
|
|
17
|
+
break;
|
|
18
|
+
case "EEXIST":
|
|
19
|
+
reason = "AlreadyExists";
|
|
20
|
+
break;
|
|
21
|
+
case "EISDIR":
|
|
22
|
+
reason = "BadResource";
|
|
23
|
+
break;
|
|
24
|
+
case "ENOTDIR":
|
|
25
|
+
reason = "BadResource";
|
|
26
|
+
break;
|
|
27
|
+
case "EBUSY":
|
|
28
|
+
reason = "Busy";
|
|
29
|
+
break;
|
|
30
|
+
case "ELOOP":
|
|
31
|
+
reason = "BadResource";
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
return (0, _Error.SystemError)({
|
|
35
|
+
reason,
|
|
36
|
+
module,
|
|
37
|
+
method,
|
|
38
|
+
pathOrDescriptor: path,
|
|
39
|
+
syscall: err.syscall,
|
|
40
|
+
message: err.message
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
exports.handleErrnoException = handleErrnoException;
|
|
44
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","names":["_Error","require","handleErrnoException","module","method","err","path","reason","code","SystemError","pathOrDescriptor","syscall","message","exports"],"sources":["../src/internal/error.ts"],"sourcesContent":[null],"mappings":";;;;;;AACA,IAAAA,MAAA,gBAAAC,OAAA;AAGA;AACO,MAAMC,oBAAoB,GAAGA,CAACC,MAA6B,EAAEC,MAAc,KAChF,CACEC,GAA0B,EAC1B,CAACC,IAAI,CAAiD,KACrC;EACjB,IAAIC,MAAM,GAAsB,SAAS;EAEzC,QAAQF,GAAG,CAACG,IAAI;IACd,KAAK,QAAQ;MACXD,MAAM,GAAG,UAAU;MACnB;IAEF,KAAK,QAAQ;MACXA,MAAM,GAAG,kBAAkB;MAC3B;IAEF,KAAK,QAAQ;MACXA,MAAM,GAAG,eAAe;MACxB;IAEF,KAAK,QAAQ;MACXA,MAAM,GAAG,aAAa;MACtB;IAEF,KAAK,SAAS;MACZA,MAAM,GAAG,aAAa;MACtB;IAEF,KAAK,OAAO;MACVA,MAAM,GAAG,MAAM;MACf;IAEF,KAAK,OAAO;MACVA,MAAM,GAAG,aAAa;MACtB;;EAGJ,OAAO,IAAAE,kBAAW,EAAC;IACjBF,MAAM;IACNJ,MAAM;IACNC,MAAM;IACNM,gBAAgB,EAAEJ,IAAuB;IACzCK,OAAO,EAAEN,GAAG,CAACM,OAAO;IACpBC,OAAO,EAAEP,GAAG,CAACO;GACd,CAAC;AACJ,CAAC;AAAAC,OAAA,CAAAX,oBAAA,GAAAA,oBAAA"}
|