@vornrun/connector-sdk 0.7.0-beta.10 → 0.7.0-beta.12
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/cli.d.ts +2 -1
- package/dist/cli.js +13 -3
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
|
@@ -15,5 +15,6 @@ interface CliDeps {
|
|
|
15
15
|
exists?(path: string): boolean;
|
|
16
16
|
}
|
|
17
17
|
declare function runCli(argv: string[], deps: CliDeps): Promise<number>;
|
|
18
|
+
declare function isEntryPoint(moduleUrl: string, argv?: readonly string[]): boolean;
|
|
18
19
|
|
|
19
|
-
export { type CliDeps, runCli };
|
|
20
|
+
export { type CliDeps, isEntryPoint, runCli };
|
package/dist/cli.js
CHANGED
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
} from "./chunk-XOP6JKBX.js";
|
|
14
14
|
|
|
15
15
|
// src/cli.ts
|
|
16
|
-
import { pathToFileURL } from "url";
|
|
17
|
-
import { existsSync } from "fs";
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
17
|
+
import { existsSync, realpathSync } from "fs";
|
|
18
18
|
import { dirname, join, resolve } from "path";
|
|
19
19
|
import { mkdir, writeFile } from "fs/promises";
|
|
20
20
|
var USAGE = `vorn-connector <command> <module | id> [options]
|
|
@@ -217,7 +217,16 @@ ${USAGE}`);
|
|
|
217
217
|
return 1;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
function isEntryPoint(moduleUrl, argv = process.argv) {
|
|
221
|
+
const invoked = argv[1];
|
|
222
|
+
if (invoked === void 0) return false;
|
|
223
|
+
try {
|
|
224
|
+
return realpathSync(fileURLToPath(moduleUrl)) === realpathSync(resolve(invoked));
|
|
225
|
+
} catch {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
var invokedDirectly = isEntryPoint(import.meta.url);
|
|
221
230
|
if (invokedDirectly) {
|
|
222
231
|
runCli(process.argv.slice(2), {
|
|
223
232
|
load: (modulePath) => modulePath.startsWith(".") || modulePath.startsWith("/") ? import(pathToFileURL(resolve(modulePath)).href) : import(modulePath),
|
|
@@ -236,5 +245,6 @@ if (invokedDirectly) {
|
|
|
236
245
|
});
|
|
237
246
|
}
|
|
238
247
|
export {
|
|
248
|
+
isEntryPoint,
|
|
239
249
|
runCli
|
|
240
250
|
};
|