parseman 0.58.0 → 0.58.2

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/cli/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  import { readFileSync, writeFileSync, readdirSync, statSync } from "node:fs";
5
5
  import { resolve, relative, join, extname } from "node:path";
6
6
  import { pathToFileURL } from "node:url";
7
- import { register } from "node:module";
7
+ import * as nodeModule from "node:module";
8
8
 
9
9
  // src/combinators/first-set.ts
10
10
  function classifyFinalChoice(arms, resolve2, activeTrivia) {
@@ -7850,12 +7850,13 @@ var Encoder = class {
7850
7850
  const rr = this.refResolver();
7851
7851
  const { next, boundary } = follow;
7852
7852
  if (matchesEmpty(next, /* @__PURE__ */ new Set(), rr) || mayCommitFailure(next, rr, this.commitFailureMemo)) return void 0;
7853
- const nextTag = next._def.tag;
7854
- if (nextTag !== "literal" && nextTag !== "regex" && nextTag !== "keywords" && nextTag !== "label") return void 0;
7853
+ const nextDef = next._def;
7854
+ if (nextDef.tag !== "literal" && nextDef.tag !== "regex" && nextDef.tag !== "keywords" && nextDef.tag !== "label") return void 0;
7855
7855
  const first = firstSetOf(next, /* @__PURE__ */ new Set(), rr, boundary);
7856
7856
  const cls = this.charClass(boundary === void 0 ? first : union(first, firstSetOf(boundary, /* @__PURE__ */ new Set(), rr)));
7857
7857
  if (cls < 0) return void 0;
7858
- return { cls, fx: this.expected(deriveExpected(next)) };
7858
+ const miss = nextDef.tag === "label" ? deriveExpected(next) : directTerminalFailureExpected(nextDef);
7859
+ return { cls, fx: this.expected(miss) };
7859
7860
  }
7860
7861
  node(p) {
7861
7862
  const lazyRef = p._def.tag === "lazy";
@@ -20193,18 +20194,21 @@ const strip = (context) => {
20193
20194
  delete rest.type
20194
20195
  return { ...context, importAttributes: rest }
20195
20196
  }
20196
- export async function resolve(specifier, context, nextResolve) {
20197
+ export function resolve(specifier, context, nextResolve) {
20197
20198
  return nextResolve(specifier, strip(context))
20198
20199
  }
20199
- export async function load(url, context, nextLoad) {
20200
+ export function load(url, context, nextLoad) {
20200
20201
  return nextLoad(url, strip(context))
20201
20202
  }
20202
20203
  `;
20203
20204
  var macroAttrRegistered = false;
20204
- function registerMacroAttributeHook() {
20205
+ async function registerMacroAttributeHook() {
20205
20206
  if (macroAttrRegistered) return;
20206
20207
  macroAttrRegistered = true;
20207
- register(`data:text/javascript,${encodeURIComponent(MACRO_ATTR_HOOK)}`);
20208
+ const url = `data:text/javascript,${encodeURIComponent(MACRO_ATTR_HOOK)}`;
20209
+ if (typeof nodeModule.registerHooks === "function") {
20210
+ nodeModule.registerHooks(await import(url));
20211
+ } else nodeModule.register(url);
20208
20212
  }
20209
20213
  async function loadGrammar(path, exportName) {
20210
20214
  const abs = resolve(path);
@@ -20214,7 +20218,7 @@ async function loadGrammar(path, exportName) {
20214
20218
  throw new CliError(`no such grammar module: ${path}`);
20215
20219
  }
20216
20220
  await registerTsIfNeeded(abs);
20217
- registerMacroAttributeHook();
20221
+ await registerMacroAttributeHook();
20218
20222
  let mod;
20219
20223
  try {
20220
20224
  mod = await import(pathToFileURL(abs).href);