@tschk/moonshine-deploy-cloudflare 0.3.7 → 0.4.1
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/package.json +8 -8
- 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
|
+
"version": "0.4.1",
|
|
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-
|
|
19
|
-
"@tschk/moonshine-
|
|
20
|
-
"@tschk/moonshine-
|
|
21
|
-
"@tschk/moonshine-
|
|
22
|
-
"@tschk/moonshine-
|
|
23
|
-
"@tschk/moonshine-server": "^0.3.6"
|
|
18
|
+
"@tschk/moonshine-compiler": "^0.4.1",
|
|
19
|
+
"@tschk/moonshine-framework": "^0.4.1",
|
|
20
|
+
"@tschk/moonshine-react": "^0.4.1",
|
|
21
|
+
"@tschk/moonshine-router": "^0.4.1",
|
|
22
|
+
"@tschk/moonshine-server": "^0.4.1"
|
|
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.4.1"
|
|
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-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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(
|