@aprovan/patchwork-compiler 0.1.2-dev.03aaf5b → 0.1.2-dev.3afec03
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 +19 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1564,13 +1564,15 @@ function disposeIframeBridge() {
|
|
|
1564
1564
|
// src/compiler.ts
|
|
1565
1565
|
var esbuildInitialized = false;
|
|
1566
1566
|
var esbuildInitPromise = null;
|
|
1567
|
-
|
|
1567
|
+
var DEFAULT_ESBUILD_WASM_URL = "https://unpkg.com/esbuild-wasm/esbuild.wasm";
|
|
1568
|
+
async function initEsbuild(urlOverrides) {
|
|
1568
1569
|
if (esbuildInitialized) return;
|
|
1569
1570
|
if (esbuildInitPromise) return esbuildInitPromise;
|
|
1571
|
+
const wasmUrl = urlOverrides?.["esbuild-wasm/esbuild.wasm"] || DEFAULT_ESBUILD_WASM_URL;
|
|
1570
1572
|
esbuildInitPromise = (async () => {
|
|
1571
1573
|
try {
|
|
1572
1574
|
await esbuild.initialize({
|
|
1573
|
-
wasmURL:
|
|
1575
|
+
wasmURL: wasmUrl
|
|
1574
1576
|
});
|
|
1575
1577
|
esbuildInitialized = true;
|
|
1576
1578
|
} catch (error) {
|
|
@@ -1593,7 +1595,7 @@ function hashContent(content) {
|
|
|
1593
1595
|
return Math.abs(hash).toString(16).padStart(8, "0");
|
|
1594
1596
|
}
|
|
1595
1597
|
async function createCompiler(options) {
|
|
1596
|
-
await initEsbuild();
|
|
1598
|
+
await initEsbuild(options.urlOverrides);
|
|
1597
1599
|
const { image: imageSpec, proxyUrl, cdnBaseUrl: cdnBaseUrl3, widgetCdnBaseUrl } = options;
|
|
1598
1600
|
if (cdnBaseUrl3) {
|
|
1599
1601
|
setCdnBaseUrl(cdnBaseUrl3);
|
|
@@ -1882,11 +1884,13 @@ var VirtualFS = class {
|
|
|
1882
1884
|
return this.backend.readFile(path, encoding);
|
|
1883
1885
|
}
|
|
1884
1886
|
async writeFile(path, content) {
|
|
1887
|
+
await this.ensureParentDir(path);
|
|
1885
1888
|
const existed = await this.backend.exists(path);
|
|
1886
1889
|
await this.backend.writeFile(path, content);
|
|
1887
1890
|
this.recordChange(path, existed ? "update" : "create");
|
|
1888
1891
|
}
|
|
1889
1892
|
async applyRemoteFile(path, content) {
|
|
1893
|
+
await this.ensureParentDir(path);
|
|
1890
1894
|
await this.backend.writeFile(path, content);
|
|
1891
1895
|
}
|
|
1892
1896
|
async applyRemoteDelete(path) {
|
|
@@ -1958,6 +1962,11 @@ var VirtualFS = class {
|
|
|
1958
1962
|
listener(record);
|
|
1959
1963
|
}
|
|
1960
1964
|
}
|
|
1965
|
+
async ensureParentDir(path) {
|
|
1966
|
+
const dir = dirname2(path);
|
|
1967
|
+
if (!dir) return;
|
|
1968
|
+
await this.backend.mkdir(dir, { recursive: true });
|
|
1969
|
+
}
|
|
1961
1970
|
};
|
|
1962
1971
|
|
|
1963
1972
|
// src/vfs/sync/differ.ts
|
|
@@ -2734,6 +2743,13 @@ var VFSStore = class {
|
|
|
2734
2743
|
)
|
|
2735
2744
|
);
|
|
2736
2745
|
}
|
|
2746
|
+
watch(path, callback) {
|
|
2747
|
+
if (this.provider.watch) {
|
|
2748
|
+
return this.provider.watch(this.remotePath(path), callback);
|
|
2749
|
+
}
|
|
2750
|
+
return () => {
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2737
2753
|
async sync() {
|
|
2738
2754
|
if (!this.syncEngine) {
|
|
2739
2755
|
return { pushed: 0, pulled: 0, conflicts: [] };
|