Skip to content
Closed
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
12 changes: 12 additions & 0 deletions packages/void/test/integration/static-pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
rmSync(join(pg, "dist"), { recursive: true, force: true });
rmSync(join(pg, ".void"), { recursive: true, force: true });
removeWranglerConfig(pg);
execSync(`pnpm --dir ${PLAYGROUND} build`, { cwd: ROOT, stdio: "pipe" });

Check failure on line 21 in packages/void/test/integration/static-pages.test.ts

View workflow job for this annotation

GitHub Actions / test (core-markdown, test:integration)

[core-markdown] packages/void/test/integration/static-pages.test.ts > playground/static-pages build (output: static)

Error: Command failed: pnpm --dir playground/static-pages build (node:4197) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. (Use `node --trace-deprecation ...` to show where the warning was created) file:///home/runner/work/void/void/node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:10923 options.channel.api.outsideEmitter.on("send", onMessage); ^ TypeError: Cannot read properties of undefined (reading 'outsideEmitter') at Object.connect (file:///home/runner/work/void/void/node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:10923:24) at Object.connect (file:///home/runner/work/void/void/node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/module-runner.js:543:21) at Object.connect (file:///home/runner/work/void/void/node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/module-runner.js:606:43) at new ModuleRunner (file:///home/runner/work/void/void/node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/module-runner.js:1052:34) at new SSRCompatModuleRunner (file:///home/runner/work/void/void/node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:10978:3) at ssrLoadModule (file:///home/runner/work/void/void/node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:10957:36) at Object.ssrLoadModule (file:///home/runner/work/void/void/node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:26379:11) at collectPrerenderPaths (file:///home/runner/work/void/void/packages/void/dist/deploy-BBYcX5sX.mjs:760:35) at async PluginContextImpl.closeBundle (file:///home/runner/work/void/void/packages/void/dist/index.mjs:1659:18) at async plugin (file:///home/runner/work/void/void/node_modules/.pnpm/rolldown@1.0.0-rc.4/node_modules/rolldown/dist/shared/bindingify-input-options-phmnMdxa.mjs:1341:4) Node.js v24.13.1 ❯ Object.connect node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:10923:24 ❯ new SSRCompatModuleRunner node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:10978:3 ❯ ssrLoadModule node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:10957:36 ❯ Object.ssrLoadModule node_modules/.pnpm/vite@8.0.0-beta.14_@types+node@24.10.15_esbuild@0.27.3_jiti@2.6.1_terser@5.46.0_tsx@4.21.0_yaml@2.8.2/node_modules/vite/dist/node/chunks/fetchableEnvironments.js:26379:11 ❯ plugin node_modules/.pnpm/rolldown@1.0.0-rc.4/node_modules/rolldown/dist/shared/bindingify-input-options-phmnMdxa.mjs:1341:4 ❯ packages/void/test/integration/static-pages.test.ts:21:5 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { status: 1, signal: null, output: [ null, '<Buffer(2746) ...>', '<Buffer(2712) ...>' ], pid: 4119, stdout: '<Buffer(2746) ...>', stderr: '<Buffer(2712) ...>' }
}, 120_000);

it("emits worker entry and client manifest", () => {
Expand Down Expand Up @@ -61,6 +61,18 @@
expect(html).not.toContain("/@id/");
});

it("prerenders dynamic pages with getPrerenderPaths", () => {
// posts/[slug] exports getPrerenderPaths returning [{slug:"hello"},{slug:"world"}]
Comment thread
hyfdev marked this conversation as resolved.
Resolved
const helloPath = join(DIST, "client/posts/hello.html");
const worldPath = join(DIST, "client/posts/world.html");
expect(existsSync(helloPath)).toBe(true);
expect(existsSync(worldPath)).toBe(true);

const html = readFileSync(helloPath, "utf-8");
expect(html).toContain('data-testid="post-title"');
expect(html).toContain("Post hello");
});
Comment thread
hyfdev marked this conversation as resolved.
Resolved

it("does not prerender dynamic pages without getPrerenderPaths", () => {
// items/[id] has no getPrerenderPaths, so it should NOT be prerendered
expect(existsSync(join(DIST, "client/items"))).toBe(false);
Expand Down
15 changes: 15 additions & 0 deletions playground/static-pages/pages/posts/[slug].server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineHandler } from "void";

export interface Props {
slug: string;
}

export const prerender = true;

export function getPrerenderPaths() {
return [{ slug: "hello" }, { slug: "world" }];
}

export const loader = defineHandler<Props>((c) => {
return { slug: c.req.param("slug") };
});
9 changes: 9 additions & 0 deletions playground/static-pages/pages/posts/[slug].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script setup lang="ts">
defineProps<{ slug: string }>();
</script>

<template>
<div>
<h1 data-testid="post-title">Post {{ slug }}</h1>
</div>
</template>
Loading