@vizhub/runtime 4.0.3 → 4.2.0

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.
Files changed (62) hide show
  1. package/dist/build/build.d.ts.map +1 -1
  2. package/dist/build-BXOhZlRS.cjs +256 -0
  3. package/dist/build-BXOhZlRS.cjs.map +1 -0
  4. package/dist/build-DnPT2Qew.js +1075 -0
  5. package/dist/build-DnPT2Qew.js.map +1 -0
  6. package/dist/common/runtimeErrorHandling.d.ts +9 -0
  7. package/dist/common/runtimeErrorHandling.d.ts.map +1 -0
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.js +93 -92
  11. package/dist/index.js.map +1 -1
  12. package/dist/orchestration/createRuntime.d.ts +2 -1
  13. package/dist/orchestration/createRuntime.d.ts.map +1 -1
  14. package/dist/orchestration/types.d.ts +3 -0
  15. package/dist/orchestration/types.d.ts.map +1 -1
  16. package/dist/test/extractEntryPoints.test.d.ts +2 -0
  17. package/dist/test/extractEntryPoints.test.d.ts.map +1 -0
  18. package/dist/test/extractEntryPointsEdgeCases.test.d.ts +2 -0
  19. package/dist/test/extractEntryPointsEdgeCases.test.d.ts.map +1 -0
  20. package/dist/test/fixtures/v2/basicBundleNameCollision.d.ts +7 -0
  21. package/dist/test/fixtures/v2/basicBundleNameCollision.d.ts.map +1 -0
  22. package/dist/test/fixtures/v2/index.d.ts +1 -0
  23. package/dist/test/fixtures/v2/index.d.ts.map +1 -1
  24. package/dist/test/fixtures/v3/svelte.d.ts.map +1 -1
  25. package/dist/test/fixtures/v4/index.d.ts +1 -0
  26. package/dist/test/fixtures/v4/index.d.ts.map +1 -1
  27. package/dist/test/fixtures/v4/jsInlineScriptModule.d.ts +5 -0
  28. package/dist/test/fixtures/v4/jsInlineScriptModule.d.ts.map +1 -0
  29. package/dist/test/runtimeErrorHandling.test.d.ts +2 -0
  30. package/dist/test/runtimeErrorHandling.test.d.ts.map +1 -0
  31. package/dist/test/runtimeErrorHandlingAllVersions.test.d.ts +2 -0
  32. package/dist/test/runtimeErrorHandlingAllVersions.test.d.ts.map +1 -0
  33. package/dist/test/runtimeErrorHandlingIntegration.test.d.ts +2 -0
  34. package/dist/test/runtimeErrorHandlingIntegration.test.d.ts.map +1 -0
  35. package/dist/test/updateHTML.test.d.ts +2 -0
  36. package/dist/test/updateHTML.test.d.ts.map +1 -0
  37. package/dist/test/v4Build.test.d.ts +2 -0
  38. package/dist/test/v4Build.test.d.ts.map +1 -0
  39. package/dist/test/v4BuildIntegration.test.d.ts +2 -0
  40. package/dist/test/v4BuildIntegration.test.d.ts.map +1 -0
  41. package/dist/v2/getComputedIndexHtml.d.ts.map +1 -1
  42. package/dist/v3/htmlTemplate.d.ts.map +1 -1
  43. package/dist/v3/svelte5-integration.test.d.ts +2 -0
  44. package/dist/v3/svelte5-integration.test.d.ts.map +1 -0
  45. package/dist/v3/transformSvelte.d.ts +9 -2
  46. package/dist/v3/transformSvelte.d.ts.map +1 -1
  47. package/dist/v3/transformSvelte.test.d.ts +2 -0
  48. package/dist/v3/transformSvelte.test.d.ts.map +1 -0
  49. package/dist/v4/extractEntryPoints.d.ts +7 -1
  50. package/dist/v4/extractEntryPoints.d.ts.map +1 -1
  51. package/dist/v4/index.d.ts.map +1 -1
  52. package/dist/v4/updateHTML.d.ts +4 -1
  53. package/dist/v4/updateHTML.d.ts.map +1 -1
  54. package/dist/worker.cjs +1 -1
  55. package/dist/worker.cjs.map +1 -1
  56. package/dist/worker.js +1 -1
  57. package/dist/worker.js.map +1 -1
  58. package/package.json +23 -15
  59. package/dist/build-D8ObHgQc.js +0 -984
  60. package/dist/build-D8ObHgQc.js.map +0 -1
  61. package/dist/build-t6B4kQWS.cjs +0 -214
  62. package/dist/build-t6B4kQWS.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,74 +1,75 @@
1
- import { g as D } from "./build-D8ObHgQc.js";
2
- import { b as G, c as _, e as A, a as F, f as J, d as T, s as Y, v as Q } from "./build-D8ObHgQc.js";
3
- const V = (n) => async (t) => {
4
- const i = D();
5
- return new Promise((r) => {
6
- const d = (l) => {
7
- l.data.type === "invalidateVizCacheResponse" && l.data.requestId === i && (n.removeEventListener(
1
+ import { g as q } from "./build-DnPT2Qew.js";
2
+ import { b as G, c as _, e as A, a as F, f as J, d as T, s as Y, v as Q } from "./build-DnPT2Qew.js";
3
+ const M = (s) => async (t) => {
4
+ const i = q();
5
+ return new Promise((p) => {
6
+ const u = (r) => {
7
+ r.data.type === "invalidateVizCacheResponse" && r.data.requestId === i && (s.removeEventListener(
8
8
  "message",
9
- d
10
- ), r());
9
+ u
10
+ ), p());
11
11
  };
12
- n.addEventListener(
12
+ s.addEventListener(
13
13
  "message",
14
- d
15
- ), n.postMessage({
14
+ u
15
+ ), s.postMessage({
16
16
  type: "invalidateVizCacheRequest",
17
17
  changedVizIds: t,
18
18
  requestId: i
19
19
  });
20
20
  });
21
21
  }, b = ({
22
- worker: n,
22
+ worker: s,
23
23
  setBuildErrorMessage: t
24
24
  }) => ({
25
25
  files: i,
26
- enableSourcemap: r,
27
- vizId: d
26
+ enableSourcemap: p,
27
+ vizId: u
28
28
  }) => {
29
- const l = D();
29
+ const r = q();
30
30
  return new Promise(
31
- (s) => {
32
- const c = (f) => {
33
- const p = f.data;
34
- if (p.type === "buildResponse" && p.requestId === l) {
35
- n.removeEventListener(
31
+ (f) => {
32
+ const n = (v) => {
33
+ const d = v.data;
34
+ if (d.type === "buildResponse" && d.requestId === r) {
35
+ s.removeEventListener(
36
36
  "message",
37
- c
37
+ n
38
38
  );
39
- const E = p.buildResult, m = p.error;
40
- m ? t == null || t(m) : t == null || t(null), s(E);
39
+ const m = d.buildResult, g = d.error;
40
+ t?.(g || null), f(m);
41
41
  }
42
42
  };
43
- n.addEventListener("message", c);
44
- const h = {
43
+ s.addEventListener("message", n);
44
+ const c = {
45
45
  type: "buildRequest",
46
46
  files: i,
47
- enableSourcemap: r,
48
- requestId: l,
49
- vizId: d
47
+ enableSourcemap: p,
48
+ requestId: r,
49
+ vizId: u
50
50
  };
51
- n.postMessage(h);
51
+ s.postMessage(c);
52
52
  }
53
53
  );
54
- }, I = "IDLE", y = "ENQUEUED", L = "PENDING_CLEAN", g = "PENDING_DIRTY", P = ({
55
- iframe: n,
54
+ }, w = "IDLE", y = "ENQUEUED", D = "PENDING_CLEAN", I = "PENDING_DIRTY", P = ({
55
+ iframe: s,
56
56
  worker: t,
57
57
  setBuildErrorMessage: i,
58
- getLatestContent: r,
59
- resolveSlugKey: d,
60
- writeFile: l
58
+ getLatestContent: p,
59
+ resolveSlugKey: u,
60
+ writeFile: r,
61
+ handleRuntimeError: f
61
62
  }) => {
62
- let s = I, c = null;
63
- const h = b({
63
+ let n = w, c = null;
64
+ const v = b({
64
65
  worker: t,
65
66
  setBuildErrorMessage: i
66
- }), f = ({
67
+ }), d = ({
67
68
  data: o
68
69
  }) => {
69
- if (o.type === "contentRequest" && r) {
70
+ if (o.type === "contentRequest" && p) {
70
71
  const { vizId: e } = o;
71
- r(e).then((a) => {
72
+ p(e).then((a) => {
72
73
  t.postMessage({
73
74
  type: "contentResponse",
74
75
  vizId: e,
@@ -77,126 +78,126 @@ const V = (n) => async (t) => {
77
78
  });
78
79
  } else if (o.type === "resolveSlugRequest") {
79
80
  const { slugKey: e, requestId: a } = o;
80
- if (d)
81
- d(e).then(
82
- (u) => {
83
- const v = {
81
+ if (u)
82
+ u(e).then(
83
+ (l) => {
84
+ const E = {
84
85
  type: "resolveSlugResponse",
85
- vizId: u,
86
+ vizId: l,
86
87
  requestId: a
87
88
  };
88
- t.postMessage(v);
89
+ t.postMessage(E);
89
90
  }
90
91
  );
91
92
  else {
92
- const u = {
93
+ const l = {
93
94
  type: "resolveSlugResponse",
94
95
  vizId: null,
95
96
  requestId: a
96
97
  };
97
- t.postMessage(u);
98
+ t.postMessage(l);
98
99
  }
99
100
  }
100
101
  };
101
- t.addEventListener("message", f);
102
- const p = (o) => {
102
+ t.addEventListener("message", d);
103
+ const m = (o) => {
103
104
  const e = o.data;
104
- (e.type === "runDone" || e.type === "runError") && e.type === "runError" && i && i(e.error.message), e.type === "writeFile" && l && e.fileName && e.content && l(e.fileName, e.content);
105
+ (e.type === "runDone" || e.type === "runError") && e.type === "runError" && i && i(e.error.message), e.type === "runtimeError" && f && f(e.formattedErrorMessage), e.type === "writeFile" && r && e.fileName && e.content && r(e.fileName, e.content);
105
106
  };
106
- window.addEventListener("message", p);
107
- const E = () => {
108
- t.removeEventListener("message", f), window.removeEventListener("message", p);
109
- }, m = async ({
107
+ window.addEventListener("message", m);
108
+ const g = () => {
109
+ t.removeEventListener("message", d), window.removeEventListener("message", m);
110
+ }, R = async ({
110
111
  files: o,
111
112
  enableHotReloading: e = !1,
112
113
  enableSourcemap: a = !1,
113
- vizId: u
114
+ vizId: l
114
115
  }) => {
115
- s = L;
116
- const v = await h({
116
+ n = D;
117
+ const E = await v({
117
118
  files: o,
118
119
  enableSourcemap: a,
119
- vizId: u
120
+ vizId: l
120
121
  });
121
- if (v) {
122
- const { html: C, runtimeVersion: S, js: N, css: w } = v;
123
- if (console.clear(), e && S === "v3") {
124
- if (w) {
125
- const R = {
122
+ if (E) {
123
+ const { html: S, runtimeVersion: V, js: N, css: L } = E;
124
+ if (console.clear(), e && V === "v3") {
125
+ if (L) {
126
+ const h = {
126
127
  type: "runCSS",
127
- css: w
128
+ css: L
128
129
  };
129
- if (!n.contentWindow)
130
+ if (!s.contentWindow)
130
131
  throw new Error(
131
132
  "iframe.contentWindow is null - this should never happen"
132
133
  );
133
- n.contentWindow.postMessage(
134
- R,
134
+ s.contentWindow.postMessage(
135
+ h,
135
136
  window.location.origin
136
137
  );
137
138
  }
138
139
  if (N) {
139
- const R = {
140
+ const h = {
140
141
  type: "runJS",
141
142
  js: N
142
143
  };
143
- if (!n.contentWindow)
144
+ if (!s.contentWindow)
144
145
  throw new Error(
145
146
  "iframe.contentWindow is null - this should never happen"
146
147
  );
147
- n.contentWindow.postMessage(
148
- R,
148
+ s.contentWindow.postMessage(
149
+ h,
149
150
  window.location.origin
150
151
  );
151
152
  }
152
153
  } else
153
- n.srcdoc = C || "";
154
+ s.srcdoc = S || "";
154
155
  }
155
- s === g ? (requestAnimationFrame(() => {
156
+ n === I ? (requestAnimationFrame(() => {
156
157
  if (!c)
157
158
  throw new Error(
158
159
  "latestFiles is not defined and state is PENDING_DIRTY - this should never happen"
159
160
  );
160
- m({
161
+ R({
161
162
  files: c,
162
163
  enableHotReloading: e,
163
164
  enableSourcemap: a,
164
- vizId: u
165
+ vizId: l
165
166
  });
166
- }), s = y) : s = I;
167
- }, q = ({
167
+ }), n = y) : n = w;
168
+ }, C = ({
168
169
  files: o,
169
170
  enableHotReloading: e = !1,
170
171
  enableSourcemap: a = !1,
171
- vizId: u = void 0
172
+ vizId: l = void 0
172
173
  }) => {
173
- if (c = null, s === I)
174
- s = y, m({
174
+ if (c = null, n === w)
175
+ n = y, R({
175
176
  files: o,
176
177
  enableHotReloading: e,
177
178
  enableSourcemap: a,
178
- vizId: u
179
+ vizId: l
179
180
  });
180
- else if (s === L)
181
- c = o, s = g;
182
- else if (s === g)
181
+ else if (n === D)
182
+ c = o, n = I;
183
+ else if (n === I)
183
184
  c = o;
184
- else if (s === y)
185
+ else if (n === y)
185
186
  c = o;
186
187
  else
187
- throw new Error(`Unexpected state: ${s}`);
188
+ throw new Error(`Unexpected state: ${n}`);
188
189
  };
189
190
  return {
190
- invalidateVizCache: V(t),
191
- run: q,
192
- cleanup: E
191
+ invalidateVizCache: M(t),
192
+ run: C,
193
+ cleanup: g
193
194
  };
194
195
  }, U = ({
195
- rawMessage: n,
196
+ rawMessage: s,
196
197
  vizId: t
197
198
  }) => {
198
199
  const i = new RegExp(t, "g");
199
- return n == null ? void 0 : n.replace(i, ".");
200
+ return s?.replace(i, ".");
200
201
  };
201
202
  export {
202
203
  G as build,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/orchestration/setupInvalidateVizCache.ts","../src/orchestration/setupBuild.ts","../src/orchestration/createRuntime.ts","../src/v3/cleanRollupErrorMessage.ts"],"sourcesContent":["import { VizId } from \"@vizhub/viz-types\";\nimport { generateRequestId } from \"./generateRequestId\";\n\nexport const setupInvalidateVizCache =\n (worker: Worker) =>\n async (changedVizIds: Array<VizId>): Promise<void> => {\n const requestId = generateRequestId();\n return new Promise<void>((resolve) => {\n const invalidateListener = (e: MessageEvent) => {\n if (\n e.data.type === \"invalidateVizCacheResponse\" &&\n e.data.requestId === requestId\n ) {\n worker.removeEventListener(\n \"message\",\n invalidateListener,\n );\n resolve();\n }\n };\n worker.addEventListener(\n \"message\",\n invalidateListener,\n );\n\n worker.postMessage({\n type: \"invalidateVizCacheRequest\",\n changedVizIds,\n requestId,\n });\n });\n };\n","import { FileCollection, VizId } from \"@vizhub/viz-types\";\nimport { generateRequestId } from \"./generateRequestId\";\nimport { BuildWorkerMessage } from \"./types\";\nimport { BuildResult } from \"../build/types\";\n\nexport const setupBuild =\n ({\n worker,\n setBuildErrorMessage,\n }: {\n worker: Worker;\n setBuildErrorMessage?: (error: string | null) => void;\n }) =>\n ({\n files,\n enableSourcemap,\n vizId,\n }: {\n files: FileCollection;\n enableSourcemap: boolean;\n vizId?: VizId;\n }): Promise<BuildResult | undefined> => {\n const requestId = generateRequestId();\n return new Promise<BuildResult | undefined>(\n (resolve) => {\n const buildListener = (e: MessageEvent) => {\n const data: BuildWorkerMessage = e.data;\n if (\n data.type === \"buildResponse\" &&\n data.requestId === requestId\n ) {\n worker.removeEventListener(\n \"message\",\n buildListener,\n );\n\n const buildResult: BuildResult | undefined =\n data.buildResult;\n const error: string | undefined = data.error;\n\n if (error) {\n setBuildErrorMessage?.(error);\n } else {\n setBuildErrorMessage?.(null);\n }\n\n resolve(buildResult);\n }\n };\n\n worker.addEventListener(\"message\", buildListener);\n\n const message: BuildWorkerMessage = {\n type: \"buildRequest\",\n files,\n enableSourcemap,\n requestId,\n vizId,\n };\n worker.postMessage(message);\n },\n );\n };\n","import {\n FileCollection,\n VizContent,\n VizId,\n} from \"@vizhub/viz-types\";\n\nimport { setupInvalidateVizCache } from \"./setupInvalidateVizCache\";\nimport { setupBuild } from \"./setupBuild\";\nimport {\n BuildWorkerMessage,\n VizHubRuntime,\n WindowMessage,\n} from \"./types\";\n\n// Flag for debugging.\nconst DEBUG = false;\n\n// State constants:\n\n// Nothing happening.\nconst IDLE = \"IDLE\";\n\n// An update has been enqueued\n// via requestAnimationFrame.\nconst ENQUEUED = \"ENQUEUED\";\n\n// An update (build and run) is pending,\n// and the files have not changed.\nconst PENDING_CLEAN = \"PENDING_CLEAN\";\n\n// An update (build and run) is pending,\n// and the files have changed\n// while this run is taking place.\nconst PENDING_DIRTY = \"PENDING_DIRTY\";\n\n// Valid State Transitions:\n//\n// * IDLE --> ENQUEUED\n// When the system is idle and files are changed.\n//\n// * ENQUEUED --> PENDING_CLEAN\n// When the pending changes run.\n//\n// * PENDING_CLEAN --> IDLE\n// When the pending update finishes running\n// and files were not changed in the mean time.\n//\n// * PENDING_CLEAN --> PENDING_DIRTY\n// When files are changed while an update is pending.\n//\n// * PENDING_DIRTY --> ENQUEUED\n// When the pending update finishes running\n// and files were changed in the mean time.\n//\n// When a build error happens, the state is set to IDLE.\n// This is to prevent a build error from causing\n// the whole system to stop working.\n\n// Creates an instance of the VizHub Runtime Environment.\n// This is the main entry point for the runtime, for use\n// by front end applications.\n// It sets up the iframe and worker, and handles messages\n// between them.\n// For server-side rendering where only a build is required,\n// just use the build function directly.\nexport const createRuntime = ({\n iframe,\n worker,\n setBuildErrorMessage,\n getLatestContent,\n resolveSlugKey,\n writeFile,\n}: {\n iframe: HTMLIFrameElement;\n worker: Worker;\n setBuildErrorMessage?: (error: string | null) => void;\n getLatestContent?: (\n vizId: VizId,\n ) => Promise<VizContent | null>;\n resolveSlugKey?: (\n slugKey: string,\n ) => Promise<VizId | null>;\n writeFile?: (fileName: string, content: string) => void;\n}): VizHubRuntime => {\n // Track the current state of the runtime\n let state:\n | typeof IDLE\n | typeof ENQUEUED\n | typeof PENDING_CLEAN\n | typeof PENDING_DIRTY = IDLE;\n\n // When a run is requested while the state is PENDING_CLEAN\n // or PENDING_DIRTY, we need to wait for the pending build to finish,\n // so until the build finishes, we use `latestFiles` to stash the latest files.\n let latestFiles: FileCollection | null = null;\n\n const build = setupBuild({\n worker,\n setBuildErrorMessage,\n });\n\n // Pending promise resolvers\n let pendingRunPromise: (() => void) | null = null;\n\n // This runs when the build worker sends a message.\n const workerListener: (e: MessageEvent) => void = ({\n data,\n }: {\n data: BuildWorkerMessage;\n }) => {\n if (\n data.type === \"contentRequest\" &&\n getLatestContent\n ) {\n DEBUG &&\n console.log(\n \"[worker] contentRequest\",\n JSON.stringify(data, null, 2),\n );\n const { vizId } = data;\n\n getLatestContent(vizId).then((content) => {\n worker.postMessage({\n type: \"contentResponse\",\n vizId,\n content,\n });\n });\n } else if (data.type === \"resolveSlugRequest\") {\n DEBUG &&\n console.log(\n \"[worker] resolveSlugRequest\",\n JSON.stringify(data, null, 2),\n );\n const { slugKey, requestId } = data;\n\n if (resolveSlugKey) {\n DEBUG &&\n console.log(\n \"[worker] resolveSlugRequest: resolving slug key\",\n slugKey,\n );\n resolveSlugKey(slugKey).then(\n (vizId: VizId | null) => {\n DEBUG &&\n console.log(\n \"[worker] resolveSlugRequest: resolved slug key\",\n slugKey,\n \"to vizId\",\n vizId,\n );\n const message: BuildWorkerMessage = {\n type: \"resolveSlugResponse\",\n vizId,\n requestId,\n };\n worker.postMessage(message);\n },\n );\n } else {\n DEBUG &&\n console.log(\n \"[worker] resolveSlugRequest: no slug resolver, returning null\",\n JSON.stringify(data, null, 2),\n );\n // If we don't have a slug resolver, we just\n // send back the slug key as the vizId.\n const message: BuildWorkerMessage = {\n type: \"resolveSlugResponse\",\n vizId: null,\n requestId,\n };\n worker.postMessage(message);\n }\n }\n };\n\n worker.addEventListener(\"message\", workerListener);\n\n // Handle messages from the iframe\n const windowListener = (event: MessageEvent) => {\n const data = event.data;\n\n if (\n data.type === \"runDone\" ||\n data.type === \"runError\"\n ) {\n if (pendingRunPromise) {\n pendingRunPromise();\n pendingRunPromise = null;\n }\n\n if (data.type === \"runError\") {\n setBuildErrorMessage &&\n setBuildErrorMessage(data.error.message);\n }\n }\n\n if (data.type === \"writeFile\" && writeFile) {\n if (data.fileName && data.content) {\n writeFile(data.fileName, data.content);\n }\n }\n };\n\n // This runs when the IFrame sends a message.\n window.addEventListener(\"message\", windowListener);\n\n const cleanup = () => {\n worker.removeEventListener(\"message\", workerListener);\n window.removeEventListener(\"message\", windowListener);\n };\n\n const update = async ({\n files,\n enableHotReloading = false,\n enableSourcemap = false,\n vizId,\n }: {\n files: FileCollection;\n enableHotReloading?: boolean;\n enableSourcemap?: boolean;\n vizId?: VizId;\n }) => {\n state = PENDING_CLEAN;\n\n DEBUG && console.log(\"[runtime] update: before build\");\n\n // Build the code\n const buildResult = await build({\n files,\n enableSourcemap,\n vizId,\n });\n\n // In this case, the build failed\n // and in the meantime the callback `setBuildErrorMessage`\n // was called.\n if (!buildResult) {\n DEBUG &&\n console.log(\"[runtime] update: build failed\");\n }\n\n DEBUG && console.log(\"[runtime] update: after build\");\n\n if (buildResult) {\n const { html, runtimeVersion, js, css } = buildResult;\n\n DEBUG &&\n console.log(\n \"[runtime] enableHotReloading\",\n enableHotReloading,\n );\n\n DEBUG &&\n console.log(\n \"[runtime] html: \",\n html?.substring(0, 200),\n );\n\n DEBUG &&\n console.log(\n \"[runtime] js: \",\n js?.substring(0, 200),\n );\n\n DEBUG &&\n console.log(\n \"[runtime] css: \",\n css?.substring(0, 200),\n );\n\n // Clear the console before each run.\n !DEBUG && console.clear();\n\n // The `enableHotReloading` only works for v3.\n if (enableHotReloading && runtimeVersion === \"v3\") {\n if (css) {\n const runCSSMessage: WindowMessage = {\n type: \"runCSS\",\n css,\n };\n if (!iframe.contentWindow) {\n throw new Error(\n \"iframe.contentWindow is null - this should never happen\",\n );\n }\n iframe.contentWindow.postMessage(\n runCSSMessage,\n window.location.origin,\n );\n }\n if (js) {\n const runJSMessage: WindowMessage = {\n type: \"runJS\",\n js,\n };\n if (!iframe.contentWindow) {\n throw new Error(\n \"iframe.contentWindow is null - this should never happen\",\n );\n }\n iframe.contentWindow.postMessage(\n runJSMessage,\n window.location.origin,\n );\n }\n } else {\n iframe.srcdoc = html || \"\";\n }\n }\n\n // TypeScript can't comprehend that `state`\n // may change during the await calls above.\n // @ts-ignore\n if (state === PENDING_DIRTY) {\n requestAnimationFrame(() => {\n if (!latestFiles) {\n throw new Error(\n \"latestFiles is not defined and state is PENDING_DIRTY - this should never happen\",\n );\n }\n update({\n files: latestFiles,\n enableHotReloading,\n enableSourcemap,\n vizId,\n });\n });\n state = ENQUEUED;\n } else {\n state = IDLE;\n }\n };\n\n // Handle code changes\n\n const run = ({\n files,\n enableHotReloading = false,\n enableSourcemap = false,\n vizId = undefined,\n }: {\n files: FileCollection;\n enableHotReloading?: boolean;\n enableSourcemap?: boolean;\n vizId?: VizId;\n }) => {\n DEBUG && console.log(\"[runtime] run\");\n latestFiles = null;\n if (state === IDLE) {\n DEBUG && console.log(\"[runtime] run: IDLE\");\n state = ENQUEUED;\n update({\n files,\n enableHotReloading,\n enableSourcemap,\n vizId,\n });\n } else if (state === PENDING_CLEAN) {\n DEBUG && console.log(\"[runtime] run: PENDING_CLEAN\");\n latestFiles = files;\n state = PENDING_DIRTY;\n } else if (state === PENDING_DIRTY) {\n DEBUG && console.log(\"[runtime] run: PENDING_DIRTY\");\n latestFiles = files;\n } else if (state === ENQUEUED) {\n DEBUG && console.log(\"[runtime] run: ENQUEUED\");\n latestFiles = files;\n } else {\n throw new Error(`Unexpected state: ${state}`);\n }\n };\n\n return {\n invalidateVizCache: setupInvalidateVizCache(worker),\n run,\n cleanup,\n };\n};\n","// We want to remove the vizId from the error message\n// to make it more user-friendly.\n// Example error message before and after:\n// Before: \"7f0b69fcb754479699172d1887817027/index.js (14:8): Expected ';', '}' or <eof>\"\n// After: \"./index.js (14:8): Expected ';', '}' or <eof>\"\nexport const cleanRollupErrorMessage = ({\n rawMessage,\n vizId,\n}: {\n rawMessage: string;\n vizId: string;\n}) => {\n const regex = new RegExp(vizId, \"g\");\n return rawMessage?.replace(regex, \".\");\n};\n"],"names":["setupInvalidateVizCache","worker","changedVizIds","requestId","generateRequestId","resolve","invalidateListener","e","setupBuild","setBuildErrorMessage","files","enableSourcemap","vizId","buildListener","data","buildResult","error","message","IDLE","ENQUEUED","PENDING_CLEAN","PENDING_DIRTY","createRuntime","iframe","getLatestContent","resolveSlugKey","writeFile","state","latestFiles","build","workerListener","content","slugKey","windowListener","event","cleanup","update","enableHotReloading","html","runtimeVersion","js","css","runCSSMessage","runJSMessage","run","cleanRollupErrorMessage","rawMessage","regex"],"mappings":";;AAGO,MAAMA,IACX,CAACC,MACD,OAAOC,MAA+C;AACpD,QAAMC,IAAYC,EAAkB;AAC7B,SAAA,IAAI,QAAc,CAACC,MAAY;AAC9B,UAAAC,IAAqB,CAACC,MAAoB;AAC9C,MACEA,EAAE,KAAK,SAAS,gCAChBA,EAAE,KAAK,cAAcJ,MAEdF,EAAA;AAAA,QACL;AAAA,QACAK;AAAA,MACF,GACQD,EAAA;AAAA,IAEZ;AACO,IAAAJ,EAAA;AAAA,MACL;AAAA,MACAK;AAAA,IACF,GAEAL,EAAO,YAAY;AAAA,MACjB,MAAM;AAAA,MACN,eAAAC;AAAA,MACA,WAAAC;AAAA,IAAA,CACD;AAAA,EAAA,CACF;AACH,GC1BWK,IACX,CAAC;AAAA,EACC,QAAAP;AAAA,EACA,sBAAAQ;AACF,MAIA,CAAC;AAAA,EACC,OAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,OAAAC;AACF,MAIwC;AACtC,QAAMT,IAAYC,EAAkB;AACpC,SAAO,IAAI;AAAA,IACT,CAACC,MAAY;AACL,YAAAQ,IAAgB,CAACN,MAAoB;AACzC,cAAMO,IAA2BP,EAAE;AACnC,YACEO,EAAK,SAAS,mBACdA,EAA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EL,MAAAS,IAAAlB;AAAA;AAEd,YAAM,IAAI,MAAM,qBAAqBiB,CAAK,EAAE;AAAA,EAEhD;AAEO,SAAA;AAAA,IACL,oBAAoB3B,EAAwBC,CAAM;AAAA,IAClD,KAAA2C;AAAA,IACA,SAAAT;AAAA,EACF;AACF,GCtXaU,IAA0B,CAAC;AAAA,EACtC,YAAAC;AAAA,EACA,OAAAlC;AACF,MAGM;AACJ,QAAMmC,IAAQ,IAAI,OAAOnC,GAAO,GAAG;AAC5B,SAAAkC,KAAA,gBAAAA,EAAY,QAAQC,GAAO;AACpC;"}
1
+ {"version":3,"file":"index.js","sources":["../src/orchestration/setupInvalidateVizCache.ts","../src/orchestration/setupBuild.ts","../src/orchestration/createRuntime.ts","../src/v3/cleanRollupErrorMessage.ts"],"sourcesContent":["import { VizId } from \"@vizhub/viz-types\";\nimport { generateRequestId } from \"./generateRequestId\";\n\nexport const setupInvalidateVizCache =\n (worker: Worker) =>\n async (changedVizIds: Array<VizId>): Promise<void> => {\n const requestId = generateRequestId();\n return new Promise<void>((resolve) => {\n const invalidateListener = (e: MessageEvent) => {\n if (\n e.data.type === \"invalidateVizCacheResponse\" &&\n e.data.requestId === requestId\n ) {\n worker.removeEventListener(\n \"message\",\n invalidateListener,\n );\n resolve();\n }\n };\n worker.addEventListener(\n \"message\",\n invalidateListener,\n );\n\n worker.postMessage({\n type: \"invalidateVizCacheRequest\",\n changedVizIds,\n requestId,\n });\n });\n };\n","import { FileCollection, VizId } from \"@vizhub/viz-types\";\nimport { generateRequestId } from \"./generateRequestId\";\nimport { BuildWorkerMessage } from \"./types\";\nimport { BuildResult } from \"../build/types\";\n\nexport const setupBuild =\n ({\n worker,\n setBuildErrorMessage,\n }: {\n worker: Worker;\n setBuildErrorMessage?: (error: string | null) => void;\n }) =>\n ({\n files,\n enableSourcemap,\n vizId,\n }: {\n files: FileCollection;\n enableSourcemap: boolean;\n vizId?: VizId;\n }): Promise<BuildResult | undefined> => {\n const requestId = generateRequestId();\n return new Promise<BuildResult | undefined>(\n (resolve) => {\n const buildListener = (e: MessageEvent) => {\n const data: BuildWorkerMessage = e.data;\n if (\n data.type === \"buildResponse\" &&\n data.requestId === requestId\n ) {\n worker.removeEventListener(\n \"message\",\n buildListener,\n );\n\n const buildResult: BuildResult | undefined =\n data.buildResult;\n const error: string | undefined = data.error;\n\n if (error) {\n setBuildErrorMessage?.(error);\n } else {\n setBuildErrorMessage?.(null);\n }\n\n resolve(buildResult);\n }\n };\n\n worker.addEventListener(\"message\", buildListener);\n\n const message: BuildWorkerMessage = {\n type: \"buildRequest\",\n files,\n enableSourcemap,\n requestId,\n vizId,\n };\n worker.postMessage(message);\n },\n );\n };\n","import {\n FileCollection,\n VizContent,\n VizId,\n} from \"@vizhub/viz-types\";\n\nimport { setupInvalidateVizCache } from \"./setupInvalidateVizCache\";\nimport { setupBuild } from \"./setupBuild\";\nimport {\n BuildWorkerMessage,\n VizHubRuntime,\n WindowMessage,\n} from \"./types\";\n\n// Flag for debugging.\nconst DEBUG = false;\n\n// State constants:\n\n// Nothing happening.\nconst IDLE = \"IDLE\";\n\n// An update has been enqueued\n// via requestAnimationFrame.\nconst ENQUEUED = \"ENQUEUED\";\n\n// An update (build and run) is pending,\n// and the files have not changed.\nconst PENDING_CLEAN = \"PENDING_CLEAN\";\n\n// An update (build and run) is pending,\n// and the files have changed\n// while this run is taking place.\nconst PENDING_DIRTY = \"PENDING_DIRTY\";\n\n// Valid State Transitions:\n//\n// * IDLE --> ENQUEUED\n// When the system is idle and files are changed.\n//\n// * ENQUEUED --> PENDING_CLEAN\n// When the pending changes run.\n//\n// * PENDING_CLEAN --> IDLE\n// When the pending update finishes running\n// and files were not changed in the mean time.\n//\n// * PENDING_CLEAN --> PENDING_DIRTY\n// When files are changed while an update is pending.\n//\n// * PENDING_DIRTY --> ENQUEUED\n// When the pending update finishes running\n// and files were changed in the mean time.\n//\n// When a build error happens, the state is set to IDLE.\n// This is to prevent a build error from causing\n// the whole system to stop working.\n\n// Creates an instance of the VizHub Runtime Environment.\n// This is the main entry point for the runtime, for use\n// by front end applications.\n// It sets up the iframe and worker, and handles messages\n// between them.\n// For server-side rendering where only a build is required,\n// just use the build function directly.\nexport const createRuntime = ({\n iframe,\n worker,\n setBuildErrorMessage,\n getLatestContent,\n resolveSlugKey,\n writeFile,\n handleRuntimeError,\n}: {\n iframe: HTMLIFrameElement;\n worker: Worker;\n setBuildErrorMessage?: (error: string | null) => void;\n getLatestContent?: (\n vizId: VizId,\n ) => Promise<VizContent | null>;\n resolveSlugKey?: (\n slugKey: string,\n ) => Promise<VizId | null>;\n writeFile?: (fileName: string, content: string) => void;\n handleRuntimeError?: (formattedErrorMessage: string) => void;\n}): VizHubRuntime => {\n // Track the current state of the runtime\n let state:\n | typeof IDLE\n | typeof ENQUEUED\n | typeof PENDING_CLEAN\n | typeof PENDING_DIRTY = IDLE;\n\n // When a run is requested while the state is PENDING_CLEAN\n // or PENDING_DIRTY, we need to wait for the pending build to finish,\n // so until the build finishes, we use `latestFiles` to stash the latest files.\n let latestFiles: FileCollection | null = null;\n\n const build = setupBuild({\n worker,\n setBuildErrorMessage,\n });\n\n // Pending promise resolvers\n let pendingRunPromise: (() => void) | null = null;\n\n // This runs when the build worker sends a message.\n const workerListener: (e: MessageEvent) => void = ({\n data,\n }: {\n data: BuildWorkerMessage;\n }) => {\n if (\n data.type === \"contentRequest\" &&\n getLatestContent\n ) {\n DEBUG &&\n console.log(\n \"[worker] contentRequest\",\n JSON.stringify(data, null, 2),\n );\n const { vizId } = data;\n\n getLatestContent(vizId).then((content) => {\n worker.postMessage({\n type: \"contentResponse\",\n vizId,\n content,\n });\n });\n } else if (data.type === \"resolveSlugRequest\") {\n DEBUG &&\n console.log(\n \"[worker] resolveSlugRequest\",\n JSON.stringify(data, null, 2),\n );\n const { slugKey, requestId } = data;\n\n if (resolveSlugKey) {\n DEBUG &&\n console.log(\n \"[worker] resolveSlugRequest: resolving slug key\",\n slugKey,\n );\n resolveSlugKey(slugKey).then(\n (vizId: VizId | null) => {\n DEBUG &&\n console.log(\n \"[worker] resolveSlugRequest: resolved slug key\",\n slugKey,\n \"to vizId\",\n vizId,\n );\n const message: BuildWorkerMessage = {\n type: \"resolveSlugResponse\",\n vizId,\n requestId,\n };\n worker.postMessage(message);\n },\n );\n } else {\n DEBUG &&\n console.log(\n \"[worker] resolveSlugRequest: no slug resolver, returning null\",\n JSON.stringify(data, null, 2),\n );\n // If we don't have a slug resolver, we just\n // send back the slug key as the vizId.\n const message: BuildWorkerMessage = {\n type: \"resolveSlugResponse\",\n vizId: null,\n requestId,\n };\n worker.postMessage(message);\n }\n }\n };\n\n worker.addEventListener(\"message\", workerListener);\n\n // Handle messages from the iframe\n const windowListener = (event: MessageEvent) => {\n const data = event.data;\n\n if (\n data.type === \"runDone\" ||\n data.type === \"runError\"\n ) {\n if (pendingRunPromise) {\n pendingRunPromise();\n pendingRunPromise = null;\n }\n\n if (data.type === \"runError\") {\n setBuildErrorMessage &&\n setBuildErrorMessage(data.error.message);\n }\n }\n\n if (data.type === \"runtimeError\" && handleRuntimeError) {\n handleRuntimeError(data.formattedErrorMessage);\n }\n\n if (data.type === \"writeFile\" && writeFile) {\n if (data.fileName && data.content) {\n writeFile(data.fileName, data.content);\n }\n }\n };\n\n // This runs when the IFrame sends a message.\n window.addEventListener(\"message\", windowListener);\n\n const cleanup = () => {\n worker.removeEventListener(\"message\", workerListener);\n window.removeEventListener(\"message\", windowListener);\n };\n\n const update = async ({\n files,\n enableHotReloading = false,\n enableSourcemap = false,\n vizId,\n }: {\n files: FileCollection;\n enableHotReloading?: boolean;\n enableSourcemap?: boolean;\n vizId?: VizId;\n }) => {\n state = PENDING_CLEAN;\n\n DEBUG && console.log(\"[runtime] update: before build\");\n\n // Build the code\n const buildResult = await build({\n files,\n enableSourcemap,\n vizId,\n });\n\n // In this case, the build failed\n // and in the meantime the callback `setBuildErrorMessage`\n // was called.\n if (!buildResult) {\n DEBUG &&\n console.log(\"[runtime] update: build failed\");\n }\n\n DEBUG && console.log(\"[runtime] update: after build\");\n\n if (buildResult) {\n const { html, runtimeVersion, js, css } = buildResult;\n\n DEBUG &&\n console.log(\n \"[runtime] enableHotReloading\",\n enableHotReloading,\n );\n\n DEBUG &&\n console.log(\n \"[runtime] html: \",\n html?.substring(0, 200),\n );\n\n DEBUG &&\n console.log(\n \"[runtime] js: \",\n js?.substring(0, 200),\n );\n\n DEBUG &&\n console.log(\n \"[runtime] css: \",\n css?.substring(0, 200),\n );\n\n // Clear the console before each run.\n !DEBUG && console.clear();\n\n // The `enableHotReloading` only works for v3.\n if (enableHotReloading && runtimeVersion === \"v3\") {\n if (css) {\n const runCSSMessage: WindowMessage = {\n type: \"runCSS\",\n css,\n };\n if (!iframe.contentWindow) {\n throw new Error(\n \"iframe.contentWindow is null - this should never happen\",\n );\n }\n iframe.contentWindow.postMessage(\n runCSSMessage,\n window.location.origin,\n );\n }\n if (js) {\n const runJSMessage: WindowMessage = {\n type: \"runJS\",\n js,\n };\n if (!iframe.contentWindow) {\n throw new Error(\n \"iframe.contentWindow is null - this should never happen\",\n );\n }\n iframe.contentWindow.postMessage(\n runJSMessage,\n window.location.origin,\n );\n }\n } else {\n iframe.srcdoc = html || \"\";\n }\n }\n\n // TypeScript can't comprehend that `state`\n // may change during the await calls above.\n // @ts-ignore\n if (state === PENDING_DIRTY) {\n requestAnimationFrame(() => {\n if (!latestFiles) {\n throw new Error(\n \"latestFiles is not defined and state is PENDING_DIRTY - this should never happen\",\n );\n }\n update({\n files: latestFiles,\n enableHotReloading,\n enableSourcemap,\n vizId,\n });\n });\n state = ENQUEUED;\n } else {\n state = IDLE;\n }\n };\n\n // Handle code changes\n\n const run = ({\n files,\n enableHotReloading = false,\n enableSourcemap = false,\n vizId = undefined,\n }: {\n files: FileCollection;\n enableHotReloading?: boolean;\n enableSourcemap?: boolean;\n vizId?: VizId;\n }) => {\n DEBUG && console.log(\"[runtime] run\");\n latestFiles = null;\n if (state === IDLE) {\n DEBUG && console.log(\"[runtime] run: IDLE\");\n state = ENQUEUED;\n update({\n files,\n enableHotReloading,\n enableSourcemap,\n vizId,\n });\n } else if (state === PENDING_CLEAN) {\n DEBUG && console.log(\"[runtime] run: PENDING_CLEAN\");\n latestFiles = files;\n state = PENDING_DIRTY;\n } else if (state === PENDING_DIRTY) {\n DEBUG && console.log(\"[runtime] run: PENDING_DIRTY\");\n latestFiles = files;\n } else if (state === ENQUEUED) {\n DEBUG && console.log(\"[runtime] run: ENQUEUED\");\n latestFiles = files;\n } else {\n throw new Error(`Unexpected state: ${state}`);\n }\n };\n\n return {\n invalidateVizCache: setupInvalidateVizCache(worker),\n run,\n cleanup,\n };\n};\n","// We want to remove the vizId from the error message\n// to make it more user-friendly.\n// Example error message before and after:\n// Before: \"7f0b69fcb754479699172d1887817027/index.js (14:8): Expected ';', '}' or <eof>\"\n// After: \"./index.js (14:8): Expected ';', '}' or <eof>\"\nexport const cleanRollupErrorMessage = ({\n rawMessage,\n vizId,\n}: {\n rawMessage: string;\n vizId: string;\n}) => {\n const regex = new RegExp(vizId, \"g\");\n return rawMessage?.replace(regex, \".\");\n};\n"],"names":["setupInvalidateVizCache","worker","changedVizIds","requestId","generateRequestId","resolve","invalidateListener","e","setupBuild","setBuildErrorMessage","files","enableSourcemap","vizId","buildListener","data","buildResult","error","message","IDLE","ENQUEUED","PENDING_CLEAN","PENDING_DIRTY","createRuntime","iframe","getLatestContent","resolveSlugKey","writeFile","handleRuntimeError","state","latestFiles","build","workerListener","content","slugKey","windowListener","event","cleanup","update","enableHotReloading","html","runtimeVersion","js","css","runCSSMessage","runJSMessage","run","cleanRollupErrorMessage","rawMessage","regex"],"mappings":";;AAGO,MAAMA,IACX,CAACC,MACD,OAAOC,MAA+C;AACpD,QAAMC,IAAYC,EAAA;AAClB,SAAO,IAAI,QAAc,CAACC,MAAY;AACpC,UAAMC,IAAqB,CAACC,MAAoB;AAC9C,MACEA,EAAE,KAAK,SAAS,gCAChBA,EAAE,KAAK,cAAcJ,MAErBF,EAA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,EAAO;AAAA,QACL,OAAOR;AAAA,QACP,oBAAAS;AAAA,QACA,iBAAA3B;AAAA,QACA,OAAAC;AAAA,MAAA,CACD;AAAA,IACH,CAAC,GACDgB,IAAQT,KAERS,IAAQV;AAAA,EAEZ,GAIM2B,IAAM,CAAC;AAAA,IACX,OAAAnC;AAAA,IACA,oBAAA4B,IAAqB;AAAA,IACrB,iBAAA3B,IAAkB;AAAA,IAClB,OAAAC,IAAQ;AAAA,EAAA,MAMJ;AAGJ,QADAiB,IAAc,MACVD,MAAUV;AAEZ,MAAAU,IAAQT,GACRkB,EAAO;AAAA,QACL,OAAA3B;AAAA,QACA,oBAAA4B;AAAA,QACA,iBAAA3B;AAAA,QACA,OAAAC;AAAA,MAAA,CACD;AAAA,aACQgB,MAAUR;AAEnB,MAAAS,IAAcnB,GACdkB,IAAQP;AAAA,aACCO,MAAUP;AAEnB,MAAAQ,IAAcnB;AAAA,aACLkB,MAAUT;AAEnB,MAAAU,IAAcnB;AAAA;AAEd,YAAM,IAAI,MAAM,qBAAqBkB,CAAK,EAAE;AAAA,EAEhD;AAEA,SAAO;AAAA,IACL,oBAAoB5B,EAAwBC,CAAM;AAAA,IAClD,KAAA4C;AAAA,IACA,SAAAT;AAAA,EAAA;AAEJ,GC5XaU,IAA0B,CAAC;AAAA,EACtC,YAAAC;AAAA,EACA,OAAAnC;AACF,MAGM;AACJ,QAAMoC,IAAQ,IAAI,OAAOpC,GAAO,GAAG;AACnC,SAAOmC,GAAY,QAAQC,GAAO,GAAG;AACvC;"}
@@ -1,11 +1,12 @@
1
1
  import { VizContent, VizId } from "@vizhub/viz-types";
2
2
  import { VizHubRuntime } from "./types";
3
- export declare const createRuntime: ({ iframe, worker, setBuildErrorMessage, getLatestContent, resolveSlugKey, writeFile, }: {
3
+ export declare const createRuntime: ({ iframe, worker, setBuildErrorMessage, getLatestContent, resolveSlugKey, writeFile, handleRuntimeError, }: {
4
4
  iframe: HTMLIFrameElement;
5
5
  worker: Worker;
6
6
  setBuildErrorMessage?: (error: string | null) => void;
7
7
  getLatestContent?: (vizId: VizId) => Promise<VizContent | null>;
8
8
  resolveSlugKey?: (slugKey: string) => Promise<VizId | null>;
9
9
  writeFile?: (fileName: string, content: string) => void;
10
+ handleRuntimeError?: (formattedErrorMessage: string) => void;
10
11
  }) => VizHubRuntime;
11
12
  //# sourceMappingURL=createRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createRuntime.d.ts","sourceRoot":"","sources":["../../src/orchestration/createRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,EACN,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAEL,aAAa,EAEd,MAAM,SAAS,CAAC;AAqDjB,eAAO,MAAM,aAAa,GAAI,wFAO3B;IACD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,gBAAgB,CAAC,EAAE,CACjB,KAAK,EAAE,KAAK,KACT,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAChC,cAAc,CAAC,EAAE,CACf,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC3B,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD,KAAG,aAwSH,CAAC"}
1
+ {"version":3,"file":"createRuntime.d.ts","sourceRoot":"","sources":["../../src/orchestration/createRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,EACN,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAEL,aAAa,EAEd,MAAM,SAAS,CAAC;AAqDjB,eAAO,MAAM,aAAa,GAAI,4GAQ3B;IACD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,gBAAgB,CAAC,EAAE,CACjB,KAAK,EAAE,KAAK,KACT,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAChC,cAAc,CAAC,EAAE,CACf,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC3B,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,kBAAkB,CAAC,EAAE,CAAC,qBAAqB,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9D,KAAG,aA4SH,CAAC"}
@@ -59,6 +59,9 @@ export type WindowMessage = {
59
59
  type: "runError";
60
60
  error: Error;
61
61
  requestId: string;
62
+ } | {
63
+ type: "runtimeError";
64
+ formattedErrorMessage: string;
62
65
  } | {
63
66
  type: "writeFile";
64
67
  fileName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/orchestration/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG;IAE1B,GAAG,EAAE,CAAC,OAAO,EAAE;QAEb,KAAK,EAAE,cAAc,CAAC;QAItB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAG7B,eAAe,CAAC,EAAE,OAAO,CAAC;QAI1B,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,KAAK,IAAI,CAAC;IAGX,OAAO,EAAE,MAAM,IAAI,CAAC;IAKpB,kBAAkB,EAAE,CAClB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,CAAC;AAGF,MAAM,MAAM,k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AC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,GAKD;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,GAOD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,GAKD;IACE,IAAI,EAAE,2BAA2B,CAAC;IAClC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB,GAKD;IACE,IAAI,EAAE,4BAA4B,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAGN,MAAM,MAAM,aAAa,GAIrB;IACE,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ,GAKD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,GAKD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,GAKD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,GAKD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;CAC/B,GAKD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extractEntryPoints.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractEntryPoints.test.d.ts","sourceRoot":"","sources":["../../src/test/extractEntryPoints.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extractEntryPointsEdgeCases.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractEntryPointsEdgeCases.test.d.ts","sourceRoot":"","sources":["../../src/test/extractEntryPointsEdgeCases.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export declare const basicBundleNameCollision: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "foo.js": string;
5
+ "bar.js": string;
6
+ };
7
+ //# sourceMappingURL=basicBundleNameCollision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basicBundleNameCollision.d.ts","sourceRoot":"","sources":["../../../../src/test/fixtures/v2/basicBundleNameCollision.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB;;;;;CASpC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { basicBundle } from "./basicBundle";
2
2
  export { basicBundleNoExtension } from "./basicBundleNoExtension";
3
+ export { basicBundleNameCollision } from "./basicBundleNameCollision";
3
4
  export { d3Import } from "./d3Import";
4
5
  export { d3ImportPkg } from "./d3ImportPkg";
5
6
  export { reactImport } from "./reactImport";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/fixtures/v2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,Y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sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"svelte.d.ts","sourceRoot":"","sources":["../../../../src/test/fixtures/v3/svelte.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;CAiBlB,CAAC"}
1
+ {"version":3,"file":"svelte.d.ts","sourceRoot":"","sources":["../../../../src/test/fixtures/v3/svelte.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;CAkBlB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export { jsScriptTagTypeModule } from "./jsScriptTagTypeModule";
2
2
  export { jsScriptTagTypeModules } from "./jsScriptTagTypeModules";
3
3
  export { jsScriptTagTypeModulesRelative } from "./jsScriptTagTypeModulesRelative";
4
+ export { jsInlineScriptModule } from "./jsInlineScriptModule";
4
5
  export { fetchInterception } from "./fetchInterception";
5
6
  export { esmBuild } from "./esmBuild";
6
7
  export { reactJsx } from "./reactJsx";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/fixtures/v4/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/fixtures/v4/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const jsInlineScriptModule: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
5
+ //# sourceMappingURL=jsInlineScriptModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsInlineScriptModule.d.ts","sourceRoot":"","sources":["../../../../src/test/fixtures/v4/jsInlineScriptModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;CAuBhC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtimeErrorHandling.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeErrorHandling.test.d.ts","sourceRoot":"","sources":["../../src/test/runtimeErrorHandling.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtimeErrorHandlingAllVersions.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeErrorHandlingAllVersions.test.d.ts","sourceRoot":"","sources":["../../src/test/runtimeErrorHandlingAllVersions.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtimeErrorHandlingIntegration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeErrorHandlingIntegration.test.d.ts","sourceRoot":"","sources":["../../src/test/runtimeErrorHandlingIntegration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=updateHTML.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateHTML.test.d.ts","sourceRoot":"","sources":["../../src/test/updateHTML.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=v4Build.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v4Build.test.d.ts","sourceRoot":"","sources":["../../src/test/v4Build.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=v4BuildIntegration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v4BuildIntegration.test.d.ts","sourceRoot":"","sources":["../../src/test/v4BuildIntegration.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"getComputedIndexHtml.d.ts","sourceRoot":"","sources":["../../src/v2/getComputedIndexHtml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA6InD,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,KACpB,MA0BF,CAAC"}
1
+ {"version":3,"file":"getComputedIndexHtml.d.ts","sourceRoot":"","sources":["../../src/v2/getComputedIndexHtml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAkJnD,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,KACpB,MA0BF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"htmlTemplate.d.ts","sourceRoot":"","sources":["../../src/v3/htmlTemplate.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,GAAI,uBAI1B;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,WAsFA,CAAC"}
1
+ {"version":3,"file":"htmlTemplate.d.ts","sourceRoot":"","sources":["../../src/v3/htmlTemplate.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,GAAI,uBAI1B;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,WAuFA,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=svelte5-integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svelte5-integration.test.d.ts","sourceRoot":"","sources":["../../src/v3/svelte5-integration.test.ts"],"names":[],"mappings":""}
@@ -1,8 +1,15 @@
1
1
  import type { InputPluginOption } from "rollup";
2
2
  export type SvelteCompiler = (code: string, options: any) => {
3
- js: string;
3
+ js: {
4
+ code: string;
5
+ map?: object;
6
+ };
7
+ css?: {
8
+ code: string;
9
+ map?: object;
10
+ } | null;
4
11
  };
5
- export declare const svelteCompilerUrl = "https://cdn.jsdelivr.net/npm/svelte@4.2.9/compiler.cjs";
12
+ export declare const svelteCompilerUrl = "https://cdn.jsdelivr.net/npm/svelte@5/compiler.cjs";
6
13
  export declare const transformSvelte: ({ getSvelteCompiler, }: {
7
14
  getSvelteCompiler?: () => Promise<any>;
8
15
  }) => InputPluginOption;
@@ -1 +1 @@
1
- {"version":3,"file":"transformSvelte.d.ts","sourceRoot":"","sources":["../../src/v3/transformSvelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAUhD,MAAM,MAAM,cAAc,GAAG,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,KACT;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAMpB,eAAO,MAAM,iBAAiB,2DAA8B,CAAC;AAO7D,eAAO,MAAM,eAAe,GAAI,wBAE7B;IACD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CACxC,KAAG,iBAoFF,CAAC"}
1
+ {"version":3,"file":"transformSvelte.d.ts","sourceRoot":"","sources":["../../src/v3/transformSvelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAUhD,MAAM,MAAM,cAAc,GAAG,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,KACT;IAAE,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,CAAC;AAMzF,eAAO,MAAM,iBAAiB,uDAA8B,CAAC;AAO7D,eAAO,MAAM,eAAe,GAAI,wBAE7B;IACD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CACxC,KAAG,iBA0GF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transformSvelte.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformSvelte.test.d.ts","sourceRoot":"","sources":["../../src/v3/transformSvelte.test.ts"],"names":[],"mappings":""}