single-file-cli 2.0.45 → 2.0.47
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/build.sh +1 -1
- package/deno.json +1 -1
- package/lib/deno-polyfill.js +30 -3
- package/lib/single-file-bundle.js +1 -1
- package/lib/version.js +1 -1
- package/options.js +1 -0
- package/package.json +1 -1
- package/single-file-cli-api.js +33 -30
package/build.sh
CHANGED
package/deno.json
CHANGED
package/lib/deno-polyfill.js
CHANGED
|
@@ -36,7 +36,8 @@ const NODE_MODULES = {
|
|
|
36
36
|
"fs": "node:fs/promises",
|
|
37
37
|
"os": "node:os",
|
|
38
38
|
"child_process": "node:child_process",
|
|
39
|
-
"url": "node:url"
|
|
39
|
+
"url": "node:url",
|
|
40
|
+
"process": "node:process"
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
const args = DENO_RUNTIME_DETECTED ? Deno.args : process.argv.slice(2);
|
|
@@ -111,11 +112,14 @@ const DenoAPI = {
|
|
|
111
112
|
addSignalListener,
|
|
112
113
|
build,
|
|
113
114
|
errors,
|
|
114
|
-
Command
|
|
115
|
+
Command,
|
|
116
|
+
cwd
|
|
115
117
|
};
|
|
116
118
|
|
|
117
119
|
const pathAPI = {
|
|
118
|
-
dirname
|
|
120
|
+
dirname,
|
|
121
|
+
toFileUrl,
|
|
122
|
+
SEPARATOR: DENO_RUNTIME_DETECTED ? path.SEPARATOR : path.sep
|
|
119
123
|
};
|
|
120
124
|
|
|
121
125
|
await initGlobalThisProperties();
|
|
@@ -204,6 +208,11 @@ function exit(code) {
|
|
|
204
208
|
if (DENO_RUNTIME_DETECTED) {
|
|
205
209
|
Deno.exit(code);
|
|
206
210
|
} else {
|
|
211
|
+
if (code == "SIGINT") {
|
|
212
|
+
code = 130;
|
|
213
|
+
} else if (code == "SIGTERM") {
|
|
214
|
+
code = 143;
|
|
215
|
+
}
|
|
207
216
|
process.exit(code);
|
|
208
217
|
}
|
|
209
218
|
}
|
|
@@ -216,10 +225,28 @@ function addSignalListener(signal, listener) {
|
|
|
216
225
|
}
|
|
217
226
|
}
|
|
218
227
|
|
|
228
|
+
async function cwd() {
|
|
229
|
+
if (DENO_RUNTIME_DETECTED) {
|
|
230
|
+
return Deno.cwd();
|
|
231
|
+
} else {
|
|
232
|
+
const process = await import(NODE_MODULES["process"]);
|
|
233
|
+
return process.cwd();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
219
237
|
async function dirname(filePath) {
|
|
220
238
|
return path.dirname(filePath);
|
|
221
239
|
}
|
|
222
240
|
|
|
241
|
+
async function toFileUrl(filePath) {
|
|
242
|
+
if (DENO_RUNTIME_DETECTED) {
|
|
243
|
+
return path.toFileUrl(filePath);
|
|
244
|
+
} else {
|
|
245
|
+
const url = await import(NODE_MODULES["url"]);
|
|
246
|
+
return url.pathToFileURL(filePath).href;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
223
250
|
function getNPMModule(module) {
|
|
224
251
|
return NPM_MODULES[module];
|
|
225
252
|
}
|