Skip to content

Commit b1bd6ec

Browse files
authored
Merge branch 'denoland:main' into rename-FreshContext-req-to-request
2 parents a6496a7 + e33b447 commit b1bd6ec

32 files changed

Lines changed: 366 additions & 252 deletions

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ jobs:
3333
if: github.repository_owner == 'denoland'
3434
with:
3535
project: "fresh"
36-
entrypoint: "./www/_fresh/server.js"
37-
root: "."
36+
entrypoint: "server.js"
37+
root: "./www/_fresh/"

deno.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
"tasks": {
88
"test": "deno test -A --parallel",
9-
"www": "deno task --cwd=www start",
9+
"www": "deno task --cwd=www dev",
1010
"build-www": "deno task --cwd=www build",
1111
"screenshot": "deno run -A www/utils/screenshot.ts",
1212
"check:types": "deno check --allow-import",
@@ -102,7 +102,8 @@
102102
"base",
103103
"noscript",
104104
"template"
105-
]
105+
],
106+
"types": ["./global.d.ts"]
106107
},
107108
"lint": {
108109
"rules": {

deno.lock

Lines changed: 66 additions & 133 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/canary/plugins/csrf.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ app.use(
2828
csrf({ origin: ["https://example.com", "https://trusted.example.com"] }),
2929
);
3030

31-
// Specify multiple origins
32-
app.use(
33-
csrf({ origin: ["https://example.com", "https://trusted.example.com"] }),
34-
);
35-
3631
// Use a function
3732
app.use(
3833
csrf({

global.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.module.css" {
2+
const CssMod: Record<string, string>;
3+
export default CssMod;
4+
}

packages/fresh/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fresh/core",
3-
"version": "2.0.0-alpha.63",
3+
"version": "2.0.0-beta.1",
44
"license": "MIT",
55
"exports": {
66
".": "./src/mod.ts",

packages/fresh/src/build_cache.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export class IslandPreparer {
9797
mod: Record<string, unknown>,
9898
chunkName: string,
9999
modName: string,
100+
css: string[],
100101
) {
101102
for (const [name, value] of Object.entries(mod)) {
102103
if (typeof value !== "function") continue;
@@ -110,6 +111,7 @@ export class IslandPreparer {
110111
file: chunkName,
111112
fn,
112113
name: uniqueName,
114+
css,
113115
});
114116
}
115117
}

packages/fresh/src/context.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface Island {
3333
name: string;
3434
exportName: string;
3535
fn: ComponentType;
36+
css: string[];
3637
}
3738

3839
export type ServerIslandRegistry = Map<ComponentType, Island>;

packages/fresh/src/dev/builder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ export class Builder<State = any> {
314314
name,
315315
server: spec,
316316
browser: null,
317+
css: [],
317318
});
318319
}
319320

packages/fresh/src/dev/dev_build_cache.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface IslandModChunk {
2727
name: string;
2828
server: string;
2929
browser: string | null;
30+
css: string[];
3031
}
3132

3233
export type FsRouteFileNoMod<State> = Omit<FsRouteFile<State>, "mod"> & {
@@ -206,7 +207,7 @@ export class MemoryBuildCache<State> implements DevBuildCache<State> {
206207
throw new Error(`Unexpected missing browser chunk`);
207208
}
208209

209-
preparer.prepare(this.islandRegistry, mod, chunk.browser, name);
210+
preparer.prepare(this.islandRegistry, mod, chunk.browser, name, []);
210211
},
211212
),
212213
);
@@ -461,7 +462,8 @@ export async function generateSnapshotServer(
461462
const islandMarkers = islands.map((item) => {
462463
const browser = JSON.stringify(item.browser);
463464
const name = JSON.stringify(item.name);
464-
return `islandPreparer.prepare(islands, ${item.name}, ${browser}, ${name});`;
465+
const css = JSON.stringify(item.css);
466+
return `islandPreparer.prepare(islands, ${item.name}, ${browser}, ${name}, ${css});`;
465467
}).join("\n");
466468

467469
const serializedFsRoutes = fsRoutesFiles

0 commit comments

Comments
 (0)