Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract workerd logic in mini-oxygen package #1891

Merged
merged 39 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d26786e
Move Node sandbox code
frandiox Mar 13, 2024
7b3f99e
Update imports
frandiox Mar 13, 2024
403ed23
Extract common headers
frandiox Mar 13, 2024
3d3c0ae
Remove redundant values
frandiox Mar 13, 2024
b2ecaaa
Change dependencies
frandiox Mar 22, 2024
3560a59
Extract workerd logic in MiniOxygen package
frandiox Mar 22, 2024
3f4d2e6
Adjust e2e tests for workerd in MiniOxygen
frandiox Mar 22, 2024
95333a8
Fix sourcemaps
frandiox Mar 22, 2024
c901ecd
Simplify reload usage
frandiox Mar 22, 2024
ed0bf83
Use @shopify/mini-oxygen in classic workerd dev process
frandiox Mar 22, 2024
70f6b9f
Only show errors in Node runtime
frandiox Mar 22, 2024
e623b2d
Merge branch 'main' into fd-workerd-mini-oxygen
frandiox Mar 22, 2024
19fcb70
Use @shopify/mini-oxygen in Vite dev process
frandiox Mar 22, 2024
6e69e87
Extract compat flags
frandiox Mar 25, 2024
5f29cd9
Fix CLI deps
frandiox Mar 25, 2024
3a39efe
Only find open ports when flags are not specified
frandiox Mar 25, 2024
7005a14
Move Node tests and avoid creating local folders
frandiox Mar 25, 2024
80ec619
Ensure only 1 instance of MiniOxygen is created
frandiox Mar 25, 2024
a236f00
Handle missing dependency better
frandiox Mar 25, 2024
65c4533
Adjust dependencies
frandiox Mar 25, 2024
fdde9c2
Make mini-oxygen an optional dep of CLI
frandiox Mar 25, 2024
c52e5ba
Fix preview command
frandiox Mar 25, 2024
2e3cb21
Make test more robust when running locally
frandiox Mar 25, 2024
7cede76
Minor log fixes
frandiox Mar 25, 2024
28c13b5
Require direct mini-oxygen dependency in templates
frandiox Mar 25, 2024
32fd8a7
Update MiniOxygen readme
frandiox Mar 25, 2024
cbc55bf
Avoid depending on mini-oxygen directly from vite plugin
frandiox Mar 25, 2024
d94448f
Changesets
frandiox Mar 25, 2024
72c7a9b
Add dispatchFetch to Node sandbox runtime
frandiox Mar 25, 2024
dcd7ba4
Add example for Node sandbox to readme
frandiox Mar 25, 2024
6191d48
Merge branch 'main' into fd-workerd-mini-oxygen
frandiox Mar 28, 2024
c4234fb
Support wrappedBindings without compat flags
frandiox Mar 28, 2024
34c7168
Fix extra lines in banners
frandiox Mar 28, 2024
1b90868
Move unsafe outbound service condition to mini-oxygen
frandiox Mar 28, 2024
5aaac3e
Merge branch 'main' into fd-workerd-mini-oxygen
frandiox Mar 29, 2024
11583a3
Enable verbose logs based on DEBUG variable
frandiox Mar 29, 2024
9e9f638
Fix TS auto-imports
frandiox Mar 29, 2024
034f63c
Move CAA schema patch for graphiql back to CLI
frandiox Mar 29, 2024
24974b4
Merge branch 'main' into fd-workerd-mini-oxygen
frandiox Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .changeset/healthy-owls-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
'@shopify/mini-oxygen': major
---

The main runtime exported from `@shopify/mini-oxygen` is now based on workerd.
The previous Node.js sandbox runtime has been moved to the `@shopify/mini-oxygen/node` export.

Example usage:

```js
import {createMiniOxygen} from '@shopify/mini-oxygen';

const miniOxygen = createMiniOxygen({
workers: [
{
name: 'main',
modules: true,
script: `export default {
async fetch() {
const response = await fetch("https://hydrogen.shopify.dev");
return response;
}
}`,
},
],
});

const response = await miniOxygen.dispatchFetch('http://placeholder');
console.log(await response.text());

await miniOxygen.dispose();
```
15 changes: 15 additions & 0 deletions .changeset/mean-pots-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'skeleton': patch
---

If you deploy to Oxygen, please add `@shopify/mini-oxygen` as a dev dependency in your project for local development:

```diff
"devDependencies": {
"@remix-run/dev": "^2.8.0",
"@remix-run/eslint-config": "^2.8.0",
+ "@shopify/mini-oxygen": "^3.0.0",
"@shopify/oxygen-workers-types": "^4.0.0",
...
},
```
7 changes: 7 additions & 0 deletions .changeset/quick-walls-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@shopify/cli-hydrogen': major
---

Hydrogen CLI now requires `@shopify/mini-oxygen` to be installed separately as a dev dependency. It is still used automatically under the hood so there is no need to change your application code aside from installing the dependency.

Also, if a port provided via `--port` or `--inspector-port` flags is already in use, the CLI will now exit with an error message instead of finding a new open port. When the flags are not provided, the CLI will still find an open port.
1 change: 1 addition & 0 deletions examples/multipass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"devDependencies": {
"@remix-run/dev": "^2.8.0",
"@remix-run/eslint-config": "^2.8.0",
"@shopify/mini-oxygen": "^2.2.5",
"@shopify/oxygen-workers-types": "^4.0.0",
"@shopify/prettier-config": "^1.1.2",
"@total-typescript/ts-reset": "^0.4.2",
Expand Down
1 change: 1 addition & 0 deletions examples/partytown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"devDependencies": {
"@remix-run/dev": "^2.8.0",
"@remix-run/eslint-config": "^2.8.0",
"@shopify/mini-oxygen": "^2.2.5",
"@shopify/oxygen-workers-types": "^4.0.0",
"@shopify/prettier-config": "^1.1.2",
"@total-typescript/ts-reset": "^0.4.2",
Expand Down
1 change: 1 addition & 0 deletions examples/subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"devDependencies": {
"@remix-run/dev": "^2.8.0",
"@remix-run/eslint-config": "^2.8.0",
"@shopify/mini-oxygen": "^2.2.5",
"@shopify/oxygen-workers-types": "^4.0.0",
"@shopify/prettier-config": "^1.1.2",
"@tailwindcss/forms": "^0.5.3",
Expand Down
Loading
Loading