@durable-streams/cli 0.1.8 → 0.1.9
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/dist/index.cjs +10 -3
- package/dist/index.js +10 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
}) : target, mod));
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
|
+
const node_fs = __toESM(require("node:fs"));
|
|
26
27
|
const node_http = __toESM(require("node:http"));
|
|
27
28
|
const node_path = __toESM(require("node:path"));
|
|
28
29
|
const node_process = __toESM(require("node:process"));
|
|
@@ -504,9 +505,15 @@ async function main() {
|
|
|
504
505
|
}
|
|
505
506
|
function isMainModule() {
|
|
506
507
|
if (!process.argv[1]) return false;
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
508
|
+
try {
|
|
509
|
+
const scriptPath = (0, node_fs.realpathSync)((0, node_path.resolve)(process.argv[1]));
|
|
510
|
+
const modulePath = (0, node_fs.realpathSync)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
511
|
+
return scriptPath === modulePath;
|
|
512
|
+
} catch {
|
|
513
|
+
const scriptPath = (0, node_path.resolve)(process.argv[1]);
|
|
514
|
+
const modulePath = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
|
|
515
|
+
return scriptPath === modulePath;
|
|
516
|
+
}
|
|
510
517
|
}
|
|
511
518
|
if (isMainModule()) main().catch((error) => {
|
|
512
519
|
node_process.stderr.write(`Fatal error: ${getErrorMessage(error)}\n`);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
2
3
|
import { STATUS_CODES } from "node:http";
|
|
3
4
|
import { resolve } from "node:path";
|
|
4
5
|
import { stderr, stdin, stdout } from "node:process";
|
|
@@ -480,9 +481,15 @@ async function main() {
|
|
|
480
481
|
}
|
|
481
482
|
function isMainModule() {
|
|
482
483
|
if (!process.argv[1]) return false;
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
try {
|
|
485
|
+
const scriptPath = realpathSync(resolve(process.argv[1]));
|
|
486
|
+
const modulePath = realpathSync(fileURLToPath(import.meta.url));
|
|
487
|
+
return scriptPath === modulePath;
|
|
488
|
+
} catch {
|
|
489
|
+
const scriptPath = resolve(process.argv[1]);
|
|
490
|
+
const modulePath = fileURLToPath(import.meta.url);
|
|
491
|
+
return scriptPath === modulePath;
|
|
492
|
+
}
|
|
486
493
|
}
|
|
487
494
|
if (isMainModule()) main().catch((error) => {
|
|
488
495
|
stderr.write(`Fatal error: ${getErrorMessage(error)}\n`);
|