alchemy 0.63.1 → 0.64.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.
- package/bin/alchemy.js +96 -86
- package/lib/alchemy.d.ts +4 -0
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +10 -4
- package/lib/alchemy.js.map +1 -1
- package/lib/apply.d.ts +3 -0
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +11 -1
- package/lib/apply.js.map +1 -1
- package/lib/cloudflare/bindings.d.ts +3 -1
- package/lib/cloudflare/bindings.d.ts.map +1 -1
- package/lib/cloudflare/bucket.d.ts +2 -1
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/bundle/cloudflare-internal.d.ts +6 -0
- package/lib/cloudflare/bundle/cloudflare-internal.d.ts.map +1 -0
- package/lib/cloudflare/bundle/cloudflare-internal.js +39 -0
- package/lib/cloudflare/bundle/cloudflare-internal.js.map +1 -0
- package/lib/cloudflare/bundle/nodejs-builtin-modules.d.ts +2 -0
- package/lib/cloudflare/bundle/nodejs-builtin-modules.d.ts.map +1 -0
- package/lib/cloudflare/bundle/nodejs-builtin-modules.js +9 -0
- package/lib/cloudflare/bundle/nodejs-builtin-modules.js.map +1 -0
- package/lib/cloudflare/bundle/plugin-als-external.d.ts +6 -0
- package/lib/cloudflare/bundle/plugin-als-external.d.ts.map +1 -0
- package/lib/cloudflare/bundle/plugin-als-external.js +12 -0
- package/lib/cloudflare/bundle/plugin-als-external.js.map +1 -0
- package/lib/cloudflare/bundle/plugin-hybrid-node-compat.d.ts +4 -1
- package/lib/cloudflare/bundle/plugin-hybrid-node-compat.d.ts.map +1 -1
- package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js +23 -23
- package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js.map +1 -1
- package/lib/cloudflare/bundle/plugin-node-compat.d.ts +11 -0
- package/lib/cloudflare/bundle/plugin-node-compat.d.ts.map +1 -0
- package/lib/cloudflare/bundle/plugin-node-compat.js +93 -0
- package/lib/cloudflare/bundle/plugin-node-compat.js.map +1 -0
- package/lib/cloudflare/d1-local-migrations.js.map +1 -1
- package/lib/cloudflare/durable-object-namespace.d.ts +1 -0
- package/lib/cloudflare/durable-object-namespace.d.ts.map +1 -1
- package/lib/cloudflare/durable-object-namespace.js.map +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +80 -82
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-bundle.d.ts +6 -0
- package/lib/cloudflare/worker-bundle.d.ts.map +1 -1
- package/lib/cloudflare/worker-bundle.js +34 -10
- package/lib/cloudflare/worker-bundle.js.map +1 -1
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
- package/lib/cloudflare/worker-metadata.js +1 -0
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +24 -6
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +2 -4
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +16 -14
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/context.d.ts +3 -1
- package/lib/context.d.ts.map +1 -1
- package/lib/context.js +2 -2
- package/lib/context.js.map +1 -1
- package/lib/destroy.d.ts +8 -0
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +20 -4
- package/lib/destroy.js.map +1 -1
- package/lib/planetscale/api/client.gen.d.ts +1750 -0
- package/lib/planetscale/api/client.gen.d.ts.map +1 -0
- package/lib/planetscale/api/client.gen.js +2401 -0
- package/lib/planetscale/api/client.gen.js.map +1 -0
- package/lib/planetscale/api/index.d.ts +3 -0
- package/lib/planetscale/api/index.d.ts.map +1 -0
- package/lib/planetscale/api/index.js +4 -0
- package/lib/planetscale/api/index.js.map +1 -0
- package/lib/planetscale/api/types.gen.d.ts +12156 -0
- package/lib/planetscale/api/types.gen.d.ts.map +1 -0
- package/lib/planetscale/api/types.gen.js +2 -0
- package/lib/planetscale/api/types.gen.js.map +1 -0
- package/lib/planetscale/branch.d.ts +5 -8
- package/lib/planetscale/branch.d.ts.map +1 -1
- package/lib/planetscale/branch.js +111 -97
- package/lib/planetscale/branch.js.map +1 -1
- package/lib/planetscale/database.d.ts +2 -6
- package/lib/planetscale/database.d.ts.map +1 -1
- package/lib/planetscale/database.js +157 -118
- package/lib/planetscale/database.js.map +1 -1
- package/lib/planetscale/index.d.ts +1 -1
- package/lib/planetscale/index.d.ts.map +1 -1
- package/lib/planetscale/index.js +1 -1
- package/lib/planetscale/index.js.map +1 -1
- package/lib/planetscale/password.d.ts +4 -7
- package/lib/planetscale/password.d.ts.map +1 -1
- package/lib/planetscale/password.js +71 -56
- package/lib/planetscale/password.js.map +1 -1
- package/lib/planetscale/utils.d.ts +8 -6
- package/lib/planetscale/utils.d.ts.map +1 -1
- package/lib/planetscale/utils.js +85 -70
- package/lib/planetscale/utils.js.map +1 -1
- package/lib/scope.d.ts +5 -1
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +11 -3
- package/lib/scope.js.map +1 -1
- package/lib/util/dedent.d.ts +3 -14
- package/lib/util/dedent.d.ts.map +1 -1
- package/lib/util/dedent.js +28 -52
- package/lib/util/dedent.js.map +1 -1
- package/package.json +4 -3
- package/src/alchemy.ts +14 -6
- package/src/apply.ts +13 -1
- package/src/cloudflare/bindings.ts +3 -1
- package/src/cloudflare/bucket.ts +3 -1
- package/src/cloudflare/bundle/cloudflare-internal.ts +42 -0
- package/src/cloudflare/bundle/nodejs-builtin-modules.ts +14 -0
- package/src/cloudflare/bundle/plugin-als-external.ts +13 -0
- package/src/cloudflare/bundle/plugin-hybrid-node-compat.ts +29 -28
- package/src/cloudflare/bundle/plugin-node-compat.ts +114 -0
- package/src/cloudflare/d1-local-migrations.ts +2 -2
- package/src/cloudflare/durable-object-namespace.ts +1 -0
- package/src/cloudflare/website.ts +88 -89
- package/src/cloudflare/worker-bundle.ts +46 -9
- package/src/cloudflare/worker-metadata.ts +2 -0
- package/src/cloudflare/worker.ts +35 -7
- package/src/cloudflare/wrangler.json.ts +108 -110
- package/src/context.ts +5 -3
- package/src/destroy.ts +26 -8
- package/src/planetscale/api/client.gen.ts +2882 -0
- package/src/planetscale/api/index.ts +4 -0
- package/src/planetscale/api/types.gen.ts +13041 -0
- package/src/planetscale/branch.ts +152 -169
- package/src/planetscale/database.ts +195 -204
- package/src/planetscale/index.ts +1 -1
- package/src/planetscale/password.ts +86 -85
- package/src/planetscale/utils.ts +141 -122
- package/src/scope.ts +12 -3
- package/src/util/dedent.ts +33 -61
- package/templates/astro/alchemy.run.ts +1 -3
- package/templates/hono/alchemy.run.ts +0 -1
- package/templates/nuxt/alchemy.run.ts +1 -3
- package/templates/react-router/alchemy.run.ts +1 -3
- package/templates/rwsdk/alchemy.run.ts +0 -2
- package/templates/sveltekit/alchemy.run.ts +1 -3
- package/templates/tanstack-start/alchemy.run.ts +1 -3
- package/templates/typescript/alchemy.run.ts +0 -1
- package/templates/vite/alchemy.run.ts +0 -1
- package/workers/cloudflare-state-store.js +58 -58
- package/lib/cloudflare/bundle/externals.d.ts +0 -3
- package/lib/cloudflare/bundle/externals.d.ts.map +0 -1
- package/lib/cloudflare/bundle/externals.js +0 -35
- package/lib/cloudflare/bundle/externals.js.map +0 -1
- package/lib/cloudflare/bundle/plugin-compat-warning.d.ts +0 -10
- package/lib/cloudflare/bundle/plugin-compat-warning.d.ts.map +0 -1
- package/lib/cloudflare/bundle/plugin-compat-warning.js +0 -67
- package/lib/cloudflare/bundle/plugin-compat-warning.js.map +0 -1
- package/lib/planetscale/api.d.ts +0 -53
- package/lib/planetscale/api.d.ts.map +0 -1
- package/lib/planetscale/api.js +0 -84
- package/lib/planetscale/api.js.map +0 -1
- package/src/cloudflare/bundle/externals.ts +0 -36
- package/src/cloudflare/bundle/plugin-compat-warning.ts +0 -94
- package/src/planetscale/api.ts +0 -115
package/src/util/dedent.ts
CHANGED
|
@@ -1,71 +1,43 @@
|
|
|
1
|
+
import assert from "node:assert";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
* This allows writing multi-line strings with proper indentation in the source code
|
|
4
|
-
* while removing that indentation in the output string.
|
|
4
|
+
* Tagged template literal for removing indentation from a block of text.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* const message = dedent`
|
|
8
|
-
* This is a multi-line string
|
|
9
|
-
* that will have its indentation removed.
|
|
10
|
-
* This line has extra indentation that will be preserved.
|
|
11
|
-
* `;
|
|
12
|
-
* // Result:
|
|
13
|
-
* // "This is a multi-line string
|
|
14
|
-
* // that will have its indentation removed.
|
|
15
|
-
* // This line has extra indentation that will be preserved."
|
|
6
|
+
* If the first line is empty, it will be ignored.
|
|
16
7
|
*/
|
|
17
|
-
export function dedent(
|
|
18
|
-
|
|
19
|
-
...values
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const lines = result.split("\n");
|
|
28
|
-
|
|
29
|
-
// Remove ALL leading blank/whitespace-only lines
|
|
30
|
-
while (lines.length > 0 && lines[0].trim() === "") {
|
|
31
|
-
lines.shift();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Remove ALL trailing blank/whitespace-only lines
|
|
35
|
-
while (lines.length > 0 && lines[lines.length - 1].trim() === "") {
|
|
36
|
-
lines.pop();
|
|
8
|
+
export function dedent(strings: TemplateStringsArray, ...values: unknown[]) {
|
|
9
|
+
// Convert template literal arguments back to a regular string
|
|
10
|
+
const raw = String.raw({ raw: strings }, ...values);
|
|
11
|
+
// Split the string by lines
|
|
12
|
+
let lines = raw.split("\n");
|
|
13
|
+
assert(lines.length > 0);
|
|
14
|
+
|
|
15
|
+
// If the last line is just whitespace, remove it
|
|
16
|
+
if (lines[lines.length - 1].trim() === "") {
|
|
17
|
+
lines = lines.slice(0, lines.length - 1);
|
|
37
18
|
}
|
|
38
19
|
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
20
|
+
// Find the minimum-length indent, excluding the first line
|
|
21
|
+
let minIndent = "";
|
|
22
|
+
// (Could use `minIndent.length` for this, but then would need to start with
|
|
23
|
+
// infinitely long string)
|
|
24
|
+
let minIndentLength = Number.POSITIVE_INFINITY;
|
|
25
|
+
for (const line of lines.slice(1)) {
|
|
26
|
+
const indent = line.match(/^[ \t]*/)?.[0];
|
|
27
|
+
if (indent != null && indent.length < minIndentLength) {
|
|
28
|
+
minIndent = indent;
|
|
29
|
+
minIndentLength = indent.length;
|
|
30
|
+
}
|
|
42
31
|
}
|
|
43
32
|
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.reduce((min, line) => {
|
|
48
|
-
const indent = line.match(/^[ \t]*/)?.[0].length || 0;
|
|
49
|
-
// Handle potentially infinite min if all lines are blank (though handled by early return)
|
|
50
|
-
return indent < min ? indent : min;
|
|
51
|
-
}, Number.POSITIVE_INFINITY);
|
|
52
|
-
|
|
53
|
-
// If minIndent remains Infinity (only blank lines existed), return empty string.
|
|
54
|
-
// This case should be caught by the lines.length check above, but belt-and-suspenders.
|
|
55
|
-
if (minIndent === Number.POSITIVE_INFINITY) {
|
|
56
|
-
return "";
|
|
33
|
+
// If the first line is just whitespace, remove it
|
|
34
|
+
if (lines.length > 0 && lines[0].trim() === "") {
|
|
35
|
+
lines = lines.slice(1);
|
|
57
36
|
}
|
|
58
37
|
|
|
59
|
-
// Remove
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
// Apply dedent only to lines with content
|
|
66
|
-
return line.substring(minIndent);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// Join the lines back together
|
|
70
|
-
return dedented.join("\n");
|
|
38
|
+
// Remove indent from all lines, and return them all joined together
|
|
39
|
+
lines = lines.map((line) =>
|
|
40
|
+
line.startsWith(minIndent) ? line.substring(minIndent.length) : line,
|
|
41
|
+
);
|
|
42
|
+
return lines.join("\n");
|
|
71
43
|
}
|
|
@@ -5,9 +5,7 @@ import { Astro } from "alchemy/cloudflare";
|
|
|
5
5
|
|
|
6
6
|
const app = await alchemy("{projectName}");
|
|
7
7
|
|
|
8
|
-
export const worker = await Astro("website"
|
|
9
|
-
name: `${app.name}-${app.stage}-website`,
|
|
10
|
-
});
|
|
8
|
+
export const worker = await Astro("website");
|
|
11
9
|
|
|
12
10
|
console.log({
|
|
13
11
|
url: worker.url,
|
|
@@ -5,9 +5,7 @@ import { Nuxt } from "alchemy/cloudflare";
|
|
|
5
5
|
|
|
6
6
|
const app = await alchemy("{projectName}");
|
|
7
7
|
|
|
8
|
-
export const worker = await Nuxt("website"
|
|
9
|
-
name: `${app.name}-${app.stage}-website`,
|
|
10
|
-
});
|
|
8
|
+
export const worker = await Nuxt("website");
|
|
11
9
|
|
|
12
10
|
console.log({
|
|
13
11
|
url: worker.url,
|
|
@@ -5,9 +5,7 @@ import { ReactRouter } from "alchemy/cloudflare";
|
|
|
5
5
|
|
|
6
6
|
const app = await alchemy("{projectName}");
|
|
7
7
|
|
|
8
|
-
export const worker = await ReactRouter("website"
|
|
9
|
-
name: `${app.name}-${app.stage}-website`,
|
|
10
|
-
});
|
|
8
|
+
export const worker = await ReactRouter("website");
|
|
11
9
|
|
|
12
10
|
console.log({
|
|
13
11
|
url: worker.url,
|
|
@@ -5,12 +5,10 @@ import { D1Database, DurableObjectNamespace, Redwood } from "alchemy/cloudflare"
|
|
|
5
5
|
const app = await alchemy("{projectName}");
|
|
6
6
|
|
|
7
7
|
const database = await D1Database("database", {
|
|
8
|
-
name: `${app.name}-${app.stage}-database`,
|
|
9
8
|
migrationsDir: "migrations",
|
|
10
9
|
});
|
|
11
10
|
|
|
12
11
|
export const worker = await Redwood("website", {
|
|
13
|
-
name: `${app.name}-${app.stage}-website`,
|
|
14
12
|
bindings: {
|
|
15
13
|
AUTH_SECRET_KEY: alchemy.secret(process.env.AUTH_SECRET_KEY),
|
|
16
14
|
DB: database,
|
|
@@ -5,9 +5,7 @@ import { SvelteKit } from "alchemy/cloudflare";
|
|
|
5
5
|
|
|
6
6
|
const app = await alchemy("{projectName}");
|
|
7
7
|
|
|
8
|
-
export const worker = await SvelteKit("website"
|
|
9
|
-
name: `${app.name}-${app.stage}-website`,
|
|
10
|
-
});
|
|
8
|
+
export const worker = await SvelteKit("website");
|
|
11
9
|
|
|
12
10
|
console.log({
|
|
13
11
|
url: worker.url,
|
|
@@ -5,9 +5,7 @@ import { TanStackStart } from "alchemy/cloudflare";
|
|
|
5
5
|
|
|
6
6
|
const app = await alchemy("{projectName}");
|
|
7
7
|
|
|
8
|
-
export const worker = await TanStackStart("website"
|
|
9
|
-
name: `${app.name}-${app.stage}-website`,
|
|
10
|
-
});
|
|
8
|
+
export const worker = await TanStackStart("website");
|
|
11
9
|
|
|
12
10
|
console.log({
|
|
13
11
|
url: worker.url,
|