@aprovan/patchwork-compiler 0.1.2-dev.ba8f277 → 0.1.2-dev.d83e6ba

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
@@ -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 */
package/dist/index.d.ts CHANGED
@@ -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 */
package/dist/index.js CHANGED
@@ -1477,13 +1477,15 @@ function disposeIframeBridge() {
1477
1477
  // src/compiler.ts
1478
1478
  var esbuildInitialized = false;
1479
1479
  var esbuildInitPromise = null;
1480
- async function initEsbuild() {
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: "https://unpkg.com/esbuild-wasm/esbuild.wasm"
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);