wesl 0.6.48 → 0.7.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 (95) hide show
  1. package/dist/index.d.ts +295 -214
  2. package/dist/index.js +2947 -1550
  3. package/package.json +6 -8
  4. package/src/AbstractElems.ts +81 -81
  5. package/src/Assertions.ts +5 -5
  6. package/src/BindIdents.ts +193 -319
  7. package/src/ClickableError.ts +3 -2
  8. package/src/Conditions.ts +2 -2
  9. package/src/LinkedWesl.ts +1 -1
  10. package/src/Linker.ts +4 -3
  11. package/src/LinkerUtil.ts +1 -1
  12. package/src/Logging.ts +165 -0
  13. package/src/LowerAndEmit.ts +278 -110
  14. package/src/ModulePathUtil.ts +59 -0
  15. package/src/ModuleResolver.ts +26 -62
  16. package/src/ParseError.ts +9 -0
  17. package/src/ParseWESL.ts +30 -94
  18. package/src/RawEmit.ts +1 -4
  19. package/src/Reflection.ts +1 -1
  20. package/src/Scope.ts +3 -0
  21. package/src/Span.ts +2 -0
  22. package/src/SrcMap.ts +208 -0
  23. package/src/Stream.ts +30 -0
  24. package/src/TransformBindingStructs.ts +2 -2
  25. package/src/Util.ts +1 -1
  26. package/src/debug/ASTtoString.ts +84 -135
  27. package/src/discovery/FindUnboundIdents.ts +14 -5
  28. package/src/index.ts +5 -0
  29. package/src/parse/ContentsHelpers.ts +70 -0
  30. package/src/parse/ExpressionUtil.ts +121 -0
  31. package/src/parse/Keywords.ts +12 -12
  32. package/src/parse/OperatorBinding.ts +146 -0
  33. package/src/parse/ParseAttribute.ts +272 -0
  34. package/src/parse/ParseCall.ts +77 -0
  35. package/src/parse/ParseControlFlow.ts +129 -0
  36. package/src/parse/ParseDirective.ts +105 -0
  37. package/src/parse/ParseExpression.ts +288 -0
  38. package/src/parse/ParseFn.ts +151 -0
  39. package/src/parse/ParseGlobalVar.ts +131 -0
  40. package/src/parse/ParseIdent.ts +77 -0
  41. package/src/parse/ParseImport.ts +160 -0
  42. package/src/parse/ParseLocalVar.ts +69 -0
  43. package/src/parse/ParseLoop.ts +112 -0
  44. package/src/parse/ParseModule.ts +116 -0
  45. package/src/parse/ParseSimpleStatement.ts +162 -0
  46. package/src/parse/ParseStatement.ts +215 -0
  47. package/src/parse/ParseStruct.ts +89 -0
  48. package/src/parse/ParseType.ts +71 -0
  49. package/src/parse/ParseUtil.ts +174 -0
  50. package/src/parse/ParseValueDeclaration.ts +130 -0
  51. package/src/parse/ParseWesl.ts +51 -0
  52. package/src/parse/ParsingContext.ts +93 -0
  53. package/src/parse/WeslStream.ts +63 -20
  54. package/src/parse/stream/CachingStream.ts +48 -0
  55. package/src/parse/stream/MatchersStream.ts +85 -0
  56. package/src/parse/stream/RegexHelpers.ts +38 -0
  57. package/src/test/BevyLink.test.ts +100 -0
  58. package/src/test/BindStdTypes.test.ts +110 -0
  59. package/src/test/{BindWESL.test.ts → BindWESLV2.test.ts} +21 -22
  60. package/src/test/BulkTests.test.ts +11 -12
  61. package/src/test/ConditionLinking.test.ts +107 -0
  62. package/src/test/ConditionalElif.test.ts +1 -13
  63. package/src/test/ConditionalTranslationCases.test.ts +5 -0
  64. package/src/test/ErrorLogging.test.ts +2 -2
  65. package/src/test/ImportCasesV2.test.ts +63 -0
  66. package/src/test/LinkFails.test.ts +69 -0
  67. package/src/test/LinkPackage.test.ts +1 -1
  68. package/src/test/Linker.test.ts +75 -2
  69. package/src/test/LogCatcher.ts +53 -0
  70. package/src/test/Mangling.test.ts +1 -1
  71. package/src/test/ParseComments.test.ts +1 -2
  72. package/src/test/{ParseConditions.test.ts → ParseConditionsV2.test.ts} +57 -49
  73. package/src/test/ParseErrorV2.test.ts +73 -0
  74. package/src/test/{ParseWESL.test.ts → ParseWeslV2.test.ts} +288 -370
  75. package/src/test/{ScopeWESL.test.ts → ScopeWESLV2.test.ts} +205 -176
  76. package/src/test/TestLink.ts +51 -51
  77. package/src/test/TestSetup.ts +9 -3
  78. package/src/test/TestUtil.ts +47 -77
  79. package/src/test/TrimmedMatch.ts +40 -0
  80. package/src/test/VirtualModules.test.ts +33 -2
  81. package/src/test/WeslDevice.test.ts +9 -2
  82. package/src/test/__snapshots__/ParseWeslV2.test.ts.snap +67 -0
  83. package/src/test-util.ts +7 -0
  84. package/src/WESLCollect.ts +0 -656
  85. package/src/parse/AttributeGrammar.ts +0 -232
  86. package/src/parse/ImportGrammar.ts +0 -195
  87. package/src/parse/WeslBaseGrammar.ts +0 -11
  88. package/src/parse/WeslExpression.ts +0 -231
  89. package/src/parse/WeslGrammar.ts +0 -739
  90. package/src/test/Expression.test.ts +0 -22
  91. package/src/test/ImportSyntaxCases.test.ts +0 -24
  92. package/src/test/ParseError.test.ts +0 -45
  93. package/src/test/Reflection.test.ts +0 -176
  94. package/src/test/TransformBindingStructs.test.ts +0 -238
  95. /package/src/test/{ParseElif.test.ts → ParseElifV2.test.ts} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { AppState, ParseError, Span, SrcMap, Stream, TypedToken } from "mini-parse";
2
-
3
1
  //#region src/LiveDeclarations.d.ts
4
2
  /** decls currently visible in this scope */
5
3
  interface LiveDecls {
@@ -19,50 +17,57 @@ interface FlatImport {
19
17
  modulePath: string[];
20
18
  }
21
19
  //#endregion
22
- //#region src/WESLCollect.d.ts
23
- type OpenElem<T extends ContainerElem = ContainerElem> = Pick<T, "kind" | "contents">;
20
+ //#region src/Span.d.ts
21
+ /** A range, from start (inclusive) to end (exclusive). */
22
+ type Span = readonly [number, number];
23
+ //#endregion
24
+ //#region src/ParseError.d.ts
25
+ declare class ParseError extends Error {
26
+ span: Span;
27
+ constructor(msg: string, span: Span);
28
+ }
24
29
  //#endregion
25
30
  //#region src/ParseWESL.d.ts
26
- /** result of a parse for one wesl module (e.g. one .wesl file)
31
+ /** Partial element being constructed during parsing. */
32
+ type OpenElem<T extends ContainerElem = ContainerElem> = Pick<T, "kind" | "contents">;
33
+ /**
34
+ * Result of parsing one WESL module (e.g., one .wesl file).
27
35
  *
28
- * The parser constructs the AST constructed into three sections
29
- * for convenient access by the binding stage.
36
+ * The AST is constructed into three sections for the binding stage:
30
37
  * - import statements
31
38
  * - language elements (fn, struct, etc)
32
39
  * - scopes
33
- *
34
40
  */
35
41
  interface WeslAST {
36
- /** source text for this module */
42
+ /** Source text for this module. */
37
43
  srcModule: SrcModule;
38
- /** root module element */
44
+ /** Root module element. */
39
45
  moduleElem: ModuleElem;
40
- /** root scope for this module */
46
+ /** Root scope for this module. */
41
47
  rootScope: Scope;
42
- /** imports found in this module */
48
+ /** Imports found in this module. */
43
49
  imports: ImportStatement[];
44
- /** module level const_assert statements */
50
+ /** Module level const_assert statements. */
45
51
  moduleAsserts?: ConstAssertElem[];
46
52
  }
47
- /** an extended version of the AST */
53
+ /** Extended AST with cached flattened imports. */
48
54
  interface BindingAST extends WeslAST {
55
+ /** Flattened import statements (cached on demand). */
49
56
  _flatImports?: FlatImport[];
50
57
  }
51
- /** stable and unstable state used during parsing */
52
- interface WeslParseState extends AppState<WeslParseContext, StableState> {
58
+ /** Stable and unstable state used during parsing. */
59
+ interface WeslParseState {
53
60
  context: WeslParseContext;
54
61
  stable: StableState;
55
62
  }
56
- /** stable values used or accumulated during parsing */
63
+ /** Stable values used or accumulated during parsing. */
57
64
  type StableState = WeslAST;
58
- /** unstable values used during parse collection */
65
+ /** Unstable values used during parse collection. */
59
66
  interface WeslParseContext {
60
67
  scope: Scope;
61
68
  openElems: OpenElem[];
62
69
  }
63
- /**
64
- * An error when parsing WESL fails. Designed to be human-readable.
65
- */
70
+ /** Human-readable error when parsing WESL fails. */
66
71
  declare class WeslParseError extends Error {
67
72
  span: Span;
68
73
  src: SrcModule;
@@ -71,11 +76,9 @@ declare class WeslParseError extends Error {
71
76
  src: SrcModule;
72
77
  });
73
78
  }
74
- /** Parse a WESL file. Throws on error. */
79
+ /** Parse a WESL file. */
75
80
  declare function parseSrcModule(srcModule: SrcModule): WeslAST;
76
- declare function blankWeslParseState(srcModule: SrcModule): WeslParseState;
77
- declare function syntheticWeslParseState(): WeslParseState;
78
- /** @return a flattened form of the import tree for convenience in binding idents. */
81
+ /** @return flattened form of import tree for binding idents. */
79
82
  declare function flatImports(ast: BindingAST, conditions?: Conditions): FlatImport[];
80
83
  //#endregion
81
84
  //#region src/Scope.d.ts
@@ -99,6 +102,8 @@ interface RefIdent extends IdentBase {
99
102
  kind: "ref";
100
103
  refersTo?: Ident;
101
104
  std?: true;
105
+ /** True for identifiers in @if/@elif conditions. Binding skips these (for now). */
106
+ conditionRef?: true;
102
107
  ast: WeslAST;
103
108
  refIdentElem: RefIdentElem;
104
109
  }
@@ -167,23 +172,36 @@ declare function childIdent(child: Scope | Ident): child is Ident;
167
172
  //#endregion
168
173
  //#region src/AbstractElems.d.ts
169
174
  /**
170
- * Structures to describe the 'interesting' parts of a WESL source file.
175
+ * AST structures describing 'interesting' parts of WESL source.
171
176
  *
172
- * The parts of the source that need to analyze further in the linker
173
- * are pulled out into these structures.
174
- *
175
- * The parts that are uninteresting the the linker are recorded
176
- * as 'TextElem' nodes, which are generally just copied to the output WGSL
177
- * along with their containing element.
177
+ * Parts needing further analysis are pulled into these structures.
178
+ * Uninteresting parts are 'TextElem' nodes, copied to output WGSL.
178
179
  */
179
- type AbstractElem = GrammarElem | SyntheticElem;
180
+ type AbstractElem = GrammarElem | SyntheticElem | ExpressionElem;
180
181
  type GrammarElem = ContainerElem | TerminalElem;
181
- type ContainerElem = AttributeElem | AliasElem | ConstAssertElem | ConstElem | UnknownExpressionElem | SimpleMemberRef | FnElem | TypedDeclElem | GlobalVarElem | LetElem | ModuleElem | OverrideElem | FnParamElem | StructElem | StructMemberElem | StuffElem | TypeRefElem | VarElem | StatementElem | SwitchClauseElem;
182
+ type ContainerElem = AttributeElem | AliasElem | ConstAssertElem | ConstElem | ContinuingElem | UnknownExpressionElem | SimpleMemberRef | FnElem | TypedDeclElem | GlobalVarElem | LetElem | ModuleElem | OverrideElem | FnParamElem | StructElem | StructMemberElem | StuffElem | TypeRefElem | VarElem | StatementElem | SwitchClauseElem;
183
+ /** Map from element kind string to element type, for type-safe element construction. */
184
+ type ElemKindMap = {
185
+ alias: AliasElem;
186
+ assert: ConstAssertElem;
187
+ const: ConstElem;
188
+ continuing: ContinuingElem;
189
+ gvar: GlobalVarElem;
190
+ let: LetElem;
191
+ member: StructMemberElem;
192
+ override: OverrideElem;
193
+ param: FnParamElem;
194
+ statement: StatementElem;
195
+ struct: StructElem;
196
+ "switch-clause": SwitchClauseElem;
197
+ type: TypeRefElem;
198
+ var: VarElem;
199
+ };
182
200
  /** Inspired by https://github.com/wgsl-tooling-wg/wesl-rs/blob/3b2434eac1b2ebda9eb8bfb25f43d8600d819872/crates/wgsl-parse/src/syntax.rs#L364 */
183
- type ExpressionElem = Literal | TranslateTimeFeature | RefIdentElem | ParenthesizedExpression | ComponentExpression | ComponentMemberExpression | UnaryExpression | BinaryExpression | FunctionCallExpression;
201
+ type ExpressionElem = Literal | RefIdentElem | TypeRefElem | ParenthesizedExpression | ComponentExpression | ComponentMemberExpression | UnaryExpression | BinaryExpression | FunctionCallExpression;
184
202
  type TerminalElem = DirectiveElem | DeclIdentElem | NameElem | RefIdentElem | TextElem | ImportElem;
185
203
  type GlobalDeclarationElem = AliasElem | ConstElem | FnElem | GlobalVarElem | OverrideElem | StructElem;
186
- type DeclarationElem = GlobalDeclarationElem | FnParamElem | VarElem;
204
+ type DeclarationElem = GlobalDeclarationElem | FnParamElem | VarElem | LetElem;
187
205
  type ElemWithAttributes = Extract<AbstractElem, HasAttributes>;
188
206
  interface AbstractElemBase {
189
207
  kind: AbstractElem["kind"];
@@ -196,22 +214,12 @@ interface ElemWithContentsBase extends AbstractElemBase {
196
214
  interface HasAttributes {
197
215
  attributes?: AttributeElem[];
198
216
  }
199
- /**
200
- * a raw bit of text in WESL source that's typically copied to the linked WGSL.
201
- * e.g. a keyword like 'var'
202
- * or a phrase we needn't analyze further like '@diagnostic(off,derivative_uniformity)'
203
- */
217
+ /** Raw text copied to linked WGSL (e.g., 'var' or '@diagnostic(off,derivative_uniformity)'). */
204
218
  interface TextElem extends AbstractElemBase {
205
219
  kind: "text";
206
220
  srcModule: SrcModule;
207
221
  }
208
- /** a name that doesn't need to be an Ident
209
- * e.g.
210
- * - a struct member name
211
- * - a diagnostic rule name
212
- * - an enable-extension name
213
- * - an interpolation sampling name
214
- */
222
+ /** A name that doesn't need to be an Ident (e.g., struct member, diagnostic rule). */
215
223
  interface NameElem extends AbstractElemBase {
216
224
  kind: "name";
217
225
  name: string;
@@ -233,59 +241,47 @@ interface ImportElem extends AbstractElemBase, HasAttributes {
233
241
  kind: "import";
234
242
  imports: ImportStatement;
235
243
  }
236
- /**
237
- * An import statement, which is tree shaped.
238
- * `import foo::bar::{baz, cat as neko};
239
- */
244
+ /** Tree-shaped import statement: `import foo::bar::{baz, cat as neko};` */
240
245
  interface ImportStatement {
241
246
  kind: "import-statement";
242
247
  segments: ImportSegment[];
243
248
  finalSegment: ImportCollection | ImportItem;
244
249
  }
245
- /**
246
- * A collection of import trees.
247
- * `{baz, cat as neko}`
248
- */
250
+ /** A segment in an import path: `foo` in `foo::bar`. */
249
251
  interface ImportSegment {
250
252
  kind: "import-segment";
251
253
  name: string;
252
254
  }
253
- /**
254
- * A primitive segment in an import statement.
255
- * `foo`
256
- */
255
+ /** A collection of import trees: `{baz, cat as neko}`. */
257
256
  interface ImportCollection {
258
257
  kind: "import-collection";
259
258
  subtrees: ImportStatement[];
260
259
  }
261
- /**
262
- * A renamed item at the end of an import statement.
263
- * `cat as neko`
264
- */
260
+ /** A renamed item at the end of an import statement: `cat as neko`. */
265
261
  interface ImportItem {
266
262
  kind: "import-item";
267
263
  name: string;
268
264
  as?: string;
269
265
  }
270
- /** generated element, produced after parsing and binding */
266
+ /** Generated element produced after parsing and binding. */
271
267
  interface SyntheticElem {
272
268
  kind: "synthetic";
273
269
  text: string;
274
270
  }
275
- /** a declaration identifer with a possible type */
271
+ /** A declaration identifier with an optional type. */
276
272
  interface TypedDeclElem extends ElemWithContentsBase {
277
273
  kind: "typeDecl";
278
274
  decl: DeclIdentElem;
279
275
  typeRef?: TypeRefElem;
280
276
  typeScope?: Scope;
281
277
  }
282
- /** an alias statement */
278
+ /** An alias statement. */
283
279
  interface AliasElem extends ElemWithContentsBase, HasAttributes {
284
280
  kind: "alias";
285
281
  name: DeclIdentElem;
286
282
  typeRef: TypeRefElem;
287
283
  }
288
- /** an attribute like '@compute' or '@binding(0)' */
284
+ /** An attribute like '@compute' or '@binding(0)'. */
289
285
  interface AttributeElem extends ElemWithContentsBase {
290
286
  kind: "attribute";
291
287
  attribute: Attribute;
@@ -304,10 +300,11 @@ interface BuiltinAttribute {
304
300
  kind: "@builtin";
305
301
  param: NameElem;
306
302
  }
303
+ type DiagnosticRule = [NameElem, NameElem | null];
307
304
  interface DiagnosticAttribute {
308
305
  kind: "@diagnostic";
309
306
  severity: NameElem;
310
- rule: [NameElem, NameElem | null];
307
+ rule: DiagnosticRule;
311
308
  }
312
309
  interface IfAttribute {
313
310
  kind: "@if";
@@ -320,71 +317,66 @@ interface ElifAttribute {
320
317
  interface ElseAttribute {
321
318
  kind: "@else";
322
319
  }
323
- /** a const_assert statement */
320
+ type ConditionalAttribute = IfAttribute | ElifAttribute | ElseAttribute;
321
+ /** A const_assert statement. */
324
322
  interface ConstAssertElem extends ElemWithContentsBase, HasAttributes {
325
323
  kind: "assert";
326
324
  }
327
- /** a const declaration */
325
+ /** A const declaration. */
328
326
  interface ConstElem extends ElemWithContentsBase, HasAttributes {
329
327
  kind: "const";
330
328
  name: TypedDeclElem;
331
329
  }
332
- /** an expression w/o special handling, used inside attribute parameters */
330
+ /** An expression without special handling, used in attribute parameters. */
333
331
  interface UnknownExpressionElem extends ElemWithContentsBase {
334
332
  kind: "expression";
335
333
  }
336
- /** an expression that can be safely evaluated at compile time */
334
+ /** An expression that can be safely evaluated at compile time. */
337
335
  interface TranslateTimeExpressionElem {
338
336
  kind: "translate-time-expression";
339
337
  expression: ExpressionElem;
340
338
  span: Span;
341
339
  }
342
- /** A literal value in WESL source. A boolean or a number. */
343
- interface Literal {
340
+ /** A literal value (boolean or number) in WESL source. */
341
+ interface Literal extends AbstractElemBase {
344
342
  kind: "literal";
345
343
  value: string;
346
- span: Span;
347
- }
348
- /** `words`s inside `@if` */
349
- interface TranslateTimeFeature {
350
- kind: "translate-time-feature";
351
- name: string;
352
- span: Span;
353
344
  }
354
345
  /** (expr) */
355
- interface ParenthesizedExpression {
346
+ interface ParenthesizedExpression extends AbstractElemBase {
356
347
  kind: "parenthesized-expression";
357
348
  expression: ExpressionElem;
358
349
  }
359
350
  /** `foo[expr]` */
360
- interface ComponentExpression {
351
+ interface ComponentExpression extends AbstractElemBase {
361
352
  kind: "component-expression";
362
353
  base: ExpressionElem;
363
354
  access: ExpressionElem;
364
355
  }
365
356
  /** `foo.member` */
366
- interface ComponentMemberExpression {
357
+ interface ComponentMemberExpression extends AbstractElemBase {
367
358
  kind: "component-member-expression";
368
359
  base: ExpressionElem;
369
360
  access: NameElem;
370
361
  }
371
362
  /** `+foo` */
372
- interface UnaryExpression {
363
+ interface UnaryExpression extends AbstractElemBase {
373
364
  kind: "unary-expression";
374
365
  operator: UnaryOperator;
375
366
  expression: ExpressionElem;
376
367
  }
377
368
  /** `foo + bar` */
378
- interface BinaryExpression {
369
+ interface BinaryExpression extends AbstractElemBase {
379
370
  kind: "binary-expression";
380
371
  operator: BinaryOperator;
381
372
  left: ExpressionElem;
382
373
  right: ExpressionElem;
383
374
  }
384
- /** `foo(arg, arg)` */
385
- interface FunctionCallExpression {
375
+ /** `foo<T>(arg, arg)` */
376
+ interface FunctionCallExpression extends AbstractElemBase {
386
377
  kind: "call-expression";
387
- function: RefIdentElem;
378
+ function: RefIdentElem | TypeRefElem;
379
+ templateArgs?: TypeTemplateParameter[];
388
380
  arguments: ExpressionElem[];
389
381
  }
390
382
  interface UnaryOperator {
@@ -413,7 +405,7 @@ interface RequiresDirective {
413
405
  kind: "requires";
414
406
  extensions: NameElem[];
415
407
  }
416
- /** a function declaration */
408
+ /** A function declaration. */
417
409
  interface FnElem extends ElemWithContentsBase, HasAttributes {
418
410
  kind: "fn";
419
411
  name: DeclIdentElem;
@@ -422,64 +414,63 @@ interface FnElem extends ElemWithContentsBase, HasAttributes {
422
414
  returnAttributes?: AttributeElem[];
423
415
  returnType?: TypeRefElem;
424
416
  }
425
- /** a global variable declaration (at the root level) */
417
+ /** A global variable declaration (at the root level). */
426
418
  interface GlobalVarElem extends ElemWithContentsBase, HasAttributes {
427
419
  kind: "gvar";
428
420
  name: TypedDeclElem;
429
421
  }
430
- /** an entire file */
422
+ /** An entire file. */
431
423
  interface ModuleElem extends ElemWithContentsBase {
432
424
  kind: "module";
433
425
  }
434
- /** an override declaration */
426
+ /** An override declaration. */
435
427
  interface OverrideElem extends ElemWithContentsBase, HasAttributes {
436
428
  kind: "override";
437
429
  name: TypedDeclElem;
438
430
  }
439
- /** a parameter in a function declaration */
431
+ /** A parameter in a function declaration. */
440
432
  interface FnParamElem extends ElemWithContentsBase, HasAttributes {
441
433
  kind: "param";
442
434
  name: TypedDeclElem;
443
435
  }
444
- /** simple references to structures, like myStruct.bar
445
- * (used for transforming refs to binding structs) */
436
+ /** Simple struct references like `myStruct.bar` (for binding struct transforms). */
446
437
  interface SimpleMemberRef extends ElemWithContentsBase {
447
438
  kind: "memberRef";
448
439
  name: RefIdentElem;
449
440
  member: NameElem;
450
441
  extraComponents?: StuffElem;
451
442
  }
452
- /** a struct declaration */
443
+ /** A struct declaration. */
453
444
  interface StructElem extends ElemWithContentsBase, HasAttributes {
454
445
  kind: "struct";
455
446
  name: DeclIdentElem;
456
447
  members: StructMemberElem[];
457
448
  bindingStruct?: true;
458
449
  }
459
- /** generic container of other elements */
450
+ /** Generic container of other elements. */
460
451
  interface StuffElem extends ElemWithContentsBase {
461
452
  kind: "stuff";
462
453
  }
463
- /** a struct declaration that's been marked as a bindingStruct */
454
+ /** A struct declaration marked as a binding struct. */
464
455
  interface BindingStructElem extends StructElem {
465
456
  bindingStruct: true;
466
457
  entryFn?: FnElem;
467
458
  }
468
- /** a member of a struct declaration */
459
+ /** A member of a struct declaration. */
469
460
  interface StructMemberElem extends ElemWithContentsBase, HasAttributes {
470
461
  kind: "member";
471
462
  name: NameElem;
472
463
  typeRef: TypeRefElem;
473
464
  mangledVarName?: string;
474
465
  }
475
- type TypeTemplateParameter = TypeRefElem | UnknownExpressionElem;
476
- /** a reference to a type, like 'f32', or 'MyStruct', or 'ptr<storage, array<f32>, read_only>' */
466
+ type TypeTemplateParameter = ExpressionElem;
467
+ /** A type reference like 'f32', 'MyStruct', or 'ptr<storage, array<f32>, read_only>'. */
477
468
  interface TypeRefElem extends ElemWithContentsBase {
478
469
  kind: "type";
479
470
  name: RefIdent;
480
471
  templateParams?: TypeTemplateParameter[];
481
472
  }
482
- /** a variable declaration */
473
+ /** A variable declaration. */
483
474
  interface VarElem extends ElemWithContentsBase, HasAttributes {
484
475
  kind: "var";
485
476
  name: TypedDeclElem;
@@ -491,10 +482,76 @@ interface LetElem extends ElemWithContentsBase, HasAttributes {
491
482
  interface StatementElem extends ElemWithContentsBase, HasAttributes {
492
483
  kind: "statement";
493
484
  }
485
+ interface ContinuingElem extends ElemWithContentsBase, HasAttributes {
486
+ kind: "continuing";
487
+ }
488
+ /** Statement or continuing - used in loop body parsing. */
489
+ type BlockStatement = StatementElem | ContinuingElem;
494
490
  interface SwitchClauseElem extends ElemWithContentsBase, HasAttributes {
495
491
  kind: "switch-clause";
496
492
  }
497
493
  //#endregion
494
+ //#region src/SrcMap.d.ts
495
+ /** A source map file, and a path for debug purposes. */
496
+ interface SrcWithPath {
497
+ /** User friendly path */
498
+ path?: string;
499
+ text: string;
500
+ }
501
+ interface SrcMapEntry {
502
+ src: SrcWithPath;
503
+ srcStart: number;
504
+ srcEnd: number;
505
+ destStart: number;
506
+ destEnd: number;
507
+ }
508
+ interface SrcPosition {
509
+ src: SrcWithPath;
510
+ position: number;
511
+ }
512
+ /** map text ranges in multiple src texts to a single dest text */
513
+ declare class SrcMap {
514
+ entries: SrcMapEntry[];
515
+ dest: SrcWithPath;
516
+ constructor(dest: SrcWithPath, entries?: SrcMapEntry[]);
517
+ /** add a new mapping from src to dest ranges (must be non-overlapping in destination) */
518
+ addEntries(newEntries: SrcMapEntry[]): void;
519
+ /** given positions in the dest string, return corresponding positions in the src strings */
520
+ mapPositions(...positions: number[]): SrcPosition[];
521
+ /** internally compress adjacent entries where possible */
522
+ compact(): void;
523
+ /** sort in destination order */
524
+ sort(): void;
525
+ /**
526
+ * This SrcMap's destination is a src for the other srcmap,
527
+ * so combine the two and return the result.
528
+ */
529
+ merge(other: SrcMap): SrcMap;
530
+ /** @return the source position corresponding to a provided destination position */
531
+ destToSrc(destPos: number): SrcPosition;
532
+ }
533
+ /** Incrementally append to a string, tracking source references */
534
+ declare class SrcMapBuilder {
535
+ #private;
536
+ source: SrcWithPath;
537
+ constructor(source: SrcWithPath);
538
+ /** append a string fragment to the destination string */
539
+ add(fragment: string, srcStart: number, srcEnd: number): void;
540
+ /**
541
+ * Append a fragment to the destination string,
542
+ * mapping source to the previous,
543
+ * and guessing that the source fragment is just as long as the dest fragment.
544
+ */
545
+ appendNext(fragment: string): void;
546
+ addSynthetic(fragment: string, syntheticSource: string, srcStart: number, srcEnd: number): void;
547
+ /** append a synthetic newline, mapped to previous source location */
548
+ addNl(): void;
549
+ /** copy a string fragment from the src to the destination string */
550
+ addCopy(srcStart: number, srcEnd: number): void;
551
+ /** return a SrcMap */
552
+ static build(builders: SrcMapBuilder[]): SrcMap;
553
+ }
554
+ //#endregion
498
555
  //#region src/WeslDevice.d.ts
499
556
  /**
500
557
  * A {@link GPUDevice} with extensions for WESL. Created with {@link makeWeslDevice}.
@@ -629,26 +686,14 @@ interface WeslBundle {
629
686
  }
630
687
  //#endregion
631
688
  //#region src/ModuleResolver.d.ts
632
- /**
633
- * Resolves module paths to parsed ASTs.
634
- *
635
- * Implementations may cache ASTs or load them lazily.
636
- */
689
+ /** Resolves module paths to parsed ASTs. Implementations may cache or load lazily. */
637
690
  interface ModuleResolver {
638
- /**
639
- * Resolve a module path to its parsed AST.
640
- *
641
- * @param modulePath - Module path in :: format (e.g., "package::foo::bar")
642
- * @returns Parsed AST or undefined if module not found
643
- */
691
+ /** Resolve module path (e.g., "package::foo::bar") to AST, or undefined if not found. */
644
692
  resolveModule(modulePath: string): WeslAST | undefined;
645
693
  }
646
694
  /** Module resolver that supports batch enumeration of all modules. */
647
695
  interface BatchModuleResolver extends ModuleResolver {
648
- /**
649
- * Return all modules, parsing them on-demand if needed.
650
- * Implementations should ensure all sources are parsed before returning.
651
- */
696
+ /** Return all modules, parsing them on-demand if needed. */
652
697
  allModules(): Iterable<[string, WeslAST]>;
653
698
  }
654
699
  interface RecordResolverOptions {
@@ -666,9 +711,10 @@ declare class RecordResolver implements BatchModuleResolver {
666
711
  constructor(sources: Record<string, string>, options?: RecordResolverOptions);
667
712
  resolveModule(modulePath: string): WeslAST | undefined;
668
713
  private findSource;
714
+ /** Convert module path to file path, or undefined if not local. */
669
715
  private moduleToFilePath;
670
716
  private modulePathToDebugPath;
671
- /** Return all modules, parsing them on-demand if needed. */
717
+ /** Parse all modules and return entries. */
672
718
  allModules(): Iterable<[string, WeslAST]>;
673
719
  }
674
720
  /** Composite resolver that tries each resolver in order until one succeeds. */
@@ -689,6 +735,8 @@ declare class BundleResolver implements ModuleResolver {
689
735
  private moduleToFilePath;
690
736
  private modulePathToDebugPath;
691
737
  }
738
+ /** Convert file path to module path (e.g., "foo/bar.wesl" to "package::foo::bar"). */
739
+ declare function fileToModulePath(filePath: string, packageName: string, treatLibAsRoot: boolean): string;
692
740
  //#endregion
693
741
  //#region src/Linker.d.ts
694
742
  type LinkerTransform = (boundAST: TransformedAST) => TransformedAST;
@@ -784,132 +832,87 @@ declare function normalizeModuleName(name: string): string;
784
832
  //#endregion
785
833
  //#region src/BindIdents.d.ts
786
834
  /**
787
- BindIdents pass
788
-
789
- Goals:
790
- - link references identifiers to their declaration identifiers.
791
- - produce a list of declarations that are used (and need to be emitted in the link)
792
- - create mangled names for global declarations (to avoid name conflicts)
793
-
794
- BindIdents proceeds as a recursive tree walk of the scope tree, starting from the root module (e.g. main.wesl).
795
- It traverses the scope tree depth first (and not the syntax tree).
796
- - For each ref ident, search prior declarations in the current scope, then
797
- up the scope tree to find a matching declaration
798
- - If no local match is found, check for partial matches with import statements
799
- - combine the ident with import statement to match a decl in an exporting module
800
- - As global declaration identifies are found, also:
801
- - mutate their mangled name to be globally unique.
802
- - collect the declarations (they will be emitted)
803
-
804
- When iterating through the idents inside a scope, we maintain a parallel data structure of
805
- 'liveDecls', the declarations that are visible in the current scope at the currently
806
- processed ident, along with a link to parent liveDecls for their current decl visibility.
807
-
808
- @if/@else Handling:
809
- The binding phase respects conditional compilation by tracking @else validity state as it
810
- processes sibling scopes. This prevents references from within filtered @else blocks from
811
- pulling in declarations that won't be emitted. The algorithm mirrors the emission phase's
812
- filterValidElements approach but operates on scopes rather than elements.
813
- */
814
- /** results returned from binding pass */
835
+ * BindIdents pass: link reference identifiers to declarations.
836
+ *
837
+ * Goals:
838
+ * - Link reference idents to declaration idents
839
+ * - Collect used declarations (to emit in link)
840
+ * - Create mangled names for globals to avoid conflicts
841
+ *
842
+ * Algorithm:
843
+ * - Recursive depth-first walk of scope tree (not syntax tree)
844
+ * - For each ref: search current scope, then up to parent scopes
845
+ * - If no local match: check import statements for external matches
846
+ * - For found global decls: mangle name to be unique, collect for emission
847
+ *
848
+ * LiveDecls: tracks visible declarations at the current position, with parent links.
849
+ *
850
+ * @if/@else: respects conditional compilation by tracking @else validity state,
851
+ * mirroring the emission phase's filterValidElements but on scopes.
852
+ */
853
+ /** Results returned from binding pass. */
815
854
  interface BindResults {
816
- /** root level names (including names mangled due to conflict with earlier names) */
855
+ /** Root level names (including mangled names from conflicts). */
817
856
  globalNames: Set<string>;
818
- /** global declarations that were referenced (these will need to be emitted in the link) */
857
+ /** Global declarations referenced (to emit in link). */
819
858
  decls: DeclIdent[];
820
- /** additional global statements to include in linked results
821
- * (e.g. for adding module level const_assert statements) */
859
+ /** Additional global statements to emit (e.g., const_assert). */
822
860
  newStatements: EmittableElem[];
823
- /** if accumulateUnbound is true, collection of unbound module paths */
861
+ /** Unbound module paths (only if accumulateUnbound is true). */
824
862
  unbound?: string[][];
825
863
  }
826
- /** an element that can be directly emitted into the linked result */
864
+ /** An element that can be directly emitted into the linked result. */
827
865
  interface EmittableElem {
828
866
  srcModule: SrcModule;
829
867
  elem: AbstractElem;
830
868
  }
831
- /** virtual package, generated by code generation function. */
869
+ /** Virtual package generated by code generation function. */
832
870
  interface VirtualLibrary {
833
- /** function to generate the module */
871
+ /** Function to generate the module. */
834
872
  fn: VirtualLibraryFn;
835
- /** parsed AST for the module (constructed lazily) */
873
+ /** Parsed AST for the module (constructed lazily). */
836
874
  ast?: WeslAST;
837
875
  }
838
- /** key is virtual module name */
876
+ /** Key is virtual module name. */
839
877
  type VirtualLibrarySet = Record<string, VirtualLibrary>;
840
878
  interface BindIdentsParams extends Pick<LinkRegistryParams, "resolver" | "conditions" | "mangler"> {
841
879
  rootAst: WeslAST;
842
880
  virtuals?: VirtualLibrarySet;
843
- /** if false, throw on unbound identifiers. If true, accumulate unbound identifiers into
844
- * a BindResults.unbound. */
881
+ /** If true, accumulate unbound identifiers into BindResults.unbound instead of throwing. */
845
882
  accumulateUnbound?: true;
846
883
  }
847
- /**
848
- * Bind active reference idents to declaration Idents by mutating the refersTo: field
849
- * Also in this pass, set the mangledName: field for all active global declaration idents.
850
- *
851
- * @param parsed
852
- * @param conditions only bind to/from idents that are valid with the current condition set
853
- * @return any new declaration elements found (they will need to be emitted)
854
- */
884
+ /** Bind ref idents to declarations and mangle global declaration names. */
855
885
  declare function bindIdents(params: BindIdentsParams): BindResults;
856
- /**
857
- * Find all conditionally valid declarations at the root level.
858
- * Declarations are either directly in the root scope or in conditionally valid partial scopes.
859
- *
860
- * This function tracks @else state to ensure that declarations in @else blocks are only
861
- * included when the corresponding @if block is invalid. This is essential for preventing
862
- * unused declarations from being included in the output.
863
- *
864
- * Results are cached on the root scope's _validRootDecls field.
865
- * Used both for binding and for publicDecl() lookups.
866
- *
867
- * @param rootScope The root scope to search
868
- * @param conditions Current conditional compilation settings
869
- * @return Array of valid declaration identifiers
870
- */
886
+ /** Find all conditionally valid declarations at the root level. */
871
887
  declare function findValidRootDecls(rootScope: Scope, conditions: Conditions): DeclIdent[];
872
- /** Find a public declaration with the given original name */
888
+ /** Find a public declaration with the given original name. */
873
889
  declare function publicDecl(scope: Scope, name: string, conditions: Conditions): DeclIdent | undefined;
874
- /** @return true if this decl is at the root scope level of a module */
875
- declare function isGlobal(declIdent: DeclIdent): boolean;
876
- /** state used during the recursive scope tree walk to bind references to declarations */
890
+ /** State used during the recursive scope tree walk to bind references to declarations. */
877
891
  interface BindContext {
878
892
  resolver: ModuleResolver;
879
- conditions: Record<string, any>;
880
- /** decl idents discovered so far (to avoid re-traversing) */
893
+ conditions: Conditions;
894
+ /** Decl idents discovered so far (to avoid re-traversing). */
881
895
  knownDecls: Set<DeclIdent>;
882
- /** save work by not processing scopes multiple times */
896
+ /** Scopes already processed (avoid duplicate work). */
883
897
  foundScopes: Set<Scope>;
884
- /** root level names used so far (enables manglers/plugins to pick unique names) */
898
+ /** Root level names used so far (enables manglers to pick unique names). */
885
899
  globalNames: Set<string>;
886
- /** additional global statements to emit (e.g. module level const_assert, indexed by elem for uniqueness) */
900
+ /** Additional global statements to emit (indexed by elem for uniqueness). */
887
901
  globalStatements: Map<AbstractElem, EmittableElem>;
888
- /** construct unique identifer names for global declarations */
902
+ /** Construct unique identifier names for global declarations. */
889
903
  mangler: ManglerFn;
890
904
  virtuals?: VirtualLibrarySet;
891
- /** list of unbound identifiers if accumulateUnbound is true */
905
+ /** Unbound identifiers if accumulateUnbound is true. */
892
906
  unbound?: string[][];
893
- /** don't follow references from declarations (used for library dependency detection) */
907
+ /** Don't follow references from declarations (for library dependency detection). */
894
908
  dontFollowDecls?: boolean;
895
909
  }
896
910
  /**
897
- * Recursively bind references to declarations in this scope and
898
- * any child scopes referenced by these declarations.
899
- * Uses a hash set of found declarations to avoid duplication.
900
- *
901
- * IMPORTANT: This function tracks @else state while traversing sibling scopes.
902
- * When an @if scope is processed, its validity determines whether the following
903
- * @else scope should be considered valid. This ensures that references from
904
- * filtered @else blocks don't pull in unused declarations.
905
- *
906
- * @return any new declarations found
907
- * @param liveDecls current set of live declaration in this scope
908
- * (empty when traversing to a new scope, possibly non-empty for a partial scope)
909
- * @param isRoot liveDecls refers to a prepopulated root scope
910
- * (root scope declarations may appear in any order)
911
+ * Recursively bind references to declarations in this scope and child scopes.
912
+ * Tracks @else state to ensure filtered @else blocks don't pull in unused declarations.
913
+ * @return new declarations found
911
914
  */
912
- declare function bindIdentsRecursive(scope: Scope, bindContext: BindContext, liveDecls: LiveDecls, isRoot?: boolean): DeclIdent[];
915
+ declare function bindIdentsRecursive(scope: Scope, bindContext: BindContext, liveDecls: LiveDecls): DeclIdent[];
913
916
  //#endregion
914
917
  //#region src/debug/ASTtoString.d.ts
915
918
  declare function astToString(elem: AbstractElem, indent?: number): string;
@@ -980,6 +983,47 @@ declare function sanitizePackageName(npmName: string): string;
980
983
  */
981
984
  declare function npmNameVariations(sanitizedPath: string): Generator<string>;
982
985
  //#endregion
986
+ //#region src/Logging.d.ts
987
+ /** base logger (can be overridden to a capturing logger for tests) */
988
+ declare let log: (...data: any[]) => void;
989
+ /** enable debug assertions and verbose error messages (set false via bundler for smaller builds) */
990
+ declare const debug = true;
991
+ /** enable user-facing validation like operator binding rules (set false via bundler for smaller builds) */
992
+ declare const validation = true;
993
+ /** use temporary logger for async tests */
994
+ declare function withLoggerAsync<T>(logFn: typeof console.log, fn: () => Promise<T>): Promise<T>;
995
+ /**
996
+ * Log a message along with the source line and a caret indicating the error position.
997
+ * @param pos is the position in the source string, or if src is a SrcMap,
998
+ * then pos is the position in the dest (e.g. preprocessed) text
999
+ */
1000
+ declare function srcLog(src: string | SrcMap, pos: number | [number, number], ...msgs: any[]): void;
1001
+ //#endregion
1002
+ //#region src/ModulePathUtil.d.ts
1003
+ /** WESL module path utilities for converting between :: and / separators. */
1004
+ /**
1005
+ * Convert module path segments to relative file path.
1006
+ * Handles package/packageName prefixes and super:: resolution.
1007
+ *
1008
+ * @param parts - module path as array e.g., ["package", "utils", "helper"]
1009
+ * @param packageName - the current package's name (required)
1010
+ * @param srcModuleParts - source module path for super:: resolution (optional)
1011
+ * @returns relative file path e.g., "utils/helper", or undefined if external
1012
+ */
1013
+ declare function modulePartsToRelativePath(parts: string[], packageName: string, srcModuleParts?: string[]): string | undefined;
1014
+ /** String variant of modulePartsToRelativePath. */
1015
+ declare function moduleToRelativePath(modulePath: string, packageName: string, srcModulePath?: string): string | undefined;
1016
+ /**
1017
+ * Resolve super:: elements to absolute module path.
1018
+ *
1019
+ * @param parts - module path with potential super:: elements
1020
+ * @param srcModuleParts - source module path for context
1021
+ * @returns absolute module path parts (no super:: elements)
1022
+ */
1023
+ declare function resolveSuper(parts: string[], srcModuleParts: string[]): string[];
1024
+ /** Normalize debug root to end with / or be empty. */
1025
+ declare function normalizeDebugRoot(root?: string): string;
1026
+ //#endregion
983
1027
  //#region src/PathUtil.d.ts
984
1028
  /** simplistic path manipulation utilities */
985
1029
  /** return path with ./ and foo/.. elements removed */
@@ -988,6 +1032,34 @@ declare function normalize(path: string): string;
988
1032
  * e.g. /foo/bar.wgsl => /foo/bar */
989
1033
  declare function noSuffix(path: string): string;
990
1034
  //#endregion
1035
+ //#region src/Stream.d.ts
1036
+ /**
1037
+ * Interface for a tokenizer. Returns a "next token", and can be reset to
1038
+ * previously saved positions (checkpoints).
1039
+ */
1040
+ interface Stream<T extends Token> {
1041
+ /** Returns the current position */
1042
+ checkpoint(): number;
1043
+ /** Restores a position */
1044
+ reset(position: number): void;
1045
+ /**
1046
+ * Returns the next token, or `null` if the end of the stream has been reached.
1047
+ * Always leaves `checkpoint` right after the token.
1048
+ */
1049
+ nextToken(): T | null;
1050
+ /** src text */
1051
+ src: string;
1052
+ }
1053
+ /** A text token */
1054
+ interface Token {
1055
+ kind: string;
1056
+ text: string;
1057
+ span: Span;
1058
+ }
1059
+ interface TypedToken<Kind extends string> extends Token {
1060
+ kind: Kind;
1061
+ }
1062
+ //#endregion
991
1063
  //#region src/parse/WeslStream.d.ts
992
1064
  type WeslTokenKind = "word" | "keyword" | "number" | "symbol";
993
1065
  type WeslToken<Kind extends WeslTokenKind = WeslTokenKind> = TypedToken<Kind>;
@@ -996,13 +1068,22 @@ declare class WeslStream implements Stream<WeslToken> {
996
1068
  private stream;
997
1069
  /** New line */
998
1070
  private eolPattern;
999
- /** Block comments */
1000
1071
  private blockCommentPattern;
1001
1072
  src: string;
1002
1073
  constructor(src: string);
1003
1074
  checkpoint(): number;
1004
1075
  reset(position: number): void;
1005
1076
  nextToken(): WeslToken | null;
1077
+ /** Peek at the next token without consuming it */
1078
+ peek(): WeslToken | null;
1079
+ /** Consume token if text matches, otherwise leave position unchanged */
1080
+ matchText(text: string): WeslToken | null;
1081
+ /** Consume token if kind matches (and optionally text), otherwise leave position unchanged */
1082
+ matchKind<K extends WeslTokenKind>(kind: K, text?: string): WeslToken<K> | null;
1083
+ /** Consume token if predicate matches, otherwise leave position unchanged */
1084
+ nextIf(predicate: (token: WeslToken) => boolean): WeslToken | null;
1085
+ /** Match a sequence of tokens by text. Resets and returns null if any fails. */
1086
+ matchSequence(...texts: string[]): WeslToken[] | null;
1006
1087
  private skipToEol;
1007
1088
  private skipBlockComment;
1008
1089
  /**
@@ -1016,12 +1097,12 @@ declare class WeslStream implements Stream<WeslToken> {
1016
1097
  nextTemplateEndToken(): (WeslToken & {
1017
1098
  kind: "symbol";
1018
1099
  }) | null;
1019
- isTemplateStart(afterToken: number): boolean;
1100
+ private isTemplateStart;
1020
1101
  /**
1021
1102
  * Call this after consuming an opening bracket.
1022
1103
  * Skips until a closing bracket. This also consumes the closing bracket.
1023
1104
  */
1024
- skipBracketsTo(closingBracket: string): void;
1105
+ private skipBracketsTo;
1025
1106
  }
1026
1107
  //#endregion
1027
1108
  //#region src/TransformBindingStructs.d.ts
@@ -1119,4 +1200,4 @@ declare function offsetToLineNumber(offset: number, text: string): [lineNum: num
1119
1200
  */
1120
1201
  declare function errorHighlight(source: string, span: Span): [string, string];
1121
1202
  //#endregion
1122
- export { AbstractElem, AbstractElemBase, AliasElem, Attribute, AttributeElem, BatchModuleResolver, BinaryExpression, BinaryOperator, BindIdentsParams, BindResults, BindingAST, BindingStructElem, BoundAndTransformed, BuiltinAttribute, BundleResolver, ComponentExpression, ComponentMemberExpression, CompositeResolver, Conditions, ConstAssertElem, ConstElem, ContainerElem, DeclIdent, DeclIdentElem, DeclarationElem, DiagnosticAttribute, DiagnosticDirective, DirectiveElem, DirectiveVariant, ElemWithAttributes, ElemWithContentsBase, ElifAttribute, ElseAttribute, EmittableElem, EnableDirective, ExpressionElem, ExtendedGPUValidationError, FnElem, FnParamElem, FunctionCallExpression, GlobalDeclarationElem, GlobalVarElem, GrammarElem, HasAttributes, Ident, IfAttribute, ImportCollection, ImportElem, ImportItem, ImportSegment, ImportStatement, InterpolateAttribute, LetElem, LexicalScope, LinkConfig, LinkParams, LinkRegistryParams, LinkedWesl, LinkerTransform, Literal, LiveDecls, ManglerFn, ModuleElem, ModuleResolver, NameElem, OverrideElem, ParenthesizedExpression, PartialScope, RecordResolver, RecordResolverOptions, RefIdent, RefIdentElem, RequiresDirective, Scope, SimpleMemberRef, SrcModule, StableState, StandardAttribute, StatementElem, StructElem, StructMemberElem, StuffElem, SwitchClauseElem, SyntheticElem, TerminalElem, TextElem, TransformedAST, TranslateTimeExpressionElem, TranslateTimeFeature, TypeRefElem, TypeTemplateParameter, TypedDeclElem, UnaryExpression, UnaryOperator, UnknownExpressionElem, VarElem, VirtualLibrary, VirtualLibraryFn, VirtualLibrarySet, WeslAST, WeslBundle, WeslDevice, WeslGPUCompilationInfo, WeslGPUCompilationMessage, WeslJsPlugin, WeslParseContext, WeslParseError, WeslParseState, WeslStream, _linkSync, astToString, attributeToString, bindAndTransform, bindIdents, bindIdentsRecursive, bindingStructsPlugin, blankWeslParseState, childIdent, childScope, containsScope, debugContentsToString, emptyScope, errorHighlight, filterMap, findMap, findRefsToBindingStructs, findUnboundIdents, findValidRootDecls, flatImports, groupBy, grouped, identToString, isGlobal, last, lengthPrefixMangle, link, linkRegistry, liveDeclsToString, lowerBindingStructs, makeLiveDecls, makeWeslDevice, mapForward, mapValues, markBindingStructs, markEntryTypes, mergeScope, minimalMangle, minimallyMangledName, multiKeySet, nextIdentId, noSuffix, normalize, normalizeModuleName, npmNameVariations, offsetToLineNumber, overlapTail, parseSrcModule, partition, publicDecl, replaceWords, requestWeslDevice, resetScopeIds, sanitizePackageName, scan, scopeToString, scopeToStringLong, syntheticWeslParseState, transformBindingReference, transformBindingStruct, underscoreMangle };
1203
+ export { AbstractElem, AbstractElemBase, AliasElem, Attribute, AttributeElem, BatchModuleResolver, BinaryExpression, BinaryOperator, BindIdentsParams, BindResults, BindingAST, BindingStructElem, BlockStatement, BoundAndTransformed, BuiltinAttribute, BundleResolver, ComponentExpression, ComponentMemberExpression, CompositeResolver, ConditionalAttribute, Conditions, ConstAssertElem, ConstElem, ContainerElem, ContinuingElem, DeclIdent, DeclIdentElem, DeclarationElem, DiagnosticAttribute, DiagnosticDirective, DiagnosticRule, DirectiveElem, DirectiveVariant, ElemKindMap, ElemWithAttributes, ElemWithContentsBase, ElifAttribute, ElseAttribute, EmittableElem, EnableDirective, ExpressionElem, ExtendedGPUValidationError, FnElem, FnParamElem, FunctionCallExpression, GlobalDeclarationElem, GlobalVarElem, GrammarElem, HasAttributes, Ident, IfAttribute, ImportCollection, ImportElem, ImportItem, ImportSegment, ImportStatement, InterpolateAttribute, LetElem, LexicalScope, LinkConfig, LinkParams, LinkRegistryParams, LinkedWesl, LinkerTransform, Literal, LiveDecls, ManglerFn, ModuleElem, ModuleResolver, NameElem, OpenElem, OverrideElem, ParenthesizedExpression, ParseError, PartialScope, RecordResolver, RecordResolverOptions, RefIdent, RefIdentElem, RequiresDirective, Scope, SimpleMemberRef, Span, SrcMap, SrcMapBuilder, SrcMapEntry, SrcModule, SrcPosition, SrcWithPath, StableState, StandardAttribute, StatementElem, StructElem, StructMemberElem, StuffElem, SwitchClauseElem, SyntheticElem, TerminalElem, TextElem, TransformedAST, TranslateTimeExpressionElem, TypeRefElem, TypeTemplateParameter, TypedDeclElem, UnaryExpression, UnaryOperator, UnknownExpressionElem, VarElem, VirtualLibrary, VirtualLibraryFn, VirtualLibrarySet, WeslAST, WeslBundle, WeslDevice, WeslGPUCompilationInfo, WeslGPUCompilationMessage, WeslJsPlugin, WeslParseContext, WeslParseError, WeslParseState, WeslStream, _linkSync, astToString, attributeToString, bindAndTransform, bindIdents, bindIdentsRecursive, bindingStructsPlugin, childIdent, childScope, containsScope, debug, debugContentsToString, emptyScope, errorHighlight, fileToModulePath, filterMap, findMap, findRefsToBindingStructs, findUnboundIdents, findValidRootDecls, flatImports, groupBy, grouped, identToString, last, lengthPrefixMangle, link, linkRegistry, liveDeclsToString, log, lowerBindingStructs, makeLiveDecls, makeWeslDevice, mapForward, mapValues, markBindingStructs, markEntryTypes, mergeScope, minimalMangle, minimallyMangledName, modulePartsToRelativePath, moduleToRelativePath, multiKeySet, nextIdentId, noSuffix, normalize, normalizeDebugRoot, normalizeModuleName, npmNameVariations, offsetToLineNumber, overlapTail, parseSrcModule, partition, publicDecl, replaceWords, requestWeslDevice, resetScopeIds, resolveSuper, sanitizePackageName, scan, scopeToString, scopeToStringLong, srcLog, transformBindingReference, transformBindingStruct, underscoreMangle, validation, withLoggerAsync };