alchemy 0.63.0 → 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 +97 -87
- package/bin/commands/init.ts +1 -1
- package/bin/services/github-workflow.ts +2 -2
- 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/cloudflare-env-proxy.js +1 -1
- package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
- package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
- package/lib/cloudflare/compatibility-date.gen.js +1 -1
- 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/hyperdrive.js +1 -1
- package/lib/cloudflare/hyperdrive.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 +2 -1
- 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/neon/project.d.ts.map +1 -1
- package/lib/neon/project.js +4 -5
- package/lib/neon/project.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/upstash/redis.js +1 -1
- package/lib/upstash/redis.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/lib/util/idempotent-spawn.d.ts.map +1 -1
- package/lib/util/idempotent-spawn.js +21 -2
- package/lib/util/idempotent-spawn.js.map +1 -1
- package/lib/util/xml.js +1 -1
- package/lib/util/xml.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/cloudflare-env-proxy.ts +1 -1
- package/src/cloudflare/compatibility-date.gen.ts +1 -1
- package/src/cloudflare/d1-local-migrations.ts +2 -2
- package/src/cloudflare/durable-object-namespace.ts +1 -1
- package/src/cloudflare/hyperdrive.ts +1 -1
- package/src/cloudflare/website.ts +88 -89
- package/src/cloudflare/worker-bundle.ts +46 -9
- package/src/cloudflare/worker-metadata.ts +3 -1
- 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/neon/project.ts +4 -5
- 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/upstash/redis.ts +1 -1
- package/src/util/dedent.ts +33 -61
- package/src/util/idempotent-spawn.ts +23 -2
- package/src/util/xml.ts +1 -1
- 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/lib/planetscale/api.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for PlanetScale API requests
|
|
3
|
-
*/
|
|
4
|
-
export interface PlanetScaleApiOptions {
|
|
5
|
-
/**
|
|
6
|
-
* PlanetScale API token (overrides environment variable)
|
|
7
|
-
*/
|
|
8
|
-
apiKey?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Minimal API client for PlanetScale using raw fetch
|
|
12
|
-
*/
|
|
13
|
-
export declare class PlanetScaleApi {
|
|
14
|
-
/** Base URL for API */
|
|
15
|
-
readonly baseUrl: string;
|
|
16
|
-
/** API token */
|
|
17
|
-
readonly apiToken: string;
|
|
18
|
-
/**
|
|
19
|
-
* Create a new API client
|
|
20
|
-
*
|
|
21
|
-
* @param options API options
|
|
22
|
-
*/
|
|
23
|
-
constructor(options?: PlanetScaleApiOptions);
|
|
24
|
-
/**
|
|
25
|
-
* Make a request to the API
|
|
26
|
-
*
|
|
27
|
-
* @param path API path (without base URL)
|
|
28
|
-
* @param init Fetch init options
|
|
29
|
-
* @returns Raw Response object from fetch
|
|
30
|
-
*/
|
|
31
|
-
private fetch;
|
|
32
|
-
/**
|
|
33
|
-
* Helper for GET requests
|
|
34
|
-
*/
|
|
35
|
-
get(path: string, init?: RequestInit): Promise<Response>;
|
|
36
|
-
/**
|
|
37
|
-
* Helper for POST requests
|
|
38
|
-
*/
|
|
39
|
-
post(path: string, body?: any, init?: RequestInit): Promise<Response>;
|
|
40
|
-
/**
|
|
41
|
-
* Helper for PUT requests
|
|
42
|
-
*/
|
|
43
|
-
put(path: string, body?: any, init?: RequestInit): Promise<Response>;
|
|
44
|
-
/**
|
|
45
|
-
* Helper for PATCH requests
|
|
46
|
-
*/
|
|
47
|
-
patch(path: string, body?: any, init?: RequestInit): Promise<Response>;
|
|
48
|
-
/**
|
|
49
|
-
* Helper for DELETE requests
|
|
50
|
-
*/
|
|
51
|
-
delete(path: string, init?: RequestInit): Promise<Response>;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/planetscale/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,uBAAuB;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,gBAAgB;IAChB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;gBACS,OAAO,GAAE,qBAA0B;IAQ/C;;;;;;OAMG;YACW,KAAK;IAgBnB;;OAEG;IACG,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIlE;;OAEG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,GAAG,EACV,IAAI,GAAE,WAAgB,GACrB,OAAO,CAAC,QAAQ,CAAC;IAQpB;;OAEG;IACG,GAAG,CACP,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,GAAG,EACV,IAAI,GAAE,WAAgB,GACrB,OAAO,CAAC,QAAQ,CAAC;IAQpB;;OAEG;IACG,KAAK,CACT,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,GAAG,EACV,IAAI,GAAE,WAAgB,GACrB,OAAO,CAAC,QAAQ,CAAC;IAQpB;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;CAGtE"}
|
package/lib/planetscale/api.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal API client for PlanetScale using raw fetch
|
|
3
|
-
*/
|
|
4
|
-
export class PlanetScaleApi {
|
|
5
|
-
/** Base URL for API */
|
|
6
|
-
baseUrl;
|
|
7
|
-
/** API token */
|
|
8
|
-
apiToken;
|
|
9
|
-
/**
|
|
10
|
-
* Create a new API client
|
|
11
|
-
*
|
|
12
|
-
* @param options API options
|
|
13
|
-
*/
|
|
14
|
-
constructor(options = {}) {
|
|
15
|
-
this.baseUrl = "https://api.planetscale.com/v1";
|
|
16
|
-
this.apiToken = options.apiKey || process.env.PLANETSCALE_API_TOKEN || "";
|
|
17
|
-
if (!this.apiToken) {
|
|
18
|
-
throw new Error("PLANETSCALE_API_TOKEN environment variable is required");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Make a request to the API
|
|
23
|
-
*
|
|
24
|
-
* @param path API path (without base URL)
|
|
25
|
-
* @param init Fetch init options
|
|
26
|
-
* @returns Raw Response object from fetch
|
|
27
|
-
*/
|
|
28
|
-
async fetch(path, init = {}) {
|
|
29
|
-
const headers = {
|
|
30
|
-
Authorization: `${this.apiToken}`,
|
|
31
|
-
"Content-Type": "application/json",
|
|
32
|
-
};
|
|
33
|
-
if (init.headers) {
|
|
34
|
-
Object.assign(headers, init.headers);
|
|
35
|
-
}
|
|
36
|
-
return fetch(`${this.baseUrl}${path}`, {
|
|
37
|
-
...init,
|
|
38
|
-
headers,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Helper for GET requests
|
|
43
|
-
*/
|
|
44
|
-
async get(path, init = {}) {
|
|
45
|
-
return this.fetch(path, { ...init, method: "GET" });
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Helper for POST requests
|
|
49
|
-
*/
|
|
50
|
-
async post(path, body, init = {}) {
|
|
51
|
-
return this.fetch(path, {
|
|
52
|
-
...init,
|
|
53
|
-
method: "POST",
|
|
54
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Helper for PUT requests
|
|
59
|
-
*/
|
|
60
|
-
async put(path, body, init = {}) {
|
|
61
|
-
return this.fetch(path, {
|
|
62
|
-
...init,
|
|
63
|
-
method: "PUT",
|
|
64
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Helper for PATCH requests
|
|
69
|
-
*/
|
|
70
|
-
async patch(path, body, init = {}) {
|
|
71
|
-
return this.fetch(path, {
|
|
72
|
-
...init,
|
|
73
|
-
method: "PATCH",
|
|
74
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Helper for DELETE requests
|
|
79
|
-
*/
|
|
80
|
-
async delete(path, init = {}) {
|
|
81
|
-
return this.fetch(path, { ...init, method: "DELETE" });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/planetscale/api.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,uBAAuB;IACd,OAAO,CAAS;IAEzB,gBAAgB;IACP,QAAQ,CAAS;IAE1B;;;;OAIG;IACH,YAAY,UAAiC,EAAE;QAC7C,IAAI,CAAC,OAAO,GAAG,gCAAgC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC;QAC1E,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACK,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,OAAoB,EAAE;QACtD,MAAM,OAAO,GAA2B;YACtC,aAAa,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE;YACjC,cAAc,EAAE,kBAAkB;SACnC,CAAC;QAEF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,EAAE;YACrC,GAAG,IAAI;YACP,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,OAAoB,EAAE;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,IAAY,EACZ,IAAU,EACV,OAAoB,EAAE;QAEtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACtB,GAAG,IAAI;YACP,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CACP,IAAY,EACZ,IAAU,EACV,OAAoB,EAAE;QAEtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACtB,GAAG,IAAI;YACP,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CACT,IAAY,EACZ,IAAU,EACV,OAAoB,EAAE;QAEtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACtB,GAAG,IAAI;YACP,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,OAAoB,EAAE;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// https://developers.cloudflare.com/workers/runtime-apis/nodejs/#supported-nodejs-apis
|
|
2
|
-
const nodejs_compat = [
|
|
3
|
-
"node:async_hooks",
|
|
4
|
-
"node:assert",
|
|
5
|
-
"node:buffer",
|
|
6
|
-
"node:console",
|
|
7
|
-
"node:crypto",
|
|
8
|
-
"node:debug",
|
|
9
|
-
"node:diagnostics_channel",
|
|
10
|
-
"node:dns",
|
|
11
|
-
"node:events",
|
|
12
|
-
"node:inspector",
|
|
13
|
-
"node:net",
|
|
14
|
-
"node:path",
|
|
15
|
-
"node:perf_hooks", // partially supported
|
|
16
|
-
"node:process",
|
|
17
|
-
"node:querystring",
|
|
18
|
-
"node:stream",
|
|
19
|
-
"node:string_decoder",
|
|
20
|
-
"node:timers",
|
|
21
|
-
"node:tls", // partially supported
|
|
22
|
-
"node:url",
|
|
23
|
-
"node:util",
|
|
24
|
-
"node:zlib",
|
|
25
|
-
// "node:*",
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
export const external = [
|
|
29
|
-
...nodejs_compat,
|
|
30
|
-
...nodejs_compat.map((p) => p.split(":")[1]),
|
|
31
|
-
"cloudflare:workers",
|
|
32
|
-
"cloudflare:workflows",
|
|
33
|
-
"cloudflare:*",
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
export const external_als = ["node:async_hooks", "async_hooks", "cloudflare:*"];
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type { Plugin, PluginBuild } from "esbuild";
|
|
2
|
-
import module from "node:module";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import pc from "picocolors";
|
|
5
|
-
import { logger } from "../../util/logger.ts";
|
|
6
|
-
|
|
7
|
-
const NODE_REGEX = new RegExp(
|
|
8
|
-
`^(node:)?(${module.builtinModules.filter((m) => m !== "async_hooks").join("|")})$`,
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* ESBuild plugin to detect node:* imports and warn about missing compatibility flags.
|
|
13
|
-
*
|
|
14
|
-
* This plugin warns when:
|
|
15
|
-
* - Any node:* import is found without nodejs_compat flag
|
|
16
|
-
* - node:async_hooks is imported without nodejs_compat or nodejs_als flags
|
|
17
|
-
*/
|
|
18
|
-
export function esbuildPluginCompatWarning(mode: "als" | null): Plugin {
|
|
19
|
-
return {
|
|
20
|
-
name: "nodejs-import-warning",
|
|
21
|
-
setup(build: PluginBuild) {
|
|
22
|
-
const packages = new Set<string>();
|
|
23
|
-
const nodeImporters = new Set<string>();
|
|
24
|
-
const alsImporters = new Set<string>();
|
|
25
|
-
|
|
26
|
-
build.onStart(() => {
|
|
27
|
-
packages.clear();
|
|
28
|
-
nodeImporters.clear();
|
|
29
|
-
alsImporters.clear();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
build.onResolve(
|
|
33
|
-
{
|
|
34
|
-
filter: NODE_REGEX,
|
|
35
|
-
},
|
|
36
|
-
(args) => {
|
|
37
|
-
packages.add(args.path);
|
|
38
|
-
nodeImporters.add(args.importer);
|
|
39
|
-
return null;
|
|
40
|
-
},
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
build.onResolve(
|
|
44
|
-
{
|
|
45
|
-
filter: /^(node:)?async_hooks$/,
|
|
46
|
-
},
|
|
47
|
-
(args) => {
|
|
48
|
-
alsImporters.add(args.importer);
|
|
49
|
-
return null;
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
build.onEnd(() => {
|
|
54
|
-
if (packages.size > 0) {
|
|
55
|
-
const formattedImports = Array.from(packages)
|
|
56
|
-
.sort()
|
|
57
|
-
.map((imp) => pc.yellow(imp))
|
|
58
|
-
.join(", ");
|
|
59
|
-
|
|
60
|
-
logger.warn(
|
|
61
|
-
[
|
|
62
|
-
`Detected Node.js imports (${formattedImports}) but ${pc.red("nodejs_compat")} compatibility flag is not set. `,
|
|
63
|
-
`Add ${pc.blue("nodejs_compat")} to your compatibility flags and ensure compatibilityDate >= 2024-09-23. Imported from:`,
|
|
64
|
-
formatImporters(
|
|
65
|
-
nodeImporters,
|
|
66
|
-
build.initialOptions.absWorkingDir ?? process.cwd(),
|
|
67
|
-
),
|
|
68
|
-
].join("\n"),
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (alsImporters.size > 0 && !mode) {
|
|
73
|
-
logger.warn(
|
|
74
|
-
[
|
|
75
|
-
`Detected import of ${pc.yellow("node:async_hooks")} but ${pc.red("nodejs_als")} compatibility flag is not set. `,
|
|
76
|
-
`Add ${pc.blue("nodejs_als")} or ${pc.blue("nodejs_compat")} to your compatibility flags. Imported from:`,
|
|
77
|
-
formatImporters(
|
|
78
|
-
alsImporters,
|
|
79
|
-
build.initialOptions.absWorkingDir ?? process.cwd(),
|
|
80
|
-
),
|
|
81
|
-
].join("\n"),
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function formatImporters(importers: Set<string>, cwd: string) {
|
|
90
|
-
return Array.from(importers)
|
|
91
|
-
.sort()
|
|
92
|
-
.map((imp) => `- ${pc.yellow(path.relative(cwd, imp))}`)
|
|
93
|
-
.join("\n");
|
|
94
|
-
}
|
package/src/planetscale/api.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for PlanetScale API requests
|
|
3
|
-
*/
|
|
4
|
-
export interface PlanetScaleApiOptions {
|
|
5
|
-
/**
|
|
6
|
-
* PlanetScale API token (overrides environment variable)
|
|
7
|
-
*/
|
|
8
|
-
apiKey?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Minimal API client for PlanetScale using raw fetch
|
|
13
|
-
*/
|
|
14
|
-
export class PlanetScaleApi {
|
|
15
|
-
/** Base URL for API */
|
|
16
|
-
readonly baseUrl: string;
|
|
17
|
-
|
|
18
|
-
/** API token */
|
|
19
|
-
readonly apiToken: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Create a new API client
|
|
23
|
-
*
|
|
24
|
-
* @param options API options
|
|
25
|
-
*/
|
|
26
|
-
constructor(options: PlanetScaleApiOptions = {}) {
|
|
27
|
-
this.baseUrl = "https://api.planetscale.com/v1";
|
|
28
|
-
this.apiToken = options.apiKey || process.env.PLANETSCALE_API_TOKEN || "";
|
|
29
|
-
if (!this.apiToken) {
|
|
30
|
-
throw new Error("PLANETSCALE_API_TOKEN environment variable is required");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Make a request to the API
|
|
36
|
-
*
|
|
37
|
-
* @param path API path (without base URL)
|
|
38
|
-
* @param init Fetch init options
|
|
39
|
-
* @returns Raw Response object from fetch
|
|
40
|
-
*/
|
|
41
|
-
private async fetch(path: string, init: RequestInit = {}): Promise<Response> {
|
|
42
|
-
const headers: Record<string, string> = {
|
|
43
|
-
Authorization: `${this.apiToken}`,
|
|
44
|
-
"Content-Type": "application/json",
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
if (init.headers) {
|
|
48
|
-
Object.assign(headers, init.headers);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return fetch(`${this.baseUrl}${path}`, {
|
|
52
|
-
...init,
|
|
53
|
-
headers,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Helper for GET requests
|
|
59
|
-
*/
|
|
60
|
-
async get(path: string, init: RequestInit = {}): Promise<Response> {
|
|
61
|
-
return this.fetch(path, { ...init, method: "GET" });
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Helper for POST requests
|
|
66
|
-
*/
|
|
67
|
-
async post(
|
|
68
|
-
path: string,
|
|
69
|
-
body?: any,
|
|
70
|
-
init: RequestInit = {},
|
|
71
|
-
): Promise<Response> {
|
|
72
|
-
return this.fetch(path, {
|
|
73
|
-
...init,
|
|
74
|
-
method: "POST",
|
|
75
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Helper for PUT requests
|
|
81
|
-
*/
|
|
82
|
-
async put(
|
|
83
|
-
path: string,
|
|
84
|
-
body?: any,
|
|
85
|
-
init: RequestInit = {},
|
|
86
|
-
): Promise<Response> {
|
|
87
|
-
return this.fetch(path, {
|
|
88
|
-
...init,
|
|
89
|
-
method: "PUT",
|
|
90
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Helper for PATCH requests
|
|
96
|
-
*/
|
|
97
|
-
async patch(
|
|
98
|
-
path: string,
|
|
99
|
-
body?: any,
|
|
100
|
-
init: RequestInit = {},
|
|
101
|
-
): Promise<Response> {
|
|
102
|
-
return this.fetch(path, {
|
|
103
|
-
...init,
|
|
104
|
-
method: "PATCH",
|
|
105
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Helper for DELETE requests
|
|
111
|
-
*/
|
|
112
|
-
async delete(path: string, init: RequestInit = {}): Promise<Response> {
|
|
113
|
-
return this.fetch(path, { ...init, method: "DELETE" });
|
|
114
|
-
}
|
|
115
|
-
}
|