wgsl-play 0.0.34 → 0.0.35
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/WgslPlay.js
CHANGED
|
@@ -304,7 +304,8 @@ var WgslPlay = class extends HTMLElement {
|
|
|
304
304
|
this.project = {
|
|
305
305
|
weslSrc: detail?.sources ?? fallback,
|
|
306
306
|
rootModuleName: detail?.rootModuleName,
|
|
307
|
-
conditions: detail?.conditions
|
|
307
|
+
conditions: detail?.conditions,
|
|
308
|
+
libs: detail?.libs
|
|
308
309
|
};
|
|
309
310
|
};
|
|
310
311
|
el.addEventListener("change", this._sourceListener);
|
package/dist/wgsl-play.js
CHANGED
|
@@ -5989,7 +5989,8 @@ var WgslPlay = class extends HTMLElement {
|
|
|
5989
5989
|
this.project = {
|
|
5990
5990
|
weslSrc: detail?.sources ?? fallback,
|
|
5991
5991
|
rootModuleName: detail?.rootModuleName,
|
|
5992
|
-
conditions: detail?.conditions
|
|
5992
|
+
conditions: detail?.conditions,
|
|
5993
|
+
libs: detail?.libs
|
|
5993
5994
|
};
|
|
5994
5995
|
};
|
|
5995
5996
|
el.addEventListener("change", this._sourceListener);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wgsl-play",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"wesl": "0.7.23",
|
|
26
|
-
"wesl-
|
|
27
|
-
"wesl-
|
|
26
|
+
"wesl-fetch": "0.0.11",
|
|
27
|
+
"wesl-gpu": "0.1.25"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@playwright/test": "^1.53.2",
|
package/src/WgslPlay.ts
CHANGED
|
@@ -432,7 +432,7 @@ export class WgslPlay extends HTMLElement {
|
|
|
432
432
|
await this.discoverAndRebuild();
|
|
433
433
|
this._fromFullProject = true; // fast rebuilds on subsequent edits
|
|
434
434
|
|
|
435
|
-
// Listen for changes - rebuild with
|
|
435
|
+
// Listen for changes - rebuild with libs from source element
|
|
436
436
|
this._sourceListener = (e: Event) => {
|
|
437
437
|
const detail = (e as CustomEvent).detail;
|
|
438
438
|
const fallback = { [this._rootModuleName]: detail?.source ?? "" };
|
|
@@ -440,6 +440,7 @@ export class WgslPlay extends HTMLElement {
|
|
|
440
440
|
weslSrc: detail?.sources ?? fallback,
|
|
441
441
|
rootModuleName: detail?.rootModuleName,
|
|
442
442
|
conditions: detail?.conditions,
|
|
443
|
+
libs: detail?.libs,
|
|
443
444
|
};
|
|
444
445
|
};
|
|
445
446
|
el.addEventListener("change", this._sourceListener);
|
package/src/test/WgslPlay.e2e.ts
CHANGED
|
@@ -221,20 +221,36 @@ test("connectToSource - external deps are fetched", async ({ page }) => {
|
|
|
221
221
|
await expectCanvasSnapshot(page, "#player11", "connect-source-external.png");
|
|
222
222
|
});
|
|
223
223
|
|
|
224
|
+
test("connectToSource - dynamic npm package loading", async ({ page }) => {
|
|
225
|
+
await page.goto("/");
|
|
226
|
+
await waitForFrame(page, "#player12");
|
|
227
|
+
|
|
228
|
+
// Inject code referencing random_wgsl (not in initial content)
|
|
229
|
+
await page.click("#inject-npm12");
|
|
230
|
+
await page.waitForLoadState("networkidle");
|
|
231
|
+
await waitForFrame(page, "#player12");
|
|
232
|
+
|
|
233
|
+
const hasError = await page.evaluate(
|
|
234
|
+
() => (document.querySelector("#player12") as any)?.hasError ?? true,
|
|
235
|
+
);
|
|
236
|
+
expect(hasError).toBe(false);
|
|
237
|
+
await expectCanvasSnapshot(page, "#player12", "connect-dynamic-npm.png");
|
|
238
|
+
});
|
|
239
|
+
|
|
224
240
|
test("editor.link() with virtualLibs resolves env:: module", async ({
|
|
225
241
|
page,
|
|
226
242
|
}) => {
|
|
227
243
|
await page.goto("/");
|
|
228
244
|
await waitForWgslPlay(page);
|
|
229
245
|
|
|
230
|
-
await page.click("#link-
|
|
246
|
+
await page.click("#link-btn13");
|
|
231
247
|
await page.waitForFunction(
|
|
232
248
|
() =>
|
|
233
|
-
document.querySelector("#link-
|
|
249
|
+
document.querySelector("#link-output13")?.textContent !==
|
|
234
250
|
"Not linked yet",
|
|
235
251
|
);
|
|
236
252
|
|
|
237
|
-
const output = await page.textContent("#link-
|
|
253
|
+
const output = await page.textContent("#link-output13");
|
|
238
254
|
expect(output).toContain("var<uniform>");
|
|
239
255
|
expect(output).toContain("fs_main");
|
|
240
256
|
expect(output).not.toContain("Error");
|