orez 0.9.5 → 0.9.6

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 (66) hide show
  1. package/README.md +23 -0
  2. package/dist/cf-deploy/bundle.d.ts +21 -0
  3. package/dist/cf-deploy/bundle.d.ts.map +1 -0
  4. package/dist/cf-deploy/bundle.js +347 -0
  5. package/dist/cf-deploy/bundle.js.map +1 -0
  6. package/dist/cf-deploy/config.d.ts +52 -0
  7. package/dist/cf-deploy/config.d.ts.map +1 -0
  8. package/dist/cf-deploy/config.js +23 -0
  9. package/dist/cf-deploy/config.js.map +1 -0
  10. package/dist/cf-deploy/index.d.ts +11 -0
  11. package/dist/cf-deploy/index.d.ts.map +1 -0
  12. package/dist/cf-deploy/index.js +17 -0
  13. package/dist/cf-deploy/index.js.map +1 -0
  14. package/dist/cf-deploy/leaves.d.ts +19 -0
  15. package/dist/cf-deploy/leaves.d.ts.map +1 -0
  16. package/dist/cf-deploy/leaves.js +109 -0
  17. package/dist/cf-deploy/leaves.js.map +1 -0
  18. package/dist/cf-deploy/migration.d.ts +40 -0
  19. package/dist/cf-deploy/migration.d.ts.map +1 -0
  20. package/dist/cf-deploy/migration.js +853 -0
  21. package/dist/cf-deploy/migration.js.map +1 -0
  22. package/dist/cf-deploy/nativeMigrations.d.ts +20 -0
  23. package/dist/cf-deploy/nativeMigrations.d.ts.map +1 -0
  24. package/dist/cf-deploy/nativeMigrations.js +171 -0
  25. package/dist/cf-deploy/nativeMigrations.js.map +1 -0
  26. package/dist/cf-deploy/prune.d.ts +14 -0
  27. package/dist/cf-deploy/prune.d.ts.map +1 -0
  28. package/dist/cf-deploy/prune.js +235 -0
  29. package/dist/cf-deploy/prune.js.map +1 -0
  30. package/dist/cf-deploy/shims.d.ts +13 -0
  31. package/dist/cf-deploy/shims.d.ts.map +1 -0
  32. package/dist/cf-deploy/shims.js +737 -0
  33. package/dist/cf-deploy/shims.js.map +1 -0
  34. package/dist/cf-deploy/smoke.d.ts +15 -0
  35. package/dist/cf-deploy/smoke.d.ts.map +1 -0
  36. package/dist/cf-deploy/smoke.js +141 -0
  37. package/dist/cf-deploy/smoke.js.map +1 -0
  38. package/dist/cf-deploy/sources.d.ts +9 -0
  39. package/dist/cf-deploy/sources.d.ts.map +1 -0
  40. package/dist/cf-deploy/sources.js +276 -0
  41. package/dist/cf-deploy/sources.js.map +1 -0
  42. package/dist/cf-deploy/wrangler.d.ts +6 -0
  43. package/dist/cf-deploy/wrangler.d.ts.map +1 -0
  44. package/dist/cf-deploy/wrangler.js +168 -0
  45. package/dist/cf-deploy/wrangler.js.map +1 -0
  46. package/dist/cf-do/tx-journal.d.ts.map +1 -1
  47. package/dist/cf-do/tx-journal.js +63 -1
  48. package/dist/cf-do/tx-journal.js.map +1 -1
  49. package/dist/cf-do/worker.d.ts +1 -0
  50. package/dist/cf-do/worker.d.ts.map +1 -1
  51. package/dist/cf-do/worker.js +32 -11
  52. package/dist/cf-do/worker.js.map +1 -1
  53. package/dist/pg-sqlite-compiler/passes/types.d.ts.map +1 -1
  54. package/dist/pg-sqlite-compiler/passes/types.js +12 -0
  55. package/dist/pg-sqlite-compiler/passes/types.js.map +1 -1
  56. package/dist/worker/cf-patches.d.ts.map +1 -1
  57. package/dist/worker/cf-patches.js +7 -0
  58. package/dist/worker/cf-patches.js.map +1 -1
  59. package/dist/worker/zero-cache-embed.d.ts.map +1 -1
  60. package/dist/worker/zero-cache-embed.js +16 -1
  61. package/dist/worker/zero-cache-embed.js.map +1 -1
  62. package/dist/zero-worker-argv-patch.d.ts +13 -0
  63. package/dist/zero-worker-argv-patch.d.ts.map +1 -0
  64. package/dist/zero-worker-argv-patch.js +76 -0
  65. package/dist/zero-worker-argv-patch.js.map +1 -0
  66. package/package.json +13 -6
package/README.md CHANGED
@@ -21,6 +21,29 @@ hosts. It replaces Zero's server side and speaks the Zero protocol to the real
21
21
  forking Zero's query or mutation API. See the
22
22
  [Orez Lite server documentation](docs/sync/README.md).
23
23
 
24
+ ## Cloudflare deploy integration
25
+
26
+ `orez/cf-deploy` is the canonical deploy-time integration for One/Orez apps
27
+ using the split app-worker and Durable Object data-worker architecture. It
28
+ exports worker-shim generators, migration-module builders, wrangler
29
+ normalization, bundle pruning, and readiness checks. Consumers provide their
30
+ own token prefix and app-specific policy:
31
+
32
+ ```ts
33
+ import { buildRustSyncUserShimSource, cfDeployConfig } from 'orez/cf-deploy'
34
+
35
+ const config = cfDeployConfig('example', {
36
+ compiledWasmModules: ['example-wasm/module.wasm'],
37
+ })
38
+
39
+ const source = buildRustSyncUserShimSource(config, {
40
+ feedTables: {},
41
+ })
42
+ ```
43
+
44
+ Individual modules are also exported, such as
45
+ `orez/cf-deploy/bundle` and `orez/cf-deploy/nativeMigrations`.
46
+
24
47
  ## Requirements
25
48
 
26
49
  - **Bun** 1.0+ or **Node.js** 20+
@@ -0,0 +1,21 @@
1
+ import { type Plugin } from 'esbuild';
2
+ import type { CfDeployConfig } from './config.js';
3
+ import type { WorkerChunkPruneSignatures } from './prune.js';
4
+ export interface BundleCloudflareDoWorkerOptions {
5
+ workerDir: string;
6
+ shimPath: string;
7
+ outfile: string;
8
+ writeMigrationModule: (workerDir: string) => Promise<string>;
9
+ chunkPruneSignatures?: WorkerChunkPruneSignatures;
10
+ }
11
+ export declare const SERVER_CONTEXT_STUBS: Record<string, string>;
12
+ export declare function orezCfAliasPlugin(cfg: CfDeployConfig, aliases: Record<string, string>, resolveDir: string, nodeModulesPath: string, wasmOutDir?: string, options?: {
13
+ nativeApplicationSql?: boolean;
14
+ }): Plugin;
15
+ export declare function bundleCloudflareDoWorker(cfg: CfDeployConfig, options: BundleCloudflareDoWorkerOptions): Promise<void>;
16
+ /** bundle a One app with SQL storage but without the zero-cache runtime. */
17
+ export declare function bundleCloudflareRustSyncAppWorker(cfg: CfDeployConfig, options: BundleCloudflareDoWorkerOptions): Promise<void>;
18
+ export declare function bundleCloudflareDoDataWorker(cfg: CfDeployConfig, options: BundleCloudflareDoWorkerOptions): Promise<void>;
19
+ /** bundle a data worker that owns the SQL DO without the PG translator or zero-cache. */
20
+ export declare function bundleCloudflareNativeDataWorker(cfg: CfDeployConfig, options: BundleCloudflareDoWorkerOptions): Promise<void>;
21
+ //# sourceMappingURL=bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/cf-deploy/bundle.ts"],"names":[],"mappings":"AAYA,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAa5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAE5D,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5D,oBAAoB,CAAC,EAAE,0BAA0B,CAAA;CAClD;AAWD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAEvD,CAAA;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,UAAU,SAAa,EACvB,OAAO,CAAC,EAAE;IAAE,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C,MAAM,CAuIR;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,+BAA+B,iBAoBzC;AAED,4EAA4E;AAC5E,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,+BAA+B,iBAiBzC;AAyID,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,+BAA+B,iBA6CzC;AAED,yFAAyF;AACzF,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,+BAA+B,iBAiCzC"}
@@ -0,0 +1,347 @@
1
+ import { copyFileSync, existsSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync, } from 'fs';
2
+ import { createRequire } from 'module';
3
+ import { basename, dirname, join } from 'path';
4
+ import { build } from 'esbuild';
5
+ import { getBrowserAliases, getBrowserDefine } from '../worker/browser-build-config.js';
6
+ import { prepareZeroCacheForCF } from '../worker/cf-patches.js';
7
+ import { NODE_EXTERNALS, isCloudflarePgImporter, isOrezAliasImporter, resolveAlias, } from './leaves.js';
8
+ import { pruneUnreachableWorkerModules, shimWorkerCreateRequire } from './prune.js';
9
+ import { cloudflarePgVirtualModule } from './sources.js';
10
+ // react's build-context marker packages, resolved for the SERVER context these
11
+ // workers are. 'server-only' ships a throwing default entry (its guard targets
12
+ // client bundles); under this bundle's [workerd, worker, import] conditions it
13
+ // resolves to that throw and kills any importing module at init — in prod this
14
+ // took out the data-worker push handler for every custom mutator (2026-07-09).
15
+ // the DO/data worker is a server context, so the marker must be a no-op here.
16
+ // unlike the generic aliases below, these apply to EVERY importer (consumer
17
+ // code, not just orez internals). scripts/check/zero-push-graph.ts asserts this
18
+ // map covers any marker package the push graph imports.
19
+ export const SERVER_CONTEXT_STUBS = {
20
+ 'server-only': 'export {}\n',
21
+ };
22
+ export function orezCfAliasPlugin(cfg, aliases, resolveDir, nodeModulesPath, wasmOutDir = resolveDir, options) {
23
+ const entries = Object.entries(aliases);
24
+ const utilVirtualModule = 'export function promisify(fn) { return fn }\nexport function inspect(value) { try { return JSON.stringify(value) } catch { return String(value) } }\nexport function format(...args) { return args.map((arg) => typeof arg === "string" ? arg : inspect(arg)).join(" ") }\nexport function stripVTControlCharacters(value) { return value }\nexport function styleText(_format, text) { return text }\nexport function inherits(ctor, superCtor) { ctor.prototype = Object.create(superCtor.prototype); ctor.prototype.constructor = ctor }\nexport function deprecate(fn) { return fn }\nexport const types = { isDate: (value) => value instanceof Date, isRegExp: (value) => value instanceof RegExp, isTypedArray: (value) => ArrayBuffer.isView(value) && !(value instanceof DataView), isProxy: () => false }\nexport default { promisify, inspect, format, stripVTControlCharacters, styleText, inherits, deprecate, types }\n';
25
+ const eventsVirtualModule = 'export class EventEmitter { constructor() { this._events = new Map() } on(event, listener) { const list = this._events.get(event) || []; list.push(listener); this._events.set(event, list); return this } once(event, listener) { const wrapped = (...args) => { this.off(event, wrapped); listener(...args) }; return this.on(event, wrapped) } off(event, listener) { const list = this._events.get(event); if (list) this._events.set(event, list.filter((item) => item !== listener)); return this } removeListener(event, listener) { return this.off(event, listener) } removeAllListeners(event) { if (event === undefined) this._events.clear(); else this._events.delete(event); return this } emit(event, ...args) { for (const listener of this._events.get(event) || []) listener(...args); return true } }\nexport default EventEmitter\n';
26
+ const fsVirtualModule = 'const missing = () => new Error("filesystem is not available in Cloudflare Workers")\nexport function existsSync() { return false }\nexport function readFileSync() { return "" }\nexport function writeFileSync() {}\nexport function mkdirSync() {}\nexport function rmSync() {}\nexport function statSync() { return { size: 0, mode: 0, isFile: () => false, isDirectory: () => false } }\nexport function stat(_path, callback) { const error = missing(); if (callback) { queueMicrotask(() => callback(error)); return } return Promise.reject(error) }\nexport function createReadStream() { return { on() { return this }, once() { return this }, pipe(target) { return target }, destroy() {} } }\nexport function readFile() { return Promise.resolve("") }\nexport function writeFile() { return Promise.resolve() }\nexport function mkdir() { return Promise.resolve() }\nexport function mkdtemp(prefix = "") { return Promise.resolve(`${prefix}stub`) }\nexport function rm() { return Promise.resolve() }\nexport function access() { return Promise.reject(missing()) }\nexport const promises = { readFile, writeFile, mkdir, mkdtemp, rm, stat: () => Promise.reject(missing()), access }\nexport default { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync, statSync, stat, createReadStream, readFile, writeFile, mkdir, mkdtemp, rm, access, promises }\n';
27
+ const pathVirtualModule = 'export const sep = "/"\nfunction normalizePath(path) { const absolute = String(path).startsWith("/"); const parts = []; for (const part of String(path).split("/")) { if (!part || part === ".") continue; if (part === "..") parts.pop(); else parts.push(part) } const normalized = parts.join("/"); return `${absolute ? "/" : ""}${normalized}` || (absolute ? "/" : ".") }\nexport const normalize = normalizePath\nexport function join(...parts) { return normalizePath(parts.filter(Boolean).join("/")) }\nexport function resolve(...parts) { const joined = parts.filter(Boolean).join("/"); return normalizePath(joined.startsWith("/") ? joined : `/${joined}`) }\nexport function basename(path) { const normalized = normalizePath(path); return normalized === "/" ? "" : normalized.split("/").pop() || "" }\nexport function dirname(path) { const normalized = normalizePath(path); if (normalized === "/") return "/"; const parts = normalized.split("/"); parts.pop(); return parts.join("/") || (normalized.startsWith("/") ? "/" : ".") }\nexport function relative(_from, to) { return normalizePath(to) }\nexport function extname(path) { const base = basename(path); const dot = base.lastIndexOf("."); return dot > 0 ? base.slice(dot) : "" }\nexport default { sep, normalize, join, resolve, basename, dirname, relative, extname }\n';
28
+ const bufferVirtualModule = 'export const Buffer = globalThis.Buffer\nexport default { Buffer }\n';
29
+ const virtualModules = {
30
+ buffer: bufferVirtualModule,
31
+ 'node:buffer': bufferVirtualModule,
32
+ util: utilVirtualModule,
33
+ 'node:util': utilVirtualModule,
34
+ events: eventsVirtualModule,
35
+ 'node:events': eventsVirtualModule,
36
+ fs: fsVirtualModule,
37
+ 'node:fs': fsVirtualModule,
38
+ 'fs/promises': fsVirtualModule,
39
+ 'node:fs/promises': fsVirtualModule,
40
+ path: pathVirtualModule,
41
+ 'node:path': pathVirtualModule,
42
+ '@dotenvx/dotenvx': 'const empty = { parsed: {}, error: undefined }\nexport function config() { return empty }\nexport function configDotenv() { return empty }\nexport function parse() { return {} }\nexport function populate(target, source = {}) { if (target && source && typeof target === "object") Object.assign(target, source); return target }\nexport function decrypt() { return "" }\nexport default { config, configDotenv, parse, populate, decrypt }\n',
43
+ '@fastify/websocket': 'export default function websocket() {}\n',
44
+ '@opentelemetry/api': 'const noopSpan = { setAttribute() { return this }, setAttributes() { return this }, addEvent() { return this }, recordException() { return this }, setStatus() { return this }, end() {}, spanContext() { return {} } }\nexport const ROOT_CONTEXT = {}\nexport const SpanStatusCode = { OK: 1, ERROR: 2, UNSET: 0 }\nexport const DiagLogLevel = { NONE: 0, ERROR: 30, WARN: 50, INFO: 60, DEBUG: 70, VERBOSE: 80, ALL: 9999 }\nexport const context = { active() { return ROOT_CONTEXT }, with(_ctx, fn, thisArg, ...args) { return fn.apply(thisArg, args) }, bind(_ctx, target) { return target } }\nexport const propagation = { inject() {}, extract(_ctx) { return _ctx || ROOT_CONTEXT } }\nexport const trace = { getTracer() { return { startSpan() { return noopSpan }, startActiveSpan(_name, a, b, c) { const fn = typeof a === "function" ? a : typeof b === "function" ? b : c; return fn(noopSpan) } } }, setSpan(ctx) { return ctx }, getSpan() { return noopSpan } }\nexport const metrics = { getMeter() { return { createCounter() { return { add() {} } }, createUpDownCounter() { return { add() {} } }, createHistogram() { return { record() {} } }, createGauge() { return { record() {} } }, createObservableGauge() { return { addCallback() {} } }, createObservableCounter() { return { addCallback() {} } } } } }\nexport const diag = { setLogger() {}, debug() {}, info() {}, warn() {}, error() {}, verbose() {} }\n',
45
+ '@opentelemetry/api-logs': 'export const SeverityNumber = { TRACE: 1, DEBUG: 5, INFO: 9, WARN: 13, ERROR: 17, FATAL: 21 }\nexport const logs = { getLogger() { return { emit() {} } } }\n',
46
+ '@opentelemetry/auto-instrumentations-node': 'export function getNodeAutoInstrumentations() { return [] }\n',
47
+ '@opentelemetry/exporter-metrics-otlp-http': 'export class OTLPMetricExporter { constructor() {} }\n',
48
+ '@opentelemetry/resources': 'export function resourceFromAttributes(attributes) { return { attributes } }\n',
49
+ '@opentelemetry/sdk-metrics': 'export class MeterProvider { constructor() {} getMeter() { return { createObservableGauge() { return { addCallback() {} } }, createObservableCounter() { return { addCallback() {} } } } } async shutdown() {} }\nexport class PeriodicExportingMetricReader { constructor() {} }\n',
50
+ '@opentelemetry/sdk-node': 'export class NodeSDK { constructor() {} start() {} async shutdown() {} }\n',
51
+ '@opentelemetry/semantic-conventions': "export const ATTR_SERVICE_VERSION = 'service.version'\n",
52
+ 'chalk-template': 'export function template(strings, ...values) { return String.raw({ raw: strings }, ...values) }\nexport default template\n',
53
+ 'command-line-usage': 'export default function commandLineUsage() { return "" }\n',
54
+ 'is-in-subnet': 'export function isIPv6(value) { return String(value).includes(":") }\nexport function isPrivate() { return false }\nexport function isReserved() { return false }\n',
55
+ ...SERVER_CONTEXT_STUBS,
56
+ };
57
+ if (!options?.nativeApplicationSql) {
58
+ const doBackendPath = join(nodeModulesPath, 'orez', 'dist', 'pg-proxy-do-backend.js');
59
+ const doBackendVirtualSpecifier = `${cfg.prefix}-do-backend`;
60
+ virtualModules.pg = cloudflarePgVirtualModule(cfg, doBackendPath);
61
+ virtualModules[doBackendVirtualSpecifier] =
62
+ `export { DoBackend } from ${JSON.stringify(doBackendPath)}\n`;
63
+ }
64
+ return {
65
+ name: 'orez-cf-aliases',
66
+ setup(buildApi) {
67
+ // consumer-declared .wasm modules (cfg.compiledWasmModules) → attach each as a
68
+ // CompiledWasm worker module: resolve the specifier (honoring its package
69
+ // exports), copy the file next to the worker output, and rewrite the import to
70
+ // a relative external specifier. wrangler's CompiledWasm rule then turns it
71
+ // into a WebAssembly.Module at runtime (workerd forbids compiling wasm from
72
+ // bytes). app-neutral — every specifier comes from the consumer's config, not
73
+ // baked in here. each onResolve only fires when that specifier is imported.
74
+ const wasmModules = cfg.compiledWasmModules ?? [];
75
+ if (wasmModules.length > 0) {
76
+ const requireFrom = createRequire(join(nodeModulesPath, '..', '_orez-cf.cjs'));
77
+ for (const specifier of wasmModules) {
78
+ const filter = new RegExp(`^${specifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`);
79
+ buildApi.onResolve({ filter }, () => {
80
+ const real = requireFrom.resolve(specifier);
81
+ const name = basename(real);
82
+ copyFileSync(real, join(wasmOutDir, name));
83
+ return { path: `./${name}`, external: true };
84
+ });
85
+ }
86
+ }
87
+ for (const specifier of Object.keys(virtualModules)) {
88
+ const filter = new RegExp(`^${specifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`);
89
+ buildApi.onResolve({ filter }, (args) => {
90
+ if (specifier === 'pg' || specifier.endsWith('-do-backend')) {
91
+ if (args.importer &&
92
+ !isCloudflarePgImporter(args.importer, resolveDir) &&
93
+ !isOrezAliasImporter(args.importer)) {
94
+ return undefined;
95
+ }
96
+ return { path: specifier, namespace: 'orez-cf-virtual' };
97
+ }
98
+ // server-context stubs apply regardless of importer: consumer app
99
+ // code (e.g. an auth module's `import 'server-only'`) must hit the
100
+ // no-op, not the throwing client-guard entry
101
+ if (specifier in SERVER_CONTEXT_STUBS) {
102
+ return { path: specifier, namespace: 'orez-cf-virtual' };
103
+ }
104
+ if (args.importer && !isOrezAliasImporter(args.importer))
105
+ return undefined;
106
+ return { path: specifier, namespace: 'orez-cf-virtual' };
107
+ });
108
+ }
109
+ buildApi.onLoad({ filter: /.*/, namespace: 'orez-cf-virtual' }, (args) => ({
110
+ contents: virtualModules[args.path],
111
+ loader: 'js',
112
+ resolveDir,
113
+ }));
114
+ for (const [specifier, target] of entries) {
115
+ const filter = new RegExp(`^${specifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`);
116
+ buildApi.onResolve({ filter }, async (args) => {
117
+ const isZeroRunner = specifier === '@rocicorp/zero/out/zero-cache/src/server/runner/run-worker.js';
118
+ const isPatchedParser = specifier.startsWith('libpg-query');
119
+ if (!isZeroRunner &&
120
+ !isPatchedParser &&
121
+ args.importer &&
122
+ !isOrezAliasImporter(args.importer)) {
123
+ return undefined;
124
+ }
125
+ return ((await resolveAlias(buildApi, target, resolveDir, args.kind)) ?? {
126
+ path: target,
127
+ });
128
+ });
129
+ }
130
+ },
131
+ };
132
+ }
133
+ export async function bundleCloudflareDoWorker(cfg, options) {
134
+ const { workerDir } = options;
135
+ const nodeModulesPath = realpathSync([
136
+ join(workerDir, 'node_modules'),
137
+ join(workerDir, '..', '..', 'node_modules'),
138
+ join(process.cwd(), 'node_modules'),
139
+ ].find((candidate) => existsSync(candidate)) || join(process.cwd(), 'node_modules'));
140
+ const zeroOverlay = prepareZeroCacheForCF({
141
+ nodeModulesPath,
142
+ outDir: join(workerDir, '.orez/zero-cache-cf'),
143
+ });
144
+ return bundleCloudflareSplitAppWorker(cfg, options, nodeModulesPath, getBrowserAliases(zeroOverlay));
145
+ }
146
+ /** bundle a One app with SQL storage but without the zero-cache runtime. */
147
+ export async function bundleCloudflareRustSyncAppWorker(cfg, options) {
148
+ const { workerDir } = options;
149
+ const nodeModulesPath = realpathSync([
150
+ join(workerDir, 'node_modules'),
151
+ join(workerDir, '..', '..', 'node_modules'),
152
+ join(process.cwd(), 'node_modules'),
153
+ ].find((candidate) => existsSync(candidate)) || join(process.cwd(), 'node_modules'));
154
+ return bundleCloudflareSplitAppWorker(cfg, options, nodeModulesPath, {}, { nativeApplicationSql: true });
155
+ }
156
+ async function bundleCloudflareSplitAppWorker(cfg, options, nodeModulesPath, aliases, pluginOptions) {
157
+ const { workerDir, shimPath, outfile, writeMigrationModule } = options;
158
+ await writeMigrationModule(workerDir);
159
+ // expose One's worker output under a stable name so the shim can DYNAMICALLY
160
+ // import it (getOneWorker -> './one-app.js'). esbuild code-splitting then emits
161
+ // it as its own lazily-evaluated chunk, so the DO isolates (schema migration /
162
+ // SQL backend) never evaluate the One app graph — the fix for the 128 MiB DO
163
+ // OOM. without code-splitting, a single-outfile bundle inlines + eagerly
164
+ // evaluates the dynamic import, which is what OOMed the DO.
165
+ const oneAppPath = join(workerDir, 'one-app.js');
166
+ copyFileSync(join(workerDir, 'index.js'), oneAppPath);
167
+ // Workers node compatibility provides streams. leaving these external avoids
168
+ // pulling readable-stream's browser dependency graph into the DO bundle.
169
+ for (const key of [
170
+ 'node:stream',
171
+ 'stream',
172
+ 'node:stream/promises',
173
+ 'stream/promises',
174
+ 'readable-stream',
175
+ ]) {
176
+ delete aliases[key];
177
+ }
178
+ // split output into a directory so dynamic imports become real lazy chunks.
179
+ const outDir = join(workerDir, '.do-bundle');
180
+ if (existsSync(outDir))
181
+ rmSync(outDir, { recursive: true, force: true });
182
+ await build({
183
+ entryPoints: [shimPath],
184
+ outdir: outDir,
185
+ entryNames: 'index',
186
+ bundle: true,
187
+ splitting: true,
188
+ format: 'esm',
189
+ platform: 'neutral',
190
+ target: 'es2022',
191
+ conditions: ['workerd', 'worker', 'import'],
192
+ mainFields: ['browser', 'module', 'main'],
193
+ external: ['cloudflare:*', './assets/*', ...NODE_EXTERNALS],
194
+ define: {
195
+ ...getBrowserDefine(),
196
+ // shim the CJS module globals, which are undefined in this workerd ESM
197
+ // bundle (platform: 'neutral' does not inject them). a bundled dep that
198
+ // references __filename/__dirname — common in RN/node libraries pulled
199
+ // into the SSR worker — otherwise throws "__filename is not defined" at
200
+ // worker startup, failing deploy validation.
201
+ __filename: JSON.stringify('index.js'),
202
+ __dirname: JSON.stringify('/'),
203
+ },
204
+ plugins: [
205
+ orezCfAliasPlugin(cfg, aliases, workerDir, nodeModulesPath, workerDir, pluginOptions),
206
+ ],
207
+ logLevel: 'silent',
208
+ });
209
+ const oneAppChunks = readdirSync(outDir).filter((name) => /^one-app-[A-Za-z0-9_-]+\.js$/.test(name));
210
+ if (oneAppChunks.length > 1) {
211
+ throw new Error(`expected at most one lazy one-app chunk, found ${oneAppChunks.length}: ${oneAppChunks.join(', ')}`);
212
+ }
213
+ const oneAppChunk = oneAppChunks[0];
214
+ if (oneAppChunk) {
215
+ // dynamic Rust-sync shims emit one lazy app chunk. one's external asset
216
+ // modules import the entry's helpers back from ../index.js, so retarget
217
+ // those references to that chunk. the static app shim emits no chunk and
218
+ // needs no rewrite.
219
+ const assetsDir = join(workerDir, 'assets');
220
+ if (existsSync(assetsDir)) {
221
+ for (const name of readdirSync(assetsDir)) {
222
+ if (!name.endsWith('.js') && !name.endsWith('.mjs'))
223
+ continue;
224
+ const file = join(assetsDir, name);
225
+ const source = readFileSync(file, 'utf8');
226
+ const rewritten = source.replace(/(\b(?:from|import)\s*\(?\s*)(['"])\.\.\/index\.js\2/g, `$1$2../${oneAppChunk}$2`);
227
+ if (rewritten !== source)
228
+ writeFileSync(file, rewritten);
229
+ }
230
+ }
231
+ }
232
+ rmSync(oneAppPath, { force: true });
233
+ // the shim entry (shimPath) plus the migration + schema-version modules it
234
+ // statically imports are esbuild INPUTS: esbuild inlined their code into
235
+ // index.js, so the root source files are orphans. leave them and wrangler's
236
+ // general `*-*.js` module rule (they all contain a dash) attaches dead
237
+ // duplicates into every DO isolate — resident weight against the 128 MiB DO
238
+ // budget the code-splitting above exists to protect. rm them like one-app.js.
239
+ rmSync(shimPath, { force: true });
240
+ rmSync(join(workerDir, 'orez-migrations.js'), { force: true });
241
+ rmSync(join(workerDir, 'orez-schema-version.js'), { force: true });
242
+ // collect the split output: index.js (entry) + chunk-*.js (lazy graphs) ->
243
+ // place them where wrangler attaches modules. the entry goes to `outfile`; the
244
+ // chunks go next to it (the rules glob `assets/**` doesn't cover them, so they
245
+ // sit beside index.js in dist/worker and the `./chunk-*.js` relative imports
246
+ // resolve).
247
+ for (const name of readdirSync(outDir)) {
248
+ const src = join(outDir, name);
249
+ if (name === 'index.js') {
250
+ copyFileSync(src, outfile);
251
+ }
252
+ else {
253
+ copyFileSync(src, join(workerDir, name));
254
+ }
255
+ }
256
+ rmSync(outDir, { recursive: true, force: true });
257
+ // prune asset modules UNREACHABLE from the worker entry's import graph.
258
+ // wrangler's `assets/**/*.js` rule attaches every chunk in assets/ as a worker
259
+ // module, and workerd holds ALL attached modules resident in EVERY isolate.
260
+ // hundreds of those are orphans (client-only / dead route chunks the server
261
+ // never imports). that resident-module weight — not the migration — is what
262
+ // OOMs the 128 MiB DO isolate. attach only what the entry actually reaches.
263
+ pruneUnreachableWorkerModules(workerDir, basename(outfile));
264
+ // neutralize the CJS-interop banner that throws at module eval in workerd.
265
+ shimWorkerCreateRequire(workerDir);
266
+ }
267
+ // bundle the LEAN data-tier worker: the orez data shim (ZeroSqlDO + ZeroCacheDO +
268
+ // embed + migration), NONE of the One app. single-outfile (no splitting needed —
269
+ // this graph is small, ~2.4 MiB, and runs with full DO-isolate headroom). reuses
270
+ // bundleCloudflareDoWorker's orez machinery (overlay + migration module + pg/
271
+ // browser aliases) but skips the one-app copy/split/prune.
272
+ export async function bundleCloudflareDoDataWorker(cfg, options) {
273
+ const { workerDir, shimPath, outfile, writeMigrationModule } = options;
274
+ const nodeModulesPath = realpathSync([
275
+ join(workerDir, 'node_modules'),
276
+ join(workerDir, '..', '..', 'node_modules'),
277
+ join(process.cwd(), 'node_modules'),
278
+ ].find((candidate) => existsSync(candidate)) || join(process.cwd(), 'node_modules'));
279
+ const zeroOverlay = prepareZeroCacheForCF({
280
+ nodeModulesPath,
281
+ outDir: join(workerDir, '.orez/zero-cache-cf'),
282
+ });
283
+ await writeMigrationModule(workerDir);
284
+ const aliases = getBrowserAliases(zeroOverlay);
285
+ for (const key of [
286
+ 'node:stream',
287
+ 'stream',
288
+ 'node:stream/promises',
289
+ 'stream/promises',
290
+ 'readable-stream',
291
+ ]) {
292
+ delete aliases[key];
293
+ }
294
+ await build({
295
+ entryPoints: [shimPath],
296
+ outfile,
297
+ bundle: true,
298
+ format: 'esm',
299
+ platform: 'neutral',
300
+ target: 'es2022',
301
+ conditions: ['workerd', 'worker', 'import'],
302
+ mainFields: ['browser', 'module', 'main'],
303
+ external: ['cloudflare:*', ...NODE_EXTERNALS],
304
+ define: {
305
+ ...getBrowserDefine(),
306
+ __filename: JSON.stringify('index.js'),
307
+ __dirname: JSON.stringify('/'),
308
+ },
309
+ plugins: [
310
+ orezCfAliasPlugin(cfg, aliases, workerDir, nodeModulesPath, dirname(outfile)),
311
+ ],
312
+ logLevel: 'silent',
313
+ });
314
+ }
315
+ /** bundle a data worker that owns the SQL DO without the PG translator or zero-cache. */
316
+ export async function bundleCloudflareNativeDataWorker(cfg, options) {
317
+ const { workerDir, shimPath, outfile, writeMigrationModule } = options;
318
+ const nodeModulesPath = realpathSync([
319
+ join(workerDir, 'node_modules'),
320
+ join(workerDir, '..', '..', 'node_modules'),
321
+ join(process.cwd(), 'node_modules'),
322
+ ].find((candidate) => existsSync(candidate)) || join(process.cwd(), 'node_modules'));
323
+ await writeMigrationModule(workerDir);
324
+ await build({
325
+ entryPoints: [shimPath],
326
+ outfile,
327
+ bundle: true,
328
+ format: 'esm',
329
+ platform: 'neutral',
330
+ target: 'es2022',
331
+ conditions: ['workerd', 'worker', 'import'],
332
+ mainFields: ['browser', 'module', 'main'],
333
+ external: ['cloudflare:*', ...NODE_EXTERNALS],
334
+ define: {
335
+ ...getBrowserDefine(),
336
+ __filename: JSON.stringify('index.js'),
337
+ __dirname: JSON.stringify('/'),
338
+ },
339
+ plugins: [
340
+ orezCfAliasPlugin(cfg, {}, workerDir, nodeModulesPath, dirname(outfile), {
341
+ nativeApplicationSql: true,
342
+ }),
343
+ ],
344
+ logLevel: 'silent',
345
+ });
346
+ }
347
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/cf-deploy/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,IAAI,CAAA;AACX,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE9C,OAAO,EAAE,KAAK,EAAe,MAAM,SAAS,CAAA;AAE5C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,GACb,MAAM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CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CACpF,CAAA;IACD,MAAM,oBAAoB,CAAC,SAAS,CAAC,CAAA;IACrC,MAAM,KAAK,CAAC;QACV,WAAW,EAAE,CAAC,QAAQ,CAAC;QACvB,OAAO;QACP,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC;QAC3C,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC;QACzC,QAAQ,EAAE,CAAC,cAAc,EAAE,GAAG,cAAc,CAAC;QAC7C,MAAM,EAAE;YACN,GAAG,gBAAgB,EAAE;YACrB,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;YACtC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;SAC/B;QACD,OAAO,EAAE;YACP,iBAAiB,CAAC,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;gBACvE,oBAAoB,EAAE,IAAI;aAC3B,CAAC;SACH;QACD,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,52 @@
1
+ export interface CfDeployConfig {
2
+ /**
3
+ * lowercase per-deploy token prefix. drives every `__<prefix>_*` global,
4
+ * `/__<prefix>_*` internal path, `x-<prefix>-*` header, `_<prefix>_*` table,
5
+ * `[<prefix>]` log tag, `<prefix>-do-backend` alias, `<prefix>-backup-v2`
6
+ * format, and the `zero_<prefix>` publication.
7
+ */
8
+ prefix: string;
9
+ /**
10
+ * PascalCase variant of `prefix` for identifier names
11
+ * (`run<Prefix>CloudflareMigrations`, `<Prefix>CloudflarePgPool`).
12
+ */
13
+ prefixPascal: string;
14
+ /**
15
+ * Consumer-declared import specifiers to attach as CompiledWasm worker modules.
16
+ * Each is resolved (honoring the package's `exports`), copied next to the worker
17
+ * output, and its import rewritten to a relative external specifier — so
18
+ * wrangler's CompiledWasm rule turns it into a `WebAssembly.Module` at runtime
19
+ * (workerd forbids compiling wasm from bytes). The matching `import` must appear
20
+ * in a worker module the esbuild step bundles (e.g. the consumer's app shim).
21
+ * Keeps this package app-neutral: no dependency names are baked in here.
22
+ */
23
+ compiledWasmModules?: readonly string[];
24
+ /**
25
+ * Extra fetches the data worker's minute cron (`* * * * *`) fires at the app
26
+ * worker over the `APP` service binding, after the data-tier warm ping. Each
27
+ * emits a guarded `POST <path>` carrying the value of `env.<secretEnvVar>` in the
28
+ * `x-cron-secret` header. The synthetic request also carries a host because One's
29
+ * request URL parser requires it inside a service binding. For consumers whose
30
+ * job/flow runner lives in the app worker and needs a periodic tick (workerd has no
31
+ * long-running process). Keeps this package app-neutral: no consumer paths are
32
+ * baked into the template.
33
+ */
34
+ minuteCronAppForwards?: readonly {
35
+ path: string;
36
+ secretEnvVar: string;
37
+ }[];
38
+ /**
39
+ * Optional consumer push handler for `/api/zero/push` inside the data worker.
40
+ * When set, ZeroCacheDO's apiFetch handles pushes without re-entering the app
41
+ * worker; pulls still route through the app worker. The module is imported
42
+ * lazily so consumer code evaluates only after the data worker has installed
43
+ * its request env globals.
44
+ */
45
+ dataWorkerZeroPush?: {
46
+ module: string;
47
+ exportName: string;
48
+ };
49
+ }
50
+ /** build a CfDeployConfig from a lowercase prefix, deriving the PascalCase form. */
51
+ export declare function cfDeployConfig(prefix: string, options?: Pick<CfDeployConfig, 'compiledWasmModules' | 'minuteCronAppForwards' | 'dataWorkerZeroPush'>): CfDeployConfig;
52
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/cf-deploy/config.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC;;;;;;;;;OASG;IACH,qBAAqB,CAAC,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACzE;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE;QACnB,MAAM,EAAE,MAAM,CAAA;QACd,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,IAAI,CACZ,cAAc,EACd,qBAAqB,GAAG,uBAAuB,GAAG,oBAAoB,CACvE,GACA,cAAc,CAWhB"}
@@ -0,0 +1,23 @@
1
+ // CfDeployConfig — the single neutralization seam for the shared Cloudflare/Orez
2
+ // deploy integration. every consumer-specific token in the worker shims is
3
+ // derived from `prefix`:
4
+ //
5
+ // prefix 'contrast' -> __contrast_* /__contrast_* x-contrast-* _contrast_* [contrast] zero_contrast
6
+ // contrast-do-backend contrast-backup-v2 contrast-ns (cookie)
7
+ // prefixPascal 'Contrast' -> runContrastCloudflareMigrations, ContrastCloudflarePgPool
8
+ //
9
+ // orez's own internal tokens (orez-data.local, __orez_signal_replication,
10
+ // _orez_pg_metadata, …) are NOT derived from prefix — they are shared across all
11
+ // consumers and stay fixed.
12
+ /** build a CfDeployConfig from a lowercase prefix, deriving the PascalCase form. */
13
+ export function cfDeployConfig(prefix, options) {
14
+ if (!/^[a-z][a-z0-9]*$/.test(prefix)) {
15
+ throw new Error(`cfDeployConfig: prefix must be a lowercase identifier, got ${JSON.stringify(prefix)}`);
16
+ }
17
+ return {
18
+ prefix,
19
+ prefixPascal: prefix.charAt(0).toUpperCase() + prefix.slice(1),
20
+ ...options,
21
+ };
22
+ }
23
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/cf-deploy/config.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,2EAA2E;AAC3E,yBAAyB;AACzB,EAAE;AACF,4GAA4G;AAC5G,oFAAoF;AACpF,yFAAyF;AACzF,EAAE;AACF,0EAA0E;AAC1E,iFAAiF;AACjF,4BAA4B;AAiD5B,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,OAGC;IAED,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,8DAA8D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CACvF,CAAA;IACH,CAAC;IACD,OAAO;QACL,MAAM;QACN,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,GAAG,OAAO;KACX,CAAA;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from './bundle.js';
2
+ export * from './config.js';
3
+ export * from './leaves.js';
4
+ export * from './migration.js';
5
+ export * from './nativeMigrations.js';
6
+ export * from './prune.js';
7
+ export * from './shims.js';
8
+ export * from './smoke.js';
9
+ export * from './sources.js';
10
+ export * from './wrangler.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cf-deploy/index.ts"],"names":[],"mappings":"AAMA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}
@@ -0,0 +1,17 @@
1
+ // orez/cf-deploy — shared Cloudflare/Orez Durable Object deploy integration.
2
+ //
3
+ // app-neutral building blocks for deploying a One/orez app to Cloudflare with the
4
+ // split app/data-worker Durable Object architecture. the consumer supplies a
5
+ // CfDeployConfig (token prefix + policy) and gets back the worker-source shims it
6
+ // bundles + deploys. consumers import the canonical implementation from Orez.
7
+ export * from './bundle.js';
8
+ export * from './config.js';
9
+ export * from './leaves.js';
10
+ export * from './migration.js';
11
+ export * from './nativeMigrations.js';
12
+ export * from './prune.js';
13
+ export * from './shims.js';
14
+ export * from './smoke.js';
15
+ export * from './sources.js';
16
+ export * from './wrangler.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cf-deploy/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,kFAAkF;AAClF,6EAA6E;AAC7E,kFAAkF;AAClF,8EAA8E;AAC9E,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}
@@ -0,0 +1,19 @@
1
+ import type { OnResolveArgs, PluginBuild } from 'esbuild';
2
+ export declare const WORKERS_DEV_URL_PATTERN: RegExp;
3
+ export declare const HEALTH_POLL_INTERVAL_MS = 2000;
4
+ export declare const HEALTH_POLL_MAX_ATTEMPTS = 60;
5
+ export declare const EMBED_READY_TIMEOUT_MS = 600000;
6
+ export declare const EMBED_WARM_TIMEOUT_MS: number;
7
+ export declare const EMBED_WARM_INTERVAL_MS = 3000;
8
+ export declare const EMBED_WARM_REQUEST_TIMEOUT_MS = 8000;
9
+ export declare const INTERNAL_ZERO_MUTATE_URL = "https://orez-zero-api.local/api/zero/push";
10
+ export declare const INTERNAL_ZERO_QUERY_URL = "https://orez-zero-api.local/api/zero/pull";
11
+ export declare function isOrezAliasImporter(importer: string): boolean;
12
+ export declare function resolveAlias(buildApi: PluginBuild, path: string, resolveDir: string, kind: OnResolveArgs['kind']): Promise<import("esbuild").ResolveResult | undefined>;
13
+ export declare function packageEntryForDirectory(path: string): string;
14
+ export declare function importSpecifier(fromDir: string, filePath: string): string;
15
+ export declare function quoteSqlIdentifier(value: string): string;
16
+ export declare function isCloudflarePgImporter(importer: string, workerDir: string): boolean;
17
+ export declare function normalizeTmpSymlinkPath(path: string): string;
18
+ export declare const NODE_EXTERNALS: string[];
19
+ //# sourceMappingURL=leaves.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaves.d.ts","sourceRoot":"","sources":["../../src/cf-deploy/leaves.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,eAAO,MAAM,uBAAuB,QACkB,CAAA;AACtD,eAAO,MAAM,uBAAuB,OAAQ,CAAA;AAC5C,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAQ1C,eAAO,MAAM,sBAAsB,SAAU,CAAA;AAC7C,eAAO,MAAM,qBAAqB,QAAmC,CAAA;AACrE,eAAO,MAAM,sBAAsB,OAAQ,CAAA;AAC3C,eAAO,MAAM,6BAA6B,OAAQ,CAAA;AAClD,eAAO,MAAM,wBAAwB,8CAA8C,CAAA;AACnF,eAAO,MAAM,uBAAuB,8CAA8C,CAAA;AAElF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAiB7D;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,WAAW,EACrB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,wDAM5B;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ7D;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGzE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAanF;AAKD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,eAAO,MAAM,cAAc,UAgC1B,CAAA"}