@atolis-hq/wake 0.4.7 → 0.4.8
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/src/bootstrap/version.js +1 -1
- package/dist/src/main.d.ts +1 -0
- package/dist/src/main.js +8 -2
- package/package.json +1 -1
package/dist/src/main.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export interface SandboxRuntimeRouter {
|
|
|
12
12
|
exec(wakeRoot: string, arguments_: readonly string[]): Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
export declare function main(argv?: readonly string[], dependencies?: TargetMainDependencies): Promise<void>;
|
|
15
|
+
export declare function isMainEntrypoint(moduleUrl: string, invokedPath: string | undefined): boolean;
|
package/dist/src/main.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
|
+
import { realpathSync } from 'node:fs';
|
|
3
4
|
import { access } from 'node:fs/promises';
|
|
4
5
|
import { join } from 'node:path';
|
|
5
|
-
import { pathToFileURL } from 'node:url';
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
7
|
import { initialiseWakeRoot } from './bootstrap/initialise.js';
|
|
7
8
|
import { wakeVersion } from './bootstrap/version.js';
|
|
8
9
|
import { parseWakeCommand, runWakeCommand, sandboxUsage, usage, } from './surfaces/index.js';
|
|
@@ -173,7 +174,12 @@ function runDocker(arguments_) {
|
|
|
173
174
|
: reject(new Error('docker ' + arguments_.join(' ') + ' exited with code ' + String(code))));
|
|
174
175
|
});
|
|
175
176
|
}
|
|
176
|
-
|
|
177
|
+
export function isMainEntrypoint(moduleUrl, invokedPath) {
|
|
178
|
+
return (invokedPath !== undefined &&
|
|
179
|
+
pathToFileURL(realpathSync(fileURLToPath(moduleUrl))).href ===
|
|
180
|
+
pathToFileURL(realpathSync(invokedPath)).href);
|
|
181
|
+
}
|
|
182
|
+
if (isMainEntrypoint(import.meta.url, process.argv[1])) {
|
|
177
183
|
try {
|
|
178
184
|
await main();
|
|
179
185
|
}
|