Skip to content

Commit 4823c42

Browse files
feat(netlify): dev context (#14269)
1 parent c984507 commit 4823c42

12 files changed

Lines changed: 3044 additions & 3413 deletions

File tree

.changeset/icy-boxes-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/netlify': patch
3+
---
4+
5+
Updates `context.netlify` to implement all its properties

knip.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default {
3737
'rehype-slug',
3838
'rehype-toc',
3939
'remark-code-titles',
40+
'@types/http-cache-semantics',
4041
],
4142
},
4243
'packages/db': {

packages/astro/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
"rollup": "^4.37.0",
215215
"sass": "^1.86.0",
216216
"typescript": "^5.8.3",
217-
"undici": "^7.5.0",
217+
"undici": "^6.21.3",
218218
"unified": "^11.0.5",
219219
"vitest": "^3.0.9"
220220
},

packages/astro/src/assets/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export type AssetsGlobalStaticImagesList = Map<
1818
>;
1919

2020
declare global {
21-
// eslint-disable-next-line no-var
2221
var astroAsset: {
2322
imageService?: ImageService;
2423
addStaticImage?:

packages/integrations/cloudflare/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@cloudflare/workers-types": "^4.20250507.0",
4242
"tinyglobby": "^0.2.13",
4343
"vite": "^6.3.5",
44-
"wrangler": "^4.14.1"
44+
"wrangler": "4.14.1"
4545
},
4646
"peerDependencies": {
4747
"astro": "^5.7.0"

packages/integrations/cloudflare/src/utils/handler.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ export interface Runtime<T extends object = object> {
2828

2929
declare global {
3030
// This is not a real global, but is injected using Vite define to allow us to specify the session binding name in the config.
31-
// eslint-disable-next-line no-var
3231
var __ASTRO_SESSION_BINDING_NAME: string;
3332

3433
// Just used to pass the KV binding to unstorage.
35-
// eslint-disable-next-line no-var
3634
var __env__: Partial<Env>;
3735
}
3836

packages/integrations/cloudflare/test/fixtures/astro-dev-platform/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"astro": "workspace:*"
88
},
99
"devDependencies": {
10-
"wrangler": "^4.14.1"
10+
"wrangler": "4.14.1"
1111
}
1212
}

packages/integrations/cloudflare/test/fixtures/astro-env/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"astro": "workspace:*"
88
},
99
"devDependencies": {
10-
"wrangler": "^4.14.1"
10+
"wrangler": "4.14.1"
1111
}
1212
}

packages/integrations/cloudflare/test/fixtures/sessions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"devDependencies": {
99
"astro": "workspace:*",
10-
"wrangler": "^4.14.1"
10+
"wrangler": "4.14.1"
1111
},
1212
"scripts": {
1313
"build": "astro build",

packages/integrations/netlify/src/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,16 +501,21 @@ export default function netlifyIntegration(
501501
};
502502

503503
const context: Context = {
504+
get url(): never {
505+
throw new Error('Please use Astro.url instead.');
506+
},
507+
// The dev server is a long running process, so promises will run even with a noop
508+
waitUntil: () => {},
504509
account: parseBase64JSON('x-nf-account-info') ?? {
505510
id: 'mock-netlify-account-id',
506511
},
507-
// TODO: this has type conflicts with @netlify/functions ^2.8.1
508-
// @ts-expect-error: this has type conflicts with @netlify/functions ^2.8.1
509512
deploy: {
513+
context: 'dev',
510514
id:
511515
typeof req.headers['x-nf-deploy-id'] === 'string'
512516
? req.headers['x-nf-deploy-id']
513517
: 'mock-netlify-deploy-id',
518+
published: false,
514519
},
515520
site: parseBase64JSON('x-nf-site-info') ?? {
516521
id: 'mock-netlify-site-id',
@@ -539,10 +544,6 @@ export default function netlifyIntegration(
539544
get cookies(): never {
540545
throw new Error('Please use Astro.cookies instead.');
541546
},
542-
flags: {
543-
get: () => undefined,
544-
evaluations: new Set<string>(),
545-
} as unknown as Context['flags'],
546547
json: (input) => Response.json(input),
547548
log: console.info,
548549
next: () => {

0 commit comments

Comments
 (0)