wgsl-test 0.2.1 → 0.2.5
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.ts +2 -27
- package/dist/index.js +145 -84
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/TestFragmentShader.ts +13 -62
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeviceCache,
|
|
1
|
+
import { DeviceCache, FragmentRenderParams, RenderUniforms, SamplerOptions, WeslOptions, checkerboardTexture, colorBarsTexture, createSampler, createUniformsVirtualLib, edgePatternTexture, fullscreenTriangleVertex, gradientTexture, noiseTexture, radialGradientTexture, renderUniformBuffer, simpleRender, solidTexture, updateRenderUniforms, withErrorScopes } from "wesl-gpu";
|
|
2
2
|
import { LinkParams, ModuleResolver, WeslBundle } from "wesl";
|
|
3
3
|
import { WgslElementType, WgslElementType as WgslElementType$1 } from "thimbleberry";
|
|
4
4
|
import { ImageData, ImageData as ImageData$1, MatchImageOptions } from "vitest-image-snapshot";
|
|
@@ -140,7 +140,7 @@ declare function testCompute(params: ComputeTestParams): Promise<number[]>;
|
|
|
140
140
|
declare function runCompute(device: GPUDevice, module: GPUShaderModule, resultFormat?: WgslElementType$1, size?: number, dispatchWorkgroups?: number | [number, number, number]): Promise<number[]>;
|
|
141
141
|
//#endregion
|
|
142
142
|
//#region src/TestFragmentShader.d.ts
|
|
143
|
-
interface FragmentTestParams {
|
|
143
|
+
interface FragmentTestParams extends WeslOptions, FragmentRenderParams {
|
|
144
144
|
/** WESL/WGSL source code for the fragment shader to test.
|
|
145
145
|
* Either src or moduleName must be provided, but not both. */
|
|
146
146
|
src?: string;
|
|
@@ -153,31 +153,6 @@ interface FragmentTestParams {
|
|
|
153
153
|
* Optional: defaults to searching upward from cwd for package.json or wesl.toml.
|
|
154
154
|
* Typically use `import.meta.url`. */
|
|
155
155
|
projectDir?: string;
|
|
156
|
-
/** GPU device for running the tests.
|
|
157
|
-
* Typically use `getGPUDevice()` from wgsl-test. */
|
|
158
|
-
device: GPUDevice;
|
|
159
|
-
/** Texture format for the output texture. Default: "rgba32float" */
|
|
160
|
-
textureFormat?: GPUTextureFormat;
|
|
161
|
-
/** Size of the output texture. Default: [1, 1] for simple color tests.
|
|
162
|
-
* Use [2, 2] for derivative tests (forms a complete 2x2 quad for dpdx/dpdy). */
|
|
163
|
-
size?: [width: number, height: number];
|
|
164
|
-
/** Flags for conditional compilation to test shader specialization.
|
|
165
|
-
* Useful for testing `@if` statements in the shader. */
|
|
166
|
-
conditions?: LinkParams["conditions"];
|
|
167
|
-
/** Constants for shader compilation.
|
|
168
|
-
* Injects host-provided values via the `constants::` namespace. */
|
|
169
|
-
constants?: LinkParams["constants"];
|
|
170
|
-
/** Uniform values for the shader (time, mouse).
|
|
171
|
-
* Resolution is auto-populated from the size parameter.
|
|
172
|
-
* Creates test::Uniforms struct available in the shader. */
|
|
173
|
-
uniforms?: RenderUniforms$1;
|
|
174
|
-
/** Input textures for the shader.
|
|
175
|
-
* Bindings: textures at [1..n], samplers at [n+1..n+m].
|
|
176
|
-
* Binding 0 is reserved for uniforms. */
|
|
177
|
-
textures?: GPUTexture[];
|
|
178
|
-
/** Samplers for the input textures.
|
|
179
|
-
* Must be length 1 (reused for all textures) or match textures.length exactly. */
|
|
180
|
-
samplers?: GPUSampler[];
|
|
181
156
|
/** Use source shaders from current package instead of built bundles.
|
|
182
157
|
* Default: true for faster iteration during development. */
|
|
183
158
|
useSourceShaders?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DeviceCache, DeviceCache as DeviceCache$1, checkerboardTexture, colorBarsTexture, createSampler, createUniformsVirtualLib, edgePatternTexture, fullscreenTriangleVertex, gradientTexture,
|
|
1
|
+
import { DeviceCache, DeviceCache as DeviceCache$1, checkerboardTexture, colorBarsTexture, createSampler, createUniformsVirtualLib, edgePatternTexture, fullscreenTriangleVertex, gradientTexture, noiseTexture, radialGradientTexture, renderUniformBuffer, runFragment, simpleRender, solidTexture, updateRenderUniforms, withErrorScopes, withErrorScopes as withErrorScopes$1 } from "wesl-gpu";
|
|
2
2
|
import * as path$1 from "node:path";
|
|
3
3
|
import path, { posix, win32 } from "node:path";
|
|
4
4
|
import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
-
import { CompositeResolver, RecordResolver, WeslParseError, filterMap, findUnboundIdents, link, normalizeModuleName, npmNameVariations, parseSrcModule } from "wesl";
|
|
5
|
+
import { CompositeResolver, RecordResolver, WeslParseError, filterMap, findUnboundIdents, link, moduleToRelativePath, normalizeDebugRoot, normalizeModuleName, npmNameVariations, parseSrcModule } from "wesl";
|
|
6
6
|
import * as fs$3 from "node:fs";
|
|
7
7
|
import fs, { realpathSync, statSync } from "node:fs";
|
|
8
8
|
import * as fs$2 from "node:fs/promises";
|
|
@@ -27,16 +27,18 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
27
27
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
28
28
|
var __getProtoOf = Object.getPrototypeOf;
|
|
29
29
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
30
|
-
var
|
|
31
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
32
|
-
};
|
|
30
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
31
|
var __copyProps = (to, from, except, desc) => {
|
|
34
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
33
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
34
|
+
key = keys[i];
|
|
35
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
36
|
+
__defProp(to, key, {
|
|
37
|
+
get: ((k) => from[k]).bind(null, key),
|
|
38
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
return to;
|
|
42
44
|
};
|
|
@@ -125,23 +127,16 @@ var FileModuleResolver = class {
|
|
|
125
127
|
}
|
|
126
128
|
/** Convert module path (package::foo::bar) to filesystem path (baseDir/foo/bar) */
|
|
127
129
|
moduleToFilePath(modulePath) {
|
|
128
|
-
const
|
|
129
|
-
if (!
|
|
130
|
-
const relativePath = parts.slice(1).join("/");
|
|
130
|
+
const relativePath = moduleToRelativePath(modulePath, this.packageName);
|
|
131
|
+
if (!relativePath) return void 0;
|
|
131
132
|
return `${this.baseDir}/${relativePath}`;
|
|
132
133
|
}
|
|
133
134
|
/** Convert module path to debug path for error messages */
|
|
134
135
|
modulePathToDebugPath(modulePath) {
|
|
135
|
-
const
|
|
136
|
-
return normalizeDebugRoot(this.debugWeslRoot) +
|
|
136
|
+
const relative = moduleToRelativePath(modulePath, this.packageName) ?? "";
|
|
137
|
+
return normalizeDebugRoot(this.debugWeslRoot) + relative + ".wesl";
|
|
137
138
|
}
|
|
138
139
|
};
|
|
139
|
-
/** Normalize debugWeslRoot to ensure it ends with / or is empty */
|
|
140
|
-
function normalizeDebugRoot(debugWeslRoot) {
|
|
141
|
-
if (debugWeslRoot === void 0) return "./";
|
|
142
|
-
if (debugWeslRoot === "") return "";
|
|
143
|
-
return debugWeslRoot.endsWith("/") ? debugWeslRoot : debugWeslRoot + "/";
|
|
144
|
-
}
|
|
145
140
|
|
|
146
141
|
//#endregion
|
|
147
142
|
//#region ../../node_modules/.pnpm/@isaacs+balanced-match@4.0.1/node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
@@ -333,7 +328,7 @@ function expand_(str, isTop) {
|
|
|
333
328
|
}
|
|
334
329
|
|
|
335
330
|
//#endregion
|
|
336
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
331
|
+
//#region ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
337
332
|
const MAX_PATTERN_LENGTH = 1024 * 64;
|
|
338
333
|
const assertValidPattern = (pattern) => {
|
|
339
334
|
if (typeof pattern !== "string") throw new TypeError("invalid pattern");
|
|
@@ -341,7 +336,7 @@ const assertValidPattern = (pattern) => {
|
|
|
341
336
|
};
|
|
342
337
|
|
|
343
338
|
//#endregion
|
|
344
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
339
|
+
//#region ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/brace-expressions.js
|
|
345
340
|
const posixClasses = {
|
|
346
341
|
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
347
342
|
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
@@ -463,27 +458,33 @@ const parseClass = (glob$1, position) => {
|
|
|
463
458
|
};
|
|
464
459
|
|
|
465
460
|
//#endregion
|
|
466
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
461
|
+
//#region ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/unescape.js
|
|
467
462
|
/**
|
|
468
463
|
* Un-escape a string that has been escaped with {@link escape}.
|
|
469
464
|
*
|
|
470
|
-
* If the {@link windowsPathsNoEscape} option is used, then
|
|
471
|
-
* escapes are removed, but not backslash escapes.
|
|
472
|
-
*
|
|
473
|
-
*
|
|
465
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
|
|
466
|
+
* square-bracket escapes are removed, but not backslash escapes.
|
|
467
|
+
*
|
|
468
|
+
* For example, it will turn the string `'[*]'` into `*`, but it will not
|
|
469
|
+
* turn `'\\*'` into `'*'`, because `\` is a path separator in
|
|
470
|
+
* `windowsPathsNoEscape` mode.
|
|
474
471
|
*
|
|
475
|
-
* When `windowsPathsNoEscape` is not set, then both
|
|
472
|
+
* When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
|
|
476
473
|
* backslash escapes are removed.
|
|
477
474
|
*
|
|
478
475
|
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
|
479
476
|
* or unescaped.
|
|
477
|
+
*
|
|
478
|
+
* When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
|
|
479
|
+
* unescaped.
|
|
480
480
|
*/
|
|
481
|
-
const unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
482
|
-
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
481
|
+
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
482
|
+
if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
483
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
483
484
|
};
|
|
484
485
|
|
|
485
486
|
//#endregion
|
|
486
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
487
|
+
//#region ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/ast.js
|
|
487
488
|
const types = new Set([
|
|
488
489
|
"!",
|
|
489
490
|
"?",
|
|
@@ -728,7 +729,7 @@ var AST = class AST {
|
|
|
728
729
|
const dot = allowDot ?? !!this.#options.dot;
|
|
729
730
|
if (this.#root === this) this.#fillNegs();
|
|
730
731
|
if (!this.type) {
|
|
731
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
732
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
732
733
|
const src = this.#parts.map((p) => {
|
|
733
734
|
const [re, _, hasMagic$1, uflag] = typeof p === "string" ? AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
734
735
|
this.#hasMagic = this.#hasMagic || hasMagic$1;
|
|
@@ -823,8 +824,7 @@ var AST = class AST {
|
|
|
823
824
|
}
|
|
824
825
|
}
|
|
825
826
|
if (c === "*") {
|
|
826
|
-
|
|
827
|
-
else re += star$1;
|
|
827
|
+
re += noEmpty && glob$1 === "*" ? starNoEmpty : star$1;
|
|
828
828
|
hasMagic$1 = true;
|
|
829
829
|
continue;
|
|
830
830
|
}
|
|
@@ -845,22 +845,26 @@ var AST = class AST {
|
|
|
845
845
|
};
|
|
846
846
|
|
|
847
847
|
//#endregion
|
|
848
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
848
|
+
//#region ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/escape.js
|
|
849
849
|
/**
|
|
850
850
|
* Escape all magic characters in a glob pattern.
|
|
851
851
|
*
|
|
852
|
-
* If the {@link
|
|
852
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape}
|
|
853
853
|
* option is used, then characters are escaped by wrapping in `[]`, because
|
|
854
854
|
* a magic character wrapped in a character class can only be satisfied by
|
|
855
855
|
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
|
856
856
|
* not interpreted as a magic character, but instead as a path separator.
|
|
857
|
+
*
|
|
858
|
+
* If the {@link MinimatchOptions.magicalBraces} option is used,
|
|
859
|
+
* then braces (`{` and `}`) will be escaped.
|
|
857
860
|
*/
|
|
858
|
-
const escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
861
|
+
const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
862
|
+
if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
859
863
|
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
860
864
|
};
|
|
861
865
|
|
|
862
866
|
//#endregion
|
|
863
|
-
//#region ../../node_modules/.pnpm/minimatch@10.
|
|
867
|
+
//#region ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/index.js
|
|
864
868
|
const minimatch = (p, pattern, options = {}) => {
|
|
865
869
|
assertValidPattern(pattern);
|
|
866
870
|
if (!options.nocomment && pattern.charAt(0) === "#") return false;
|
|
@@ -1367,16 +1371,23 @@ var Minimatch = class {
|
|
|
1367
1371
|
if (p !== GLOBSTAR || prev === GLOBSTAR) return;
|
|
1368
1372
|
if (prev === void 0) if (next !== void 0 && next !== GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
1369
1373
|
else pp[i] = twoStar;
|
|
1370
|
-
else if (next === void 0) pp[i - 1] = prev + "(
|
|
1374
|
+
else if (next === void 0) pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
1371
1375
|
else if (next !== GLOBSTAR) {
|
|
1372
1376
|
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
1373
1377
|
pp[i + 1] = GLOBSTAR;
|
|
1374
1378
|
}
|
|
1375
1379
|
});
|
|
1376
|
-
|
|
1380
|
+
const filtered = pp.filter((p) => p !== GLOBSTAR);
|
|
1381
|
+
if (this.partial && filtered.length >= 1) {
|
|
1382
|
+
const prefixes = [];
|
|
1383
|
+
for (let i = 1; i <= filtered.length; i++) prefixes.push(filtered.slice(0, i).join("/"));
|
|
1384
|
+
return "(?:" + prefixes.join("|") + ")";
|
|
1385
|
+
}
|
|
1386
|
+
return filtered.join("/");
|
|
1377
1387
|
}).join("|");
|
|
1378
1388
|
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1379
1389
|
re = "^" + open + re + close + "$";
|
|
1390
|
+
if (this.partial) re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
|
|
1380
1391
|
if (this.negate) re = "^(?!" + re + ").+$";
|
|
1381
1392
|
try {
|
|
1382
1393
|
this.regexp = new RegExp(re, [...flags].join(""));
|
|
@@ -1427,7 +1438,7 @@ minimatch.escape = escape;
|
|
|
1427
1438
|
minimatch.unescape = unescape;
|
|
1428
1439
|
|
|
1429
1440
|
//#endregion
|
|
1430
|
-
//#region ../../node_modules/.pnpm/lru-cache@11.2.
|
|
1441
|
+
//#region ../../node_modules/.pnpm/lru-cache@11.2.4/node_modules/lru-cache/dist/esm/index.js
|
|
1431
1442
|
/**
|
|
1432
1443
|
* @module LRUCache
|
|
1433
1444
|
*/
|
|
@@ -1614,6 +1625,7 @@ var LRUCache = class LRUCache {
|
|
|
1614
1625
|
#sizes;
|
|
1615
1626
|
#starts;
|
|
1616
1627
|
#ttls;
|
|
1628
|
+
#autopurgeTimers;
|
|
1617
1629
|
#hasDispose;
|
|
1618
1630
|
#hasFetchMethod;
|
|
1619
1631
|
#hasDisposeAfter;
|
|
@@ -1631,6 +1643,7 @@ var LRUCache = class LRUCache {
|
|
|
1631
1643
|
return {
|
|
1632
1644
|
starts: c.#starts,
|
|
1633
1645
|
ttls: c.#ttls,
|
|
1646
|
+
autopurgeTimers: c.#autopurgeTimers,
|
|
1634
1647
|
sizes: c.#sizes,
|
|
1635
1648
|
keyMap: c.#keyMap,
|
|
1636
1649
|
keyList: c.#keyList,
|
|
@@ -1792,15 +1805,23 @@ var LRUCache = class LRUCache {
|
|
|
1792
1805
|
const starts = new ZeroArray(this.#max);
|
|
1793
1806
|
this.#ttls = ttls;
|
|
1794
1807
|
this.#starts = starts;
|
|
1808
|
+
const purgeTimers = this.ttlAutopurge ? new Array(this.#max) : void 0;
|
|
1809
|
+
this.#autopurgeTimers = purgeTimers;
|
|
1795
1810
|
this.#setItemTTL = (index, ttl, start = this.#perf.now()) => {
|
|
1796
1811
|
starts[index] = ttl !== 0 ? start : 0;
|
|
1797
1812
|
ttls[index] = ttl;
|
|
1798
|
-
if (
|
|
1813
|
+
if (purgeTimers?.[index]) {
|
|
1814
|
+
clearTimeout(purgeTimers[index]);
|
|
1815
|
+
purgeTimers[index] = void 0;
|
|
1816
|
+
}
|
|
1817
|
+
if (ttl !== 0 && purgeTimers) {
|
|
1799
1818
|
const t = setTimeout(() => {
|
|
1800
1819
|
if (this.#isStale(index)) this.#delete(this.#keyList[index], "expire");
|
|
1801
1820
|
}, ttl + 1);
|
|
1802
1821
|
/* c8 ignore start */
|
|
1803
1822
|
if (t.unref) t.unref();
|
|
1823
|
+
/* c8 ignore stop */
|
|
1824
|
+
purgeTimers[index] = t;
|
|
1804
1825
|
}
|
|
1805
1826
|
};
|
|
1806
1827
|
this.#updateItemAge = (index) => {
|
|
@@ -2249,6 +2270,10 @@ var LRUCache = class LRUCache {
|
|
|
2249
2270
|
]);
|
|
2250
2271
|
}
|
|
2251
2272
|
this.#removeItemSize(head);
|
|
2273
|
+
if (this.#autopurgeTimers?.[head]) {
|
|
2274
|
+
clearTimeout(this.#autopurgeTimers[head]);
|
|
2275
|
+
this.#autopurgeTimers[head] = void 0;
|
|
2276
|
+
}
|
|
2252
2277
|
if (free) {
|
|
2253
2278
|
this.#keyList[head] = void 0;
|
|
2254
2279
|
this.#valList[head] = void 0;
|
|
@@ -2462,7 +2487,7 @@ var LRUCache = class LRUCache {
|
|
|
2462
2487
|
memo(k, memoOptions = {}) {
|
|
2463
2488
|
const memoMethod = this.#memoMethod;
|
|
2464
2489
|
if (!memoMethod) throw new Error("no memoMethod provided to constructor");
|
|
2465
|
-
const { context, forceRefresh
|
|
2490
|
+
const { context, forceRefresh, ...options } = memoOptions;
|
|
2466
2491
|
const v = this.get(k, options);
|
|
2467
2492
|
if (!forceRefresh && v !== void 0) return v;
|
|
2468
2493
|
const vv = memoMethod(k, v, {
|
|
@@ -2529,6 +2554,10 @@ var LRUCache = class LRUCache {
|
|
|
2529
2554
|
if (this.#size !== 0) {
|
|
2530
2555
|
const index = this.#keyMap.get(k);
|
|
2531
2556
|
if (index !== void 0) {
|
|
2557
|
+
if (this.#autopurgeTimers?.[index]) {
|
|
2558
|
+
clearTimeout(this.#autopurgeTimers?.[index]);
|
|
2559
|
+
this.#autopurgeTimers[index] = void 0;
|
|
2560
|
+
}
|
|
2532
2561
|
deleted = true;
|
|
2533
2562
|
if (this.#size === 1) this.#clear(reason);
|
|
2534
2563
|
else {
|
|
@@ -2592,6 +2621,8 @@ var LRUCache = class LRUCache {
|
|
|
2592
2621
|
if (this.#ttls && this.#starts) {
|
|
2593
2622
|
this.#ttls.fill(0);
|
|
2594
2623
|
this.#starts.fill(0);
|
|
2624
|
+
for (const t of this.#autopurgeTimers ?? []) if (t !== void 0) clearTimeout(t);
|
|
2625
|
+
this.#autopurgeTimers?.fill(void 0);
|
|
2595
2626
|
}
|
|
2596
2627
|
if (this.#sizes) this.#sizes.fill(0);
|
|
2597
2628
|
this.#head = 0;
|
|
@@ -3426,7 +3457,7 @@ while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
|
|
|
3426
3457
|
};
|
|
3427
3458
|
|
|
3428
3459
|
//#endregion
|
|
3429
|
-
//#region ../../node_modules/.pnpm/path-scurry@2.0.
|
|
3460
|
+
//#region ../../node_modules/.pnpm/path-scurry@2.0.1/node_modules/path-scurry/dist/esm/index.js
|
|
3430
3461
|
const realpathSync$2 = realpathSync$1.native;
|
|
3431
3462
|
const defaultFS = {
|
|
3432
3463
|
lstatSync,
|
|
@@ -3471,7 +3502,7 @@ const ENOREALPATH = 512;
|
|
|
3471
3502
|
const ENOCHILD = ENOENT | 576;
|
|
3472
3503
|
const TYPEMASK = 1023;
|
|
3473
3504
|
const entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN;
|
|
3474
|
-
const normalizeCache =
|
|
3505
|
+
const normalizeCache = new LRUCache({ max: 2 ** 12 });
|
|
3475
3506
|
const normalize = (s) => {
|
|
3476
3507
|
const c = normalizeCache.get(s);
|
|
3477
3508
|
if (c) return c;
|
|
@@ -3479,7 +3510,7 @@ const normalize = (s) => {
|
|
|
3479
3510
|
normalizeCache.set(s, n);
|
|
3480
3511
|
return n;
|
|
3481
3512
|
};
|
|
3482
|
-
const normalizeNocaseCache =
|
|
3513
|
+
const normalizeNocaseCache = new LRUCache({ max: 2 ** 12 });
|
|
3483
3514
|
const normalizeNocase = (s) => {
|
|
3484
3515
|
const c = normalizeNocaseCache.get(s);
|
|
3485
3516
|
if (c) return c;
|
|
@@ -3653,6 +3684,7 @@ var PathBase = class {
|
|
|
3653
3684
|
get parentPath() {
|
|
3654
3685
|
return (this.parent || this).fullpath();
|
|
3655
3686
|
}
|
|
3687
|
+
/* c8 ignore start */
|
|
3656
3688
|
/**
|
|
3657
3689
|
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
|
3658
3690
|
* this property refers to the *parent* path, not the path object itself.
|
|
@@ -3662,6 +3694,7 @@ var PathBase = class {
|
|
|
3662
3694
|
get path() {
|
|
3663
3695
|
return this.parentPath;
|
|
3664
3696
|
}
|
|
3697
|
+
/* c8 ignore stop */
|
|
3665
3698
|
/**
|
|
3666
3699
|
* Do not create new Path objects directly. They should always be accessed
|
|
3667
3700
|
* via the PathScurry class or other methods on the Path class.
|
|
@@ -4990,7 +5023,7 @@ const Path = process.platform === "win32" ? PathWin32 : PathPosix;
|
|
|
4990
5023
|
const PathScurry = process.platform === "win32" ? PathScurryWin32 : process.platform === "darwin" ? PathScurryDarwin : PathScurryPosix;
|
|
4991
5024
|
|
|
4992
5025
|
//#endregion
|
|
4993
|
-
//#region ../../node_modules/.pnpm/glob@
|
|
5026
|
+
//#region ../../node_modules/.pnpm/glob@13.0.0/node_modules/glob/dist/esm/pattern.js
|
|
4994
5027
|
const isPatternList = (pl) => pl.length >= 1;
|
|
4995
5028
|
const isGlobList = (gl) => gl.length >= 1;
|
|
4996
5029
|
/**
|
|
@@ -5153,7 +5186,7 @@ var Pattern = class Pattern {
|
|
|
5153
5186
|
};
|
|
5154
5187
|
|
|
5155
5188
|
//#endregion
|
|
5156
|
-
//#region ../../node_modules/.pnpm/glob@
|
|
5189
|
+
//#region ../../node_modules/.pnpm/glob@13.0.0/node_modules/glob/dist/esm/ignore.js
|
|
5157
5190
|
const defaultPlatform$1 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
|
|
5158
5191
|
/**
|
|
5159
5192
|
* Class used to process ignored patterns
|
|
@@ -5225,7 +5258,7 @@ var Ignore = class {
|
|
|
5225
5258
|
};
|
|
5226
5259
|
|
|
5227
5260
|
//#endregion
|
|
5228
|
-
//#region ../../node_modules/.pnpm/glob@
|
|
5261
|
+
//#region ../../node_modules/.pnpm/glob@13.0.0/node_modules/glob/dist/esm/processor.js
|
|
5229
5262
|
/**
|
|
5230
5263
|
* A cache of which patterns have been processed for a given Path
|
|
5231
5264
|
*/
|
|
@@ -5418,7 +5451,13 @@ var Processor = class Processor {
|
|
|
5418
5451
|
};
|
|
5419
5452
|
|
|
5420
5453
|
//#endregion
|
|
5421
|
-
//#region ../../node_modules/.pnpm/glob@
|
|
5454
|
+
//#region ../../node_modules/.pnpm/glob@13.0.0/node_modules/glob/dist/esm/walker.js
|
|
5455
|
+
/**
|
|
5456
|
+
* Single-use utility classes to provide functionality to the {@link Glob}
|
|
5457
|
+
* methods.
|
|
5458
|
+
*
|
|
5459
|
+
* @module
|
|
5460
|
+
*/
|
|
5422
5461
|
const makeIgnore = (ignore, opts) => typeof ignore === "string" ? new Ignore([ignore], opts) : Array.isArray(ignore) ? new Ignore(ignore, opts) : ignore;
|
|
5423
5462
|
/**
|
|
5424
5463
|
* basic walking utilities that all the glob walker types use
|
|
@@ -5697,7 +5736,7 @@ var GlobStream = class extends GlobUtil {
|
|
|
5697
5736
|
};
|
|
5698
5737
|
|
|
5699
5738
|
//#endregion
|
|
5700
|
-
//#region ../../node_modules/.pnpm/glob@
|
|
5739
|
+
//#region ../../node_modules/.pnpm/glob@13.0.0/node_modules/glob/dist/esm/glob.js
|
|
5701
5740
|
const defaultPlatform = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
|
|
5702
5741
|
/**
|
|
5703
5742
|
* An object that can perform glob pattern traversals.
|
|
@@ -5884,7 +5923,7 @@ var Glob = class {
|
|
|
5884
5923
|
};
|
|
5885
5924
|
|
|
5886
5925
|
//#endregion
|
|
5887
|
-
//#region ../../node_modules/.pnpm/glob@
|
|
5926
|
+
//#region ../../node_modules/.pnpm/glob@13.0.0/node_modules/glob/dist/esm/has-magic.js
|
|
5888
5927
|
/**
|
|
5889
5928
|
* Return true if the patterns provided contain any magic glob characters,
|
|
5890
5929
|
* given the options provided.
|
|
@@ -5903,7 +5942,7 @@ const hasMagic = (pattern, options = {}) => {
|
|
|
5903
5942
|
};
|
|
5904
5943
|
|
|
5905
5944
|
//#endregion
|
|
5906
|
-
//#region ../../node_modules/.pnpm/glob@
|
|
5945
|
+
//#region ../../node_modules/.pnpm/glob@13.0.0/node_modules/glob/dist/esm/index.js
|
|
5907
5946
|
function globStreamSync(pattern, options = {}) {
|
|
5908
5947
|
return new Glob(pattern, options).streamSync();
|
|
5909
5948
|
}
|
|
@@ -5951,7 +5990,7 @@ glob.glob = glob;
|
|
|
5951
5990
|
|
|
5952
5991
|
//#endregion
|
|
5953
5992
|
//#region ../../node_modules/.pnpm/toml@3.0.0/node_modules/toml/lib/parser.js
|
|
5954
|
-
var require_parser = /* @__PURE__ */
|
|
5993
|
+
var require_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5955
5994
|
module.exports = (function() {
|
|
5956
5995
|
function peg$subclass(child, parent) {
|
|
5957
5996
|
function ctor() {
|
|
@@ -9586,11 +9625,11 @@ var require_parser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/toml
|
|
|
9586
9625
|
parse
|
|
9587
9626
|
};
|
|
9588
9627
|
})();
|
|
9589
|
-
})
|
|
9628
|
+
}));
|
|
9590
9629
|
|
|
9591
9630
|
//#endregion
|
|
9592
9631
|
//#region ../../node_modules/.pnpm/toml@3.0.0/node_modules/toml/lib/compiler.js
|
|
9593
|
-
var require_compiler = /* @__PURE__ */
|
|
9632
|
+
var require_compiler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9594
9633
|
function compile(nodes) {
|
|
9595
9634
|
var assignedPaths = [];
|
|
9596
9635
|
var valueAssignments = [];
|
|
@@ -9714,18 +9753,18 @@ var require_compiler = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/to
|
|
|
9714
9753
|
}
|
|
9715
9754
|
}
|
|
9716
9755
|
module.exports = { compile };
|
|
9717
|
-
})
|
|
9756
|
+
}));
|
|
9718
9757
|
|
|
9719
9758
|
//#endregion
|
|
9720
9759
|
//#region ../../node_modules/.pnpm/toml@3.0.0/node_modules/toml/index.js
|
|
9721
|
-
var require_toml = /* @__PURE__ */
|
|
9760
|
+
var require_toml = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9722
9761
|
var parser = require_parser();
|
|
9723
9762
|
var compiler = require_compiler();
|
|
9724
9763
|
module.exports = { parse: function(input) {
|
|
9725
9764
|
var nodes = parser.parse(input.toString());
|
|
9726
9765
|
return compiler.compile(nodes);
|
|
9727
9766
|
} };
|
|
9728
|
-
})
|
|
9767
|
+
}));
|
|
9729
9768
|
|
|
9730
9769
|
//#endregion
|
|
9731
9770
|
//#region ../wesl-tooling/src/LoadWeslToml.ts
|
|
@@ -9787,6 +9826,19 @@ async function findWeslToml(projectDir, specifiedToml) {
|
|
|
9787
9826
|
|
|
9788
9827
|
//#endregion
|
|
9789
9828
|
//#region ../../node_modules/.pnpm/import-meta-resolve@4.1.0/node_modules/import-meta-resolve/lib/errors.js
|
|
9829
|
+
/**
|
|
9830
|
+
* @typedef ErrnoExceptionFields
|
|
9831
|
+
* @property {number | undefined} [errnode]
|
|
9832
|
+
* @property {string | undefined} [code]
|
|
9833
|
+
* @property {string | undefined} [path]
|
|
9834
|
+
* @property {string | undefined} [syscall]
|
|
9835
|
+
* @property {string | undefined} [url]
|
|
9836
|
+
*
|
|
9837
|
+
* @typedef {Error & ErrnoExceptionFields} ErrnoException
|
|
9838
|
+
*/
|
|
9839
|
+
/**
|
|
9840
|
+
* @typedef {(...parameters: Array<any>) => string} MessageFunction
|
|
9841
|
+
*/
|
|
9790
9842
|
const own$1 = {}.hasOwnProperty;
|
|
9791
9843
|
const classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
9792
9844
|
const kTypes = new Set([
|
|
@@ -10111,6 +10163,20 @@ function determineSpecificType(value) {
|
|
|
10111
10163
|
|
|
10112
10164
|
//#endregion
|
|
10113
10165
|
//#region ../../node_modules/.pnpm/import-meta-resolve@4.1.0/node_modules/import-meta-resolve/lib/package-json-reader.js
|
|
10166
|
+
/**
|
|
10167
|
+
* @typedef {import('./errors.js').ErrnoException} ErrnoException
|
|
10168
|
+
*
|
|
10169
|
+
* @typedef {'commonjs' | 'module' | 'none'} PackageType
|
|
10170
|
+
*
|
|
10171
|
+
* @typedef PackageConfig
|
|
10172
|
+
* @property {string} pjsonPath
|
|
10173
|
+
* @property {boolean} exists
|
|
10174
|
+
* @property {string | undefined} [main]
|
|
10175
|
+
* @property {string | undefined} [name]
|
|
10176
|
+
* @property {PackageType} type
|
|
10177
|
+
* @property {Record<string, unknown> | undefined} [exports]
|
|
10178
|
+
* @property {Record<string, unknown> | undefined} [imports]
|
|
10179
|
+
*/
|
|
10114
10180
|
const hasOwnProperty$1 = {}.hasOwnProperty;
|
|
10115
10181
|
const { ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG$1 } = codes;
|
|
10116
10182
|
/** @type {Map<string, PackageConfig>} */
|
|
@@ -10326,6 +10392,11 @@ function getConditionsSet(conditions) {
|
|
|
10326
10392
|
|
|
10327
10393
|
//#endregion
|
|
10328
10394
|
//#region ../../node_modules/.pnpm/import-meta-resolve@4.1.0/node_modules/import-meta-resolve/lib/resolve.js
|
|
10395
|
+
/**
|
|
10396
|
+
* @typedef {import('node:fs').Stats} Stats
|
|
10397
|
+
* @typedef {import('./errors.js').ErrnoException} ErrnoException
|
|
10398
|
+
* @typedef {import('./package-json-reader.js').PackageConfig} PackageConfig
|
|
10399
|
+
*/
|
|
10329
10400
|
const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
|
|
10330
10401
|
const { ERR_NETWORK_IMPORT_DISALLOWED, ERR_INVALID_MODULE_SPECIFIER, ERR_INVALID_PACKAGE_CONFIG, ERR_INVALID_PACKAGE_TARGET, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_IMPORT_NOT_DEFINED, ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_UNSUPPORTED_DIR_IMPORT, ERR_UNSUPPORTED_RESOLVE_REQUEST } = codes;
|
|
10331
10402
|
const own = {}.hasOwnProperty;
|
|
@@ -10982,6 +11053,9 @@ function defaultResolve(specifier, context = {}) {
|
|
|
10982
11053
|
//#endregion
|
|
10983
11054
|
//#region ../../node_modules/.pnpm/import-meta-resolve@4.1.0/node_modules/import-meta-resolve/index.js
|
|
10984
11055
|
/**
|
|
11056
|
+
* @typedef {import('./lib/errors.js').ErrnoException} ErrnoException
|
|
11057
|
+
*/
|
|
11058
|
+
/**
|
|
10985
11059
|
* Match `import.meta.resolve` except that `parent` is required (you can pass
|
|
10986
11060
|
* `import.meta.url`).
|
|
10987
11061
|
*
|
|
@@ -11454,7 +11528,7 @@ async function expectFragmentImage(device, moduleName, opts = {}) {
|
|
|
11454
11528
|
*/
|
|
11455
11529
|
async function testFragment(params) {
|
|
11456
11530
|
const { textureFormat = "rgba32float" } = params;
|
|
11457
|
-
const data = await runFragment(params);
|
|
11531
|
+
const data = await runFragment$1(params);
|
|
11458
11532
|
const count = numComponents(textureFormat);
|
|
11459
11533
|
return data.slice(0, count);
|
|
11460
11534
|
}
|
|
@@ -11468,7 +11542,7 @@ async function testFragment(params) {
|
|
|
11468
11542
|
*/
|
|
11469
11543
|
async function testFragmentImage(params) {
|
|
11470
11544
|
const { textureFormat = "rgba32float", size = [1, 1] } = params;
|
|
11471
|
-
const data = imageToUint8(await runFragment(params), textureFormat, size[0], size[1]);
|
|
11545
|
+
const data = imageToUint8(await runFragment$1(params), textureFormat, size[0], size[1]);
|
|
11472
11546
|
return {
|
|
11473
11547
|
data: new Uint8ClampedArray(data),
|
|
11474
11548
|
width: size[0],
|
|
@@ -11476,33 +11550,20 @@ async function testFragmentImage(params) {
|
|
|
11476
11550
|
colorSpace: "srgb"
|
|
11477
11551
|
};
|
|
11478
11552
|
}
|
|
11479
|
-
async function runFragment(params) {
|
|
11480
|
-
const { projectDir,
|
|
11481
|
-
const { conditions = {}, constants } = params;
|
|
11482
|
-
const { textureFormat = "rgba32float", size = [1, 1] } = params;
|
|
11483
|
-
const { textures, samplers, uniforms = {} } = params;
|
|
11553
|
+
async function runFragment$1(params) {
|
|
11554
|
+
const { projectDir, src, moduleName, useSourceShaders } = params;
|
|
11484
11555
|
const fragmentSrc = await resolveShaderSource(src, moduleName, projectDir);
|
|
11485
11556
|
const ctx = await resolveShaderContext({
|
|
11486
11557
|
src: fragmentSrc,
|
|
11487
11558
|
projectDir,
|
|
11488
11559
|
useSourceShaders
|
|
11489
11560
|
});
|
|
11490
|
-
return
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
resolver: ctx.resolver,
|
|
11497
|
-
packageName: ctx.packageName,
|
|
11498
|
-
conditions,
|
|
11499
|
-
constants
|
|
11500
|
-
}),
|
|
11501
|
-
outputFormat: textureFormat,
|
|
11502
|
-
size,
|
|
11503
|
-
textures,
|
|
11504
|
-
samplers,
|
|
11505
|
-
uniformBuffer: renderUniformBuffer$1(device, size, uniforms)
|
|
11561
|
+
return runFragment({
|
|
11562
|
+
...params,
|
|
11563
|
+
src: fragmentSrc,
|
|
11564
|
+
libs: params.libs ?? ctx.libs,
|
|
11565
|
+
resolver: params.resolver ?? ctx.resolver,
|
|
11566
|
+
packageName: params.packageName ?? ctx.packageName
|
|
11506
11567
|
});
|
|
11507
11568
|
}
|
|
11508
11569
|
/** Convert texture data to RGBA Uint8ClampedArray for image comparison. */
|