alchemy 0.12.18 → 0.12.19
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/cloudflare/bundle/external.d.ts.map +1 -0
- package/lib/cloudflare/{external.js → bundle/external.js} +2 -0
- package/lib/cloudflare/bundle/external.js.map +1 -0
- package/lib/cloudflare/bundle/hybrid-nodejs-compat.d.ts +11 -0
- package/lib/cloudflare/bundle/hybrid-nodejs-compat.d.ts.map +1 -0
- package/lib/cloudflare/bundle/hybrid-nodejs-compat.js +198 -0
- package/lib/cloudflare/bundle/hybrid-nodejs-compat.js.map +1 -0
- package/lib/cloudflare/bundle/local-dev-cloudflare-shim.d.ts.map +1 -0
- package/lib/cloudflare/bundle/local-dev-cloudflare-shim.js.map +1 -0
- package/lib/cloudflare/index.d.ts +2 -2
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +2 -2
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +11 -6
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/neon/project.d.ts +2 -2
- package/lib/neon/project.d.ts.map +1 -1
- package/lib/neon/project.js +1 -1
- package/lib/neon/project.js.map +1 -1
- package/lib/serde.d.ts.map +1 -1
- package/lib/serde.js +4 -0
- package/lib/serde.js.map +1 -1
- package/lib/test/prune.js +1 -0
- package/lib/test/prune.js.map +1 -1
- package/lib/util/dedent.d.ts +18 -0
- package/lib/util/dedent.d.ts.map +1 -0
- package/lib/util/dedent.js +61 -0
- package/lib/util/dedent.js.map +1 -0
- package/package.json +3 -1
- package/src/cloudflare/{external.ts → bundle/external.ts} +2 -0
- package/src/cloudflare/bundle/hybrid-nodejs-compat.ts +249 -0
- package/src/cloudflare/index.ts +2 -2
- package/src/cloudflare/worker.ts +17 -7
- package/src/neon/project.ts +4 -4
- package/src/serde.ts +3 -0
- package/src/test/prune.ts +1 -0
- package/src/util/dedent.ts +71 -0
- package/lib/cloudflare/external.d.ts.map +0 -1
- package/lib/cloudflare/external.js.map +0 -1
- package/lib/cloudflare/local-dev-cloudflare-shim.d.ts.map +0 -1
- package/lib/cloudflare/local-dev-cloudflare-shim.js.map +0 -1
- /package/lib/cloudflare/{external.d.ts → bundle/external.d.ts} +0 -0
- /package/lib/cloudflare/{local-dev-cloudflare-shim.d.ts → bundle/local-dev-cloudflare-shim.d.ts} +0 -0
- /package/lib/cloudflare/{local-dev-cloudflare-shim.js → bundle/local-dev-cloudflare-shim.js} +0 -0
- /package/src/cloudflare/{local-dev-cloudflare-shim.ts → bundle/local-dev-cloudflare-shim.ts} +0 -0
package/lib/test/prune.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prune.js","sourceRoot":"","sources":["../../src/test/prune.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,SAAiB,EACjB,UAAmB;IAEnB,MAAM,YAAY,GAAG,MAAM,oBAAoB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAEvE,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;IAED,2DAA2D;IAC3D,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,OAAO,CAAC,GAAG,CAAC,YAAY,YAAY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C;YACvB,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC,2BAA2B,EAAE,UAAU,CAAC;YACnD,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,OAAO,YAAY,CAAC;QACtB,CAAC;QAED,6CAA6C;QAC7C,MAAM,aAAa,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEzE,oCAAoC;QACpC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC;QACnC,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;YAC9B,0CAA0C;YAC1C,IACE,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC;gBACjC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACzB,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EACzB,CAAC;gBACD,SAAS;YACX,CAAC;YAED,MAAM,YAAY,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC7C,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;QACtE,uCAAuC;QACvC,OAAO,YAAY,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes common indentation from template literals to make them more readable in code.
|
|
3
|
+
* This allows writing multi-line strings with proper indentation in the source code
|
|
4
|
+
* while removing that indentation in the output string.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
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."
|
|
16
|
+
*/
|
|
17
|
+
export declare function dedent(strings: TemplateStringsArray, ...values: any[]): string;
|
|
18
|
+
//# sourceMappingURL=dedent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedent.d.ts","sourceRoot":"","sources":["../../src/util/dedent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CACpB,OAAO,EAAE,oBAAoB,EAC7B,GAAG,MAAM,EAAE,GAAG,EAAE,GACf,MAAM,CAmDR"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes common indentation from template literals to make them more readable in code.
|
|
3
|
+
* This allows writing multi-line strings with proper indentation in the source code
|
|
4
|
+
* while removing that indentation in the output string.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
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."
|
|
16
|
+
*/
|
|
17
|
+
export function dedent(strings, ...values) {
|
|
18
|
+
// Combine the template strings and values
|
|
19
|
+
let result = strings.reduce((acc, str, i) => {
|
|
20
|
+
return acc + str + (values[i] !== undefined ? values[i] : "");
|
|
21
|
+
}, "");
|
|
22
|
+
// Split into lines
|
|
23
|
+
let lines = result.split("\n");
|
|
24
|
+
// Remove ALL leading blank/whitespace-only lines
|
|
25
|
+
while (lines.length > 0 && lines[0].trim() === "") {
|
|
26
|
+
lines.shift();
|
|
27
|
+
}
|
|
28
|
+
// Remove ALL trailing blank/whitespace-only lines
|
|
29
|
+
while (lines.length > 0 && lines[lines.length - 1].trim() === "") {
|
|
30
|
+
lines.pop();
|
|
31
|
+
}
|
|
32
|
+
// If there are no lines left after trimming, return an empty string
|
|
33
|
+
if (lines.length === 0) {
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
// Find the minimum indentation level (excluding empty/whitespace lines)
|
|
37
|
+
const minIndent = lines
|
|
38
|
+
.filter((line) => line.trim().length > 0) // Only consider non-blank lines for indent calculation
|
|
39
|
+
.reduce((min, line) => {
|
|
40
|
+
const indent = line.match(/^[ \t]*/)?.[0].length || 0;
|
|
41
|
+
// Handle potentially infinite min if all lines are blank (though handled by early return)
|
|
42
|
+
return indent < min ? indent : min;
|
|
43
|
+
}, Infinity);
|
|
44
|
+
// If minIndent remains Infinity (only blank lines existed), return empty string.
|
|
45
|
+
// This case should be caught by the lines.length check above, but belt-and-suspenders.
|
|
46
|
+
if (minIndent === Infinity) {
|
|
47
|
+
return "";
|
|
48
|
+
}
|
|
49
|
+
// Remove the common indentation from each line
|
|
50
|
+
const dedented = lines.map((line) => {
|
|
51
|
+
// Preserve internal blank lines as empty strings, don't try to substring them
|
|
52
|
+
if (line.trim().length === 0) {
|
|
53
|
+
return "";
|
|
54
|
+
}
|
|
55
|
+
// Apply dedent only to lines with content
|
|
56
|
+
return line.substring(minIndent);
|
|
57
|
+
});
|
|
58
|
+
// Join the lines back together
|
|
59
|
+
return dedented.join("\n");
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=dedent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedent.js","sourceRoot":"","sources":["../../src/util/dedent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GA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AAM,IAAI,CAAC,CAAC;QACtD,0FAA0F;QAC1F,OAAO,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;IACrC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAEf,iFAAiF;IACjF,uFAAuF;IACvF,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAClC,8EAA8E;QAC9E,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,0CAA0C;QAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,+BAA+B;IAC/B,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "./lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@aws-sdk/client-sesv2": "^3.0.0",
|
|
44
44
|
"@aws-sdk/client-sqs": "^3.0.0",
|
|
45
45
|
"@aws-sdk/client-sts": "^3.0.0",
|
|
46
|
+
"@cloudflare/unenv-preset": "^2.3.1",
|
|
46
47
|
"@iarna/toml": "^2.2.5",
|
|
47
48
|
"@octokit/rest": "^21.1.1",
|
|
48
49
|
"ai": "^4.0.0",
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
"prettier": "^3.0.0",
|
|
59
60
|
"stripe": "^17.0.0",
|
|
60
61
|
"turndown": "^7.0.0",
|
|
62
|
+
"unenv": "2.0.0-rc.15",
|
|
61
63
|
"xdg-app-paths": "^8.0.0",
|
|
62
64
|
"yaml": "^2.0.0",
|
|
63
65
|
"zod": "^3.0.0"
|
|
@@ -21,10 +21,12 @@ const nodejs_compat = [
|
|
|
21
21
|
"node:url",
|
|
22
22
|
"node:util",
|
|
23
23
|
"node:zlib",
|
|
24
|
+
// "node:*",
|
|
24
25
|
];
|
|
25
26
|
|
|
26
27
|
export const external = [
|
|
27
28
|
...nodejs_compat,
|
|
28
29
|
...nodejs_compat.map((p) => p.split(":")[1]),
|
|
29
30
|
"cloudflare:workers",
|
|
31
|
+
// "cloudflare:*",
|
|
30
32
|
];
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/deployment-bundle/esbuild-plugins/hybrid-nodejs-compat.ts#L17
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Plugin, PluginBuild } from "esbuild";
|
|
6
|
+
import assert from "node:assert";
|
|
7
|
+
import { builtinModules } from "node:module";
|
|
8
|
+
import nodePath from "node:path";
|
|
9
|
+
import { dedent } from "../../util/dedent";
|
|
10
|
+
// import dedent from "ts-dedent";
|
|
11
|
+
// import { getBasePath } from "../../paths";
|
|
12
|
+
|
|
13
|
+
const REQUIRED_NODE_BUILT_IN_NAMESPACE = "node-built-in-modules";
|
|
14
|
+
const REQUIRED_UNENV_ALIAS_NAMESPACE = "required-unenv-alias";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* ESBuild plugin to apply the unenv preset.
|
|
18
|
+
*
|
|
19
|
+
* @returns ESBuild plugin
|
|
20
|
+
*/
|
|
21
|
+
export async function nodejsHybridPlugin(): Promise<Plugin> {
|
|
22
|
+
// `unenv` and `@cloudflare/unenv-preset` only publish esm
|
|
23
|
+
const { defineEnv } = await import("unenv");
|
|
24
|
+
const { cloudflare } = await import("@cloudflare/unenv-preset");
|
|
25
|
+
const { alias, inject, external, polyfill } = defineEnv({
|
|
26
|
+
presets: [cloudflare],
|
|
27
|
+
npmShims: true,
|
|
28
|
+
}).env;
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
name: "hybrid-nodejs_compat",
|
|
32
|
+
setup(build) {
|
|
33
|
+
errorOnServiceWorkerFormat(build);
|
|
34
|
+
handleRequireCallsToNodeJSBuiltins(build);
|
|
35
|
+
handleUnenvAliasedPackages(build, alias, external);
|
|
36
|
+
handleNodeJSGlobals(build, inject, polyfill);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const NODEJS_MODULES_RE = new RegExp(`^(node:)?(${builtinModules.join("|")})$`);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* If we are bundling a "Service Worker" formatted Worker, imports of external modules,
|
|
45
|
+
* which won't be inlined/bundled by esbuild, are invalid.
|
|
46
|
+
*
|
|
47
|
+
* This `onResolve()` handler will error if it identifies node.js external imports.
|
|
48
|
+
*/
|
|
49
|
+
function errorOnServiceWorkerFormat(build: PluginBuild) {
|
|
50
|
+
const paths = new Set();
|
|
51
|
+
build.onStart(() => paths.clear());
|
|
52
|
+
build.onResolve({ filter: NODEJS_MODULES_RE }, (args) => {
|
|
53
|
+
paths.add(args.path);
|
|
54
|
+
return null;
|
|
55
|
+
});
|
|
56
|
+
build.onEnd(() => {
|
|
57
|
+
if (build.initialOptions.format === "iife" && paths.size > 0) {
|
|
58
|
+
const pathList = new Intl.ListFormat("en-US").format(
|
|
59
|
+
Array.from(paths.keys())
|
|
60
|
+
.map((p) => `"${p}"`)
|
|
61
|
+
.sort()
|
|
62
|
+
);
|
|
63
|
+
return {
|
|
64
|
+
errors: [
|
|
65
|
+
{
|
|
66
|
+
text: dedent`
|
|
67
|
+
Unexpected external import of ${pathList}.
|
|
68
|
+
Your worker has no default export, which means it is assumed to be a Service Worker format Worker.
|
|
69
|
+
Did you mean to create a ES Module format Worker?
|
|
70
|
+
If so, try adding \`export default { ... }\` in your entry-point.
|
|
71
|
+
See https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/.
|
|
72
|
+
`,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* We must convert `require()` calls for Node.js modules to a virtual ES Module that can be imported avoiding the require calls.
|
|
82
|
+
* We do this by creating a special virtual ES module that re-exports the library in an onLoad handler.
|
|
83
|
+
* The onLoad handler is triggered by matching the "namespace" added to the resolve.
|
|
84
|
+
*/
|
|
85
|
+
function handleRequireCallsToNodeJSBuiltins(build: PluginBuild) {
|
|
86
|
+
build.onResolve({ filter: NODEJS_MODULES_RE }, (args) => {
|
|
87
|
+
if (args.kind === "require-call") {
|
|
88
|
+
return {
|
|
89
|
+
path: args.path,
|
|
90
|
+
namespace: REQUIRED_NODE_BUILT_IN_NAMESPACE,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
build.onLoad(
|
|
95
|
+
{ filter: /.*/, namespace: REQUIRED_NODE_BUILT_IN_NAMESPACE },
|
|
96
|
+
({ path }) => {
|
|
97
|
+
return {
|
|
98
|
+
contents: dedent`
|
|
99
|
+
import libDefault from '${path}';
|
|
100
|
+
module.exports = libDefault;`,
|
|
101
|
+
loader: "js",
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Handles aliased NPM packages.
|
|
109
|
+
*
|
|
110
|
+
* @param build ESBuild PluginBuild.
|
|
111
|
+
* @param alias Aliases resolved to absolute paths.
|
|
112
|
+
* @param external external modules.
|
|
113
|
+
*/
|
|
114
|
+
function handleUnenvAliasedPackages(
|
|
115
|
+
build: PluginBuild,
|
|
116
|
+
alias: Record<string, string>,
|
|
117
|
+
external: readonly string[]
|
|
118
|
+
) {
|
|
119
|
+
// esbuild expects alias paths to be absolute
|
|
120
|
+
const aliasAbsolute: Record<string, string> = {};
|
|
121
|
+
for (const [module, unresolvedAlias] of Object.entries(alias)) {
|
|
122
|
+
try {
|
|
123
|
+
aliasAbsolute[module] = require.resolve(unresolvedAlias);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
// this is an alias for package that is not installed in the current app => ignore
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const UNENV_ALIAS_RE = new RegExp(
|
|
130
|
+
`^(${Object.keys(aliasAbsolute).join("|")})$`
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
build.onResolve({ filter: UNENV_ALIAS_RE }, (args) => {
|
|
134
|
+
const unresolvedAlias = alias[args.path];
|
|
135
|
+
// Convert `require()` calls for NPM packages to a virtual ES Module that can be imported avoiding the require calls.
|
|
136
|
+
// Note: Does not apply to Node.js packages that are handled in `handleRequireCallsToNodeJSBuiltins`
|
|
137
|
+
if (
|
|
138
|
+
args.kind === "require-call" &&
|
|
139
|
+
(unresolvedAlias.startsWith("unenv/npm/") ||
|
|
140
|
+
unresolvedAlias.startsWith("unenv/mock/"))
|
|
141
|
+
) {
|
|
142
|
+
return {
|
|
143
|
+
path: args.path,
|
|
144
|
+
namespace: REQUIRED_UNENV_ALIAS_NAMESPACE,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Resolve the alias to its absolute path and potentially mark it as external
|
|
149
|
+
return {
|
|
150
|
+
path: aliasAbsolute[args.path],
|
|
151
|
+
external: external.includes(unresolvedAlias),
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
build.onLoad(
|
|
156
|
+
{ filter: /.*/, namespace: REQUIRED_UNENV_ALIAS_NAMESPACE },
|
|
157
|
+
({ path }) => {
|
|
158
|
+
return {
|
|
159
|
+
contents: dedent`
|
|
160
|
+
import * as esm from '${path}';
|
|
161
|
+
module.exports = Object.entries(esm)
|
|
162
|
+
.filter(([k,]) => k !== 'default')
|
|
163
|
+
.reduce((cjs, [k, value]) =>
|
|
164
|
+
Object.defineProperty(cjs, k, { value, enumerable: true }),
|
|
165
|
+
"default" in esm ? esm.default : {}
|
|
166
|
+
);`,
|
|
167
|
+
loader: "js",
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Inject node globals defined in unenv's preset `inject` and `polyfill` properties.
|
|
175
|
+
*
|
|
176
|
+
* - an `inject` injects virtual module defining the name on `globalThis`
|
|
177
|
+
* - a `polyfill` is injected directly
|
|
178
|
+
*/
|
|
179
|
+
function handleNodeJSGlobals(
|
|
180
|
+
build: PluginBuild,
|
|
181
|
+
inject: Record<string, string | readonly string[]>,
|
|
182
|
+
polyfill: readonly string[]
|
|
183
|
+
) {
|
|
184
|
+
const UNENV_VIRTUAL_MODULE_RE = /_virtual_unenv_global_polyfill-(.+)$/;
|
|
185
|
+
const prefix = nodePath.resolve(
|
|
186
|
+
// getBasePath(),
|
|
187
|
+
import.meta.dirname,
|
|
188
|
+
"_virtual_unenv_global_polyfill-"
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Map of module identifiers to
|
|
193
|
+
* - `injectedName`: the name injected on `globalThis`
|
|
194
|
+
* - `exportName`: the export name from the module
|
|
195
|
+
* - `importName`: the imported name
|
|
196
|
+
*/
|
|
197
|
+
const injectsByModule = new Map<
|
|
198
|
+
string,
|
|
199
|
+
{ injectedName: string; exportName: string; importName: string }[]
|
|
200
|
+
>();
|
|
201
|
+
|
|
202
|
+
// Module specifier (i.e. `/unenv/runtime/node/...`) keyed by path (i.e. `/prefix/_virtual_unenv_global_polyfill-...`)
|
|
203
|
+
const virtualModulePathToSpecifier = new Map<string, string>();
|
|
204
|
+
|
|
205
|
+
for (const [injectedName, moduleSpecifier] of Object.entries(inject)) {
|
|
206
|
+
const [module, exportName, importName] = Array.isArray(moduleSpecifier)
|
|
207
|
+
? [moduleSpecifier[0], moduleSpecifier[1], moduleSpecifier[1]]
|
|
208
|
+
: [moduleSpecifier, "default", "defaultExport"];
|
|
209
|
+
|
|
210
|
+
if (!injectsByModule.has(module)) {
|
|
211
|
+
injectsByModule.set(module, []);
|
|
212
|
+
virtualModulePathToSpecifier.set(
|
|
213
|
+
prefix + module.replaceAll("/", "-"),
|
|
214
|
+
module
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
218
|
+
injectsByModule.get(module)!.push({ injectedName, exportName, importName });
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
build.initialOptions.inject = [
|
|
222
|
+
...(build.initialOptions.inject ?? []),
|
|
223
|
+
// Inject the virtual modules
|
|
224
|
+
...virtualModulePathToSpecifier.keys(),
|
|
225
|
+
// Inject the polyfills - needs an absolute path
|
|
226
|
+
...polyfill.map((m) => require.resolve(m)),
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
build.onResolve({ filter: UNENV_VIRTUAL_MODULE_RE }, ({ path }) => ({
|
|
230
|
+
path,
|
|
231
|
+
}));
|
|
232
|
+
|
|
233
|
+
build.onLoad({ filter: UNENV_VIRTUAL_MODULE_RE }, ({ path }) => {
|
|
234
|
+
const module = virtualModulePathToSpecifier.get(path);
|
|
235
|
+
assert(module, `Expected ${path} to be mapped to a module specifier`);
|
|
236
|
+
const injects = injectsByModule.get(module);
|
|
237
|
+
assert(injects, `Expected ${module} to inject values`);
|
|
238
|
+
|
|
239
|
+
const imports = injects.map(({ exportName, importName }) =>
|
|
240
|
+
importName === exportName ? exportName : `${exportName} as ${importName}`
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
contents: dedent`
|
|
245
|
+
import { ${imports.join(", ")} } from "${module}";
|
|
246
|
+
${injects.map(({ injectedName, importName }) => `globalThis.${injectedName} = ${importName};`).join("\n")}`,
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
}
|
package/src/cloudflare/index.ts
CHANGED
|
@@ -8,14 +8,14 @@ export * from "./bindings.js";
|
|
|
8
8
|
export * from "./bound.js";
|
|
9
9
|
export * from "./browser-rendering.js";
|
|
10
10
|
export * from "./bucket.js";
|
|
11
|
+
export * from "./bundle/external.js";
|
|
12
|
+
export * from "./bundle/local-dev-cloudflare-shim.js";
|
|
11
13
|
export * from "./custom-domain.js";
|
|
12
14
|
export * from "./d1-database.js";
|
|
13
15
|
export * from "./dns-records.js";
|
|
14
16
|
export * from "./durable-object-namespace.js";
|
|
15
|
-
export * from "./external.js";
|
|
16
17
|
export * from "./hyperdrive.js";
|
|
17
18
|
export * from "./kv-namespace.js";
|
|
18
|
-
export * from "./local-dev-cloudflare-shim.js";
|
|
19
19
|
export * from "./nuxt.js";
|
|
20
20
|
export * from "./permission-groups.js";
|
|
21
21
|
export * from "./pipeline.js";
|
package/src/cloudflare/worker.ts
CHANGED
|
@@ -15,9 +15,10 @@ import {
|
|
|
15
15
|
import type { Assets } from "./assets.js";
|
|
16
16
|
import type { Bindings, WorkerBindingSpec } from "./bindings.js";
|
|
17
17
|
import type { Bound } from "./bound.js";
|
|
18
|
+
import { external } from "./bundle/external.js";
|
|
19
|
+
import { nodejsHybridPlugin } from "./bundle/hybrid-nodejs-compat.js";
|
|
18
20
|
import type { DurableObjectNamespace } from "./durable-object-namespace.js";
|
|
19
21
|
import { type EventSource, isQueueEventSource } from "./event-source.js";
|
|
20
|
-
import { external } from "./external.js";
|
|
21
22
|
import {
|
|
22
23
|
QueueConsumer,
|
|
23
24
|
deleteQueueConsumer,
|
|
@@ -364,8 +365,12 @@ export const Worker = Resource(
|
|
|
364
365
|
|
|
365
366
|
const oldBindings = await this.get<Bindings>("bindings");
|
|
366
367
|
|
|
368
|
+
const compatibilityDate = props.compatibilityDate ?? "2025-04-20";
|
|
369
|
+
const compatibilityFlags = props.compatibilityFlags ?? [];
|
|
370
|
+
|
|
367
371
|
// Get the script content - either from props.script, or by bundling
|
|
368
|
-
const scriptContent =
|
|
372
|
+
const scriptContent =
|
|
373
|
+
props.script ?? (await bundleWorkerScript(compatibilityDate, props));
|
|
369
374
|
|
|
370
375
|
// Find any assets bindings
|
|
371
376
|
const assetsBindings: { name: string; assets: Assets }[] = [];
|
|
@@ -399,9 +404,6 @@ export const Worker = Resource(
|
|
|
399
404
|
);
|
|
400
405
|
}
|
|
401
406
|
|
|
402
|
-
const compatibilityDate = props.compatibilityDate ?? "2025-04-20";
|
|
403
|
-
const compatibilityFlags = props.compatibilityFlags ?? [];
|
|
404
|
-
|
|
405
407
|
// Prepare metadata with bindings
|
|
406
408
|
const scriptMetadata = await prepareWorkerMetadata(
|
|
407
409
|
this,
|
|
@@ -928,13 +930,16 @@ async function assertWorkerDoesNotExist<B extends Bindings>(
|
|
|
928
930
|
}
|
|
929
931
|
}
|
|
930
932
|
|
|
931
|
-
async function bundleWorkerScript<B extends Bindings>(
|
|
933
|
+
async function bundleWorkerScript<B extends Bindings>(
|
|
934
|
+
compatibilityDate: string,
|
|
935
|
+
props: WorkerProps<B>
|
|
936
|
+
) {
|
|
932
937
|
const bundle = await Bundle("bundle", {
|
|
933
938
|
entryPoint: props.entrypoint!,
|
|
934
939
|
format: props.format === "cjs" ? "cjs" : "esm", // Use the specified format or default to ESM
|
|
935
940
|
target: "esnext",
|
|
936
941
|
platform: "neutral",
|
|
937
|
-
minify:
|
|
942
|
+
minify: false,
|
|
938
943
|
...(props.bundle || {}),
|
|
939
944
|
options: {
|
|
940
945
|
...(props.bundle?.options || {}),
|
|
@@ -943,6 +948,11 @@ async function bundleWorkerScript<B extends Bindings>(props: WorkerProps) {
|
|
|
943
948
|
".sql": "text",
|
|
944
949
|
".json": "json",
|
|
945
950
|
},
|
|
951
|
+
plugins:
|
|
952
|
+
compatibilityDate >= "2024-09-23" &&
|
|
953
|
+
props.compatibilityFlags?.find((flag) => flag === "nodejs_compat")
|
|
954
|
+
? [await nodejsHybridPlugin()]
|
|
955
|
+
: [],
|
|
946
956
|
},
|
|
947
957
|
external: [
|
|
948
958
|
...external,
|
package/src/neon/project.ts
CHANGED
|
@@ -38,9 +38,9 @@ export interface NeonProjectProps extends NeonApiOptions {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* PostgreSQL version to use
|
|
41
|
-
* @default
|
|
41
|
+
* @default 16
|
|
42
42
|
*/
|
|
43
|
-
pg_version?: 14 | 15 | 16;
|
|
43
|
+
pg_version?: 14 | 15 | 16 | 17;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Whether to create a default branch and endpoint
|
|
@@ -607,7 +607,7 @@ export const NeonProject = Resource(
|
|
|
607
607
|
id: response.project.id,
|
|
608
608
|
name: response.project.name,
|
|
609
609
|
region_id: response.project.region_id as NeonRegion,
|
|
610
|
-
pg_version: response.project.pg_version as 14 | 15 | 16,
|
|
610
|
+
pg_version: response.project.pg_version as 14 | 15 | 16 | 17,
|
|
611
611
|
created_at: response.project.created_at,
|
|
612
612
|
updated_at: response.project.updated_at,
|
|
613
613
|
proxy_host: response.project.proxy_host,
|
|
@@ -646,7 +646,7 @@ async function createNewProject(
|
|
|
646
646
|
project: {
|
|
647
647
|
name: props.name,
|
|
648
648
|
region_id: props.region_id || "aws-us-east-1",
|
|
649
|
-
pg_version: props.pg_version ||
|
|
649
|
+
pg_version: props.pg_version || 16,
|
|
650
650
|
default_endpoint: defaultEndpoint,
|
|
651
651
|
branch: defaultEndpoint
|
|
652
652
|
? { name: props.default_branch_name || "main" }
|
package/src/serde.ts
CHANGED
package/src/test/prune.ts
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes common indentation from template literals to make them more readable in code.
|
|
3
|
+
* This allows writing multi-line strings with proper indentation in the source code
|
|
4
|
+
* while removing that indentation in the output string.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
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."
|
|
16
|
+
*/
|
|
17
|
+
export function dedent(
|
|
18
|
+
strings: TemplateStringsArray,
|
|
19
|
+
...values: any[]
|
|
20
|
+
): string {
|
|
21
|
+
// Combine the template strings and values
|
|
22
|
+
let result = strings.reduce((acc, str, i) => {
|
|
23
|
+
return acc + str + (values[i] !== undefined ? values[i] : "");
|
|
24
|
+
}, "");
|
|
25
|
+
|
|
26
|
+
// Split into lines
|
|
27
|
+
let 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();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// If there are no lines left after trimming, return an empty string
|
|
40
|
+
if (lines.length === 0) {
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Find the minimum indentation level (excluding empty/whitespace lines)
|
|
45
|
+
const minIndent = lines
|
|
46
|
+
.filter((line) => line.trim().length > 0) // Only consider non-blank lines for indent calculation
|
|
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
|
+
}, 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 === Infinity) {
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Remove the common indentation from each line
|
|
60
|
+
const dedented = lines.map((line) => {
|
|
61
|
+
// Preserve internal blank lines as empty strings, don't try to substring them
|
|
62
|
+
if (line.trim().length === 0) {
|
|
63
|
+
return "";
|
|
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");
|
|
71
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../src/cloudflare/external.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,QAAQ,UAIpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../src/cloudflare/external.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,aAAa,GAAG;IACpB,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,cAAc;IACd,aAAa;IACb,0BAA0B;IAC1B,UAAU;IACV,aAAa;IACb,gBAAgB;IAChB,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,cAAc;IACd,kBAAkB;IAClB,aAAa;IACb,qBAAqB;IACrB,aAAa;IACb,UAAU,EAAE,sBAAsB;IAClC,UAAU;IACV,WAAW;IACX,WAAW;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,aAAa;IAChB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,oBAAoB;CACrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-dev-cloudflare-shim.d.ts","sourceRoot":"","sources":["../../src/cloudflare/local-dev-cloudflare-shim.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mCAAmC;;;;6BAKjC,MAAM;wBAGX,MAAM;EAUlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-dev-cloudflare-shim.js","sourceRoot":"","sources":["../../src/cloudflare/local-dev-cloudflare-shim.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,mCAAmC;IACjD,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,KAAK,EAAE,OAAO,EAAE,WAAW;QAC3B,OAAO,EAAE,KAAK;QACd,SAAS,CAAC,EAAU;YAClB,IAAI,EAAE,KAAK,oBAAoB;gBAAE,OAAO,EAAE,CAAC,CAAC,0BAA0B;QACxE,CAAC;QACD,IAAI,CAAC,EAAU;YACb,IAAI,EAAE,KAAK,oBAAoB;gBAC7B,OAAO;;;;;CAKd,CAAC;QACE,CAAC;KACO,CAAC;AACb,CAAC"}
|
|
File without changes
|
/package/lib/cloudflare/{local-dev-cloudflare-shim.d.ts → bundle/local-dev-cloudflare-shim.d.ts}
RENAMED
|
File without changes
|
/package/lib/cloudflare/{local-dev-cloudflare-shim.js → bundle/local-dev-cloudflare-shim.js}
RENAMED
|
File without changes
|
/package/src/cloudflare/{local-dev-cloudflare-shim.ts → bundle/local-dev-cloudflare-shim.ts}
RENAMED
|
File without changes
|