@tschk/moonshine-deploy-cloudflare 0.3.5 → 0.4.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.
Files changed (2) hide show
  1. package/package.json +8 -8
  2. package/src/index.ts +19 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tschk/moonshine-deploy-cloudflare",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -15,16 +15,16 @@
15
15
  "test": "bun test"
16
16
  },
17
17
  "dependencies": {
18
- "@tschk/moonshine-adapter-conformance": "^0.3.5",
19
- "@tschk/moonshine-compiler": "^0.3.5",
20
- "@tschk/moonshine-framework": "^0.3.5",
21
- "@tschk/moonshine-react": "^0.3.5",
22
- "@tschk/moonshine-router": "^0.3.5",
23
- "@tschk/moonshine-server": "^0.3.5"
18
+ "@tschk/moonshine-compiler": "^0.3.6",
19
+ "@tschk/moonshine-framework": "^0.3.6",
20
+ "@tschk/moonshine-react": "^0.3.6",
21
+ "@tschk/moonshine-router": "^0.3.6",
22
+ "@tschk/moonshine-server": "^0.3.6"
24
23
  },
25
24
  "devDependencies": {
26
25
  "@types/bun": "1.3.14",
27
- "typescript": "7.0.2"
26
+ "typescript": "7.0.2",
27
+ "@tschk/moonshine-adapter-conformance": "^0.3.6"
28
28
  },
29
29
  "files": [
30
30
  "src"
package/src/index.ts CHANGED
@@ -10,11 +10,9 @@ import { reactRenderer, registerRouteModules } from "@tschk/moonshine-react";
10
10
  import type {
11
11
  DeploymentAdapter,
12
12
  MoonshineManifest,
13
- } from "@tschk/moonshine-framework";
14
- import type {
15
13
  Harness,
16
14
  HarnessFactory,
17
- } from "@tschk/moonshine-adapter-conformance";
15
+ } from "@tschk/moonshine-framework";
18
16
 
19
17
  export type CloudflareEnv = {
20
18
  ASSETS?: { fetch: (request: Request) => Promise<Response> };
@@ -69,7 +67,9 @@ export async function cloudflareFetch(
69
67
  (async () => {
70
68
  try {
71
69
  await cache.put(request.clone(), response.clone());
72
- } catch {}
70
+ } catch (err) {
71
+ console.warn("Failed to cache response:", err);
72
+ }
73
73
  })(),
74
74
  );
75
75
  }
@@ -122,19 +122,21 @@ async function copyAssets(
122
122
  assets: MoonshineManifest["assets"],
123
123
  outDir: string,
124
124
  ): Promise<void> {
125
- for (const asset of assets) {
126
- const source = isAbsolute(asset.file)
127
- ? asset.file
128
- : resolve(outDir, asset.file);
129
- const target = resolve(
130
- outDir,
131
- (asset.path ?? asset.file).replace(/^\/+/, ""),
132
- );
133
- await mkdir(dirname(target), { recursive: true });
134
- if (source !== target) {
135
- await copyFile(source, target);
136
- }
137
- }
125
+ await Promise.all(
126
+ assets.map(async (asset) => {
127
+ const source = isAbsolute(asset.file)
128
+ ? asset.file
129
+ : resolve(outDir, asset.file);
130
+ const target = resolve(
131
+ outDir,
132
+ (asset.path ?? asset.file).replace(/^\/+/, ""),
133
+ );
134
+ await mkdir(dirname(target), { recursive: true });
135
+ if (source !== target) {
136
+ await copyFile(source, target);
137
+ }
138
+ }),
139
+ );
138
140
  }
139
141
 
140
142
  function validateRuntime(