@rcompat/io 0.9.0 → 0.10.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/lib/private/spawn.js +2 -1
- package/lib/public/browser.d.ts +13 -0
- package/lib/public/browser.js +15 -0
- package/package.json +6 -4
package/lib/private/spawn.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import assert from "@rcompat/assert";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import { Readable, Writable } from "node:stream";
|
|
4
|
+
const OPTIONS = { shell: true, stdio: "inherit" };
|
|
4
5
|
export default (command, options) => {
|
|
5
6
|
assert.maybe.dict(options);
|
|
6
7
|
const inherit = assert.maybe.boolean(options?.inherit) ?? false;
|
|
7
8
|
if (inherit) {
|
|
8
9
|
return new Promise((resolve, reject) => {
|
|
9
|
-
const child = spawn(command, { ...options,
|
|
10
|
+
const child = spawn(command, { ...options, ...OPTIONS });
|
|
10
11
|
child.on("exit", code => code === 0 ? resolve() : reject(code));
|
|
11
12
|
});
|
|
12
13
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function unimplemented(): void;
|
|
2
|
+
declare const io: {
|
|
3
|
+
async: {};
|
|
4
|
+
isatty: typeof unimplemented;
|
|
5
|
+
run: typeof unimplemented;
|
|
6
|
+
spawn: typeof unimplemented;
|
|
7
|
+
stderr: {};
|
|
8
|
+
stdin: {};
|
|
9
|
+
stdout: {};
|
|
10
|
+
which: typeof unimplemented;
|
|
11
|
+
};
|
|
12
|
+
export default io;
|
|
13
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function unimplemented() {
|
|
2
|
+
throw new Error("unimplemented");
|
|
3
|
+
}
|
|
4
|
+
const io = {
|
|
5
|
+
async: {},
|
|
6
|
+
isatty: unimplemented,
|
|
7
|
+
run: unimplemented,
|
|
8
|
+
spawn: unimplemented,
|
|
9
|
+
stderr: {},
|
|
10
|
+
stdin: {},
|
|
11
|
+
stdout: {},
|
|
12
|
+
which: unimplemented,
|
|
13
|
+
};
|
|
14
|
+
export default io;
|
|
15
|
+
//# sourceMappingURL=browser.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rcompat/io",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Standard library input/output",
|
|
5
5
|
"bugs": "https://github.com/rcompat/rcompat/issues",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"directory": "packages/io"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@rcompat/assert": "^0.
|
|
18
|
+
"@rcompat/assert": "^0.13.0"
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
21
21
|
"imports": {
|
|
@@ -27,12 +27,14 @@
|
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
29
|
"@rcompat/source": "./src/public/index.ts",
|
|
30
|
+
"browser": "./lib/public/browser.js",
|
|
30
31
|
"default": "./lib/public/index.js"
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
|
-
"build": "npm run clean &&
|
|
35
|
+
"build": "npm run clean && tsgo",
|
|
35
36
|
"test": "npx proby",
|
|
36
|
-
"clean": "rm -rf ./lib"
|
|
37
|
+
"clean": "rm -rf ./lib",
|
|
38
|
+
"lint": "eslint ."
|
|
37
39
|
}
|
|
38
40
|
}
|