parseman 0.58.1 → 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 +9 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin/index.js +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -1
- package/src/cli/index.ts +18 -6
- package/src/version.ts +1 -1
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
|
|
7
|
+
import * as nodeModule from "node:module";
|
|
8
8
|
|
|
9
9
|
// src/combinators/first-set.ts
|
|
10
10
|
function classifyFinalChoice(arms, resolve2, activeTrivia) {
|
|
@@ -20194,18 +20194,21 @@ const strip = (context) => {
|
|
|
20194
20194
|
delete rest.type
|
|
20195
20195
|
return { ...context, importAttributes: rest }
|
|
20196
20196
|
}
|
|
20197
|
-
export
|
|
20197
|
+
export function resolve(specifier, context, nextResolve) {
|
|
20198
20198
|
return nextResolve(specifier, strip(context))
|
|
20199
20199
|
}
|
|
20200
|
-
export
|
|
20200
|
+
export function load(url, context, nextLoad) {
|
|
20201
20201
|
return nextLoad(url, strip(context))
|
|
20202
20202
|
}
|
|
20203
20203
|
`;
|
|
20204
20204
|
var macroAttrRegistered = false;
|
|
20205
|
-
function registerMacroAttributeHook() {
|
|
20205
|
+
async function registerMacroAttributeHook() {
|
|
20206
20206
|
if (macroAttrRegistered) return;
|
|
20207
20207
|
macroAttrRegistered = true;
|
|
20208
|
-
|
|
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);
|
|
20209
20212
|
}
|
|
20210
20213
|
async function loadGrammar(path, exportName) {
|
|
20211
20214
|
const abs = resolve(path);
|
|
@@ -20215,7 +20218,7 @@ async function loadGrammar(path, exportName) {
|
|
|
20215
20218
|
throw new CliError(`no such grammar module: ${path}`);
|
|
20216
20219
|
}
|
|
20217
20220
|
await registerTsIfNeeded(abs);
|
|
20218
|
-
registerMacroAttributeHook();
|
|
20221
|
+
await registerMacroAttributeHook();
|
|
20219
20222
|
let mod;
|
|
20220
20223
|
try {
|
|
20221
20224
|
mod = await import(pathToFileURL(abs).href);
|