Skip to content

Commit

Permalink
Use native runtime on macOS (#386)
Browse files Browse the repository at this point in the history
* Use `NativeRuntime` on macOS

* Add `compatibilityDate` to miniflare injected workers (KV, R2, and Core Entry)
  • Loading branch information
mrbbot authored Sep 23, 2022
1 parent b929f02 commit 4aa7199
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/tre/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ runtime... 👀
# Additional Development Setup

1. Copy the open-source runtime binary to `./lib/cfwrkr`
1. Copy the open-source runtime binary to `./lib/workerd`
2. Copy the config files `sserve-conf.{capnp,capnp.d.ts,capnp.js,ts}` to
`./src/runtime/config/`
2 changes: 1 addition & 1 deletion packages/tre/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ type PluginRouters = {
};

// `__dirname` relative to bundled output `dist/src/index.js`
const RUNTIME_PATH = path.resolve(__dirname, "..", "..", "lib", "cfwrkr");
const RUNTIME_PATH = path.resolve(__dirname, "..", "..", "lib", "workerd");

type StoppableServer = http.Server & stoppable.WithStop;

Expand Down
1 change: 1 addition & 0 deletions packages/tre/src/plugins/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export const CORE_PLUGIN: Plugin<
worker: {
serviceWorkerScript: SCRIPT_ENTRY,
bindings: serviceEntryBindings,
compatibilityDate: "2022-09-01",
},
},
];
Expand Down
1 change: 1 addition & 0 deletions packages/tre/src/plugins/kv/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const KV_PLUGIN: Plugin<
{ name: BINDING_TEXT_NAMESPACE, text: id },
loopbackBinding,
],
compatibilityDate: "2022-09-01",
},
})
);
Expand Down
1 change: 1 addition & 0 deletions packages/tre/src/plugins/r2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const R2_PLUGIN: Plugin<
{ name: BINDING_TEXT_NAMESPACE, text: id },
loopbackBinding,
],
compatibilityDate: "2022-09-01",
},
})
);
Expand Down
2 changes: 1 addition & 1 deletion packages/tre/src/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function waitForExit(process: childProcess.ChildProcess): Promise<void> {

class NativeRuntime extends Runtime {
static isSupported() {
return process.platform === "linux"; // TODO: and "darwin"?
return process.platform === "linux" || process.platform === "darwin";
}
static supportSuggestion = "Run using a Linux or macOS based system";
static description = "natively ⚡️";
Expand Down

0 comments on commit 4aa7199

Please sign in to comment.