wgsl-play 0.0.33 → 0.0.34
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 +13 -13
- package/dist/wgsl-play.js +13 -13
- package/package.json +3 -3
- package/src/WgslPlay.ts +17 -24
package/dist/WgslPlay.js
CHANGED
|
@@ -151,9 +151,10 @@ var WgslPlay = class extends HTMLElement {
|
|
|
151
151
|
}
|
|
152
152
|
/** Set sources from a full project with weslSrc. */
|
|
153
153
|
setProjectSources(weslSrc, rootModuleName) {
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
this.
|
|
154
|
+
const pkg = this._linkOptions.packageName || "package";
|
|
155
|
+
const root = rootModuleName ?? "main";
|
|
156
|
+
this._weslSrc = toModulePaths(weslSrc, pkg);
|
|
157
|
+
this._rootModuleName = fileToModulePath(root, pkg, false);
|
|
157
158
|
this._fromFullProject = true;
|
|
158
159
|
this.rebuildPipeline();
|
|
159
160
|
}
|
|
@@ -285,13 +286,10 @@ var WgslPlay = class extends HTMLElement {
|
|
|
285
286
|
const source = el.source ?? el.textContent ?? "";
|
|
286
287
|
return { [this._rootModuleName]: source };
|
|
287
288
|
};
|
|
288
|
-
const conditions = el
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const entries = Object.entries(weslSrc).map(([k, v]) => [toModulePath(k), v]);
|
|
293
|
-
this._weslSrc = Object.fromEntries(entries);
|
|
294
|
-
this._rootModuleName = rootModuleName ? toModulePath(rootModuleName) : "package::main";
|
|
289
|
+
const { conditions, rootModuleName, libs } = el;
|
|
290
|
+
const root = rootModuleName ?? "main";
|
|
291
|
+
this._weslSrc = getSources();
|
|
292
|
+
this._rootModuleName = fileToModulePath(root, "package", false);
|
|
295
293
|
if (conditions) this._linkOptions = {
|
|
296
294
|
...this._linkOptions,
|
|
297
295
|
conditions
|
|
@@ -444,9 +442,11 @@ function upgradeProperty(el, prop) {
|
|
|
444
442
|
el[prop] = value;
|
|
445
443
|
}
|
|
446
444
|
}
|
|
447
|
-
/**
|
|
448
|
-
function
|
|
449
|
-
|
|
445
|
+
/** Normalize all keys in a weslSrc record to module paths. */
|
|
446
|
+
function toModulePaths(weslSrc, pkg) {
|
|
447
|
+
const result = {};
|
|
448
|
+
for (const [key, value] of Object.entries(weslSrc)) result[fileToModulePath(key, pkg, false)] = value;
|
|
449
|
+
return result;
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
//#endregion
|
package/dist/wgsl-play.js
CHANGED
|
@@ -5836,9 +5836,10 @@ var WgslPlay = class extends HTMLElement {
|
|
|
5836
5836
|
}
|
|
5837
5837
|
/** Set sources from a full project with weslSrc. */
|
|
5838
5838
|
setProjectSources(weslSrc, rootModuleName) {
|
|
5839
|
-
const
|
|
5840
|
-
|
|
5841
|
-
this.
|
|
5839
|
+
const pkg = this._linkOptions.packageName || "package";
|
|
5840
|
+
const root = rootModuleName ?? "main";
|
|
5841
|
+
this._weslSrc = toModulePaths(weslSrc, pkg);
|
|
5842
|
+
this._rootModuleName = fileToModulePath(root, pkg, false);
|
|
5842
5843
|
this._fromFullProject = true;
|
|
5843
5844
|
this.rebuildPipeline();
|
|
5844
5845
|
}
|
|
@@ -5970,13 +5971,10 @@ var WgslPlay = class extends HTMLElement {
|
|
|
5970
5971
|
const source = el.source ?? el.textContent ?? "";
|
|
5971
5972
|
return { [this._rootModuleName]: source };
|
|
5972
5973
|
};
|
|
5973
|
-
const conditions = el
|
|
5974
|
-
const
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
const entries = Object.entries(weslSrc).map(([k, v]) => [toModulePath(k), v]);
|
|
5978
|
-
this._weslSrc = Object.fromEntries(entries);
|
|
5979
|
-
this._rootModuleName = rootModuleName ? toModulePath(rootModuleName) : "package::main";
|
|
5974
|
+
const { conditions, rootModuleName, libs } = el;
|
|
5975
|
+
const root = rootModuleName ?? "main";
|
|
5976
|
+
this._weslSrc = getSources();
|
|
5977
|
+
this._rootModuleName = fileToModulePath(root, "package", false);
|
|
5980
5978
|
if (conditions) this._linkOptions = {
|
|
5981
5979
|
...this._linkOptions,
|
|
5982
5980
|
conditions
|
|
@@ -6129,9 +6127,11 @@ function upgradeProperty(el, prop) {
|
|
|
6129
6127
|
el[prop] = value;
|
|
6130
6128
|
}
|
|
6131
6129
|
}
|
|
6132
|
-
/**
|
|
6133
|
-
function
|
|
6134
|
-
|
|
6130
|
+
/** Normalize all keys in a weslSrc record to module paths. */
|
|
6131
|
+
function toModulePaths(weslSrc, pkg) {
|
|
6132
|
+
const result = {};
|
|
6133
|
+
for (const [key, value] of Object.entries(weslSrc)) result[fileToModulePath(key, pkg, false)] = value;
|
|
6134
|
+
return result;
|
|
6135
6135
|
}
|
|
6136
6136
|
|
|
6137
6137
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wgsl-play",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
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-gpu": "0.1.25",
|
|
27
|
+
"wesl-fetch": "0.0.11"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@playwright/test": "^1.53.2",
|
package/src/WgslPlay.ts
CHANGED
|
@@ -241,15 +241,10 @@ export class WgslPlay extends HTMLElement {
|
|
|
241
241
|
weslSrc: Record<string, string>,
|
|
242
242
|
rootModuleName?: string,
|
|
243
243
|
): void {
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
]);
|
|
249
|
-
this._weslSrc = Object.fromEntries(entries);
|
|
250
|
-
this._rootModuleName = rootModuleName
|
|
251
|
-
? toModulePath(rootModuleName)
|
|
252
|
-
: "package::main";
|
|
244
|
+
const pkg = this._linkOptions.packageName || "package";
|
|
245
|
+
const root = rootModuleName ?? "main";
|
|
246
|
+
this._weslSrc = toModulePaths(weslSrc, pkg);
|
|
247
|
+
this._rootModuleName = fileToModulePath(root, pkg, false);
|
|
253
248
|
this._fromFullProject = true;
|
|
254
249
|
this.rebuildPipeline();
|
|
255
250
|
}
|
|
@@ -427,18 +422,10 @@ export class WgslPlay extends HTMLElement {
|
|
|
427
422
|
|
|
428
423
|
// Load initial sources, conditions, and libs from source element.
|
|
429
424
|
// Use discoverAndRebuild (not project setter) so external deps are fetched.
|
|
430
|
-
const conditions =
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
const entries = Object.entries(weslSrc).map(([k, v]) => [
|
|
435
|
-
toModulePath(k),
|
|
436
|
-
v,
|
|
437
|
-
]);
|
|
438
|
-
this._weslSrc = Object.fromEntries(entries);
|
|
439
|
-
this._rootModuleName = rootModuleName
|
|
440
|
-
? toModulePath(rootModuleName)
|
|
441
|
-
: "package::main";
|
|
425
|
+
const { conditions, rootModuleName, libs } = el as any;
|
|
426
|
+
const root = rootModuleName ?? "main";
|
|
427
|
+
this._weslSrc = getSources();
|
|
428
|
+
this._rootModuleName = fileToModulePath(root, "package", false);
|
|
442
429
|
if (conditions) this._linkOptions = { ...this._linkOptions, conditions };
|
|
443
430
|
if (libs) this._libs = libs;
|
|
444
431
|
this._fromFullProject = false;
|
|
@@ -629,7 +616,13 @@ function upgradeProperty(el: HTMLElement, prop: string): void {
|
|
|
629
616
|
}
|
|
630
617
|
}
|
|
631
618
|
|
|
632
|
-
/**
|
|
633
|
-
function
|
|
634
|
-
|
|
619
|
+
/** Normalize all keys in a weslSrc record to module paths. */
|
|
620
|
+
function toModulePaths(
|
|
621
|
+
weslSrc: Record<string, string>,
|
|
622
|
+
pkg: string,
|
|
623
|
+
): Record<string, string> {
|
|
624
|
+
const result: Record<string, string> = {};
|
|
625
|
+
for (const [key, value] of Object.entries(weslSrc))
|
|
626
|
+
result[fileToModulePath(key, pkg, false)] = value;
|
|
627
|
+
return result;
|
|
635
628
|
}
|