wgsl-test 0.2.21 → 0.2.23

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.
@@ -815,7 +815,7 @@ function emitStandardAttribute(e, ctx) {
815
815
  }
816
816
  ctx.srcBuilder.add("@" + e.attribute.name + "(", e.start, params$1[0].start);
817
817
  for (let i = 0; i < params$1.length; i++) {
818
- ctx.srcBuilder.addCopy(params$1[i].start, params$1[i].end);
818
+ emitContents(params$1[i], ctx);
819
819
  if (i < params$1.length - 1) ctx.srcBuilder.add(",", params$1[i].end, params$1[i + 1].start);
820
820
  }
821
821
  ctx.srcBuilder.add(")", params$1[params$1.length - 1].end, e.end);
@@ -3373,6 +3373,7 @@ const wgslStandardAttributes = new Set([
3373
3373
  function bindIdents(params$1) {
3374
3374
  const { rootAst, resolver, virtuals, accumulateUnbound } = params$1;
3375
3375
  const { conditions = {}, mangler = minimalMangle } = params$1;
3376
+ const packageName = rootAst.srcModule.modulePath.split("::")[0];
3376
3377
  const validRootDecls = findValidRootDecls(rootAst.rootScope, conditions);
3377
3378
  const { globalNames, knownDecls } = initRootDecls(validRootDecls);
3378
3379
  const bindContext = {
@@ -3381,6 +3382,7 @@ function bindIdents(params$1) {
3381
3382
  knownDecls,
3382
3383
  virtuals,
3383
3384
  mangler,
3385
+ packageName,
3384
3386
  foundScopes: /* @__PURE__ */ new Set(),
3385
3387
  globalNames,
3386
3388
  globalStatements: /* @__PURE__ */ new Map(),
@@ -3555,25 +3557,25 @@ function matchingImport(identParts, imports) {
3555
3557
  }
3556
3558
  /** @return an exported root declIdent for the provided path. */
3557
3559
  function findExport(pathParts, srcModule, ctx) {
3558
- const { resolver, conditions, virtuals } = ctx;
3559
3560
  const modulePath = resolveModulePath(pathParts, srcModule.modulePath.split("::")).slice(0, -1).join("::");
3560
- const moduleAst = resolver.resolveModule(modulePath) ?? virtualModule(pathParts[0], conditions, virtuals);
3561
+ const moduleAst = ctx.resolver.resolveModule(modulePath) ?? virtualModule(pathParts[0], ctx);
3561
3562
  if (!moduleAst) return void 0;
3562
- const decl = publicDecl(moduleAst.rootScope, last$1(pathParts), conditions);
3563
+ const decl = publicDecl(moduleAst.rootScope, last$1(pathParts), ctx.conditions);
3563
3564
  if (decl) return {
3564
3565
  decl,
3565
3566
  moduleAst
3566
3567
  };
3567
3568
  }
3568
3569
  /** @return AST for a virtual module. */
3569
- function virtualModule(moduleName, conditions = {}, virtuals) {
3570
- const found = virtuals?.[moduleName];
3570
+ function virtualModule(moduleName, ctx) {
3571
+ const found = ctx.virtuals?.[moduleName];
3571
3572
  if (!found) return void 0;
3572
3573
  if (found.ast) return found.ast;
3574
+ const src = found.fn(ctx.conditions);
3573
3575
  found.ast = parseSrcModule({
3574
- modulePath: moduleName,
3576
+ modulePath: ctx.packageName + "::" + moduleName,
3575
3577
  debugFilePath: moduleName,
3576
- src: found.fn(conditions)
3578
+ src
3577
3579
  });
3578
3580
  return found.ast;
3579
3581
  }
@@ -3643,6 +3645,7 @@ function findUnboundRefs(resolver) {
3643
3645
  globalNames: /* @__PURE__ */ new Set(),
3644
3646
  globalStatements: /* @__PURE__ */ new Map(),
3645
3647
  mangler: minimalMangle,
3648
+ packageName: "package",
3646
3649
  unbound: [],
3647
3650
  dontFollowDecls: true
3648
3651
  };