Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/reusable-ecosystem-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:
vp fmt
vp test --api.port="$ECOSYSTEM_VITEST_PORT"
vp run build
vp run test:dev
# FIXME: TypeError: Failed to fetch dynamically imported module
# - name: skeleton
# node-version: 24
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"name": "command-dev-bundled-dev-test",
"private": true
"private": true,
"type": "module",
"devDependencies": {
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
"vite-plus": "latest"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,34 @@
# ENV_ENTRY to dist/vite/client/, but it left BUNDLED_DEV_CLIENT_ENTRY at
# dist/client/. With `experimental.bundledDev` enabled, Vite reads that
# path with fs.readFileSync, so `vp dev` fails at startup with ENOENT.
# Install packed packages for #3110: linking core to the checkout exposes its
# rolldown devDependency and hides missing runtime rewrites. Disable automatic
# peer installation so npm cannot add another rolldown through upstream Vite.
[[case]]
name = "command_dev_bundled_dev"
vp = "local"
vp = "global"
skip-platforms = ["windows"]
local-registry = true
env = { ROLLDOWN_PACKAGE = "missing" }
steps = [
{ argv = ["vp", "dev", "--host", "127.0.0.1", "--port", "0"], comment = "dev server with experimental.bundledDev enabled starts and serves the bundled dev client", continue-on-failure = true, interactions = [
{ "expect-milestone" = "dev-server:ready" },
{ argv = ["npm", "install", "--ignore-scripts", "--legacy-peer-deps", "--no-audit", "--no-fund"], snapshot = false },
{ argv = ["vp", "dev", "--host", "127.0.0.1", "--port", "0"], comment = "Bundled dev serves core's runtime without a separate rolldown package.", interactions = [
{ "expect-milestone" = "dev-server:runtime-verified" },
{ "write-key" = "ctrl-c" },
] },
]

[[case]]
name = "command_dev_bundled_dev_unrelated_rolldown"
vp = "global"
skip-platforms = ["windows"]
local-registry = true
env = { ROLLDOWN_PACKAGE = "unrelated" }
steps = [
{ argv = ["npm", "install", "--ignore-scripts", "--legacy-peer-deps", "--no-audit", "--no-fund"], snapshot = false },
{ argv = ["vpt", "cp", "-r", "unrelated-rolldown", "node_modules/rolldown"], snapshot = false },
{ argv = ["vp", "dev", "--host", "127.0.0.1", "--port", "0"], comment = "An unrelated rolldown package must not replace core's bundled runtime.", interactions = [
{ "expect-milestone" = "dev-server:runtime-verified" },
{ "write-key" = "ctrl-c" },
] },
]
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
# command_dev_bundled_dev

## `npm install --ignore-scripts --legacy-peer-deps --no-audit --no-fund`


## `vp dev --host 127.0.0.1 --port 0`

dev server with experimental.bundledDev enabled starts and serves the bundled dev client
Bundled dev serves core's runtime without a separate rolldown package.

**Exit code:** 130

**→ expect-milestone:** `dev-server:ready`
**→ expect-milestone:** `dev-server:runtime-verified`

```
VITE+ - The Unified Toolchain for the Web

VITE+ <version> ready in <duration>

➜ Local: http://127.0.0.1:<port>/
➜ Local: http://127.0.0.1:<port>/nested/
➜ press h + enter to show help
Rolldown package: missing
Client imports /nested/@rolldown/experimental-runtime.mjs
Served runtime matches core
```

**← write-key:** `ctrl-c`

```
VITE+ - The Unified Toolchain for the Web

VITE+ <version> ready in <duration>

➜ Local: http://127.0.0.1:<port>/
➜ Local: http://127.0.0.1:<port>/nested/
➜ press h + enter to show help
Rolldown package: missing
Client imports /nested/@rolldown/experimental-runtime.mjs
Served runtime matches core

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# command_dev_bundled_dev_unrelated_rolldown

## `npm install --ignore-scripts --legacy-peer-deps --no-audit --no-fund`


## `vpt cp -r unrelated-rolldown node_modules/rolldown`


## `vp dev --host 127.0.0.1 --port 0`

An unrelated rolldown package must not replace core's bundled runtime.

**Exit code:** 130

**→ expect-milestone:** `dev-server:runtime-verified`

```
VITE+ - The Unified Toolchain for the Web

VITE+ <version> ready in <duration>

➜ Local: http://127.0.0.1:<port>/nested/
➜ press h + enter to show help
Rolldown package: unrelated
Client imports /nested/@rolldown/experimental-runtime.mjs
Served runtime matches core
```

**← write-key:** `ctrl-c`

```
VITE+ - The Unified Toolchain for the Web

VITE+ <version> ready in <duration>

➜ Local: http://127.0.0.1:<port>/nested/
➜ press h + enter to show help
Rolldown package: unrelated
Client imports /nested/@rolldown/experimental-runtime.mjs
Served runtime matches core

```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
throw new Error('Unrelated rolldown runtime');
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "rolldown",
"type": "module",
"exports": {
"./experimental/runtime": "./experimental-runtime.mjs"
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,62 @@
import assert from 'node:assert/strict';
import { readFileSync, realpathSync } from 'node:fs';
import { createRequire } from 'node:module';
import { join, sep } from 'node:path';

export default {
base: '/nested/',
clearScreen: false,
experimental: {
bundledDev: true,
},
plugins: [
{
name: 'dev-server-ready-milestone',
name: 'verify-bundled-dev-runtime',
configureServer(server) {
const projectRequire = createRequire(join(server.config.root, 'package.json'));
const cliRequire = createRequire(projectRequire.resolve('vite-plus/package.json'));
const corePackage = cliRequire.resolve('vite/package.json');
// Reject a linked checkout: its development dependencies can mask #3110.
assert.ok(realpathSync(corePackage).startsWith(realpathSync('node_modules') + sep));
const coreRequire = createRequire(corePackage);
assert.equal(coreRequire('./package.json').name, '@voidzero-dev/vite-plus-core');
if (process.env.ROLLDOWN_PACKAGE === 'unrelated') {
assert.equal(
coreRequire.resolve('rolldown/experimental/runtime'),
realpathSync('node_modules/rolldown/experimental-runtime.mjs'),
);
} else {
assert.throws(() => coreRequire.resolve('rolldown/experimental/runtime'), {
code: 'MODULE_NOT_FOUND',
});
}
const expectedRuntime = readFileSync(
coreRequire.resolve('@voidzero-dev/vite-plus-core/rolldown/experimental/runtime'),
'utf8',
);
server.httpServer?.once('listening', () => {
// Let Vite print its startup banner after server.listen() resolves.
setImmediate(() => {
const name = Buffer.from('dev-server:ready').toString('base64url');
process.stdout.write(`\x1b]2;vt-pty-terminal-test:${'0'.repeat(32)}:${name}\x1b\\`);
setImmediate(async () => {
try {
const base = `http://127.0.0.1:${server.httpServer.address().port}/nested/`;
const client = await fetch(base + 'bundledDevClient.mjs');
assert.equal(client.status, 200);
assert.match(
await client.text(),
/from\s*['"]\/nested\/@rolldown\/experimental-runtime\.mjs['"]/,
);
const runtime = await fetch(base + '@rolldown/experimental-runtime.mjs');
assert.equal(runtime.status, 200);
assert.ok((await runtime.text()) === expectedRuntime, 'must serve core\'s runtime');
console.log(`Rolldown package: ${process.env.ROLLDOWN_PACKAGE}`);
console.log('Client imports /nested/@rolldown/experimental-runtime.mjs');
console.log('Served runtime matches core');
const name = Buffer.from('dev-server:runtime-verified').toString('base64url');
process.stdout.write(`\x1b]2;vt-pty-terminal-test:${'0'.repeat(32)}:${name}\x1b\\`);
} catch (error) {
console.error(error);
process.exit(1);
}
});
});
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "rolldown-webcontainer-fallback-test",
"private": true,
"type": "module",
"dependencies": {
"@voidzero-dev/vite-plus-core": "latest"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Execute the complete packed binding loader in a simulated WebContainer.
# Native bindings are unavailable; the WASM installer and cache are local fakes.
# A linked checkout would hide the missing rolldown/package.json dependency.
[[case]]
name = "rolldown_webcontainer_fallback"
vp = "global"
local-registry = true
steps = [
{ argv = ["npm", "install", "--ignore-scripts", "--legacy-peer-deps", "--no-audit", "--no-fund"], snapshot = false },
{ argv = ["node", "--experimental-vm-modules", "--disable-warning=ExperimentalWarning", "verify.mjs", "missing"], comment = "Without a standalone rolldown package, download the WASM binding at the bundled Rolldown version." },
{ argv = ["node", "--experimental-vm-modules", "--disable-warning=ExperimentalWarning", "verify.mjs", "cached"], comment = "Load an existing WASM binding without a package lookup or another download." },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# rolldown_webcontainer_fallback

## `npm install --ignore-scripts --legacy-peer-deps --no-audit --no-fund`


## `node --experimental-vm-modules --disable-warning=ExperimentalWarning verify.mjs missing`

Without a standalone rolldown package, download the WASM binding at the bundled Rolldown version.

```
Standalone rolldown: missing
WASM cache: missing
[rolldown] Downloading @rolldown/binding-wasm32-wasi@<bundled-rolldown-version> on WebContainer...
Installer selected the bundled Rolldown version
Loaded the WebContainer WASM binding
Downloads: 1
```

## `node --experimental-vm-modules --disable-warning=ExperimentalWarning verify.mjs cached`

Load an existing WASM binding without a package lookup or another download.

```
Standalone rolldown: missing
WASM cache: cached
Loaded the WebContainer WASM binding
Downloads: 0
```
Loading
Loading