@aprovan/patchwork-compiler 0.1.2-dev.98a5bc4 → 0.1.2-dev.9d1cd22

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.d.cts CHANGED
@@ -17,7 +17,7 @@ interface VirtualProject {
17
17
  /**
18
18
  * Core types for the Patchwork compiler
19
19
  */
20
- type Platform = 'browser' | 'cli';
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: 'string' | 'number' | 'boolean' | 'object' | 'array';
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 = 'embedded' | 'iframe';
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?: 'esm' | 'cjs' | 'iife';
83
- jsx?: 'automatic' | 'transform' | 'preserve';
82
+ format?: "esm" | "cjs" | "iife";
83
+ jsx?: "automatic" | "transform" | "preserve";
84
84
  jsxFactory?: string;
85
85
  jsxFragment?: string;
86
86
  };
@@ -163,7 +163,7 @@ interface Compiler {
163
163
  * The compiler provides the interface; actual implementation (e.g., UTCP, MCP)
164
164
  * is handled by the runtime/backend.
165
165
  */
166
- interface ServiceProxy {
166
+ interface Proxy {
167
167
  call(namespace: string, procedure: string, args: unknown[]): Promise<unknown>;
168
168
  }
169
169
  /**
@@ -184,7 +184,7 @@ interface GlobalInterfaceDefinition {
184
184
  /** Optional TypeScript type definitions for methods */
185
185
  types?: string;
186
186
  }
187
- type BridgeMessageType = 'service-call' | 'service-result' | 'error';
187
+ type BridgeMessageType = "service-call" | "service-result" | "error";
188
188
  interface BridgeMessage {
189
189
  type: BridgeMessageType;
190
190
  id: string;
@@ -701,11 +701,11 @@ declare class VFSStore {
701
701
  /**
702
702
  * Mount a widget in embedded mode (direct DOM injection)
703
703
  */
704
- declare function mountEmbedded(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: ServiceProxy): Promise<MountedWidget>;
704
+ declare function mountEmbedded(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
705
705
  /**
706
706
  * Hot reload an embedded widget
707
707
  */
708
- declare function reloadEmbedded(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: ServiceProxy): Promise<MountedWidget>;
708
+ declare function reloadEmbedded(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
709
709
 
710
710
  /**
711
711
  * Iframe mount mode - mounts widgets in sandboxed iframes
@@ -731,11 +731,11 @@ declare const DEV_SANDBOX: string[];
731
731
  /**
732
732
  * Mount a widget in iframe mode (sandboxed)
733
733
  */
734
- declare function mountIframe(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: ServiceProxy): Promise<MountedWidget>;
734
+ declare function mountIframe(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
735
735
  /**
736
736
  * Hot reload an iframe widget
737
737
  */
738
- declare function reloadIframe(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: ServiceProxy): Promise<MountedWidget>;
738
+ declare function reloadIframe(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
739
739
  /**
740
740
  * Dispose the shared bridge (call on app shutdown)
741
741
  */
@@ -748,7 +748,7 @@ declare function disposeIframeBridge(): void;
748
748
  /**
749
749
  * Create a service proxy that calls the backend via HTTP
750
750
  */
751
- declare function createHttpServiceProxy(proxyUrl: string): ServiceProxy;
751
+ declare function createHttpProxy(proxyUrl: string): Proxy;
752
752
  /**
753
753
  * Creates a proxy that enables fluent method chaining for dynamic field access.
754
754
  *
@@ -776,7 +776,7 @@ declare function createFieldAccessProxy<T = unknown>(namespace: string, handler:
776
776
  * // calls proxy.call('github', 'repos.list_for_user', [{ username: 'x' }])
777
777
  * ```
778
778
  */
779
- declare function generateNamespaceGlobals(services: string[], proxy: ServiceProxy): Record<string, unknown>;
779
+ declare function generateNamespaceGlobals(services: string[], proxy: Proxy): Record<string, unknown>;
780
780
  /**
781
781
  * Inject namespace globals into a window object
782
782
  */
@@ -799,7 +799,7 @@ declare class ParentBridge {
799
799
  private pendingCalls;
800
800
  private iframes;
801
801
  private messageHandler;
802
- constructor(proxy: ServiceProxy);
802
+ constructor(proxy: Proxy);
803
803
  /**
804
804
  * Register an iframe to receive messages from
805
805
  */
@@ -822,7 +822,7 @@ declare class ParentBridge {
822
822
  *
823
823
  * Creates a service proxy that sends postMessage to parent.
824
824
  */
825
- declare function createIframeServiceProxy(): ServiceProxy;
825
+ declare function createIframeProxy(): Proxy;
826
826
  /**
827
827
  * Generate the bridge script to inject into iframes
828
828
  *
@@ -832,4 +832,4 @@ declare function createIframeServiceProxy(): ServiceProxy;
832
832
  */
833
833
  declare function generateIframeBridgeScript(services: string[]): string;
834
834
 
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 ServiceCallHandler, type ServiceCallPayload, type ServiceProxy, type ServiceResultPayload, type VFSPluginOptions, VFSStore, type VFSStoreOptions, type VirtualFile, type VirtualProject, type WatchCallback, type WatchEventType, cdnTransformPlugin, createCompiler, createFieldAccessProxy, createHttpServiceProxy, createIframeServiceProxy, 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 };
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 = 'browser' | 'cli';
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: 'string' | 'number' | 'boolean' | 'object' | 'array';
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 = 'embedded' | 'iframe';
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?: 'esm' | 'cjs' | 'iife';
83
- jsx?: 'automatic' | 'transform' | 'preserve';
82
+ format?: "esm" | "cjs" | "iife";
83
+ jsx?: "automatic" | "transform" | "preserve";
84
84
  jsxFactory?: string;
85
85
  jsxFragment?: string;
86
86
  };
@@ -163,7 +163,7 @@ interface Compiler {
163
163
  * The compiler provides the interface; actual implementation (e.g., UTCP, MCP)
164
164
  * is handled by the runtime/backend.
165
165
  */
166
- interface ServiceProxy {
166
+ interface Proxy {
167
167
  call(namespace: string, procedure: string, args: unknown[]): Promise<unknown>;
168
168
  }
169
169
  /**
@@ -184,7 +184,7 @@ interface GlobalInterfaceDefinition {
184
184
  /** Optional TypeScript type definitions for methods */
185
185
  types?: string;
186
186
  }
187
- type BridgeMessageType = 'service-call' | 'service-result' | 'error';
187
+ type BridgeMessageType = "service-call" | "service-result" | "error";
188
188
  interface BridgeMessage {
189
189
  type: BridgeMessageType;
190
190
  id: string;
@@ -701,11 +701,11 @@ declare class VFSStore {
701
701
  /**
702
702
  * Mount a widget in embedded mode (direct DOM injection)
703
703
  */
704
- declare function mountEmbedded(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: ServiceProxy): Promise<MountedWidget>;
704
+ declare function mountEmbedded(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
705
705
  /**
706
706
  * Hot reload an embedded widget
707
707
  */
708
- declare function reloadEmbedded(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: ServiceProxy): Promise<MountedWidget>;
708
+ declare function reloadEmbedded(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
709
709
 
710
710
  /**
711
711
  * Iframe mount mode - mounts widgets in sandboxed iframes
@@ -731,11 +731,11 @@ declare const DEV_SANDBOX: string[];
731
731
  /**
732
732
  * Mount a widget in iframe mode (sandboxed)
733
733
  */
734
- declare function mountIframe(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: ServiceProxy): Promise<MountedWidget>;
734
+ declare function mountIframe(widget: CompiledWidget, options: MountOptions, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
735
735
  /**
736
736
  * Hot reload an iframe widget
737
737
  */
738
- declare function reloadIframe(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: ServiceProxy): Promise<MountedWidget>;
738
+ declare function reloadIframe(mounted: MountedWidget, widget: CompiledWidget, image: LoadedImage | null, proxy: Proxy): Promise<MountedWidget>;
739
739
  /**
740
740
  * Dispose the shared bridge (call on app shutdown)
741
741
  */
@@ -748,7 +748,7 @@ declare function disposeIframeBridge(): void;
748
748
  /**
749
749
  * Create a service proxy that calls the backend via HTTP
750
750
  */
751
- declare function createHttpServiceProxy(proxyUrl: string): ServiceProxy;
751
+ declare function createHttpProxy(proxyUrl: string): Proxy;
752
752
  /**
753
753
  * Creates a proxy that enables fluent method chaining for dynamic field access.
754
754
  *
@@ -776,7 +776,7 @@ declare function createFieldAccessProxy<T = unknown>(namespace: string, handler:
776
776
  * // calls proxy.call('github', 'repos.list_for_user', [{ username: 'x' }])
777
777
  * ```
778
778
  */
779
- declare function generateNamespaceGlobals(services: string[], proxy: ServiceProxy): Record<string, unknown>;
779
+ declare function generateNamespaceGlobals(services: string[], proxy: Proxy): Record<string, unknown>;
780
780
  /**
781
781
  * Inject namespace globals into a window object
782
782
  */
@@ -799,7 +799,7 @@ declare class ParentBridge {
799
799
  private pendingCalls;
800
800
  private iframes;
801
801
  private messageHandler;
802
- constructor(proxy: ServiceProxy);
802
+ constructor(proxy: Proxy);
803
803
  /**
804
804
  * Register an iframe to receive messages from
805
805
  */
@@ -822,7 +822,7 @@ declare class ParentBridge {
822
822
  *
823
823
  * Creates a service proxy that sends postMessage to parent.
824
824
  */
825
- declare function createIframeServiceProxy(): ServiceProxy;
825
+ declare function createIframeProxy(): Proxy;
826
826
  /**
827
827
  * Generate the bridge script to inject into iframes
828
828
  *
@@ -832,4 +832,4 @@ declare function createIframeServiceProxy(): ServiceProxy;
832
832
  */
833
833
  declare function generateIframeBridgeScript(services: string[]): string;
834
834
 
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 ServiceCallHandler, type ServiceCallPayload, type ServiceProxy, type ServiceResultPayload, type VFSPluginOptions, VFSStore, type VFSStoreOptions, type VirtualFile, type VirtualProject, type WatchCallback, type WatchEventType, cdnTransformPlugin, createCompiler, createFieldAccessProxy, createHttpServiceProxy, createIframeServiceProxy, 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 };
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 createHttpServiceProxy(proxyUrl) {
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 createIframeServiceProxy() {
854
+ function createIframeProxy() {
855
855
  const pendingCalls = /* @__PURE__ */ new Map();
856
856
  if (typeof window !== "undefined") {
857
857
  window.addEventListener("message", (event) => {
@@ -1520,7 +1520,7 @@ async function createCompiler(options) {
1520
1520
  }
1521
1521
  const registry = getImageRegistry();
1522
1522
  await registry.preload(imageSpec);
1523
- const proxy = createHttpServiceProxy(proxyUrl);
1523
+ const proxy = createHttpProxy(proxyUrl);
1524
1524
  return new PatchworkCompiler(proxy, registry);
1525
1525
  }
1526
1526
  var PatchworkCompiler = class {
@@ -2717,8 +2717,8 @@ export {
2717
2717
  cdnTransformPlugin,
2718
2718
  createCompiler,
2719
2719
  createFieldAccessProxy,
2720
- createHttpServiceProxy,
2721
- createIframeServiceProxy,
2720
+ createHttpProxy,
2721
+ createIframeProxy,
2722
2722
  createImageRegistry,
2723
2723
  createProjectFromFiles,
2724
2724
  createSingleFileProject,