@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.cjs
CHANGED
|
@@ -49,8 +49,8 @@ __export(index_exports, {
|
|
|
49
49
|
cdnTransformPlugin: () => cdnTransformPlugin,
|
|
50
50
|
createCompiler: () => createCompiler,
|
|
51
51
|
createFieldAccessProxy: () => createFieldAccessProxy,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
createHttpProxy: () => createHttpProxy,
|
|
53
|
+
createIframeProxy: () => createIframeProxy,
|
|
54
54
|
createImageRegistry: () => createImageRegistry,
|
|
55
55
|
createProjectFromFiles: () => createProjectFromFiles,
|
|
56
56
|
createSingleFileProject: () => createSingleFileProject,
|
|
@@ -81,7 +81,7 @@ __export(index_exports, {
|
|
|
81
81
|
});
|
|
82
82
|
module.exports = __toCommonJS(index_exports);
|
|
83
83
|
|
|
84
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@1.21.7_postcss@8.5.
|
|
84
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@1.21.7_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js
|
|
85
85
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
86
86
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
87
87
|
|
|
@@ -794,7 +794,7 @@ function vfsPlugin(project, options = {}) {
|
|
|
794
794
|
function generateMessageId() {
|
|
795
795
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
796
796
|
}
|
|
797
|
-
function
|
|
797
|
+
function createHttpProxy(proxyUrl) {
|
|
798
798
|
return {
|
|
799
799
|
async call(namespace, procedure, args) {
|
|
800
800
|
const url = `${proxyUrl}/${namespace}/${procedure}`;
|
|
@@ -938,7 +938,7 @@ var ParentBridge = class {
|
|
|
938
938
|
this.pendingCalls.clear();
|
|
939
939
|
}
|
|
940
940
|
};
|
|
941
|
-
function
|
|
941
|
+
function createIframeProxy() {
|
|
942
942
|
const pendingCalls = /* @__PURE__ */ new Map();
|
|
943
943
|
if (typeof window !== "undefined") {
|
|
944
944
|
window.addEventListener("message", (event) => {
|
|
@@ -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);
|
|
@@ -1605,7 +1607,7 @@ async function createCompiler(options) {
|
|
|
1605
1607
|
}
|
|
1606
1608
|
const registry = getImageRegistry();
|
|
1607
1609
|
await registry.preload(imageSpec);
|
|
1608
|
-
const proxy =
|
|
1610
|
+
const proxy = createHttpProxy(proxyUrl);
|
|
1609
1611
|
return new PatchworkCompiler(proxy, registry);
|
|
1610
1612
|
}
|
|
1611
1613
|
var PatchworkCompiler = class {
|
|
@@ -2803,8 +2805,8 @@ var VFSStore = class {
|
|
|
2803
2805
|
cdnTransformPlugin,
|
|
2804
2806
|
createCompiler,
|
|
2805
2807
|
createFieldAccessProxy,
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
+
createHttpProxy,
|
|
2809
|
+
createIframeProxy,
|
|
2808
2810
|
createImageRegistry,
|
|
2809
2811
|
createProjectFromFiles,
|
|
2810
2812
|
createSingleFileProject,
|