@aprovan/patchwork-compiler 0.1.2-dev.6bd527d → 0.1.2-dev.f456953

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
@@ -679,6 +679,7 @@ declare class VFSStore {
679
679
  listFiles(prefix?: string): Promise<string[]>;
680
680
  loadProject(id: string): Promise<VirtualProject | null>;
681
681
  saveProject(project: VirtualProject): Promise<void>;
682
+ watch(path: string, callback: WatchCallback): () => void;
682
683
  sync(): Promise<SyncResult>;
683
684
  on<T extends SyncEventType>(event: T, callback: SyncEventCallback<T extends "change" ? ChangeRecord : T extends "conflict" ? ConflictRecord : T extends "error" ? Error : SyncStatus>): () => void;
684
685
  private remotePath;
@@ -825,4 +826,4 @@ declare function createIframeServiceProxy(): ServiceProxy;
825
826
  */
826
827
  declare function generateIframeBridgeScript(services: string[]): string;
827
828
 
828
- 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, 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 };
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 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 };
package/dist/index.d.ts CHANGED
@@ -679,6 +679,7 @@ declare class VFSStore {
679
679
  listFiles(prefix?: string): Promise<string[]>;
680
680
  loadProject(id: string): Promise<VirtualProject | null>;
681
681
  saveProject(project: VirtualProject): Promise<void>;
682
+ watch(path: string, callback: WatchCallback): () => void;
682
683
  sync(): Promise<SyncResult>;
683
684
  on<T extends SyncEventType>(event: T, callback: SyncEventCallback<T extends "change" ? ChangeRecord : T extends "conflict" ? ConflictRecord : T extends "error" ? Error : SyncStatus>): () => void;
684
685
  private remotePath;
@@ -825,4 +826,4 @@ declare function createIframeServiceProxy(): ServiceProxy;
825
826
  */
826
827
  declare function generateIframeBridgeScript(services: string[]): string;
827
828
 
828
- 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, 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 };
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 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 };
package/dist/index.js CHANGED
@@ -1487,7 +1487,7 @@ async function initEsbuild() {
1487
1487
  });
1488
1488
  esbuildInitialized = true;
1489
1489
  } catch (error) {
1490
- if (error instanceof Error && error.message.includes("initialized")) {
1490
+ if (error instanceof Error && error.message.includes("initialize")) {
1491
1491
  esbuildInitialized = true;
1492
1492
  } else {
1493
1493
  throw error;
@@ -1795,11 +1795,13 @@ var VirtualFS = class {
1795
1795
  return this.backend.readFile(path, encoding);
1796
1796
  }
1797
1797
  async writeFile(path, content) {
1798
+ await this.ensureParentDir(path);
1798
1799
  const existed = await this.backend.exists(path);
1799
1800
  await this.backend.writeFile(path, content);
1800
1801
  this.recordChange(path, existed ? "update" : "create");
1801
1802
  }
1802
1803
  async applyRemoteFile(path, content) {
1804
+ await this.ensureParentDir(path);
1803
1805
  await this.backend.writeFile(path, content);
1804
1806
  }
1805
1807
  async applyRemoteDelete(path) {
@@ -1871,6 +1873,11 @@ var VirtualFS = class {
1871
1873
  listener(record);
1872
1874
  }
1873
1875
  }
1876
+ async ensureParentDir(path) {
1877
+ const dir = dirname2(path);
1878
+ if (!dir) return;
1879
+ await this.backend.mkdir(dir, { recursive: true });
1880
+ }
1874
1881
  };
1875
1882
 
1876
1883
  // src/vfs/sync/differ.ts
@@ -2647,6 +2654,13 @@ var VFSStore = class {
2647
2654
  )
2648
2655
  );
2649
2656
  }
2657
+ watch(path, callback) {
2658
+ if (this.provider.watch) {
2659
+ return this.provider.watch(this.remotePath(path), callback);
2660
+ }
2661
+ return () => {
2662
+ };
2663
+ }
2650
2664
  async sync() {
2651
2665
  if (!this.syncEngine) {
2652
2666
  return { pushed: 0, pulled: 0, conflicts: [] };