@openworkers/adapter-static 0.1.4 → 0.1.6

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.
package/README.md CHANGED
@@ -70,10 +70,10 @@ Assets with hashed filenames are served with long cache headers (`max-age=315360
70
70
 
71
71
  Auto-detected patterns:
72
72
 
73
- - `/_app/immutable/*` — SvelteKit
74
- - `/assets/*` — Vite
75
- - `/_next/static/*` — Next.js
76
- - `/_astro/*` — Astro
73
+ - `/_app/immutable/**` — SvelteKit
74
+ - `/assets/**` — Vite
75
+ - `/_next/static/**` — Next.js
76
+ - `/_astro/**` — Astro
77
77
 
78
78
  ## Deploy to OpenWorkers
79
79
 
package/bin/cli.js CHANGED
@@ -64,7 +64,7 @@ Options:
64
64
  -o, --out <dir> Output directory (default: dist-openworkers)
65
65
  -m, --mode <mode> Routing mode: 'directory' or 'flat' (default: auto-detect)
66
66
  -f, --fallback <f> SPA fallback file (e.g., /index.html or /200.html)
67
- --immutable <p> Comma-separated immutable patterns (e.g., /assets/*,/_app/*)
67
+ --immutable <p> Comma-separated immutable patterns (e.g., /assets/**,/_app/**)
68
68
  -h, --help Show this help message
69
69
  -v, --version Show version
70
70
 
package/files/worker.js CHANGED
@@ -461,8 +461,8 @@ var index_lite_default = new Mime_default(standard_default)._freeze();
461
461
  import routes from "ROUTES";
462
462
  function isImmutable(pathname) {
463
463
  for (const pattern of routes.immutable) {
464
- if (pattern.endsWith("/*")) {
465
- const prefix = pattern.slice(0, -1);
464
+ if (pattern.endsWith("/**") || pattern.endsWith("/*")) {
465
+ const prefix = pattern.endsWith("/**") ? pattern.slice(0, -2) : pattern.slice(0, -1);
466
466
  if (pathname.startsWith(prefix)) {
467
467
  return true;
468
468
  }
package/index.d.ts CHANGED
@@ -29,7 +29,7 @@ export interface AdapterOptions {
29
29
  /**
30
30
  * Glob patterns for immutable assets (hashed filenames)
31
31
  * These files get long cache headers
32
- * @default auto-detected (/_app/immutable/*, /assets/*, etc.)
32
+ * @default auto-detected (/_app/immutable/**, /assets/**, etc.)
33
33
  */
34
34
  immutable?: string[];
35
35
  }
package/index.js CHANGED
@@ -62,9 +62,11 @@ export async function adapt(options = {}) {
62
62
  mode,
63
63
  fallback,
64
64
  immutable,
65
- // Static: all files with their original names (including .html)
66
- static: staticFiles.map((f) => '/' + f),
65
+ // Static: only non-HTML files (robots.txt, favicon.ico, etc.)
66
+ // HTML files are in prerendered to avoid duplication
67
+ static: nonHtmlFiles.map((f) => '/' + f),
67
68
  // Prerendered: HTML files without .html extension
69
+ // Requests with .html extension will match via fallback routing
68
70
  prerendered: prerenderedRoutes,
69
71
  functions: [],
70
72
  // If fallback is set, worker handles all unmatched routes (SPA mode)
@@ -156,7 +158,7 @@ function detectImmutable(dir) {
156
158
 
157
159
  for (const pattern of commonImmutable) {
158
160
  if (existsSync(join(dir, pattern))) {
159
- patterns.push(`/${pattern}/*`);
161
+ patterns.push(`/${pattern}/**`);
160
162
  }
161
163
  }
162
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openworkers/adapter-static",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Static site adapter for OpenWorkers",
5
5
  "keywords": [
6
6
  "adapter",