@tokamakdev/tok 0.1.1-beta.142 → 0.1.1-beta.144
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/astro.mjs +2 -4
- package/dist/client.mjs +2 -4
- package/dist/dev-socket.d.mts +0 -6
- package/dist/events.d.mts +1 -8
- package/dist/events.mjs +1 -9
- package/dist/native-worker.d.mts +4 -0
- package/dist/native-worker.mjs +7 -2
- package/dist/plugin-manifest.d.mts +2 -2
- package/dist/vite.mjs +3 -4
- package/dist/worker-contract.d.mts +2 -5
- package/dist/worker-contract.mjs +0 -8
- package/dist/worker-graph.d.mts +4 -1
- package/dist/worker-graph.mjs +11 -5
- package/dist/worker-types.mjs +0 -1
- package/package.json +13 -13
- package/platform.js +2 -8
package/dist/astro.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import cloudflare, {} from "@astrojs/cloudflare";
|
|
|
6
6
|
import { sessionDrivers } from "astro/config";
|
|
7
7
|
import { normalizePath } from "vite";
|
|
8
8
|
import { experimental_readRawConfig, unstable_readConfig } from "wrangler";
|
|
9
|
-
import { createNativeWorker } from "./native-worker.mjs";
|
|
9
|
+
import { createNativeWorker, rejectAuxiliaryWorkers } from "./native-worker.mjs";
|
|
10
10
|
import { createClientPlugin } from "./client.mjs";
|
|
11
11
|
import { writeChanged } from "./worker-graph.mjs";
|
|
12
12
|
/** The Worker entry Astro's Cloudflare adapter builds when the configuration names none. */
|
|
@@ -52,9 +52,7 @@ export function tokamak(options = {}, cloudflareOptions = {}) {
|
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
throw new Error("Tokamak hosts the main and native workers; additional auxiliary workers are not supported.");
|
|
57
|
-
}
|
|
55
|
+
rejectAuxiliaryWorkers(cloudflareOptions);
|
|
58
56
|
const generated = path.join(path.dirname(cloudflareOptions.configPath ?? "."), `.tokamak.${randomUUID()}.json`);
|
|
59
57
|
let generatedPath;
|
|
60
58
|
const cleanup = () => {
|
package/dist/client.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
2
|
import { normalizePath } from "vite";
|
|
4
3
|
import { findModule } from "./worker-contract.mjs";
|
|
4
|
+
import { CAPABILITIES, corePath } from "./worker-graph.mjs";
|
|
5
5
|
import { WorkerTypes } from "./worker-types.mjs";
|
|
6
6
|
const MODULE = "virtual:tokamak/client";
|
|
7
|
-
|
|
8
|
-
const CAPABILITIES = "/_tokamak/capabilities.js";
|
|
9
|
-
const TRANSPORT = normalizePath(fileURLToPath(new URL("./rpc/client.mjs", import.meta.resolve("@tokamakdev/plugin/events"))));
|
|
7
|
+
const TRANSPORT = corePath("./rpc/client.mjs");
|
|
10
8
|
/** The app's public methods, without its native implementation. */
|
|
11
9
|
export function createClientPlugin(module, native, shared) {
|
|
12
10
|
let root;
|
package/dist/dev-socket.d.mts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/** The header that carries the device's session token, which `tok dev`'s relay forwards. */
|
|
2
2
|
export declare const SESSION_HEADER = "x-tokamak-session";
|
|
3
|
-
/** The native endpoint's opaque result and completion status. */
|
|
4
|
-
export interface PluginResult {
|
|
5
|
-
payload: Uint8Array;
|
|
6
|
-
failed: boolean;
|
|
7
|
-
done: boolean;
|
|
8
|
-
}
|
|
9
3
|
/** The loopback server the device's dev WebSocket reaches through `tok dev`'s relay. */
|
|
10
4
|
export interface DevSocket {
|
|
11
5
|
readonly port: number;
|
package/dist/events.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type LifecycleStage, type TokamakContext } from "@tokamakdev/plugin";
|
|
2
1
|
/** Runs once per runtime start, including when the system starts the app in the background. */
|
|
3
2
|
export declare const onStart: (listener: import("@tokamakdev/plugin/events").Listener<{
|
|
4
3
|
readonly foreground: boolean;
|
|
@@ -7,10 +6,4 @@ export declare const onStart: (listener: import("@tokamakdev/plugin/events").Lis
|
|
|
7
6
|
export declare const onResume: (listener: import("@tokamakdev/plugin/events").Listener<Readonly<Record<string, never>>, void>) => void;
|
|
8
7
|
/** Runs each time the app moves out of the foreground. */
|
|
9
8
|
export declare const onSuspend: (listener: import("@tokamakdev/plugin/events").Listener<Readonly<Record<string, never>>, void>) => void;
|
|
10
|
-
export type
|
|
11
|
-
/**
|
|
12
|
-
* The app's stage now, which can differ from the last event delivered: an `onSuspend` listener
|
|
13
|
-
* that runs late reads `"foreground"` once the user has returned. Rejects with
|
|
14
|
-
* `NotSupportedError` outside a tokamak Worker.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getLifecycleStage(ctx: TokamakContext): Promise<LifecycleStage>;
|
|
9
|
+
export { lifecycleStage as getLifecycleStage, type LifecycleStage } from "@tokamakdev/plugin";
|
package/dist/events.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { lifecycleStage } from "@tokamakdev/plugin";
|
|
2
1
|
import { defineEvent } from "@tokamakdev/plugin/events";
|
|
3
2
|
/** Runs once per runtime start, including when the system starts the app in the background. */
|
|
4
3
|
export const onStart = defineEvent("start");
|
|
@@ -6,11 +5,4 @@ export const onStart = defineEvent("start");
|
|
|
6
5
|
export const onResume = defineEvent("resume");
|
|
7
6
|
/** Runs each time the app moves out of the foreground. */
|
|
8
7
|
export const onSuspend = defineEvent("suspend");
|
|
9
|
-
|
|
10
|
-
* The app's stage now, which can differ from the last event delivered: an `onSuspend` listener
|
|
11
|
-
* that runs late reads `"foreground"` once the user has returned. Rejects with
|
|
12
|
-
* `NotSupportedError` outside a tokamak Worker.
|
|
13
|
-
*/
|
|
14
|
-
export function getLifecycleStage(ctx) {
|
|
15
|
-
return lifecycleStage(ctx);
|
|
16
|
-
}
|
|
8
|
+
export { lifecycleStage as getLifecycleStage } from "@tokamakdev/plugin";
|
package/dist/native-worker.d.mts
CHANGED
|
@@ -7,6 +7,10 @@ export type TokamakOptions = Config & {
|
|
|
7
7
|
module?: string;
|
|
8
8
|
};
|
|
9
9
|
type AuxiliaryWorker = NonNullable<PluginConfig["auxiliaryWorkers"]>[number];
|
|
10
|
+
/** Rejects Cloudflare options that add Workers beside the main and native workers Tokamak hosts. */
|
|
11
|
+
export declare function rejectAuxiliaryWorkers(options: {
|
|
12
|
+
auxiliaryWorkers?: readonly unknown[];
|
|
13
|
+
}): void;
|
|
10
14
|
/** The native worker and its development relay. */
|
|
11
15
|
export declare function createNativeWorker(options: TokamakOptions, output: string, prepare?: (root: string, graph: WorkerGraph) => void | Promise<void>): {
|
|
12
16
|
plugin: Plugin;
|
package/dist/native-worker.mjs
CHANGED
|
@@ -5,9 +5,14 @@ import { normalizePath } from "vite";
|
|
|
5
5
|
import { capabilitiesFor } from "@tokamakdev/plugin/capabilities";
|
|
6
6
|
import { openDevSocket } from "./dev-socket.mjs";
|
|
7
7
|
import { findModule } from "./worker-contract.mjs";
|
|
8
|
-
import { createWorkerGraph } from "./worker-graph.mjs";
|
|
9
|
-
const CAPABILITIES = "/_tokamak/capabilities.js";
|
|
8
|
+
import { CAPABILITIES, createWorkerGraph } from "./worker-graph.mjs";
|
|
10
9
|
const MIDDLEWARE_MODE_ERROR = "Vite is running in middleware mode, so tokamak cannot find the development server's address; tok dev needs Vite's own dev server";
|
|
10
|
+
/** Rejects Cloudflare options that add Workers beside the main and native workers Tokamak hosts. */
|
|
11
|
+
export function rejectAuxiliaryWorkers(options) {
|
|
12
|
+
if (options.auxiliaryWorkers?.length) {
|
|
13
|
+
throw new Error("Tokamak hosts the main and native workers; additional auxiliary workers are not supported.");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
11
16
|
/** The native worker and its development relay. */
|
|
12
17
|
export function createNativeWorker(options, output, prepare) {
|
|
13
18
|
const { module, ...config } = options;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { NativePlatform } from "@tokamakdev/plugin/capabilities";
|
|
2
|
-
|
|
3
|
-
export interface ModuleExport {
|
|
2
|
+
interface ModuleExport {
|
|
4
3
|
module: string;
|
|
5
4
|
export: string;
|
|
6
5
|
}
|
|
@@ -17,3 +16,4 @@ export interface PluginDefinition {
|
|
|
17
16
|
}
|
|
18
17
|
/** Installed direct dependencies select the application's plugin services. */
|
|
19
18
|
export declare function discoverPlugins(root: string): PluginDefinition[];
|
|
19
|
+
export {};
|
package/dist/vite.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
2
|
-
import { createNativeWorker } from "./native-worker.mjs";
|
|
2
|
+
import { createNativeWorker, rejectAuxiliaryWorkers } from "./native-worker.mjs";
|
|
3
3
|
import { createClientPlugin } from "./client.mjs";
|
|
4
4
|
/** Cloudflare's Vite integration, with a separate native worker when run by tok. */
|
|
5
5
|
export function tokamak(options = {}, cloudflareOptions = {}) {
|
|
6
6
|
const output = process.env.TOKAMAK_VITE_OUTPUT;
|
|
7
|
-
if (output
|
|
8
|
-
|
|
9
|
-
}
|
|
7
|
+
if (output)
|
|
8
|
+
rejectAuxiliaryWorkers(cloudflareOptions);
|
|
10
9
|
const native = output ? createNativeWorker(options, output) : undefined;
|
|
11
10
|
const client = createClientPlugin(options.module, !!output, native ? () => native.graph().types : undefined);
|
|
12
11
|
return [...native ? [native.plugin] : [], client, ...cloudflare({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { NativePlatform
|
|
1
|
+
import type { NativePlatform } from "@tokamakdev/plugin/capabilities";
|
|
2
|
+
import type { PluginDefinition } from "./plugin-manifest.mjs";
|
|
2
3
|
/** The callable prototype methods and source dependencies of a Worker entrypoint. */
|
|
3
4
|
export interface WorkerContract {
|
|
4
5
|
methods: string[];
|
|
@@ -17,10 +18,6 @@ export interface PluginContract extends WorkerContract {
|
|
|
17
18
|
/** The contract of a Tokamak worker without a module. */
|
|
18
19
|
export declare function emptyContract(): WorkerContract;
|
|
19
20
|
export declare function findModule(root: string, name: string | undefined): string | undefined;
|
|
20
|
-
/** Resolve the application's types before generating its service adapters. */
|
|
21
|
-
export declare function readWorkerContract(entry: string, root: string): WorkerContract;
|
|
22
|
-
/** Check every WorkerEntrypoint exported by an application service bundle. */
|
|
23
|
-
export declare function readServiceContracts(entry: string, root: string): Record<string, WorkerContract>;
|
|
24
21
|
/** Analyze both entrypoints in one TypeScript program. */
|
|
25
22
|
export declare function readWorkerContracts(entry: string | undefined, main: string | undefined, root: string, validate: boolean, plugins?: PluginDefinition[]): {
|
|
26
23
|
native: WorkerContract;
|
package/dist/worker-contract.mjs
CHANGED
|
@@ -18,14 +18,6 @@ export function findModule(root, name) {
|
|
|
18
18
|
throw new Error(`tokamak module not found: ${candidates[0]}`);
|
|
19
19
|
return file;
|
|
20
20
|
}
|
|
21
|
-
/** Resolve the application's types before generating its service adapters. */
|
|
22
|
-
export function readWorkerContract(entry, root) {
|
|
23
|
-
return readWorkerContracts(entry, undefined, root, true).native;
|
|
24
|
-
}
|
|
25
|
-
/** Check every WorkerEntrypoint exported by an application service bundle. */
|
|
26
|
-
export function readServiceContracts(entry, root) {
|
|
27
|
-
return readWorkerContracts(undefined, entry, root, true).main;
|
|
28
|
-
}
|
|
29
21
|
/** Analyze both entrypoints in one TypeScript program. */
|
|
30
22
|
export function readWorkerContracts(entry, main, root, validate, plugins = []) {
|
|
31
23
|
const entries = [entry, main, ...plugins.flatMap(plugin => [plugin.api.module, plugin.web?.module])]
|
package/dist/worker-graph.d.mts
CHANGED
|
@@ -20,7 +20,6 @@ export interface WorkerGraph {
|
|
|
20
20
|
serviceBindings(config: ServiceConfiguration): ServiceBindings;
|
|
21
21
|
native: AuxiliaryCustomizer;
|
|
22
22
|
names(): {
|
|
23
|
-
main: string;
|
|
24
23
|
native: string;
|
|
25
24
|
app: string;
|
|
26
25
|
};
|
|
@@ -38,9 +37,13 @@ export interface WorkerGraph {
|
|
|
38
37
|
load: Extract<Plugin["load"], (...args: never[]) => unknown>;
|
|
39
38
|
};
|
|
40
39
|
}
|
|
40
|
+
/** The Tokamak worker's page module of each plugin operation's support on the app's platform. */
|
|
41
|
+
export declare const CAPABILITIES = "/_tokamak/capabilities.js";
|
|
41
42
|
/** Configure the two bundles through Cloudflare's public auxiliary-worker API. */
|
|
42
43
|
export declare function createWorkerGraph(root: string, entry: string | undefined, output: string): WorkerGraph;
|
|
43
44
|
export declare function workerName(main: string): string;
|
|
45
|
+
/** The Vite path of `file`, relative to the source directory of `@tokamakdev/plugin`. */
|
|
46
|
+
export declare function corePath(file: string): string;
|
|
44
47
|
/** Writes `source` to `file` unless it already holds it, so watchers see only changes. */
|
|
45
48
|
export declare function writeChanged(file: string, source: string): void;
|
|
46
49
|
export {};
|
package/dist/worker-graph.mjs
CHANGED
|
@@ -5,6 +5,8 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import { normalizePath } from "vite";
|
|
6
6
|
import { platformGlobal } from "@tokamakdev/plugin/native-protocol";
|
|
7
7
|
import { WorkerTypes } from "./worker-types.mjs";
|
|
8
|
+
/** The Tokamak worker's page module of each plugin operation's support on the app's platform. */
|
|
9
|
+
export const CAPABILITIES = "/_tokamak/capabilities.js";
|
|
8
10
|
const NATIVE_CONNECTION = "virtual:tokamak/native-connection";
|
|
9
11
|
const PLATFORM = "virtual:tokamak/platform";
|
|
10
12
|
const NATIVE_CALLS = normalizePath(fileURLToPath(new URL("./native.mjs", import.meta.url)));
|
|
@@ -16,7 +18,7 @@ export function createWorkerGraph(root, entry, output) {
|
|
|
16
18
|
const types = path.join(root, "tokamak-env.d.ts");
|
|
17
19
|
const contracts = new WorkerTypes(root, entry);
|
|
18
20
|
contracts.discover();
|
|
19
|
-
const events =
|
|
21
|
+
const events = corePath("./entrypoint.js");
|
|
20
22
|
let mainName;
|
|
21
23
|
let nativeName;
|
|
22
24
|
let appName;
|
|
@@ -27,7 +29,7 @@ export function createWorkerGraph(root, entry, output) {
|
|
|
27
29
|
let configuredEntrypoints;
|
|
28
30
|
const entrypoints = () => Object.keys(contracts.named).join();
|
|
29
31
|
const signatures = new Map();
|
|
30
|
-
const development =
|
|
32
|
+
const development = corePath("./rpc/binding.mjs");
|
|
31
33
|
let relay;
|
|
32
34
|
const serviceModule = (role) => `virtual:tokamak/service/${role}`;
|
|
33
35
|
const bindingsModule = (role) => `\0tokamak:bindings:${role}`;
|
|
@@ -110,7 +112,7 @@ export const TokamakEvents = eventEntrypoint(Worker, nativeContext);\n`);
|
|
|
110
112
|
configure,
|
|
111
113
|
serviceBindings: config => services(checkedName(config)),
|
|
112
114
|
native,
|
|
113
|
-
names: () => ({
|
|
115
|
+
names: () => ({ native: nativeName, app: appName }),
|
|
114
116
|
types: contracts,
|
|
115
117
|
cloudflare: {
|
|
116
118
|
config: config => { configure(config); },
|
|
@@ -277,7 +279,7 @@ function availability(plugins) {
|
|
|
277
279
|
}
|
|
278
280
|
function serviceEntrypoint(entry, services) {
|
|
279
281
|
const sdk = normalizePath(fileURLToPath(import.meta.resolve("@tokamakdev/plugin/worker")));
|
|
280
|
-
const rpc =
|
|
282
|
+
const rpc = corePath("./rpc/endpoint.mjs");
|
|
281
283
|
const plugins = services.flatMap(service => service.plugin ? [service.plugin] : []);
|
|
282
284
|
const imports = services.map((service, index) => {
|
|
283
285
|
if (service.plugin) {
|
|
@@ -324,7 +326,7 @@ export default class extends WorkerEntrypoint {
|
|
|
324
326
|
get #instance() { return this.#worker ??= services[0].create(this.ctx, this.env); }
|
|
325
327
|
fetch(request) {
|
|
326
328
|
const { pathname } = new URL(request.url);
|
|
327
|
-
if (pathname ===
|
|
329
|
+
if (pathname === ${JSON.stringify(CAPABILITIES)}) return capabilitiesModule(nativeContext(this.ctx));
|
|
328
330
|
const service = services.find(service => service.route === pathname);
|
|
329
331
|
if (service) return rpcResponse(request, ctx => service.create(ctx, this.env), service.methods, this.ctx);
|
|
330
332
|
if (typeof this.#instance.fetch !== "function") throw new TypeError("The Tokamak worker has no fetch handler");
|
|
@@ -335,6 +337,10 @@ export default class extends WorkerEntrypoint {
|
|
|
335
337
|
${named.join("")}
|
|
336
338
|
`;
|
|
337
339
|
}
|
|
340
|
+
/** The Vite path of `file`, relative to the source directory of `@tokamakdev/plugin`. */
|
|
341
|
+
export function corePath(file) {
|
|
342
|
+
return normalizePath(fileURLToPath(new URL(file, import.meta.resolve("@tokamakdev/plugin/events"))));
|
|
343
|
+
}
|
|
338
344
|
/** Writes `source` to `file` unless it already holds it, so watchers see only changes. */
|
|
339
345
|
export function writeChanged(file, source) {
|
|
340
346
|
if (fs.existsSync(file) && fs.readFileSync(file, "utf8") === source)
|
package/dist/worker-types.mjs
CHANGED
|
@@ -29,7 +29,6 @@ export class WorkerTypes {
|
|
|
29
29
|
const source = path.resolve(config.configPath ? path.dirname(config.configPath) : this.root, config.main);
|
|
30
30
|
this.mainEntry = fs.existsSync(source) ? source : config.main;
|
|
31
31
|
this.mainModule = undefined;
|
|
32
|
-
this.#ready = false;
|
|
33
32
|
this.bindings(config);
|
|
34
33
|
}
|
|
35
34
|
bindings(config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokamakdev/tok",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.144",
|
|
4
4
|
"description": "The tokamak CLI, Vite plugin and app API: build native apps from a Cloudflare Workers codebase",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"node": ">=18"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@tokamakdev/plugin": "0.1.0-beta.
|
|
46
|
+
"@tokamakdev/plugin": "0.1.0-beta.144",
|
|
47
47
|
"typescript": "5.9.3",
|
|
48
48
|
"ws": "^8.22.0"
|
|
49
49
|
},
|
|
@@ -75,17 +75,17 @@
|
|
|
75
75
|
"wrangler": "4.147.0"
|
|
76
76
|
},
|
|
77
77
|
"optionalDependencies": {
|
|
78
|
-
"@tokamakdev/platform-android-arm64": "0.1.1-beta.
|
|
79
|
-
"@tokamakdev/platform-ios-arm64": "0.1.1-beta.
|
|
80
|
-
"@tokamakdev/platform-ios-simulator-arm64": "0.1.1-beta.
|
|
81
|
-
"@tokamakdev/platform-ios-simulator-x64": "0.1.1-beta.
|
|
82
|
-
"@tokamakdev/platform-macos-arm64": "0.1.1-beta.
|
|
83
|
-
"@tokamakdev/platform-macos-x64": "0.1.1-beta.
|
|
84
|
-
"@tokamakdev/platform-windows-x64": "0.1.1-beta.
|
|
85
|
-
"@tokamakdev/tok-darwin-arm64": "0.1.1-beta.
|
|
86
|
-
"@tokamakdev/tok-darwin-x64": "0.1.1-beta.
|
|
87
|
-
"@tokamakdev/tok-linux-x64": "0.1.1-beta.
|
|
88
|
-
"@tokamakdev/tok-win32-x64": "0.1.1-beta.
|
|
78
|
+
"@tokamakdev/platform-android-arm64": "0.1.1-beta.144",
|
|
79
|
+
"@tokamakdev/platform-ios-arm64": "0.1.1-beta.144",
|
|
80
|
+
"@tokamakdev/platform-ios-simulator-arm64": "0.1.1-beta.144",
|
|
81
|
+
"@tokamakdev/platform-ios-simulator-x64": "0.1.1-beta.144",
|
|
82
|
+
"@tokamakdev/platform-macos-arm64": "0.1.1-beta.144",
|
|
83
|
+
"@tokamakdev/platform-macos-x64": "0.1.1-beta.144",
|
|
84
|
+
"@tokamakdev/platform-windows-x64": "0.1.1-beta.144",
|
|
85
|
+
"@tokamakdev/tok-darwin-arm64": "0.1.1-beta.144",
|
|
86
|
+
"@tokamakdev/tok-darwin-x64": "0.1.1-beta.144",
|
|
87
|
+
"@tokamakdev/tok-linux-x64": "0.1.1-beta.144",
|
|
88
|
+
"@tokamakdev/tok-win32-x64": "0.1.1-beta.144"
|
|
89
89
|
},
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
package/platform.js
CHANGED
|
@@ -3,18 +3,12 @@
|
|
|
3
3
|
const path = require("node:path");
|
|
4
4
|
const { optionalDependencies } = require("./package.json");
|
|
5
5
|
|
|
6
|
-
const PACKAGES = {
|
|
7
|
-
"darwin-arm64": "@tokamakdev/tok-darwin-arm64",
|
|
8
|
-
"darwin-x64": "@tokamakdev/tok-darwin-x64",
|
|
9
|
-
"linux-x64": "@tokamakdev/tok-linux-x64",
|
|
10
|
-
"win32-x64": "@tokamakdev/tok-win32-x64",
|
|
11
|
-
};
|
|
12
6
|
|
|
13
7
|
const PLATFORM_PACKS = Object.keys(optionalDependencies).filter((name) => name.startsWith("@tokamakdev/platform-"));
|
|
14
8
|
|
|
15
9
|
function packageFor(platform, arch) {
|
|
16
|
-
const name =
|
|
17
|
-
if (!name) throw new Error(`tokamak does not publish a CLI for ${platform} ${arch}`);
|
|
10
|
+
const name = `@tokamakdev/tok-${platform}-${arch}`;
|
|
11
|
+
if (!Object.hasOwn(optionalDependencies, name)) throw new Error(`tokamak does not publish a CLI for ${platform} ${arch}`);
|
|
18
12
|
return name;
|
|
19
13
|
}
|
|
20
14
|
|