Skip to content

Commit

Permalink
Merge branch 'main' into add-dot-markdown-file-extension-support
Browse files Browse the repository at this point in the history
  • Loading branch information
MoustaphaDev authored Oct 26, 2022
2 parents c73d62c + d151d9f commit 85b625d
Show file tree
Hide file tree
Showing 47 changed files with 200 additions and 151 deletions.
9 changes: 0 additions & 9 deletions .changeset/chilly-experts-add.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/clever-keys-hammer.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/dry-dragons-greet.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/gentle-insects-run.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/nine-roses-explain.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/poor-frogs-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@astrojs/cloudflare': patch
---

enable access to cloudflare runtime [KV, R2, Durable Objects]
- access native cloudflare runtime through `import { getRuntime } from "@astrojs/cloudflare/runtime"` now you can call `getRuntime(Astro.request)` and get access to the runtime environment
5 changes: 0 additions & 5 deletions .changeset/smart-chicken-develop.md

This file was deleted.

11 changes: 0 additions & 11 deletions .changeset/wicked-laws-heal.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
}
}
4 changes: 2 additions & 2 deletions examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"@astrojs/mdx": "^0.11.4",
"astro": "^1.5.3",
"@astrojs/mdx": "^0.11.5",
"@astrojs/rss": "^1.0.2",
"@astrojs/sitemap": "^1.0.0"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
],
"scripts": {},
"devDependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
},
"peerDependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
},
"devDependencies": {
"@astrojs/deno": "^1.2.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"preact": "^10.7.3",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"alpinejs": "^3.10.2",
"@astrojs/alpinejs": "^0.1.2",
"@types/alpinejs": "^3.7.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"lit": "^2.2.5",
"@astrojs/lit": "^1.0.0",
"@webcomponents/template-shadowroot": "^0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"preact": "^10.7.3",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"preact": "^10.7.3",
"@astrojs/preact": "^1.2.0",
"@preact/signals": "^1.1.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"@astrojs/react": "^1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"solid-js": "^1.4.3",
"@astrojs/solid-js": "^1.2.1"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"dependencies": {
"svelte": "^3.48.0",
"@astrojs/svelte": "^1.0.2",
"astro": "^1.5.2"
"astro": "^1.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"vue": "^3.2.37",
"@astrojs/vue": "^1.2.1"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
],
"scripts": {},
"devDependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
},
"peerDependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/non-html-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/portfolio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"server": "node dist/server/entry.mjs"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"svelte": "^3.48.0",
"@astrojs/svelte": "^1.0.2",
"@astrojs/node": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"@astrojs/markdown-remark": "^1.1.3",
"hast-util-select": "5.0.1",
"rehype-autolink-headings": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-shiki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2"
"astro": "^1.5.3"
}
}
4 changes: 2 additions & 2 deletions examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"preact": "^10.6.5",
"@astrojs/preact": "^1.2.0",
"@astrojs/mdx": "^0.11.4"
"@astrojs/mdx": "^0.11.5"
}
}
2 changes: 1 addition & 1 deletion examples/with-nanostores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"preact": "^10.7.3",
"@astrojs/preact": "^1.2.0",
"nanostores": "^0.5.12",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^0.11.4",
"@astrojs/mdx": "^0.11.5",
"@astrojs/tailwind": "^2.1.1",
"@types/canvas-confetti": "^1.4.3",
"astro": "^1.5.2",
"astro": "^1.5.3",
"autoprefixer": "^10.4.7",
"canvas-confetti": "^1.5.1",
"postcss": "^8.4.14",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vite-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"vite-plugin-pwa": "0.11.11",
"workbox-window": "^6.5.3"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^1.5.2",
"astro": "^1.5.3",
"vitest": "^0.20.3"
}
}
10 changes: 10 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# astro

## 1.5.3

### Patch Changes

- [#5133](https://github.com/withastro/astro/pull/5133) [`1c477dd8d`](https://github.com/withastro/astro/commit/1c477dd8d9026fcbd533b4e6d11908e167ce7247) Thanks [@bluwy](https://github.com/bluwy)! - Fix `.css?raw` usage

- [#5133](https://github.com/withastro/astro/pull/5133) [`1c477dd8d`](https://github.com/withastro/astro/commit/1c477dd8d9026fcbd533b4e6d11908e167ce7247) Thanks [@bluwy](https://github.com/bluwy)! - Update `@astrojs/compiler` and use the new `resolvePath` option. This allows removing much of the runtime code, which should improve rendering performance for Astro and MDX pages.

- [#5192](https://github.com/withastro/astro/pull/5192) [`8728ee0b9`](https://github.com/withastro/astro/commit/8728ee0b94ef28524900367a06b9fe806babd574) Thanks [@tony-sull](https://github.com/tony-sull)! - `astro add` no longer automatically installs optional peer dependencies

## 1.5.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "1.5.2",
"version": "1.5.3",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down
12 changes: 12 additions & 0 deletions packages/integrations/cloudflare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ $ pnpm install wrangler --save-dev

It's then possible to update the preview script in your `package.json` to `"preview": "wrangler pages dev ./dist"`.This will allow you run your entire application locally with [Wrangler](https://github.com/cloudflare/wrangler2), which supports secrets, environment variables, KV namespaces, Durable Objects and [all other supported Cloudflare bindings](https://developers.cloudflare.com/pages/platform/functions/#adding-bindings).

## Access to the cloudflare runtime

You have the posibility to access all the cloudflare bindings and environment variables from your astro pages and api routes through the adapter API

```
import { getRuntime } from "@astrojs/cloudflare/runtime";
getRuntime(Astro.request);
```

Depending your adapter mode (advanced = worker, directory = pages) the runtime object will look a little different due to the difference in the cloudflare API.

## Streams

Some integrations such as [React](https://github.com/withastro/astro/tree/main/packages/integrations/react) rely on web streams. Currently Cloudflare Pages Functions require enabling a flag to support Streams.
Expand Down
3 changes: 2 additions & 1 deletion packages/integrations/cloudflare/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@astrojs/cloudflare",
"description": "Deploy your site to cloudflare pages functions",
"description": "Deploy your site to cloudflare workers or cloudflare pages",
"version": "3.1.0",
"type": "module",
"types": "./dist/index.d.ts",
Expand All @@ -19,6 +19,7 @@
"homepage": "https://docs.astro.build/en/guides/integrations-guide/cloudflare/",
"exports": {
".": "./dist/index.js",
"./runtime": "./dist/runtime.js",
"./server.advanced.js": "./dist/server.advanced.js",
"./server.directory.js": "./dist/server.directory.js",
"./package.json": "./package.json"
Expand Down
28 changes: 28 additions & 0 deletions packages/integrations/cloudflare/src/runtime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export type WorkerRuntime<T = unknown> = {
name: 'cloudflare';
env: T;
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
};

export type PagesRuntime<T = unknown, U = unknown> = {
name: 'cloudflare';
env: T;
functionPath: string;
params: Record<string, string>;
data: U;
waitUntil(promise: Promise<any>): void;
next(request: Request): void;
};

export function getRuntime<T = unknown, U = unknown>(
request: Request
): WorkerRuntime<T> | PagesRuntime<T, U> {
if (!!request) {
return Reflect.get(request, Symbol.for('runtime'));
} else {
throw new Error(
'To retrieve the current cloudflare runtime you need to pass in the Astro request object'
);
}
}
Loading

0 comments on commit 85b625d

Please sign in to comment.