alchemy 0.21.0 → 0.22.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/lib/ai/astro-file.d.ts +4 -4
- package/lib/ai/client.d.ts +1 -1
- package/lib/ai/css-file.d.ts +4 -4
- package/lib/ai/data.d.ts +4 -4
- package/lib/ai/document.d.ts +5 -5
- package/lib/ai/html-file.d.ts +4 -4
- package/lib/ai/index.d.ts +10 -10
- package/lib/ai/json-file.d.ts +4 -4
- package/lib/ai/typescript-file.d.ts +4 -4
- package/lib/ai/vue-file.d.ts +4 -4
- package/lib/ai/yaml-file.d.ts +4 -4
- package/lib/alchemy.d.ts +5 -5
- package/lib/apply.d.ts +2 -2
- package/lib/aws/bucket.d.ts +2 -2
- package/lib/aws/control/error.d.ts +1 -1
- package/lib/aws/control/index.d.ts +4 -4
- package/lib/aws/control/resource.d.ts +2 -2
- package/lib/aws/credentials.d.ts +1 -1
- package/lib/aws/function.d.ts +3 -3
- package/lib/aws/index.d.ts +9 -9
- package/lib/aws/oidc/github-oidc-provider.d.ts +1 -1
- package/lib/aws/oidc/index.d.ts +2 -2
- package/lib/aws/oidc/oidc-provider.d.ts +2 -2
- package/lib/aws/policy-attachment.d.ts +2 -2
- package/lib/aws/policy.d.ts +2 -2
- package/lib/aws/queue.d.ts +2 -2
- package/lib/aws/role.d.ts +3 -3
- package/lib/aws/ses.d.ts +2 -2
- package/lib/aws/table.d.ts +2 -2
- package/lib/cloudflare/account-api-token.d.ts +5 -5
- package/lib/cloudflare/account-id.d.ts +1 -1
- package/lib/cloudflare/ai-gateway.d.ts +3 -3
- package/lib/cloudflare/api.d.ts +2 -2
- package/lib/cloudflare/assets.d.ts +2 -2
- package/lib/cloudflare/auth.d.ts +1 -1
- package/lib/cloudflare/bindings.d.ts +18 -18
- package/lib/cloudflare/bound.d.ts +16 -16
- package/lib/cloudflare/bucket.d.ts +4 -4
- package/lib/cloudflare/bundle/bundle-worker.d.ts +2 -2
- package/lib/cloudflare/bundle/bundle-worker.d.ts.map +1 -1
- package/lib/cloudflare/bundle/bundle-worker.js +4 -0
- package/lib/cloudflare/bundle/bundle-worker.js.map +1 -1
- package/lib/cloudflare/bundle/wasm-plugin.d.ts +3 -0
- package/lib/cloudflare/bundle/wasm-plugin.d.ts.map +1 -0
- package/lib/cloudflare/bundle/wasm-plugin.js +53 -0
- package/lib/cloudflare/bundle/wasm-plugin.js.map +1 -0
- package/lib/cloudflare/custom-domain.d.ts +3 -3
- package/lib/cloudflare/custom-domain.js.map +1 -1
- package/lib/cloudflare/d1-clone.d.ts +3 -3
- package/lib/cloudflare/d1-database.d.ts +3 -3
- package/lib/cloudflare/d1-export.d.ts +1 -1
- package/lib/cloudflare/d1-import.d.ts +1 -1
- package/lib/cloudflare/d1-migrations.d.ts +1 -1
- package/lib/cloudflare/dns-records.d.ts +4 -4
- package/lib/cloudflare/durable-object-namespace.d.ts +1 -1
- package/lib/cloudflare/event-source.d.ts +2 -2
- package/lib/cloudflare/hyperdrive.d.ts +4 -4
- package/lib/cloudflare/index.d.ts +40 -39
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +1 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts +3 -3
- package/lib/cloudflare/nuxt.d.ts +4 -4
- package/lib/cloudflare/nuxt.d.ts.map +1 -1
- package/lib/cloudflare/nuxt.js +2 -1
- package/lib/cloudflare/nuxt.js.map +1 -1
- package/lib/cloudflare/permission-groups.d.ts +3 -3
- package/lib/cloudflare/pipeline.d.ts +4 -4
- package/lib/cloudflare/queue-consumer.d.ts +4 -4
- package/lib/cloudflare/queue.d.ts +3 -3
- package/lib/cloudflare/r2-rest-state-store.d.ts +3 -3
- package/lib/cloudflare/react-router.d.ts +13 -0
- package/lib/cloudflare/react-router.d.ts.map +1 -0
- package/lib/cloudflare/react-router.js +29 -0
- package/lib/cloudflare/react-router.js.map +1 -0
- package/lib/cloudflare/redwood.d.ts +4 -4
- package/lib/cloudflare/route.d.ts +4 -4
- package/lib/cloudflare/tanstack-start.d.ts +4 -4
- package/lib/cloudflare/user.d.ts +2 -2
- package/lib/cloudflare/vectorize-index.d.ts +3 -3
- package/lib/cloudflare/vectorize-metadata-index.d.ts +4 -4
- package/lib/cloudflare/vite.d.ts +4 -4
- package/lib/cloudflare/website.d.ts +3 -3
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +30 -35
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts +3 -3
- package/lib/cloudflare/worker-metadata.d.ts +5 -5
- package/lib/cloudflare/worker-stub.d.ts +3 -3
- package/lib/cloudflare/worker.d.ts +12 -11
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +2 -1
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/workflow.d.ts +2 -2
- package/lib/cloudflare/wrangler.json.d.ts +13 -2
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +1 -0
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/cloudflare/zone.d.ts +4 -4
- package/lib/context.d.ts +3 -3
- package/lib/destroy.d.ts +2 -2
- package/lib/dns/import-dns.d.ts +3 -3
- package/lib/dns/index.d.ts +2 -2
- package/lib/esbuild/bundle.d.ts +2 -2
- package/lib/esbuild/index.d.ts +1 -1
- package/lib/fs/copy-file.d.ts +2 -2
- package/lib/fs/file-system-state-store.d.ts +2 -2
- package/lib/fs/file.d.ts +5 -5
- package/lib/fs/folder.d.ts +2 -2
- package/lib/fs/index.d.ts +14 -14
- package/lib/fs/static-astro-file.d.ts +1 -1
- package/lib/fs/static-css-file.d.ts +1 -1
- package/lib/fs/static-html-file.d.ts +1 -1
- package/lib/fs/static-json-file.d.ts +1 -1
- package/lib/fs/static-text-file.d.ts +1 -1
- package/lib/fs/static-typescript-file.d.ts +1 -1
- package/lib/fs/static-vue-file.d.ts +1 -1
- package/lib/fs/static-yaml-file.d.ts +1 -1
- package/lib/github/index.d.ts +2 -2
- package/lib/github/repository-environment.d.ts +2 -2
- package/lib/github/secret.d.ts +3 -3
- package/lib/index.d.ts +10 -10
- package/lib/internal/docs/providers.d.ts +2 -2
- package/lib/neon/api.d.ts +1 -1
- package/lib/neon/index.d.ts +3 -3
- package/lib/neon/project.d.ts +4 -4
- package/lib/os/exec.d.ts +2 -2
- package/lib/os/index.d.ts +1 -1
- package/lib/resource.d.ts +2 -2
- package/lib/runtime/bind.d.ts +3 -3
- package/lib/runtime/global.d.ts +1 -1
- package/lib/runtime/state.d.ts +1 -1
- package/lib/scope.d.ts +3 -3
- package/lib/sentry/api.d.ts +1 -1
- package/lib/sentry/client-key.d.ts +3 -3
- package/lib/sentry/index.d.ts +4 -4
- package/lib/sentry/project.d.ts +3 -3
- package/lib/sentry/team.d.ts +3 -3
- package/lib/serde.d.ts +3 -3
- package/lib/state.d.ts +2 -2
- package/lib/stripe/index.d.ts +4 -4
- package/lib/stripe/index.d.ts.map +1 -1
- package/lib/stripe/index.js +1 -1
- package/lib/stripe/index.js.map +1 -1
- package/lib/stripe/meter.d.ts +2 -2
- package/lib/stripe/price.d.ts +2 -2
- package/lib/stripe/product.d.ts +2 -2
- package/lib/stripe/webhook.d.ts +2 -2
- package/lib/test/bun.d.ts +3 -3
- package/lib/upstash/api.d.ts +1 -1
- package/lib/upstash/index.d.ts +3 -3
- package/lib/upstash/redis.d.ts +4 -4
- package/lib/vercel/api.d.ts +1 -1
- package/lib/vercel/index.d.ts +3 -3
- package/lib/vercel/project-domain.d.ts +3 -3
- package/lib/vercel/project.d.ts +4 -4
- package/lib/web/astro.d.ts +2 -2
- package/lib/web/shadcn-component.d.ts +2 -2
- package/lib/web/shadcn.d.ts +3 -3
- package/lib/web/tailwind.d.ts +2 -2
- package/lib/web/vite.d.ts +2 -2
- package/lib/web/vitepress/config.d.ts +1 -1
- package/lib/web/vitepress/custom-theme.d.ts +4 -4
- package/lib/web/vitepress/dependencies.d.ts +2 -2
- package/lib/web/vitepress/home-page.d.ts +3 -3
- package/lib/web/vitepress/index.d.ts +5 -5
- package/lib/web/vitepress/vitepress.d.ts +2 -2
- package/package.json +7 -7
- package/src/ai/astro-file.ts +5 -5
- package/src/ai/client.ts +1 -1
- package/src/ai/css-file.ts +5 -5
- package/src/ai/data.ts +5 -5
- package/src/ai/document.ts +5 -5
- package/src/ai/html-file.ts +5 -5
- package/src/ai/index.ts +10 -10
- package/src/ai/json-file.ts +6 -6
- package/src/ai/typescript-file.ts +5 -5
- package/src/ai/vue-file.ts +5 -5
- package/src/ai/yaml-file.ts +6 -6
- package/src/alchemy.ts +9 -9
- package/src/apply.ts +6 -6
- package/src/aws/bucket.ts +3 -3
- package/src/aws/control/client.ts +1 -1
- package/src/aws/control/error.ts +1 -1
- package/src/aws/control/index.ts +4 -4
- package/src/aws/control/proxy.ts +1 -1
- package/src/aws/control/resource.ts +5 -5
- package/src/aws/credentials.ts +1 -1
- package/src/aws/function.ts +4 -4
- package/src/aws/index.ts +9 -9
- package/src/aws/oidc/github-oidc-provider.ts +1 -1
- package/src/aws/oidc/index.ts +2 -2
- package/src/aws/oidc/oidc-provider.ts +3 -3
- package/src/aws/policy-attachment.ts +3 -3
- package/src/aws/policy.ts +2 -2
- package/src/aws/queue.ts +2 -2
- package/src/aws/role.ts +4 -4
- package/src/aws/ses.ts +3 -3
- package/src/aws/table.ts +4 -4
- package/src/cloudflare/account-api-token.ts +7 -7
- package/src/cloudflare/account-id.ts +1 -1
- package/src/cloudflare/ai-gateway.ts +6 -6
- package/src/cloudflare/api.ts +5 -5
- package/src/cloudflare/assets.ts +3 -3
- package/src/cloudflare/auth.ts +1 -1
- package/src/cloudflare/bindings.ts +18 -18
- package/src/cloudflare/bound.ts +16 -16
- package/src/cloudflare/bucket.ts +7 -7
- package/src/cloudflare/bundle/bundle-worker.ts +12 -8
- package/src/cloudflare/bundle/local-dev-cloudflare-shim.ts +1 -1
- package/src/cloudflare/bundle/nodejs-compat.ts +1 -1
- package/src/cloudflare/bundle/wasm-plugin.ts +57 -0
- package/src/cloudflare/custom-domain.ts +5 -5
- package/src/cloudflare/d1-clone.ts +3 -3
- package/src/cloudflare/d1-database.ts +7 -7
- package/src/cloudflare/d1-export.ts +1 -1
- package/src/cloudflare/d1-import.ts +1 -1
- package/src/cloudflare/d1-migrations.ts +2 -2
- package/src/cloudflare/dns-records.ts +5 -5
- package/src/cloudflare/durable-object-namespace.ts +1 -1
- package/src/cloudflare/event-source.ts +2 -2
- package/src/cloudflare/hyperdrive.ts +7 -7
- package/src/cloudflare/index.ts +40 -39
- package/src/cloudflare/kv-namespace.ts +7 -7
- package/src/cloudflare/nuxt.ts +6 -5
- package/src/cloudflare/permission-groups.ts +3 -3
- package/src/cloudflare/pipeline.ts +7 -7
- package/src/cloudflare/queue-consumer.ts +5 -5
- package/src/cloudflare/queue.ts +6 -6
- package/src/cloudflare/r2-rest-state-store.ts +8 -8
- package/src/cloudflare/react-router.ts +45 -0
- package/src/cloudflare/redwood.ts +4 -4
- package/src/cloudflare/route.ts +5 -5
- package/src/cloudflare/tanstack-start.ts +4 -4
- package/src/cloudflare/user.ts +3 -3
- package/src/cloudflare/vectorize-index.ts +6 -6
- package/src/cloudflare/vectorize-metadata-index.ts +5 -5
- package/src/cloudflare/vite.ts +4 -4
- package/src/cloudflare/website.ts +42 -48
- package/src/cloudflare/worker-assets.ts +4 -4
- package/src/cloudflare/worker-metadata.ts +7 -7
- package/src/cloudflare/worker-stub.ts +4 -4
- package/src/cloudflare/worker.ts +36 -33
- package/src/cloudflare/workflow.ts +3 -3
- package/src/cloudflare/wrangler.json.ts +17 -2
- package/src/cloudflare/zone.ts +5 -5
- package/src/context.ts +4 -4
- package/src/destroy.ts +4 -4
- package/src/dns/import-dns.ts +3 -3
- package/src/dns/index.ts +2 -2
- package/src/esbuild/bundle.ts +2 -2
- package/src/esbuild/index.ts +1 -1
- package/src/fs/copy-file.ts +3 -3
- package/src/fs/file-system-state-store.ts +5 -5
- package/src/fs/file.ts +7 -7
- package/src/fs/folder.ts +3 -3
- package/src/fs/index.ts +14 -14
- package/src/fs/static-astro-file.ts +1 -1
- package/src/fs/static-css-file.ts +1 -1
- package/src/fs/static-html-file.ts +1 -1
- package/src/fs/static-json-file.ts +1 -1
- package/src/fs/static-text-file.ts +1 -1
- package/src/fs/static-typescript-file.ts +1 -1
- package/src/fs/static-vue-file.ts +1 -1
- package/src/fs/static-yaml-file.ts +1 -1
- package/src/github/index.ts +2 -2
- package/src/github/repository-environment.ts +3 -3
- package/src/github/secret.ts +4 -4
- package/src/index.ts +10 -10
- package/src/internal/docs/providers.ts +4 -4
- package/src/neon/api.ts +2 -2
- package/src/neon/index.ts +3 -3
- package/src/neon/project.ts +6 -6
- package/src/os/exec.ts +2 -2
- package/src/os/index.ts +1 -1
- package/src/resource.ts +3 -3
- package/src/runtime/bind.ts +7 -7
- package/src/runtime/global.ts +1 -1
- package/src/runtime/state.ts +1 -1
- package/src/scope.ts +5 -5
- package/src/secret.ts +1 -1
- package/src/sentry/api.ts +2 -2
- package/src/sentry/client-key.ts +4 -4
- package/src/sentry/index.ts +4 -4
- package/src/sentry/project.ts +4 -4
- package/src/sentry/team.ts +4 -4
- package/src/serde.ts +4 -4
- package/src/state.ts +3 -3
- package/src/stripe/index.ts +4 -4
- package/src/stripe/meter.ts +2 -2
- package/src/stripe/price.ts +2 -2
- package/src/stripe/product.ts +2 -2
- package/src/stripe/webhook.ts +2 -2
- package/src/test/bun.ts +5 -5
- package/src/upstash/api.ts +1 -1
- package/src/upstash/index.ts +3 -3
- package/src/upstash/redis.ts +6 -6
- package/src/vercel/api.ts +2 -2
- package/src/vercel/index.ts +3 -3
- package/src/vercel/project-domain.ts +4 -4
- package/src/vercel/project.ts +4 -4
- package/src/web/astro.ts +7 -7
- package/src/web/shadcn-component.ts +3 -3
- package/src/web/shadcn.ts +6 -6
- package/src/web/tailwind.ts +4 -4
- package/src/web/vite.ts +8 -8
- package/src/web/vitepress/config.ts +1 -1
- package/src/web/vitepress/custom-theme.ts +10 -10
- package/src/web/vitepress/dependencies.ts +2 -2
- package/src/web/vitepress/home-page.ts +4 -4
- package/src/web/vitepress/index.ts +5 -5
- package/src/web/vitepress/vitepress.ts +7 -7
- package/lib/runtime/shims.d.ts +0 -6
- package/lib/runtime/shims.d.ts.map +0 -1
- package/lib/runtime/shims.js +0 -27
- package/lib/runtime/shims.js.map +0 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
1
|
import path from "node:path";
|
|
3
|
-
import { alchemy } from "../alchemy.
|
|
4
|
-
import { Exec } from "../os/exec.
|
|
5
|
-
import { Assets } from "./assets.
|
|
6
|
-
import type { Bindings } from "./bindings.
|
|
7
|
-
import {
|
|
8
|
-
|
|
2
|
+
import { alchemy } from "../alchemy.ts";
|
|
3
|
+
import { Exec } from "../os/exec.ts";
|
|
4
|
+
import { Assets } from "./assets.ts";
|
|
5
|
+
import type { Bindings } from "./bindings.ts";
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_COMPATIBILITY_DATE,
|
|
8
|
+
Worker,
|
|
9
|
+
type AssetsConfig,
|
|
10
|
+
type WorkerProps,
|
|
11
|
+
} from "./worker.ts";
|
|
12
|
+
import { WranglerJson } from "./wrangler.json.ts";
|
|
9
13
|
|
|
10
14
|
export interface WebsiteProps<B extends Bindings>
|
|
11
15
|
extends Omit<WorkerProps<B>, "name" | "assets" | "entrypoint"> {
|
|
@@ -69,9 +73,6 @@ export async function Website<B extends Bindings>(
|
|
|
69
73
|
const wrangler = props.wrangler ?? true;
|
|
70
74
|
|
|
71
75
|
return alchemy.run(id, async () => {
|
|
72
|
-
// building the site requires a wrangler.jsonc file to start
|
|
73
|
-
// - so initialize an empty one if it doesn't exist
|
|
74
|
-
|
|
75
76
|
const cwd = path.resolve(props.cwd || process.cwd());
|
|
76
77
|
const fileName =
|
|
77
78
|
typeof wrangler === "boolean"
|
|
@@ -84,35 +85,17 @@ export async function Website<B extends Bindings>(
|
|
|
84
85
|
const wranglerMain =
|
|
85
86
|
typeof wrangler === "object" ? (wrangler.main ?? props.main) : props.main;
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
await fs.access(wranglerPath!);
|
|
90
|
-
} catch {
|
|
91
|
-
await fs.writeFile(
|
|
92
|
-
wranglerPath!,
|
|
93
|
-
JSON.stringify(
|
|
94
|
-
{
|
|
95
|
-
name: id,
|
|
96
|
-
main: wranglerMain,
|
|
97
|
-
compatibility_date: new Date().toISOString().split("T")[0],
|
|
98
|
-
compatibility_flags: props.compatibilityFlags ?? [],
|
|
99
|
-
},
|
|
100
|
-
null,
|
|
101
|
-
2,
|
|
102
|
-
),
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
88
|
+
const workerName = props.name ?? id;
|
|
106
89
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
const assetDir =
|
|
91
|
+
typeof props.assets === "string"
|
|
92
|
+
? props.assets
|
|
93
|
+
: (props.assets?.dist ?? "dist");
|
|
111
94
|
|
|
112
|
-
|
|
113
|
-
const worker = await Worker("worker", {
|
|
95
|
+
const workerProps = {
|
|
114
96
|
...props,
|
|
115
|
-
|
|
97
|
+
compatibilityDate: props.compatibilityDate ?? DEFAULT_COMPATIBILITY_DATE,
|
|
98
|
+
name: workerName,
|
|
116
99
|
entrypoint: props.main,
|
|
117
100
|
assets: {
|
|
118
101
|
html_handling: "auto-trailing-slash",
|
|
@@ -130,25 +113,36 @@ export default {
|
|
|
130
113
|
};`,
|
|
131
114
|
url: true,
|
|
132
115
|
adopt: true,
|
|
133
|
-
|
|
134
|
-
...props.bindings,
|
|
135
|
-
ASSETS: await Assets("assets", {
|
|
136
|
-
path:
|
|
137
|
-
typeof props.assets === "string"
|
|
138
|
-
? props.assets
|
|
139
|
-
: (props.assets?.dist ?? "dist"),
|
|
140
|
-
}),
|
|
141
|
-
},
|
|
142
|
-
});
|
|
116
|
+
} as WorkerProps<any> & { name: string };
|
|
143
117
|
|
|
144
118
|
if (wrangler) {
|
|
145
119
|
await WranglerJson("wrangler.jsonc", {
|
|
146
120
|
path: wranglerPath,
|
|
147
|
-
worker,
|
|
121
|
+
worker: workerProps,
|
|
148
122
|
main: wranglerMain,
|
|
123
|
+
// hard-code the assets directory because we haven't yet included the assets binding
|
|
124
|
+
assets: {
|
|
125
|
+
binding: "ASSETS",
|
|
126
|
+
directory: assetDir,
|
|
127
|
+
},
|
|
149
128
|
});
|
|
150
129
|
}
|
|
151
130
|
|
|
152
|
-
|
|
131
|
+
await Exec("build", {
|
|
132
|
+
cwd,
|
|
133
|
+
command: props.command,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return (await Worker("worker", {
|
|
137
|
+
...workerProps,
|
|
138
|
+
bindings: {
|
|
139
|
+
...workerProps.bindings,
|
|
140
|
+
// we don't include the Assets binding until after build to make sure the asset manifest is correct
|
|
141
|
+
// we generate the wrangler.json using all the bind
|
|
142
|
+
ASSETS: await Assets("assets", {
|
|
143
|
+
path: assetDir,
|
|
144
|
+
}),
|
|
145
|
+
},
|
|
146
|
+
} as WorkerProps<any> & { name: string })) as Website<B>;
|
|
153
147
|
});
|
|
154
148
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { getContentType } from "../util/content-type.
|
|
5
|
-
import type { CloudflareApi } from "./api.
|
|
6
|
-
import type { Assets } from "./assets.
|
|
7
|
-
import type { AssetsConfig, WorkerProps } from "./worker.
|
|
4
|
+
import { getContentType } from "../util/content-type.ts";
|
|
5
|
+
import type { CloudflareApi } from "./api.ts";
|
|
6
|
+
import type { Assets } from "./assets.ts";
|
|
7
|
+
import type { AssetsConfig, WorkerProps } from "./worker.ts";
|
|
8
8
|
|
|
9
9
|
export interface AssetUploadResult {
|
|
10
10
|
completionToken: string;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { Context } from "../context.
|
|
2
|
-
import { slugify } from "../util/slugify.
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { slugify } from "../util/slugify.ts";
|
|
3
3
|
import {
|
|
4
4
|
Self,
|
|
5
5
|
type Bindings,
|
|
6
6
|
type WorkerBindingDurableObjectNamespace,
|
|
7
7
|
type WorkerBindingSpec,
|
|
8
|
-
} from "./bindings.
|
|
8
|
+
} from "./bindings.ts";
|
|
9
9
|
import {
|
|
10
10
|
isDurableObjectNamespace,
|
|
11
11
|
type DurableObjectNamespace,
|
|
12
|
-
} from "./durable-object-namespace.
|
|
13
|
-
import { createAssetConfig, type AssetUploadResult } from "./worker-assets.
|
|
14
|
-
import type { SingleStepMigration } from "./worker-migration.
|
|
15
|
-
import type { AssetsConfig, Worker, WorkerProps } from "./worker.
|
|
12
|
+
} from "./durable-object-namespace.ts";
|
|
13
|
+
import { createAssetConfig, type AssetUploadResult } from "./worker-assets.ts";
|
|
14
|
+
import type { SingleStepMigration } from "./worker-migration.ts";
|
|
15
|
+
import type { AssetsConfig, Worker, WorkerProps } from "./worker.ts";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Metadata returned by Cloudflare API for a worker script
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Context } from "../context.
|
|
2
|
-
import { Resource, ResourceKind } from "../resource.
|
|
3
|
-
import { handleApiError } from "./api-error.
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { Resource, ResourceKind } from "../resource.ts";
|
|
3
|
+
import { handleApiError } from "./api-error.ts";
|
|
4
4
|
import {
|
|
5
5
|
createCloudflareApi,
|
|
6
6
|
type CloudflareApi,
|
|
7
7
|
type CloudflareApiOptions,
|
|
8
|
-
} from "./api.
|
|
8
|
+
} from "./api.ts";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Properties for creating a Worker stub
|
package/src/cloudflare/worker.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import type { Context } from "../context.
|
|
3
|
-
import type { BundleProps } from "../esbuild/bundle.
|
|
4
|
-
import { InnerResourceScope, Resource, ResourceKind } from "../resource.
|
|
5
|
-
import { getBindKey, tryGetBinding } from "../runtime/bind.
|
|
6
|
-
import { isRuntime } from "../runtime/global.
|
|
7
|
-
import { bootstrapPlugin } from "../runtime/plugin.
|
|
8
|
-
import { Scope } from "../scope.
|
|
9
|
-
import { Secret, secret } from "../secret.
|
|
10
|
-
import { serializeScope } from "../serde.
|
|
11
|
-
import type { type } from "../type.
|
|
12
|
-
import { withExponentialBackoff } from "../util/retry.
|
|
13
|
-
import { slugify } from "../util/slugify.
|
|
14
|
-
import { CloudflareApiError, handleApiError } from "./api-error.
|
|
2
|
+
import type { Context } from "../context.ts";
|
|
3
|
+
import type { BundleProps } from "../esbuild/bundle.ts";
|
|
4
|
+
import { InnerResourceScope, Resource, ResourceKind } from "../resource.ts";
|
|
5
|
+
import { getBindKey, tryGetBinding } from "../runtime/bind.ts";
|
|
6
|
+
import { isRuntime } from "../runtime/global.ts";
|
|
7
|
+
import { bootstrapPlugin } from "../runtime/plugin.ts";
|
|
8
|
+
import { Scope } from "../scope.ts";
|
|
9
|
+
import { Secret, secret } from "../secret.ts";
|
|
10
|
+
import { serializeScope } from "../serde.ts";
|
|
11
|
+
import type { type } from "../type.ts";
|
|
12
|
+
import { withExponentialBackoff } from "../util/retry.ts";
|
|
13
|
+
import { slugify } from "../util/slugify.ts";
|
|
14
|
+
import { CloudflareApiError, handleApiError } from "./api-error.ts";
|
|
15
15
|
import {
|
|
16
16
|
type CloudflareApi,
|
|
17
17
|
type CloudflareApiOptions,
|
|
18
18
|
createCloudflareApi,
|
|
19
|
-
} from "./api.
|
|
20
|
-
import type { Assets } from "./assets.
|
|
19
|
+
} from "./api.ts";
|
|
20
|
+
import type { Assets } from "./assets.ts";
|
|
21
21
|
import {
|
|
22
22
|
type Binding,
|
|
23
23
|
type Bindings,
|
|
24
24
|
Json,
|
|
25
25
|
type WorkerBindingSpec,
|
|
26
|
-
} from "./bindings.
|
|
27
|
-
import type { Bound } from "./bound.
|
|
28
|
-
import { isBucket } from "./bucket.
|
|
29
|
-
import { bundleWorkerScript } from "./bundle/bundle-worker.
|
|
30
|
-
import { isD1Database } from "./d1-database.
|
|
26
|
+
} from "./bindings.ts";
|
|
27
|
+
import type { Bound } from "./bound.ts";
|
|
28
|
+
import { isBucket } from "./bucket.ts";
|
|
29
|
+
import { bundleWorkerScript } from "./bundle/bundle-worker.ts";
|
|
30
|
+
import { isD1Database } from "./d1-database.ts";
|
|
31
31
|
import {
|
|
32
32
|
DurableObjectNamespace,
|
|
33
33
|
isDurableObjectNamespace,
|
|
34
|
-
} from "./durable-object-namespace.
|
|
34
|
+
} from "./durable-object-namespace.ts";
|
|
35
35
|
import {
|
|
36
36
|
type EventSource,
|
|
37
37
|
type QueueEventSource,
|
|
38
38
|
isQueueEventSource,
|
|
39
|
-
} from "./event-source.
|
|
40
|
-
import { isKVNamespace } from "./kv-namespace.
|
|
41
|
-
import { isPipeline } from "./pipeline.
|
|
39
|
+
} from "./event-source.ts";
|
|
40
|
+
import { isKVNamespace } from "./kv-namespace.ts";
|
|
41
|
+
import { isPipeline } from "./pipeline.ts";
|
|
42
42
|
import {
|
|
43
43
|
QueueConsumer,
|
|
44
44
|
deleteQueueConsumer,
|
|
45
45
|
listQueueConsumers,
|
|
46
|
-
} from "./queue-consumer.
|
|
47
|
-
import { type QueueResource, isQueue } from "./queue.
|
|
48
|
-
import { isVectorizeIndex } from "./vectorize-index.
|
|
49
|
-
import { type AssetUploadResult, uploadAssets } from "./worker-assets.
|
|
46
|
+
} from "./queue-consumer.ts";
|
|
47
|
+
import { type QueueResource, isQueue } from "./queue.ts";
|
|
48
|
+
import { isVectorizeIndex } from "./vectorize-index.ts";
|
|
49
|
+
import { type AssetUploadResult, uploadAssets } from "./worker-assets.ts";
|
|
50
50
|
import {
|
|
51
51
|
type WorkerMetadata,
|
|
52
52
|
type WorkerScriptMetadata,
|
|
53
53
|
prepareWorkerMetadata,
|
|
54
|
-
} from "./worker-metadata.
|
|
55
|
-
import type { SingleStepMigration } from "./worker-migration.
|
|
56
|
-
import { WorkerStub, isWorkerStub } from "./worker-stub.
|
|
57
|
-
import { type Workflow, upsertWorkflow } from "./workflow.
|
|
54
|
+
} from "./worker-metadata.ts";
|
|
55
|
+
import type { SingleStepMigration } from "./worker-migration.ts";
|
|
56
|
+
import { WorkerStub, isWorkerStub } from "./worker-stub.ts";
|
|
57
|
+
import { type Workflow, upsertWorkflow } from "./workflow.ts";
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Configuration options for static assets
|
|
@@ -683,6 +683,8 @@ export function Worker<const B extends Bindings>(
|
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
+
export const DEFAULT_COMPATIBILITY_DATE = "2025-04-20";
|
|
687
|
+
|
|
686
688
|
export const _Worker = Resource(
|
|
687
689
|
"cloudflare::Worker",
|
|
688
690
|
{
|
|
@@ -699,7 +701,8 @@ export const _Worker = Resource(
|
|
|
699
701
|
// Use the provided name
|
|
700
702
|
const workerName = props.name ?? id;
|
|
701
703
|
|
|
702
|
-
const compatibilityDate =
|
|
704
|
+
const compatibilityDate =
|
|
705
|
+
props.compatibilityDate ?? DEFAULT_COMPATIBILITY_DATE;
|
|
703
706
|
const compatibilityFlags = props.compatibilityFlags ?? [];
|
|
704
707
|
|
|
705
708
|
const uploadWorkerScript = async (props: WorkerProps<B>) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { handleApiError } from "./api-error.
|
|
2
|
-
import type { CloudflareApi } from "./api.
|
|
3
|
-
import type { Binding } from "./bindings.
|
|
1
|
+
import { handleApiError } from "./api-error.ts";
|
|
2
|
+
import type { CloudflareApi } from "./api.ts";
|
|
3
|
+
import type { Binding } from "./bindings.ts";
|
|
4
4
|
|
|
5
5
|
export interface WorkflowProps {
|
|
6
6
|
/**
|
|
@@ -7,7 +7,7 @@ import type { DurableObjectNamespace } from "./durable-object-namespace.js";
|
|
|
7
7
|
import type { EventSource } from "./event-source.js";
|
|
8
8
|
import { isQueueEventSource } from "./event-source.js";
|
|
9
9
|
import { isQueue } from "./queue.js";
|
|
10
|
-
import type { Worker } from "./worker.js";
|
|
10
|
+
import type { Worker, WorkerProps } from "./worker.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Properties for wrangler.json configuration file
|
|
@@ -17,7 +17,11 @@ export interface WranglerJsonProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* The worker to generate the wrangler.json file for
|
|
19
19
|
*/
|
|
20
|
-
worker:
|
|
20
|
+
worker:
|
|
21
|
+
| Worker
|
|
22
|
+
| (WorkerProps<any> & {
|
|
23
|
+
name: string;
|
|
24
|
+
});
|
|
21
25
|
/**
|
|
22
26
|
* Path to write the wrangler.json file to
|
|
23
27
|
*
|
|
@@ -31,6 +35,16 @@ export interface WranglerJsonProps {
|
|
|
31
35
|
* @default worker.entrypoint
|
|
32
36
|
*/
|
|
33
37
|
main?: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Path to the assets directory
|
|
41
|
+
*
|
|
42
|
+
* @default inferred from the worker's Asset bindings
|
|
43
|
+
*/
|
|
44
|
+
assets?: {
|
|
45
|
+
binding: string;
|
|
46
|
+
directory: string;
|
|
47
|
+
};
|
|
34
48
|
}
|
|
35
49
|
|
|
36
50
|
/**
|
|
@@ -92,6 +106,7 @@ export const WranglerJson = Resource(
|
|
|
92
106
|
// see: https://developers.cloudflare.com/workers/configuration/compatibility-dates/
|
|
93
107
|
compatibility_date: worker.compatibilityDate,
|
|
94
108
|
compatibility_flags: props.worker.compatibilityFlags,
|
|
109
|
+
assets: props.assets,
|
|
95
110
|
};
|
|
96
111
|
|
|
97
112
|
// Process bindings if they exist
|
package/src/cloudflare/zone.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Context } from "../context.
|
|
2
|
-
import { Resource } from "../resource.
|
|
3
|
-
import { handleApiError } from "./api-error.
|
|
4
|
-
import { createCloudflareApi, type CloudflareApiOptions } from "./api.
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { Resource } from "../resource.ts";
|
|
3
|
+
import { handleApiError } from "./api-error.ts";
|
|
4
|
+
import { createCloudflareApi, type CloudflareApiOptions } from "./api.ts";
|
|
5
5
|
import type {
|
|
6
6
|
AlwaysUseHTTPSValue,
|
|
7
7
|
AutomaticHTTPSRewritesValue,
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
UpdateZoneSettingParams,
|
|
21
21
|
WebSocketsValue,
|
|
22
22
|
ZeroRTTValue,
|
|
23
|
-
} from "./zone-settings.
|
|
23
|
+
} from "./zone-settings.ts";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Properties for creating or updating a Zone
|
package/src/context.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DestroyedSignal } from "./destroy.
|
|
1
|
+
import { DestroyedSignal } from "./destroy.ts";
|
|
2
2
|
import {
|
|
3
3
|
ResourceFQN,
|
|
4
4
|
ResourceID,
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
ResourceSeq,
|
|
8
8
|
type Resource,
|
|
9
9
|
type ResourceProps,
|
|
10
|
-
} from "./resource.
|
|
11
|
-
import type { Scope } from "./scope.
|
|
12
|
-
import type { State } from "./state.
|
|
10
|
+
} from "./resource.ts";
|
|
11
|
+
import type { Scope } from "./scope.ts";
|
|
12
|
+
import type { State } from "./state.ts";
|
|
13
13
|
|
|
14
14
|
export type Context<
|
|
15
15
|
Out extends Resource,
|
package/src/destroy.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { alchemy } from "./alchemy.
|
|
2
|
-
import { context } from "./context.
|
|
1
|
+
import { alchemy } from "./alchemy.ts";
|
|
2
|
+
import { context } from "./context.ts";
|
|
3
3
|
import {
|
|
4
4
|
resolveDeletionHandler,
|
|
5
5
|
type Resource,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
ResourceKind,
|
|
9
9
|
ResourceScope,
|
|
10
10
|
ResourceSeq,
|
|
11
|
-
} from "./resource.
|
|
12
|
-
import { Scope } from "./scope.
|
|
11
|
+
} from "./resource.ts";
|
|
12
|
+
import { Scope } from "./scope.ts";
|
|
13
13
|
|
|
14
14
|
export class DestroyedSignal extends Error {}
|
|
15
15
|
|
package/src/dns/import-dns.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Context } from "../context.
|
|
2
|
-
import { Resource } from "../resource.
|
|
3
|
-
import { DEFAULT_RECORD_TYPES, type DnsRecordType } from "./record.
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { Resource } from "../resource.ts";
|
|
3
|
+
import { DEFAULT_RECORD_TYPES, type DnsRecordType } from "./record.ts";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* DNS record response structure from Cloudflare DNS API
|
package/src/dns/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./import-dns.
|
|
2
|
-
export * from "./record.
|
|
1
|
+
export * from "./import-dns.ts";
|
|
2
|
+
export * from "./record.ts";
|
package/src/esbuild/bundle.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type esbuild from "esbuild";
|
|
|
2
2
|
import crypto from "node:crypto";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import type { Context } from "../context.
|
|
6
|
-
import { Resource } from "../resource.
|
|
5
|
+
import type { Context } from "../context.ts";
|
|
6
|
+
import { Resource } from "../resource.ts";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Properties for creating or updating an esbuild bundle
|
package/src/esbuild/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./bundle.
|
|
1
|
+
export * from "./bundle.ts";
|
package/src/fs/copy-file.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import type { Context } from "../context.
|
|
3
|
-
import { Resource } from "../resource.
|
|
4
|
-
import { ignore } from "../util/ignore.
|
|
2
|
+
import type { Context } from "../context.ts";
|
|
3
|
+
import { Resource } from "../resource.ts";
|
|
4
|
+
import { ignore } from "../util/ignore.ts";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Properties for creating a CopyFile resource
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { ResourceScope } from "../resource.
|
|
4
|
-
import type { Scope } from "../scope.
|
|
5
|
-
import { serialize } from "../serde.
|
|
6
|
-
import { deserializeState, type State, type StateStore } from "../state.
|
|
7
|
-
import { ignore } from "../util/ignore.
|
|
3
|
+
import { ResourceScope } from "../resource.ts";
|
|
4
|
+
import type { Scope } from "../scope.ts";
|
|
5
|
+
import { serialize } from "../serde.ts";
|
|
6
|
+
import { deserializeState, type State, type StateStore } from "../state.ts";
|
|
7
|
+
import { ignore } from "../util/ignore.ts";
|
|
8
8
|
|
|
9
9
|
const stateRootDir = path.join(process.cwd(), ".alchemy");
|
|
10
10
|
|
package/src/fs/file.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import type { Context } from "../context.
|
|
4
|
-
import { Resource } from "../resource.
|
|
5
|
-
import { ignore } from "../util/ignore.
|
|
3
|
+
import type { Context } from "../context.ts";
|
|
4
|
+
import { Resource } from "../resource.ts";
|
|
5
|
+
import { ignore } from "../util/ignore.ts";
|
|
6
6
|
|
|
7
|
-
import { alchemy } from "../alchemy.
|
|
8
|
-
import type { FileCollection } from "./file-collection.
|
|
9
|
-
import type { FileRef } from "./file-ref.
|
|
7
|
+
import { alchemy } from "../alchemy.ts";
|
|
8
|
+
import type { FileCollection } from "./file-collection.ts";
|
|
9
|
+
import type { FileRef } from "./file-ref.ts";
|
|
10
10
|
|
|
11
|
-
declare module "../alchemy.
|
|
11
|
+
declare module "../alchemy.ts" {
|
|
12
12
|
interface Alchemy {
|
|
13
13
|
/**
|
|
14
14
|
* Creates a reference to a file in the filesystem.
|
package/src/fs/folder.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import type { Context } from "../context.
|
|
3
|
-
import { Resource } from "../resource.
|
|
4
|
-
import { ignore } from "../util/ignore.
|
|
2
|
+
import type { Context } from "../context.ts";
|
|
3
|
+
import { Resource } from "../resource.ts";
|
|
4
|
+
import { ignore } from "../util/ignore.ts";
|
|
5
5
|
|
|
6
6
|
export interface FolderProps {
|
|
7
7
|
/**
|
package/src/fs/index.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from "./copy-file.
|
|
2
|
-
export * from "./file-collection.
|
|
3
|
-
export * from "./file-ref.
|
|
4
|
-
export * from "./file-system-state-store.
|
|
5
|
-
export * from "./file.
|
|
6
|
-
export * from "./folder.
|
|
7
|
-
export * from "./static-astro-file.
|
|
8
|
-
export * from "./static-css-file.
|
|
9
|
-
export * from "./static-html-file.
|
|
10
|
-
export * from "./static-json-file.
|
|
11
|
-
export * from "./static-text-file.
|
|
12
|
-
export * from "./static-typescript-file.
|
|
13
|
-
export * from "./static-vue-file.
|
|
14
|
-
export * from "./static-yaml-file.
|
|
1
|
+
export * from "./copy-file.ts";
|
|
2
|
+
export * from "./file-collection.ts";
|
|
3
|
+
export * from "./file-ref.ts";
|
|
4
|
+
export * from "./file-system-state-store.ts";
|
|
5
|
+
export * from "./file.ts";
|
|
6
|
+
export * from "./folder.ts";
|
|
7
|
+
export * from "./static-astro-file.ts";
|
|
8
|
+
export * from "./static-css-file.ts";
|
|
9
|
+
export * from "./static-html-file.ts";
|
|
10
|
+
export * from "./static-json-file.ts";
|
|
11
|
+
export * from "./static-text-file.ts";
|
|
12
|
+
export * from "./static-typescript-file.ts";
|
|
13
|
+
export * from "./static-vue-file.ts";
|
|
14
|
+
export * from "./static-yaml-file.ts";
|
package/src/github/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./repository-environment.
|
|
2
|
-
export * from "./secret.
|
|
1
|
+
export * from "./repository-environment.ts";
|
|
2
|
+
export * from "./secret.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Context } from "../context.
|
|
2
|
-
import { Resource } from "../resource.
|
|
3
|
-
import { createGitHubClient, verifyGitHubAuth } from "./client.
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { Resource } from "../resource.ts";
|
|
3
|
+
import { createGitHubClient, verifyGitHubAuth } from "./client.ts";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Properties for creating or updating a GitHub Repository Environment
|
package/src/github/secret.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import sodium from "libsodium-wrappers";
|
|
2
|
-
import type { Context } from "../context.
|
|
3
|
-
import { Resource } from "../resource.
|
|
4
|
-
import type { Secret } from "../secret.
|
|
5
|
-
import { createGitHubClient, verifyGitHubAuth } from "./client.
|
|
2
|
+
import type { Context } from "../context.ts";
|
|
3
|
+
import { Resource } from "../resource.ts";
|
|
4
|
+
import type { Secret } from "../secret.ts";
|
|
5
|
+
import { createGitHubClient, verifyGitHubAuth } from "./client.ts";
|
|
6
6
|
/**
|
|
7
7
|
* Properties for creating or updating a GitHub Secret
|
|
8
8
|
*/
|