@aprovan/patchwork-compiler 0.1.2-dev.ba8f277 → 0.1.2-dev.c680591
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/dist/index.cjs +13 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -16
- package/dist/index.d.ts +22 -16
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -17,7 +17,7 @@ interface VirtualProject {
|
|
|
17
17
|
/**
|
|
18
18
|
* Core types for the Patchwork compiler
|
|
19
19
|
*/
|
|
20
|
-
type Platform =
|
|
20
|
+
type Platform = "browser" | "cli";
|
|
21
21
|
interface Manifest$1 {
|
|
22
22
|
name: string;
|
|
23
23
|
version: string;
|
|
@@ -29,7 +29,7 @@ interface Manifest$1 {
|
|
|
29
29
|
packages?: Record<string, string>;
|
|
30
30
|
}
|
|
31
31
|
interface InputSpec {
|
|
32
|
-
type:
|
|
32
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
33
33
|
default?: unknown;
|
|
34
34
|
required?: boolean;
|
|
35
35
|
description?: string;
|
|
@@ -46,7 +46,7 @@ interface CompiledWidget {
|
|
|
46
46
|
/** Source map (if generated) */
|
|
47
47
|
sourceMap?: string;
|
|
48
48
|
}
|
|
49
|
-
type MountMode =
|
|
49
|
+
type MountMode = "embedded" | "iframe";
|
|
50
50
|
interface MountOptions {
|
|
51
51
|
/** Target DOM element to mount into */
|
|
52
52
|
target: HTMLElement;
|
|
@@ -79,8 +79,8 @@ interface ImageConfig$1 {
|
|
|
79
79
|
platform: Platform;
|
|
80
80
|
esbuild?: {
|
|
81
81
|
target?: string;
|
|
82
|
-
format?:
|
|
83
|
-
jsx?:
|
|
82
|
+
format?: "esm" | "cjs" | "iife";
|
|
83
|
+
jsx?: "automatic" | "transform" | "preserve";
|
|
84
84
|
jsxFactory?: string;
|
|
85
85
|
jsxFragment?: string;
|
|
86
86
|
};
|
|
@@ -136,6 +136,12 @@ interface CompilerOptions {
|
|
|
136
136
|
cdnBaseUrl?: string;
|
|
137
137
|
/** Base URL for widget imports (default: same as cdnBaseUrl). Used for transforming imports in widget code. */
|
|
138
138
|
widgetCdnBaseUrl?: string;
|
|
139
|
+
/**
|
|
140
|
+
* URL overrides for bundled assets/packages.
|
|
141
|
+
* Keys are asset identifiers (e.g., 'esbuild-wasm/esbuild.wasm'), values are local URLs.
|
|
142
|
+
* Use this to bundle assets locally for offline support or improved performance.
|
|
143
|
+
*/
|
|
144
|
+
urlOverrides?: Record<string, string>;
|
|
139
145
|
}
|
|
140
146
|
interface Compiler {
|
|
141
147
|
/** Pre-load an image package */
|
|
@@ -157,7 +163,7 @@ interface Compiler {
|
|
|
157
163
|
* The compiler provides the interface; actual implementation (e.g., UTCP, MCP)
|
|
158
164
|
* is handled by the runtime/backend.
|
|
159
165
|
*/
|
|
160
|
-
interface
|
|
166
|
+
interface Proxy {
|
|
161
167
|
call(namespace: string, procedure: string, args: unknown[]): Promise<unknown>;
|
|
162
168
|
}
|
|
163
169
|
/**
|
|
@@ -178,7 +184,7 @@ interface GlobalInterfaceDefinition {
|
|
|
178
184
|
/** Optional TypeScript type definitions for methods */
|
|
179
185
|
types?: string;
|
|
180
186
|
}
|
|
181
|
-
type BridgeMessageType =
|
|
187
|
+
type BridgeMessageType = "service-call" | "service-result" | "error";
|
|
182
188
|
interface BridgeMessage {
|
|
183
189
|
type: BridgeMessageType;
|
|
184
190
|
id: string;
|
|
@@ -695,11 +701,11 @@ declare class VFSStore {
|
|
|
695
701
|
/**
|
|
696
702
|
* Mount a widget in embedded mode (direct DOM injection)
|
|
697
703
|
*/
|
|
698
|
-
declare function mountEmbedded(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy:
|
|
704
|
+
declare function mountEmbedded(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
|
|
699
705
|
/**
|
|
700
706
|
* Hot reload an embedded widget
|
|
701
707
|
*/
|
|
702
|
-
declare function reloadEmbedded(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy:
|
|
708
|
+
declare function reloadEmbedded(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
|
|
703
709
|
|
|
704
710
|
/**
|
|
705
711
|
* Iframe mount mode - mounts widgets in sandboxed iframes
|
|
@@ -725,11 +731,11 @@ declare const DEV_SANDBOX: string[];
|
|
|
725
731
|
/**
|
|
726
732
|
* Mount a widget in iframe mode (sandboxed)
|
|
727
733
|
*/
|
|
728
|
-
declare function mountIframe(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy:
|
|
734
|
+
declare function mountIframe(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
|
|
729
735
|
/**
|
|
730
736
|
* Hot reload an iframe widget
|
|
731
737
|
*/
|
|
732
|
-
declare function reloadIframe(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy:
|
|
738
|
+
declare function reloadIframe(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
|
|
733
739
|
/**
|
|
734
740
|
* Dispose the shared bridge (call on app shutdown)
|
|
735
741
|
*/
|
|
@@ -742,7 +748,7 @@ declare function disposeIframeBridge(): void;
|
|
|
742
748
|
/**
|
|
743
749
|
* Create a service proxy that calls the backend via HTTP
|
|
744
750
|
*/
|
|
745
|
-
declare function
|
|
751
|
+
declare function createHttpProxy(proxyUrl: string): Proxy;
|
|
746
752
|
/**
|
|
747
753
|
* Creates a proxy that enables fluent method chaining for dynamic field access.
|
|
748
754
|
*
|
|
@@ -770,7 +776,7 @@ declare function createFieldAccessProxy<T = unknown>(namespace: string, handler:
|
|
|
770
776
|
* // calls proxy.call('github', 'repos.list_for_user', [{ username: 'x' }])
|
|
771
777
|
* ```
|
|
772
778
|
*/
|
|
773
|
-
declare function generateNamespaceGlobals(services: string[], proxy:
|
|
779
|
+
declare function generateNamespaceGlobals(services: string[], proxy: Proxy): Record<string, unknown>;
|
|
774
780
|
/**
|
|
775
781
|
* Inject namespace globals into a window object
|
|
776
782
|
*/
|
|
@@ -793,7 +799,7 @@ declare class ParentBridge {
|
|
|
793
799
|
private pendingCalls;
|
|
794
800
|
private iframes;
|
|
795
801
|
private messageHandler;
|
|
796
|
-
constructor(proxy:
|
|
802
|
+
constructor(proxy: Proxy);
|
|
797
803
|
/**
|
|
798
804
|
* Register an iframe to receive messages from
|
|
799
805
|
*/
|
|
@@ -816,7 +822,7 @@ declare class ParentBridge {
|
|
|
816
822
|
*
|
|
817
823
|
* Creates a service proxy that sends postMessage to parent.
|
|
818
824
|
*/
|
|
819
|
-
declare function
|
|
825
|
+
declare function createIframeProxy(): Proxy;
|
|
820
826
|
/**
|
|
821
827
|
* Generate the bridge script to inject into iframes
|
|
822
828
|
*
|
|
@@ -826,4 +832,4 @@ declare function createIframeServiceProxy(): ServiceProxy;
|
|
|
826
832
|
*/
|
|
827
833
|
declare function generateIframeBridgeScript(services: string[]): string;
|
|
828
834
|
|
|
829
|
-
export { type BridgeMessage, type BridgeMessageType, type CdnTransformOptions, type ChangeRecord, type CompileOptions, CompileOptionsSchema, type CompiledWidget, type Compiler, type CompilerOptions, DEFAULT_CLI_IMAGE_CONFIG, DEFAULT_IMAGE_CONFIG, DEV_SANDBOX, EsbuildConfigSchema, type GlobalInterfaceDefinition, HttpBackend, type HttpBackendConfig, type ImageConfig$1 as ImageConfig, ImageConfigSchema, type ImageMountFn, ImageRegistry, IndexedDBBackend, type InputSpec, InputSpecSchema, type LoadedImage, type Manifest$1 as Manifest, ManifestSchema, type MountMode, MountModeSchema, type MountOptions, MountOptionsSchema, type MountedWidget, ParentBridge, type Platform, PlatformSchema, type
|
|
835
|
+
export { type BridgeMessage, type BridgeMessageType, type CdnTransformOptions, type ChangeRecord, type CompileOptions, CompileOptionsSchema, type CompiledWidget, type Compiler, type CompilerOptions, DEFAULT_CLI_IMAGE_CONFIG, DEFAULT_IMAGE_CONFIG, DEV_SANDBOX, EsbuildConfigSchema, type GlobalInterfaceDefinition, HttpBackend, type HttpBackendConfig, type ImageConfig$1 as ImageConfig, ImageConfigSchema, type ImageMountFn, ImageRegistry, IndexedDBBackend, type InputSpec, InputSpecSchema, type LoadedImage, type Manifest$1 as Manifest, ManifestSchema, type MountMode, MountModeSchema, type MountOptions, MountOptionsSchema, type MountedWidget, ParentBridge, type Platform, PlatformSchema, type Proxy, type ServiceCallHandler, type ServiceCallPayload, type ServiceResultPayload, type VFSPluginOptions, VFSStore, type VFSStoreOptions, type VirtualFile, type VirtualProject, type WatchCallback, type WatchEventType, cdnTransformPlugin, createCompiler, createFieldAccessProxy, createHttpProxy, createIframeProxy, createImageRegistry, createProjectFromFiles, createSingleFileProject, detectMainFile, disposeIframeBridge, extractNamespaces, fetchPackageJson, generateIframeBridgeScript, generateImportMap, generateNamespaceGlobals, getCdnBaseUrl, getImageRegistry, injectNamespaceGlobals, loadImage, mountEmbedded, mountIframe, parseImageConfig, parseImageSpec, parseManifest, reloadEmbedded, reloadIframe, removeNamespaceGlobals, resolveEntry, safeParseImageConfig, safeParseManifest, setCdnBaseUrl, vfsPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface VirtualProject {
|
|
|
17
17
|
/**
|
|
18
18
|
* Core types for the Patchwork compiler
|
|
19
19
|
*/
|
|
20
|
-
type Platform =
|
|
20
|
+
type Platform = "browser" | "cli";
|
|
21
21
|
interface Manifest$1 {
|
|
22
22
|
name: string;
|
|
23
23
|
version: string;
|
|
@@ -29,7 +29,7 @@ interface Manifest$1 {
|
|
|
29
29
|
packages?: Record<string, string>;
|
|
30
30
|
}
|
|
31
31
|
interface InputSpec {
|
|
32
|
-
type:
|
|
32
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
33
33
|
default?: unknown;
|
|
34
34
|
required?: boolean;
|
|
35
35
|
description?: string;
|
|
@@ -46,7 +46,7 @@ interface CompiledWidget {
|
|
|
46
46
|
/** Source map (if generated) */
|
|
47
47
|
sourceMap?: string;
|
|
48
48
|
}
|
|
49
|
-
type MountMode =
|
|
49
|
+
type MountMode = "embedded" | "iframe";
|
|
50
50
|
interface MountOptions {
|
|
51
51
|
/** Target DOM element to mount into */
|
|
52
52
|
target: HTMLElement;
|
|
@@ -79,8 +79,8 @@ interface ImageConfig$1 {
|
|
|
79
79
|
platform: Platform;
|
|
80
80
|
esbuild?: {
|
|
81
81
|
target?: string;
|
|
82
|
-
format?:
|
|
83
|
-
jsx?:
|
|
82
|
+
format?: "esm" | "cjs" | "iife";
|
|
83
|
+
jsx?: "automatic" | "transform" | "preserve";
|
|
84
84
|
jsxFactory?: string;
|
|
85
85
|
jsxFragment?: string;
|
|
86
86
|
};
|
|
@@ -136,6 +136,12 @@ interface CompilerOptions {
|
|
|
136
136
|
cdnBaseUrl?: string;
|
|
137
137
|
/** Base URL for widget imports (default: same as cdnBaseUrl). Used for transforming imports in widget code. */
|
|
138
138
|
widgetCdnBaseUrl?: string;
|
|
139
|
+
/**
|
|
140
|
+
* URL overrides for bundled assets/packages.
|
|
141
|
+
* Keys are asset identifiers (e.g., 'esbuild-wasm/esbuild.wasm'), values are local URLs.
|
|
142
|
+
* Use this to bundle assets locally for offline support or improved performance.
|
|
143
|
+
*/
|
|
144
|
+
urlOverrides?: Record<string, string>;
|
|
139
145
|
}
|
|
140
146
|
interface Compiler {
|
|
141
147
|
/** Pre-load an image package */
|
|
@@ -157,7 +163,7 @@ interface Compiler {
|
|
|
157
163
|
* The compiler provides the interface; actual implementation (e.g., UTCP, MCP)
|
|
158
164
|
* is handled by the runtime/backend.
|
|
159
165
|
*/
|
|
160
|
-
interface
|
|
166
|
+
interface Proxy {
|
|
161
167
|
call(namespace: string, procedure: string, args: unknown[]): Promise<unknown>;
|
|
162
168
|
}
|
|
163
169
|
/**
|
|
@@ -178,7 +184,7 @@ interface GlobalInterfaceDefinition {
|
|
|
178
184
|
/** Optional TypeScript type definitions for methods */
|
|
179
185
|
types?: string;
|
|
180
186
|
}
|
|
181
|
-
type BridgeMessageType =
|
|
187
|
+
type BridgeMessageType = "service-call" | "service-result" | "error";
|
|
182
188
|
interface BridgeMessage {
|
|
183
189
|
type: BridgeMessageType;
|
|
184
190
|
id: string;
|
|
@@ -695,11 +701,11 @@ declare class VFSStore {
|
|
|
695
701
|
/**
|
|
696
702
|
* Mount a widget in embedded mode (direct DOM injection)
|
|
697
703
|
*/
|
|
698
|
-
declare function mountEmbedded(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy:
|
|
704
|
+
declare function mountEmbedded(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
|
|
699
705
|
/**
|
|
700
706
|
* Hot reload an embedded widget
|
|
701
707
|
*/
|
|
702
|
-
declare function reloadEmbedded(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy:
|
|
708
|
+
declare function reloadEmbedded(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
|
|
703
709
|
|
|
704
710
|
/**
|
|
705
711
|
* Iframe mount mode - mounts widgets in sandboxed iframes
|
|
@@ -725,11 +731,11 @@ declare const DEV_SANDBOX: string[];
|
|
|
725
731
|
/**
|
|
726
732
|
* Mount a widget in iframe mode (sandboxed)
|
|
727
733
|
*/
|
|
728
|
-
declare function mountIframe(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy:
|
|
734
|
+
declare function mountIframe(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
|
|
729
735
|
/**
|
|
730
736
|
* Hot reload an iframe widget
|
|
731
737
|
*/
|
|
732
|
-
declare function reloadIframe(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy:
|
|
738
|
+
declare function reloadIframe(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
|
|
733
739
|
/**
|
|
734
740
|
* Dispose the shared bridge (call on app shutdown)
|
|
735
741
|
*/
|
|
@@ -742,7 +748,7 @@ declare function disposeIframeBridge(): void;
|
|
|
742
748
|
/**
|
|
743
749
|
* Create a service proxy that calls the backend via HTTP
|
|
744
750
|
*/
|
|
745
|
-
declare function
|
|
751
|
+
declare function createHttpProxy(proxyUrl: string): Proxy;
|
|
746
752
|
/**
|
|
747
753
|
* Creates a proxy that enables fluent method chaining for dynamic field access.
|
|
748
754
|
*
|
|
@@ -770,7 +776,7 @@ declare function createFieldAccessProxy<T = unknown>(namespace: string, handler:
|
|
|
770
776
|
* // calls proxy.call('github', 'repos.list_for_user', [{ username: 'x' }])
|
|
771
777
|
* ```
|
|
772
778
|
*/
|
|
773
|
-
declare function generateNamespaceGlobals(services: string[], proxy:
|
|
779
|
+
declare function generateNamespaceGlobals(services: string[], proxy: Proxy): Record<string, unknown>;
|
|
774
780
|
/**
|
|
775
781
|
* Inject namespace globals into a window object
|
|
776
782
|
*/
|
|
@@ -793,7 +799,7 @@ declare class ParentBridge {
|
|
|
793
799
|
private pendingCalls;
|
|
794
800
|
private iframes;
|
|
795
801
|
private messageHandler;
|
|
796
|
-
constructor(proxy:
|
|
802
|
+
constructor(proxy: Proxy);
|
|
797
803
|
/**
|
|
798
804
|
* Register an iframe to receive messages from
|
|
799
805
|
*/
|
|
@@ -816,7 +822,7 @@ declare class ParentBridge {
|
|
|
816
822
|
*
|
|
817
823
|
* Creates a service proxy that sends postMessage to parent.
|
|
818
824
|
*/
|
|
819
|
-
declare function
|
|
825
|
+
declare function createIframeProxy(): Proxy;
|
|
820
826
|
/**
|
|
821
827
|
* Generate the bridge script to inject into iframes
|
|
822
828
|
*
|
|
@@ -826,4 +832,4 @@ declare function createIframeServiceProxy(): ServiceProxy;
|
|
|
826
832
|
*/
|
|
827
833
|
declare function generateIframeBridgeScript(services: string[]): string;
|
|
828
834
|
|
|
829
|
-
export { type BridgeMessage, type BridgeMessageType, type CdnTransformOptions, type ChangeRecord, type CompileOptions, CompileOptionsSchema, type CompiledWidget, type Compiler, type CompilerOptions, DEFAULT_CLI_IMAGE_CONFIG, DEFAULT_IMAGE_CONFIG, DEV_SANDBOX, EsbuildConfigSchema, type GlobalInterfaceDefinition, HttpBackend, type HttpBackendConfig, type ImageConfig$1 as ImageConfig, ImageConfigSchema, type ImageMountFn, ImageRegistry, IndexedDBBackend, type InputSpec, InputSpecSchema, type LoadedImage, type Manifest$1 as Manifest, ManifestSchema, type MountMode, MountModeSchema, type MountOptions, MountOptionsSchema, type MountedWidget, ParentBridge, type Platform, PlatformSchema, type
|
|
835
|
+
export { type BridgeMessage, type BridgeMessageType, type CdnTransformOptions, type ChangeRecord, type CompileOptions, CompileOptionsSchema, type CompiledWidget, type Compiler, type CompilerOptions, DEFAULT_CLI_IMAGE_CONFIG, DEFAULT_IMAGE_CONFIG, DEV_SANDBOX, EsbuildConfigSchema, type GlobalInterfaceDefinition, HttpBackend, type HttpBackendConfig, type ImageConfig$1 as ImageConfig, ImageConfigSchema, type ImageMountFn, ImageRegistry, IndexedDBBackend, type InputSpec, InputSpecSchema, type LoadedImage, type Manifest$1 as Manifest, ManifestSchema, type MountMode, MountModeSchema, type MountOptions, MountOptionsSchema, type MountedWidget, ParentBridge, type Platform, PlatformSchema, type Proxy, type ServiceCallHandler, type ServiceCallPayload, type ServiceResultPayload, type VFSPluginOptions, VFSStore, type VFSStoreOptions, type VirtualFile, type VirtualProject, type WatchCallback, type WatchEventType, cdnTransformPlugin, createCompiler, createFieldAccessProxy, createHttpProxy, createIframeProxy, createImageRegistry, createProjectFromFiles, createSingleFileProject, detectMainFile, disposeIframeBridge, extractNamespaces, fetchPackageJson, generateIframeBridgeScript, generateImportMap, generateNamespaceGlobals, getCdnBaseUrl, getImageRegistry, injectNamespaceGlobals, loadImage, mountEmbedded, mountIframe, parseImageConfig, parseImageSpec, parseManifest, reloadEmbedded, reloadIframe, removeNamespaceGlobals, resolveEntry, safeParseImageConfig, safeParseManifest, setCdnBaseUrl, vfsPlugin };
|
package/dist/index.js
CHANGED
|
@@ -707,7 +707,7 @@ function vfsPlugin(project, options = {}) {
|
|
|
707
707
|
function generateMessageId() {
|
|
708
708
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function createHttpProxy(proxyUrl) {
|
|
711
711
|
return {
|
|
712
712
|
async call(namespace, procedure, args) {
|
|
713
713
|
const url = `${proxyUrl}/${namespace}/${procedure}`;
|
|
@@ -851,7 +851,7 @@ var ParentBridge = class {
|
|
|
851
851
|
this.pendingCalls.clear();
|
|
852
852
|
}
|
|
853
853
|
};
|
|
854
|
-
function
|
|
854
|
+
function createIframeProxy() {
|
|
855
855
|
const pendingCalls = /* @__PURE__ */ new Map();
|
|
856
856
|
if (typeof window !== "undefined") {
|
|
857
857
|
window.addEventListener("message", (event) => {
|
|
@@ -1477,13 +1477,15 @@ function disposeIframeBridge() {
|
|
|
1477
1477
|
// src/compiler.ts
|
|
1478
1478
|
var esbuildInitialized = false;
|
|
1479
1479
|
var esbuildInitPromise = null;
|
|
1480
|
-
|
|
1480
|
+
var DEFAULT_ESBUILD_WASM_URL = "https://unpkg.com/esbuild-wasm/esbuild.wasm";
|
|
1481
|
+
async function initEsbuild(urlOverrides) {
|
|
1481
1482
|
if (esbuildInitialized) return;
|
|
1482
1483
|
if (esbuildInitPromise) return esbuildInitPromise;
|
|
1484
|
+
const wasmUrl = urlOverrides?.["esbuild-wasm/esbuild.wasm"] || DEFAULT_ESBUILD_WASM_URL;
|
|
1483
1485
|
esbuildInitPromise = (async () => {
|
|
1484
1486
|
try {
|
|
1485
1487
|
await esbuild.initialize({
|
|
1486
|
-
wasmURL:
|
|
1488
|
+
wasmURL: wasmUrl
|
|
1487
1489
|
});
|
|
1488
1490
|
esbuildInitialized = true;
|
|
1489
1491
|
} catch (error) {
|
|
@@ -1506,7 +1508,7 @@ function hashContent(content) {
|
|
|
1506
1508
|
return Math.abs(hash).toString(16).padStart(8, "0");
|
|
1507
1509
|
}
|
|
1508
1510
|
async function createCompiler(options) {
|
|
1509
|
-
await initEsbuild();
|
|
1511
|
+
await initEsbuild(options.urlOverrides);
|
|
1510
1512
|
const { image: imageSpec, proxyUrl, cdnBaseUrl: cdnBaseUrl3, widgetCdnBaseUrl } = options;
|
|
1511
1513
|
if (cdnBaseUrl3) {
|
|
1512
1514
|
setCdnBaseUrl(cdnBaseUrl3);
|
|
@@ -1518,7 +1520,7 @@ async function createCompiler(options) {
|
|
|
1518
1520
|
}
|
|
1519
1521
|
const registry = getImageRegistry();
|
|
1520
1522
|
await registry.preload(imageSpec);
|
|
1521
|
-
const proxy =
|
|
1523
|
+
const proxy = createHttpProxy(proxyUrl);
|
|
1522
1524
|
return new PatchworkCompiler(proxy, registry);
|
|
1523
1525
|
}
|
|
1524
1526
|
var PatchworkCompiler = class {
|
|
@@ -2715,8 +2717,8 @@ export {
|
|
|
2715
2717
|
cdnTransformPlugin,
|
|
2716
2718
|
createCompiler,
|
|
2717
2719
|
createFieldAccessProxy,
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
+
createHttpProxy,
|
|
2721
|
+
createIframeProxy,
|
|
2720
2722
|
createImageRegistry,
|
|
2721
2723
|
createProjectFromFiles,
|
|
2722
2724
|
createSingleFileProject,
|