@crvouga/mockingbird-adapter-browser 0.0.0-reserved → 0.0.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.
Files changed (67) hide show
  1. package/README.md +171 -1
  2. package/TRANSPORT.md +46 -0
  3. package/dist/assets.d.ts +3 -0
  4. package/dist/assets.d.ts.map +1 -0
  5. package/dist/assets.js +3 -0
  6. package/dist/assets.js.map +1 -0
  7. package/dist/async-context.d.ts +29 -0
  8. package/dist/async-context.d.ts.map +1 -0
  9. package/dist/async-context.js +74 -0
  10. package/dist/async-context.js.map +1 -0
  11. package/dist/build.d.ts +25 -0
  12. package/dist/build.d.ts.map +1 -0
  13. package/dist/build.js +275 -0
  14. package/dist/build.js.map +1 -0
  15. package/dist/child-process-unsupported.d.ts +18 -0
  16. package/dist/child-process-unsupported.d.ts.map +1 -0
  17. package/dist/child-process-unsupported.js +13 -0
  18. package/dist/child-process-unsupported.js.map +1 -0
  19. package/dist/globals.d.ts +113 -0
  20. package/dist/globals.d.ts.map +1 -0
  21. package/dist/globals.js +58 -0
  22. package/dist/globals.js.map +1 -0
  23. package/dist/http-client.d.ts +64 -0
  24. package/dist/http-client.d.ts.map +1 -0
  25. package/dist/http-client.js +182 -0
  26. package/dist/http-client.js.map +1 -0
  27. package/dist/http.d.ts +143 -0
  28. package/dist/http.d.ts.map +1 -0
  29. package/dist/http.js +349 -0
  30. package/dist/http.js.map +1 -0
  31. package/dist/http2-unsupported.d.ts +4 -0
  32. package/dist/http2-unsupported.d.ts.map +1 -0
  33. package/dist/http2-unsupported.js +11 -0
  34. package/dist/http2-unsupported.js.map +1 -0
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +24 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/modules.d.ts +8 -0
  40. package/dist/modules.d.ts.map +1 -0
  41. package/dist/modules.js +19 -0
  42. package/dist/modules.js.map +1 -0
  43. package/dist/net.d.ts +59 -0
  44. package/dist/net.d.ts.map +1 -0
  45. package/dist/net.js +273 -0
  46. package/dist/net.js.map +1 -0
  47. package/dist/network/diagnostics-channel.d.ts +34 -0
  48. package/dist/network/diagnostics-channel.d.ts.map +1 -0
  49. package/dist/network/diagnostics-channel.js +92 -0
  50. package/dist/network/diagnostics-channel.js.map +1 -0
  51. package/dist/network/dns.d.ts +12 -0
  52. package/dist/network/dns.d.ts.map +1 -0
  53. package/dist/network/dns.js +44 -0
  54. package/dist/network/dns.js.map +1 -0
  55. package/dist/network/tls.d.ts +12 -0
  56. package/dist/network/tls.d.ts.map +1 -0
  57. package/dist/network/tls.js +14 -0
  58. package/dist/network/tls.js.map +1 -0
  59. package/dist/performance.d.ts +9 -0
  60. package/dist/performance.d.ts.map +1 -0
  61. package/dist/performance.js +10 -0
  62. package/dist/performance.js.map +1 -0
  63. package/dist/runtime.d.ts +249 -0
  64. package/dist/runtime.d.ts.map +1 -0
  65. package/dist/runtime.js +258 -0
  66. package/dist/runtime.js.map +1 -0
  67. package/package.json +103 -6
package/dist/build.js ADDED
@@ -0,0 +1,275 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { dirname, isAbsolute, join, relative, sep } from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import { build as rewriteLocations } from "esbuild";
5
+ import { fs } from "memfs";
6
+ import stdlib from "node-stdlib-browser";
7
+ /**
8
+ * A value as a JavaScript literal for generated module source: JSON, with the characters that can
9
+ * end a script or string context (`<`, `>`, `/`, U+2028, U+2029) escaped, so no path or name can
10
+ * change the code around it.
11
+ */
12
+ const literal = (value) => JSON.stringify(value).replace(/[<>/\u2028\u2029]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
13
+ const here = dirname(fileURLToPath(import.meta.url));
14
+ const extension = import.meta.url.endsWith(".ts") ? ".ts" : ".js";
15
+ const unsupported = new Set([
16
+ "child_process",
17
+ "cluster",
18
+ "dgram",
19
+ "dns",
20
+ "http2",
21
+ "module",
22
+ "net",
23
+ "readline",
24
+ "repl",
25
+ "tls",
26
+ "tty",
27
+ "worker_threads",
28
+ "async_hooks",
29
+ "inspector",
30
+ "v8",
31
+ "trace_events",
32
+ ]);
33
+ const aliases = stdlib;
34
+ /** esbuild configuration shared by hosts; no environment values are copied from the build machine. */
35
+ export function browserRuntimeBuildOptions(options = {}) {
36
+ const adapters = new Map(Object.entries(options.adapters ?? {}).map(([name, target]) => [
37
+ name.replace(/^node:/, ""),
38
+ target,
39
+ ]));
40
+ if (options.asyncContext && adapters.has("async_hooks"))
41
+ throw new TypeError("Choose Zone context or an explicit async_hooks adapter, not both");
42
+ const modules = Object.entries(options.modules ?? {});
43
+ for (const [name, target] of [...adapters, ...modules]) {
44
+ if (!isAbsolute(target))
45
+ throw new TypeError(`Browser module ${name} must have an absolute build-time path`);
46
+ }
47
+ if (options.sourceRoot && !isAbsolute(options.sourceRoot))
48
+ throw new TypeError("sourceRoot must be absolute");
49
+ const registry = "mockingbird:module-registry";
50
+ const runtimePath = literal(join(here, `runtime${extension}`));
51
+ const plugin = {
52
+ name: "mockingbird-browser-runtime",
53
+ setup(build) {
54
+ if (options.asyncContext)
55
+ build.onStart(() => {
56
+ const supported = build.initialOptions.supported;
57
+ if (supported?.["async-await"] !== false || supported?.["async-generator"] !== false)
58
+ return {
59
+ errors: [
60
+ {
61
+ text: "Zone async context requires async-await and async-generator lowering for the entire bundle",
62
+ },
63
+ ],
64
+ };
65
+ if (build.initialOptions.external?.length || build.initialOptions.packages === "external")
66
+ return {
67
+ errors: [
68
+ {
69
+ text: "Zone async context cannot verify external modules; bundle every async function",
70
+ },
71
+ ],
72
+ };
73
+ return undefined;
74
+ });
75
+ build.onResolve({ filter: /^mockingbird:module-registry$/ }, (args) => ({
76
+ path: args.path,
77
+ namespace: "browser-support",
78
+ }));
79
+ build.onLoad({ filter: /.*/, namespace: "browser-support" }, () => {
80
+ return {
81
+ contents: `import { createModuleRegistry } from ${literal(join(here, `modules${extension}`))}; const registry = createModuleRegistry({${modules.map(([name, target]) => `${literal(name)}: () => require(${literal(target)})`).join(",")}}); const runtimeRequire = registry.require; export { runtimeRequire as require }; export const createRequire = () => runtimeRequire;`,
82
+ resolveDir: here,
83
+ };
84
+ });
85
+ build.onLoad({ filter: /[/\\]assets\.[jt]s$/ }, (args) => {
86
+ if (args.path !== join(here, `assets${extension}`))
87
+ return undefined;
88
+ const files = Object.entries(options.assets ?? {}).map(([name, value]) => [
89
+ name,
90
+ typeof value === "string" ? [...new TextEncoder().encode(value)] : [...value],
91
+ ]);
92
+ return {
93
+ contents: `export const publicAssets = ${literal(Object.fromEntries(files))};`,
94
+ loader: "js",
95
+ };
96
+ });
97
+ if (options.transformSource || options.sourceRoot)
98
+ build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
99
+ if (args.path.startsWith(here + sep))
100
+ return undefined;
101
+ const original = await readFile(args.path, "utf8");
102
+ const changed = await options.transformSource?.(original, args.path);
103
+ const loader = changed?.loader ??
104
+ (args.path.endsWith("tsx")
105
+ ? "tsx"
106
+ : args.path.endsWith("ts")
107
+ ? "ts"
108
+ : args.path.endsWith("jsx")
109
+ ? "jsx"
110
+ : "js");
111
+ let contents = changed?.contents ?? original;
112
+ if (options.sourceRoot) {
113
+ const within = relative(options.sourceRoot, args.path);
114
+ if (!within.startsWith(`..${sep}`) && within !== ".." && !isAbsolute(within)) {
115
+ const virtual = `/${within.split(sep).join("/")}`;
116
+ const transformed = await rewriteLocations({
117
+ stdin: { contents, loader, sourcefile: args.path, resolveDir: dirname(args.path) },
118
+ write: false,
119
+ jsx: "preserve",
120
+ ...(build.initialOptions.tsconfig !== undefined
121
+ ? { tsconfig: build.initialOptions.tsconfig }
122
+ : {}),
123
+ ...(build.initialOptions.tsconfigRaw !== undefined
124
+ ? { tsconfigRaw: build.initialOptions.tsconfigRaw }
125
+ : {}),
126
+ logLevel: "silent",
127
+ define: {
128
+ __filename: literal(virtual),
129
+ __dirname: literal(virtual.slice(0, virtual.lastIndexOf("/")) || "/"),
130
+ "import.meta.url": literal(pathToFileURL(virtual).href),
131
+ "import.meta.filename": literal(virtual),
132
+ "import.meta.dirname": literal(virtual.slice(0, virtual.lastIndexOf("/")) || "/"),
133
+ },
134
+ });
135
+ contents = transformed.outputFiles[0]?.text ?? "";
136
+ return { contents, loader: "jsx", resolveDir: dirname(args.path) };
137
+ }
138
+ }
139
+ return changed ? { contents, loader, resolveDir: dirname(args.path) } : undefined;
140
+ });
141
+ build.onResolve({ filter: /\.node$/ }, (args) => ({
142
+ errors: [{ text: `Native addon ${args.path} cannot run in the browser` }],
143
+ }));
144
+ build.onResolve({ filter: /^[a-z_@]/ }, (args) => {
145
+ const name = args.path.replace(/^node:/, "");
146
+ const adapter = adapters.get(name);
147
+ if (adapter)
148
+ return { path: adapter };
149
+ if (options.optionalModules?.includes(args.path))
150
+ return { path: args.path, namespace: "browser-optional" };
151
+ if (name === "perf_hooks")
152
+ return { path: join(here, `performance${extension}`) };
153
+ if (options.virtualNetwork && ["dns", "tls", "diagnostics_channel"].includes(name))
154
+ return {
155
+ path: join(here, "network", `${name === "diagnostics_channel" ? "diagnostics-channel" : name}${extension}`),
156
+ };
157
+ if (name === "async_hooks" && options.asyncContext === "zone")
158
+ return { path: join(here, `async-context${extension}`) };
159
+ if (name === "module" && modules.length > 0)
160
+ return { path: registry, namespace: "browser-support" };
161
+ if (name === "net" && options.virtualNetwork)
162
+ return { path: "net", namespace: "browser-runtime" };
163
+ if (unsupported.has(name) || args.path.startsWith("bun:")) {
164
+ return {
165
+ errors: [
166
+ {
167
+ text: `Unsupported browser runtime module: ${args.path}. Use a browser-compatible dependency or explicit system adapter.`,
168
+ },
169
+ ],
170
+ };
171
+ }
172
+ if (name === "fs" ||
173
+ name === "fs/promises" ||
174
+ name === "stream/web" ||
175
+ name === "bun" ||
176
+ name === "http" ||
177
+ name === "crypto" ||
178
+ name === "assert/strict" ||
179
+ name === "path/posix" ||
180
+ name === "stream/promises")
181
+ return { path: name, namespace: "browser-runtime" };
182
+ if (name === "util/types")
183
+ return { path: join(stdlib.util, "support/types.js") };
184
+ const target = aliases[args.path];
185
+ if (target)
186
+ return build.resolve(target, { resolveDir: here, kind: args.kind });
187
+ if (args.path.startsWith("node:"))
188
+ return { errors: [{ text: `Unknown browser Node polyfill: ${args.path}` }] };
189
+ return undefined;
190
+ });
191
+ build.onLoad({ filter: /.*/, namespace: "browser-optional" }, (args) => ({
192
+ contents: `throw Object.assign(new Error(${literal(`Optional module ${args.path} is unavailable in this preview`)}), { code: "ERR_BROWSER_RUNTIME_UNSUPPORTED" });`,
193
+ loader: "js",
194
+ }));
195
+ build.onLoad({ filter: /.*/, namespace: "browser-runtime" }, (args) => {
196
+ if (args.path === "net")
197
+ return {
198
+ contents: `import { browserRuntime } from ${runtimePath}; export const { Socket, Server, createServer, connect, createConnection, isIP, isIPv4, isIPv6 } = browserRuntime.net; export default browserRuntime.net;`,
199
+ resolveDir: here,
200
+ };
201
+ if (args.path === "bun")
202
+ return {
203
+ contents: `import { browserRuntime } from ${literal(join(here, `runtime${extension}`))}; export const { serve, file, write, env, sleep } = browserRuntime.bun; export default browserRuntime.bun;`,
204
+ resolveDir: here,
205
+ };
206
+ if (args.path === "crypto") {
207
+ const names = [
208
+ "createHash",
209
+ "createHmac",
210
+ "randomBytes",
211
+ "randomFill",
212
+ "randomFillSync",
213
+ "pbkdf2",
214
+ "pbkdf2Sync",
215
+ "createSign",
216
+ "createVerify",
217
+ "createCipheriv",
218
+ "createDecipheriv",
219
+ "createDiffieHellman",
220
+ "getDiffieHellman",
221
+ "getHashes",
222
+ "getCiphers",
223
+ ];
224
+ return {
225
+ contents: `import legacy from ${literal(stdlib.crypto)}; export const { ${names.join(",")} } = legacy; export const webcrypto = globalThis.crypto; export const subtle = webcrypto.subtle; export const randomUUID = () => webcrypto.randomUUID(); export const getRandomValues = value => webcrypto.getRandomValues(value); export default { ...legacy, webcrypto, subtle, randomUUID, getRandomValues };`,
226
+ resolveDir: here,
227
+ };
228
+ }
229
+ if (args.path === "assert/strict")
230
+ return {
231
+ contents: `import assert from ${literal(stdlib.assert)}; export default assert.strict;`,
232
+ resolveDir: here,
233
+ };
234
+ if (args.path === "path/posix")
235
+ return {
236
+ contents: `import path from ${literal(stdlib.path)}; export const { resolve, normalize, isAbsolute, join, relative, dirname, basename, extname, format, parse, sep, delimiter } = path; export default path;`,
237
+ resolveDir: here,
238
+ };
239
+ if (args.path === "stream/promises")
240
+ return {
241
+ contents: 'import { pipeline as callbackPipeline, finished as callbackFinished } from "stream"; export const pipeline = (...args) => new Promise((resolve, reject) => callbackPipeline(...args, error => error ? reject(error) : resolve())); export const finished = stream => new Promise((resolve, reject) => { const cleanup = callbackFinished(stream, error => { cleanup(); error ? reject(error) : resolve(); }); });',
242
+ resolveDir: here,
243
+ };
244
+ if (args.path === "http") {
245
+ return {
246
+ contents: `import client from ${literal(stdlib.http)}; import { createServer, Server, IncomingMessage, ServerResponse } from ${literal(join(here, `http${extension}`))}; export const { request, get, Agent, STATUS_CODES, METHODS, globalAgent } = client; export { createServer, Server, IncomingMessage, ServerResponse }; export default { ...client, createServer, Server, IncomingMessage, ServerResponse };`,
247
+ resolveDir: here,
248
+ };
249
+ }
250
+ if (args.path === "stream/web")
251
+ return {
252
+ contents: "export const { ReadableStream, WritableStream, TransformStream, ByteLengthQueuingStrategy, CountQueuingStrategy } = globalThis;",
253
+ };
254
+ const source = args.path === "fs" ? fs : fs.promises;
255
+ const member = args.path === "fs" ? "fs" : "fs.promises";
256
+ const names = Object.keys(source)
257
+ .filter((name) => name !== "fs")
258
+ .filter((name) => /^[a-zA-Z_$][\w$]*$/.test(name) && name !== "default");
259
+ return {
260
+ contents: `import { browserRuntime } from ${literal(join(here, `runtime${extension}`))}; const fs = browserRuntime.${member}; export default fs;\n${names.map((name) => `export const ${name} = fs[${literal(name)}];`).join("\n")}`,
261
+ resolveDir: here,
262
+ };
263
+ });
264
+ },
265
+ };
266
+ return {
267
+ platform: "browser",
268
+ plugins: [plugin],
269
+ inject: [join(here, `globals${extension}`)],
270
+ ...(options.asyncContext
271
+ ? { supported: { "async-await": false, "async-generator": false } }
272
+ : {}),
273
+ };
274
+ }
275
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAEvD,OAAO,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,SAAS,CAAA;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC1B,OAAO,MAAM,MAAM,qBAAqB,CAAA;AAExC;;;;GAIG;AACH,MAAM,OAAO,GAAG,CAAC,KAAc,EAAU,EAAE,CACzC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAC3B,oBAAoB,EACpB,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAC7E,CAAA;AAEH,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AACpD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACjE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,eAAe;IACf,SAAS;IACT,OAAO;IACP,KAAK;IACL,OAAO;IACP,QAAQ;IACR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AAI,CAAC,IAAI,IAAI,KAAK,SAAS,CAAC,CAAA;gBAC1E,OAAO;oBACL,QAAQ,EAAE,kCAAkC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,SAAS,EAAE,CAAC,CAAC,+BAA+B,MAAM,yBAAyB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,IAAI,SAAS,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBACpO,UAAU,EAAE,IAAI;iBACjB,CAAA;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;IACD,OAAO;QACL,QAAQ,EAAE,SAAS;QACnB,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,SAAS,EAAE,CAAC,CAAC;QAC3C,GAAG,CAAC,OAAO,CAAC,YAAY;YACtB,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE;YACnE,CAAC,CAAC,EAAE,CAAC;KACR,CAAA;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare const exec: () => never;
2
+ export declare const execFile: () => never;
3
+ export declare const execSync: () => never;
4
+ export declare const execFileSync: () => never;
5
+ export declare const spawn: () => never;
6
+ export declare const spawnSync: () => never;
7
+ export declare const fork: () => never;
8
+ declare const _default: {
9
+ exec: () => never;
10
+ execFile: () => never;
11
+ execSync: () => never;
12
+ execFileSync: () => never;
13
+ spawn: () => never;
14
+ spawnSync: () => never;
15
+ fork: () => never;
16
+ };
17
+ export default _default;
18
+ //# sourceMappingURL=child-process-unsupported.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-process-unsupported.d.ts","sourceRoot":"","sources":["../src/child-process-unsupported.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,QAHO,KAGO,CAAA;AAC/B,eAAO,MAAM,QAAQ,QAJG,KAIW,CAAA;AACnC,eAAO,MAAM,QAAQ,QALG,KAKW,CAAA;AACnC,eAAO,MAAM,YAAY,QAND,KAMe,CAAA;AACvC,eAAO,MAAM,KAAK,QAPM,KAOQ,CAAA;AAChC,eAAO,MAAM,SAAS,QARE,KAQY,CAAA;AACpC,eAAO,MAAM,IAAI,QATO,KASO,CAAA;;gBATP,KAAK;oBAAL,KAAK;oBAAL,KAAK;wBAAL,KAAK;iBAAL,KAAK;qBAAL,KAAK;gBAAL,KAAK;;AAU7B,wBAAiF"}
@@ -0,0 +1,13 @@
1
+ import { UnsupportedRuntimeError } from "./runtime.js";
2
+ const unsupported = () => {
3
+ throw new UnsupportedRuntimeError("child_process");
4
+ };
5
+ export const exec = unsupported;
6
+ export const execFile = unsupported;
7
+ export const execSync = unsupported;
8
+ export const execFileSync = unsupported;
9
+ export const spawn = unsupported;
10
+ export const spawnSync = unsupported;
11
+ export const fork = unsupported;
12
+ export default { exec, execFile, execSync, execFileSync, spawn, spawnSync, fork };
13
+ //# sourceMappingURL=child-process-unsupported.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-process-unsupported.js","sourceRoot":"","sources":["../src/child-process-unsupported.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,MAAM,WAAW,GAAG,GAAU,EAAE;IAC9B,MAAM,IAAI,uBAAuB,CAAC,eAAe,CAAC,CAAA;AACpD,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAA;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAA;AACnC,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAA;AACnC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAA;AACvC,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAA;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAA;AAC/B,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,113 @@
1
+ import { clearImmediate, setImmediate } from "node:timers";
2
+ import { Buffer } from "buffer";
3
+ import process from "process";
4
+ declare const Bun: {
5
+ env: {
6
+ [x: string]: string;
7
+ };
8
+ file: (value: string | URL) => {
9
+ readonly size: number;
10
+ type: string;
11
+ name: string;
12
+ exists: () => Promise<boolean>;
13
+ text: () => Promise<string>;
14
+ json: () => Promise<unknown>;
15
+ arrayBuffer: () => Promise<ArrayBuffer>;
16
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
17
+ slice: (start?: number, end?: number, type?: string) => Blob;
18
+ };
19
+ write: (target: string | URL, data: string | Uint8Array | ArrayBuffer | Blob | Response) => Promise<number>;
20
+ serve: (options: {
21
+ port?: number;
22
+ hostname?: string;
23
+ fetch: import("./runtime.js").FetchHandler;
24
+ }) => {
25
+ url: URL;
26
+ port: number;
27
+ hostname: string;
28
+ stop: () => void;
29
+ shutdown: () => Promise<void>;
30
+ finished: Promise<void>;
31
+ };
32
+ sleep: (ms: number) => Promise<void>;
33
+ };
34
+ declare const Deno: {
35
+ env: {
36
+ get: (key: string) => string | undefined;
37
+ set: (key: string, value: string) => void;
38
+ has: (key: string) => boolean;
39
+ delete: (key: string) => void;
40
+ toObject: () => {
41
+ [x: string]: string;
42
+ };
43
+ };
44
+ readFile: (name: string | URL) => Promise<Uint8Array<ArrayBuffer>>;
45
+ readTextFile: (name: string | URL) => Promise<string>;
46
+ writeFile: (name: string | URL, data: Uint8Array) => Promise<void>;
47
+ writeTextFile: (name: string | URL, data: string) => Promise<void>;
48
+ mkdir: (name: string | URL, opts?: {
49
+ recursive?: boolean;
50
+ }) => Promise<void>;
51
+ remove: (name: string | URL, opts?: {
52
+ recursive?: boolean;
53
+ }) => Promise<void>;
54
+ rename: (old: string | URL, next: string | URL) => Promise<void>;
55
+ readFileSync: (name: string | URL) => Uint8Array<ArrayBuffer>;
56
+ readTextFileSync: (name: string | URL) => string;
57
+ writeFileSync: (name: string | URL, data: Uint8Array) => void;
58
+ writeTextFileSync: (name: string | URL, data: string) => void;
59
+ mkdirSync: (name: string | URL, opts?: {
60
+ recursive?: boolean;
61
+ }) => void;
62
+ removeSync: (name: string | URL, opts?: {
63
+ recursive?: boolean;
64
+ }) => void;
65
+ renameSync: (old: string | URL, next: string | URL) => void;
66
+ stat: (name: string | URL) => Promise<{
67
+ isFile: boolean;
68
+ isDirectory: boolean;
69
+ isSymlink: boolean;
70
+ size: number;
71
+ mtime: Date;
72
+ atime: Date;
73
+ birthtime: Date;
74
+ mode: number;
75
+ uid: number;
76
+ gid: number;
77
+ }>;
78
+ statSync: (name: string | URL) => {
79
+ isFile: boolean;
80
+ isDirectory: boolean;
81
+ isSymlink: boolean;
82
+ size: number;
83
+ mtime: Date;
84
+ atime: Date;
85
+ birthtime: Date;
86
+ mode: number;
87
+ uid: number;
88
+ gid: number;
89
+ };
90
+ realPath: (name: string | URL) => Promise<string>;
91
+ realPathSync: (name: string | URL) => string;
92
+ readDir(name: string | URL): AsyncGenerator<{
93
+ name: string;
94
+ isFile: boolean;
95
+ isDirectory: boolean;
96
+ isSymlink: boolean;
97
+ }, void, unknown>;
98
+ cwd: () => "/";
99
+ serve: (handlerOrOptions: import("./runtime.js").FetchHandler | {
100
+ port?: number;
101
+ hostname?: string;
102
+ }, handler?: import("./runtime.js").FetchHandler) => {
103
+ url: URL;
104
+ port: number;
105
+ hostname: string;
106
+ stop: () => void;
107
+ shutdown: () => Promise<void>;
108
+ finished: Promise<void>;
109
+ };
110
+ };
111
+ declare const global: typeof globalThis;
112
+ export { Buffer, Bun, clearImmediate, Deno, global, process, setImmediate };
113
+ //# sourceMappingURL=globals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,OAAO,MAAM,SAAS,CAAA;AAmD7B,QAAA,MAAM,GAAG;;;;;;;;;;;;;;;;;YARH,CAAN;gBAAkB,CAAC;;;;;;;;;;;CAQW,CAAA;AAC9B,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;iBAIojJ,CAAC;;;iBAAkI,CAAC;;;;;;;;iBAAwoB,CAAC;;;iBAAqH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAAu3B,CAAC;gBAAkB,CAAC;;;;;;;;;CAJ5yM,CAAA;AAChC,QAAA,MAAM,MAAM,mBAAa,CAAA;AAEzB,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,58 @@
1
+ import { clearImmediate, setImmediate } from "node:timers";
2
+ import { Buffer } from "buffer";
3
+ import process from "process";
4
+ import { browserRuntime } from "./runtime.js";
5
+ const started = performance.now();
6
+ process.hrtime ??= Object.assign((previous) => {
7
+ const nanos = Math.floor(performance.now() * 1e6);
8
+ const difference = nanos - (previous ? previous[0] * 1e9 + previous[1] : 0);
9
+ return [Math.floor(difference / 1e9), difference % 1e9];
10
+ }, { bigint: () => BigInt(Math.floor(performance.now() * 1e6)) });
11
+ process.uptime ??= () => (performance.now() - started) / 1000;
12
+ const output = (write) => {
13
+ const listeners = new Map();
14
+ const stream = {
15
+ isTTY: false,
16
+ writable: true,
17
+ write(value, encodingOrCallback, callback) {
18
+ write(String(value));
19
+ const done = typeof encodingOrCallback === "function" ? encodingOrCallback : callback;
20
+ if (done)
21
+ queueMicrotask(done);
22
+ return true;
23
+ },
24
+ on(event, callback) {
25
+ const set = listeners.get(event) ?? new Set();
26
+ set.add(callback);
27
+ listeners.set(event, set);
28
+ return stream;
29
+ },
30
+ off(event, callback) {
31
+ listeners.get(event)?.delete(callback);
32
+ return stream;
33
+ },
34
+ once(event, callback) {
35
+ const run = (...args) => {
36
+ stream.off(event, run);
37
+ callback(...args);
38
+ };
39
+ return stream.on(event, run);
40
+ },
41
+ emit(event, ...args) {
42
+ for (const callback of listeners.get(event) ?? [])
43
+ callback(...args);
44
+ return (listeners.get(event)?.size ?? 0) > 0;
45
+ },
46
+ };
47
+ return stream;
48
+ };
49
+ if (!process.stdout)
50
+ Object.assign(process, { stdout: output((value) => console.info(value)) });
51
+ if (!process.stderr)
52
+ Object.assign(process, { stderr: output((value) => console.error(value)) });
53
+ process.env = browserRuntime.env;
54
+ const Bun = browserRuntime.bun;
55
+ const Deno = browserRuntime.deno;
56
+ const global = globalThis;
57
+ export { Buffer, Bun, clearImmediate, Deno, global, process, setImmediate };
58
+ //# sourceMappingURL=globals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.js","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;AACjC,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAC9B,CAAC,QAA2B,EAAoB,EAAE;IAChD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAA;IACjD,MAAM,UAAU,GAAG,KAAK,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG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AC9B,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAA;AAChC,MAAM,MAAM,GAAG,UAAU,CAAA;AAEzB,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,64 @@
1
+ import { Readable, Writable } from "node:stream";
2
+ import type { WebFetch } from "./runtime.js";
3
+ type RequestOptions = {
4
+ protocol?: string;
5
+ hostname?: string;
6
+ host?: string;
7
+ port?: number | string;
8
+ path?: string;
9
+ method?: string;
10
+ headers?: Record<string, string | number | readonly string[]>;
11
+ signal?: AbortSignal;
12
+ timeout?: number;
13
+ agent?: unknown;
14
+ };
15
+ export declare class ClientResponse extends Readable {
16
+ private readonly abort;
17
+ readonly statusCode: number;
18
+ readonly statusMessage: string;
19
+ readonly headers: Record<string, string>;
20
+ readonly rawHeaders: string[];
21
+ readonly httpVersion = "1.1";
22
+ complete: boolean;
23
+ private reader;
24
+ private reading;
25
+ constructor(response: Response, abort: () => void);
26
+ _read(): void;
27
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
28
+ }
29
+ /** Explicit outgoing Node HTTP adapter over a host-owned Fetch boundary. */
30
+ export declare function createFetchHttpClient(fetch: WebFetch, protocol?: string): {
31
+ request: (input: string | URL | RequestOptions, optionsOrCallback?: RequestOptions | ((response: ClientResponse) => void), callback?: (response: ClientResponse) => void) => Writable & {
32
+ setTimeout: (ms: number, fn?: () => void) => Writable;
33
+ abort: () => Writable;
34
+ };
35
+ get: (input: string | URL | RequestOptions, optionsOrCallback?: RequestOptions | ((response: ClientResponse) => void) | undefined, callback?: ((response: ClientResponse) => void) | undefined) => Writable & {
36
+ setTimeout: (ms: number, fn?: () => void) => Writable;
37
+ abort: () => Writable;
38
+ };
39
+ };
40
+ export declare const request: (input: string | URL | RequestOptions, optionsOrCallback?: RequestOptions | ((response: ClientResponse) => void), callback?: (response: ClientResponse) => void) => Writable & {
41
+ setTimeout: (ms: number, fn?: () => void) => Writable;
42
+ abort: () => Writable;
43
+ }, get: (input: string | URL | RequestOptions, optionsOrCallback?: RequestOptions | ((response: ClientResponse) => void) | undefined, callback?: ((response: ClientResponse) => void) | undefined) => Writable & {
44
+ setTimeout: (ms: number, fn?: () => void) => Writable;
45
+ abort: () => Writable;
46
+ };
47
+ export declare class Agent {
48
+ destroy(): void;
49
+ }
50
+ export declare const globalAgent: Agent;
51
+ declare const _default: {
52
+ request: (input: string | URL | RequestOptions, optionsOrCallback?: RequestOptions | ((response: ClientResponse) => void), callback?: (response: ClientResponse) => void) => Writable & {
53
+ setTimeout: (ms: number, fn?: () => void) => Writable;
54
+ abort: () => Writable;
55
+ };
56
+ get: (input: string | URL | RequestOptions, optionsOrCallback?: RequestOptions | ((response: ClientResponse) => void) | undefined, callback?: ((response: ClientResponse) => void) | undefined) => Writable & {
57
+ setTimeout: (ms: number, fn?: () => void) => Writable;
58
+ abort: () => Writable;
59
+ };
60
+ Agent: typeof Agent;
61
+ globalAgent: Agent;
62
+ };
63
+ export default _default;
64
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SA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