@astrojs/cloudflare 9.1.0 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import type { CacheStorage, ExecutionContext, Request as CFRequest } from '@cloudflare/workers-types';
1
+ import type { Request as CFRequest, CacheStorage, ExecutionContext } from '@cloudflare/workers-types';
2
2
  import type { SSRManifest } from 'astro';
3
3
  type Env = {
4
4
  ASSETS: {
@@ -1,4 +1,4 @@
1
- import type { CacheStorage, EventContext, Request as CFRequest } from '@cloudflare/workers-types';
1
+ import type { Request as CFRequest, CacheStorage, EventContext } from '@cloudflare/workers-types';
2
2
  import type { SSRManifest } from 'astro';
3
3
  export interface DirectoryRuntime<T extends object = object> {
4
4
  runtime: {
package/dist/index.d.ts CHANGED
@@ -3,25 +3,31 @@ import type { RUNTIME } from './utils/local-runtime.js';
3
3
  export type { AdvancedRuntime } from './entrypoints/server.advanced.js';
4
4
  export type { DirectoryRuntime } from './entrypoints/server.directory.js';
5
5
  export type Options = {
6
+ /**
7
+ * @deprecated Removed in v10. The 'directory' mode was discontinued because it redundantly bundles code, slowing down your site. Prefer using Astro API Endpoints over `/functions`. The new default mode is 'advanced'.
8
+ */
6
9
  mode?: 'directory' | 'advanced';
10
+ /**
11
+ * @deprecated Removed in v10. This setting is obsolete as Cloudflare handles all functions in a single execution context, negating the need for multiple functions per project.
12
+ */
7
13
  functionPerRoute?: boolean;
8
14
  imageService?: 'passthrough' | 'cloudflare' | 'compile';
9
- /** Configure automatic `routes.json` generation */
10
15
  routes?: {
11
- /** Strategy for generating `include` and `exclude` patterns
12
- * - `auto`: Will use the strategy that generates the least amount of entries.
13
- * - `include`: For each page or endpoint in your application that is not prerendered, an entry in the `include` array will be generated. For each page that is prerendered and whoose path is matched by an `include` entry, an entry in the `exclude` array will be generated.
14
- * - `exclude`: One `"/*"` entry in the `include` array will be generated. For each page that is prerendered, an entry in the `exclude` array will be generated.
15
- * */
16
+ /**
17
+ * @deprecated Removed in v10. You will have two options going forward, using auto generated `_route.json` file or provide your own one in `public/_routes.json`. The previous method caused confusion and inconsistencies.
18
+ */
16
19
  strategy?: 'auto' | 'include' | 'exclude';
17
- /** Additional `include` patterns */
20
+ /**
21
+ * @deprecated Removed in v10. Use `routes.extend.include` instead.
22
+ */
18
23
  include?: string[];
19
- /** Additional `exclude` patterns */
24
+ /**
25
+ * @deprecated Removed in v10. Use `routes.extend.exclude` instead.
26
+ */
20
27
  exclude?: string[];
21
28
  };
22
29
  /**
23
- * { mode: 'off' }: current behaviour (wrangler is needed)
24
- * { mode: 'local', ... }: adds cf request object, locals bindings, env vars/secrets which are defined by the user to `astro.dev` with `Astro.locals.runtime` / `context.locals.runtime`
30
+ * @deprecated Removed in v10. Configure bindings in `wrangler.toml`. Leveraging Cloudflare's API simplifies setup and ensures full compatibility with Wrangler configurations. Use `platformProxy` instead.
25
31
  */
26
32
  runtime?: {
27
33
  mode: 'off';
package/dist/index.js CHANGED
@@ -434,10 +434,10 @@ export default function createIntegration(args) {
434
434
  {
435
435
  const includeStrategyLength = includeStrategy
436
436
  ? includeStrategy.include.length + includeStrategy.exclude.length
437
- : Infinity;
437
+ : Number.POSITIVE_INFINITY;
438
438
  const excludeStrategyLength = excludeStrategy
439
439
  ? excludeStrategy.include.length + excludeStrategy.exclude.length
440
- : Infinity;
440
+ : Number.POSITIVE_INFINITY;
441
441
  const winningStrategy = notFoundIsSSR
442
442
  ? excludeStrategy
443
443
  : includeStrategyLength <= excludeStrategyLength
@@ -1,6 +1,6 @@
1
- import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'fs';
2
1
  import assert from 'node:assert';
3
- import { fileURLToPath } from 'url';
2
+ import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
4
  import TOML from '@iarna/toml';
5
5
  import { AstroError } from 'astro/errors';
6
6
  import dotenv from 'dotenv';
@@ -89,6 +89,7 @@ function getVarsForDev(config, configPath) {
89
89
  function parseConfig() {
90
90
  if (_wrangler)
91
91
  return _wrangler;
92
+ // biome-ignore lint/suspicious/noImplicitAnyLet: correct usage
92
93
  let rawConfig;
93
94
  const configPath = findWranglerToml(process.cwd(), false); // false = args.experimentalJsonConfig
94
95
  if (!configPath) {
@@ -1,4 +1,4 @@
1
- import esbuild from 'esbuild';
1
+ import type esbuild from 'esbuild';
2
2
  /**
3
3
  *
4
4
  * @param relativePathToAssets - relative path from the final location for the current esbuild output bundle, to the assets directory.
@@ -1,5 +1,4 @@
1
1
  import { basename } from 'node:path';
2
- import esbuild from 'esbuild';
3
2
  /**
4
3
  *
5
4
  * @param relativePathToAssets - relative path from the final location for the current esbuild output bundle, to the assets directory.
@@ -1,2 +1,2 @@
1
- import esbuild from 'esbuild';
1
+ import type esbuild from 'esbuild';
2
2
  export declare function patchSharpBundle(): esbuild.Plugin;
@@ -1,4 +1,3 @@
1
- import esbuild from 'esbuild';
2
1
  export function patchSharpBundle() {
3
2
  return {
4
3
  name: 'sharp-patch',
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "//comment": "test changeset-bot",
3
3
  "name": "@astrojs/cloudflare",
4
4
  "description": "Deploy your site to Cloudflare Workers/Pages",
5
- "version": "9.1.0",
5
+ "version": "9.2.0",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
8
8
  "author": "withastro",