parseman 0.60.1 → 0.60.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/analysis/diagnostics.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin/index.d.ts +18 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +113 -45
- package/dist/plugin/index.js.map +1 -1
- package/dist/table/index.js +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/plugin/index.ts +189 -63
- package/src/version.ts +1 -1
|
@@ -13192,7 +13192,7 @@ function clearOf(ranges, input, from, to) {
|
|
|
13192
13192
|
}
|
|
13193
13193
|
|
|
13194
13194
|
// src/version.ts
|
|
13195
|
-
var PARSEMAN_VERSION = "0.60.
|
|
13195
|
+
var PARSEMAN_VERSION = "0.60.2";
|
|
13196
13196
|
|
|
13197
13197
|
// src/table/assemble.ts
|
|
13198
13198
|
import { PlainBuf as PlainBuf2, PlainField, PlainLeaf as PlainLeaf9, PlainNode as PlainNode2, PlainSpan as PlainSpan10 } from "../cst/plain.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -13337,7 +13337,7 @@ function clearOf(ranges, input, from, to) {
|
|
|
13337
13337
|
}
|
|
13338
13338
|
|
|
13339
13339
|
// src/version.ts
|
|
13340
|
-
var PARSEMAN_VERSION = "0.60.
|
|
13340
|
+
var PARSEMAN_VERSION = "0.60.2";
|
|
13341
13341
|
|
|
13342
13342
|
// src/table/assemble.ts
|
|
13343
13343
|
import { PlainBuf as PlainBuf2, PlainField, PlainLeaf as PlainLeaf9, PlainNode as PlainNode2, PlainSpan as PlainSpan10 } from "../cst/plain.js";
|
package/dist/index.js
CHANGED
|
@@ -13793,7 +13793,7 @@ function clearOf(ranges, input, from, to) {
|
|
|
13793
13793
|
}
|
|
13794
13794
|
|
|
13795
13795
|
// src/version.ts
|
|
13796
|
-
var PARSEMAN_VERSION = "0.60.
|
|
13796
|
+
var PARSEMAN_VERSION = "0.60.2";
|
|
13797
13797
|
|
|
13798
13798
|
// src/table/assemble.ts
|
|
13799
13799
|
import { PlainBuf as PlainBuf2, PlainField, PlainLeaf as PlainLeaf9, PlainNode as PlainNode2, PlainSpan as PlainSpan10 } from "./cst/plain.js";
|
package/dist/plugin/index.d.ts
CHANGED
|
@@ -20,9 +20,26 @@ export type CarriedSidecarItem = IRPiece | {
|
|
|
20
20
|
from: string;
|
|
21
21
|
name: string;
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* A recorded item: a reference also carries the pieces it stands for, expanded, so a
|
|
25
|
+
* build that BUNDLES the referenced package rather than keeping it external writes
|
|
26
|
+
* those pieces instead of a reference to a package its artifact no longer imports
|
|
27
|
+
* (`emitCarriedSidecars`).
|
|
28
|
+
*/
|
|
29
|
+
export type CarriedSinkItem = IRPiece | {
|
|
30
|
+
from: string;
|
|
31
|
+
name: string;
|
|
32
|
+
expanded?: readonly CarriedSidecarItem[];
|
|
33
|
+
};
|
|
23
34
|
/** One module's carried lists, by export name. */
|
|
24
|
-
export type CarriedSink = Map<string,
|
|
35
|
+
export type CarriedSink = Map<string, CarriedSinkItem[]>;
|
|
25
36
|
export declare const CARRIED_SIDECAR_SUFFIX = ".parseman.json";
|
|
37
|
+
/**
|
|
38
|
+
* The digest a sidecar records of its artifact: SHA-256 of the chunk's code, less a
|
|
39
|
+
* trailing `sourceMappingURL` comment, which a bundler appends after the hook that
|
|
40
|
+
* writes the sidecar has seen the code.
|
|
41
|
+
*/
|
|
42
|
+
export declare function artifactDigest(code: string): string;
|
|
26
43
|
export type ParsecraftPluginOptions = {
|
|
27
44
|
/** Extra module specifiers to treat as parseman re-exports */
|
|
28
45
|
moduleAliases?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAyBA,OAAO,WAAW,MAAM,cAAc,CAAA;AActC,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAA;AA6BrE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AACzE,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAyBA,OAAO,WAAW,MAAM,cAAc,CAAA;AActC,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAA;AA6BrE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AACzE;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAAE,CAAA;AAChH,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAA;AACxD,eAAO,MAAM,sBAAsB,mBAAmB,CAAA;AAQtD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD;AA+BD,MAAM,MAAM,uBAAuB,GAAG;IACpC,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;8CAC0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,wFAAwF;AACxF,MAAM,MAAM,eAAe,GAAG;IAC5B;qDACiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAClC,CAAA;;;AA6jBD,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAA;IAC3C,kFAAkF;IAClF,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AA0CD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,aAAa,cAA6B,EAC1C,kBAAkB,UAAQ,EAC1B,QAAQ,UAAQ,EAChB,eAAe,UAAQ,EACvB,eAAe,CAAC,EAAE,eAAe,EACjC,cAAc,SAA0B,EACxC,WAAW,CAAC,EAAE,WAAW,GACxB,oBAAoB,GAAG,IAAI,CAW7B"}
|
package/dist/plugin/index.js
CHANGED
|
@@ -13387,7 +13387,7 @@ function clearOf(ranges, input, from, to) {
|
|
|
13387
13387
|
}
|
|
13388
13388
|
|
|
13389
13389
|
// src/version.ts
|
|
13390
|
-
var PARSEMAN_VERSION = "0.60.
|
|
13390
|
+
var PARSEMAN_VERSION = "0.60.2";
|
|
13391
13391
|
|
|
13392
13392
|
// src/table/assemble.ts
|
|
13393
13393
|
import { PlainBuf as PlainBuf2, PlainField, PlainLeaf as PlainLeaf9, PlainNode as PlainNode2, PlainSpan as PlainSpan10 } from "../cst/plain.js";
|
|
@@ -22741,26 +22741,36 @@ function evalIR(ir, rulesImpl) {
|
|
|
22741
22741
|
import { createHash } from "node:crypto";
|
|
22742
22742
|
var TABLE_RUNTIME_SPECIFIER = "parseman/table";
|
|
22743
22743
|
var CARRIED_SIDECAR_SUFFIX = ".parseman.json";
|
|
22744
|
+
function artifactDigest(code) {
|
|
22745
|
+
const body = code.replace(/\n?\/\/# sourceMappingURL=[^\n]*\n?$/, "");
|
|
22746
|
+
return createHash("sha256").update(body).digest("hex").slice(0, 32);
|
|
22747
|
+
}
|
|
22744
22748
|
var _sidecarCache = /* @__PURE__ */ new Map();
|
|
22745
22749
|
function readCarriedSidecar(artifact) {
|
|
22746
22750
|
const file = artifact + CARRIED_SIDECAR_SUFFIX;
|
|
22747
22751
|
let mtimeMs;
|
|
22752
|
+
let artifactMtimeMs;
|
|
22748
22753
|
try {
|
|
22749
22754
|
mtimeMs = fs2.statSync(file).mtimeMs;
|
|
22755
|
+
artifactMtimeMs = fs2.statSync(artifact).mtimeMs;
|
|
22750
22756
|
} catch {
|
|
22751
22757
|
return null;
|
|
22752
22758
|
}
|
|
22753
22759
|
const hit = _sidecarCache.get(file);
|
|
22754
|
-
if (hit && hit.mtimeMs === mtimeMs) return hit.
|
|
22755
|
-
let
|
|
22760
|
+
if (hit && hit.mtimeMs === mtimeMs && hit.artifactMtimeMs === artifactMtimeMs) return hit.read;
|
|
22761
|
+
let read = null;
|
|
22756
22762
|
try {
|
|
22757
22763
|
const parsed = JSON.parse(fs2.readFileSync(file, "utf8"));
|
|
22758
22764
|
const exports = typeof parsed === "object" && parsed !== null ? parsed.exports : void 0;
|
|
22759
|
-
if (typeof exports === "object" && exports !== null)
|
|
22765
|
+
if (typeof exports === "object" && exports !== null) {
|
|
22766
|
+
const sidecar = parsed;
|
|
22767
|
+
const stale = typeof sidecar.artifact === "string" && sidecar.artifact !== artifactDigest(fs2.readFileSync(artifact, "utf8"));
|
|
22768
|
+
read = { sidecar, stale };
|
|
22769
|
+
}
|
|
22760
22770
|
} catch {
|
|
22761
22771
|
}
|
|
22762
|
-
_sidecarCache.set(file, { mtimeMs,
|
|
22763
|
-
return
|
|
22772
|
+
_sidecarCache.set(file, { mtimeMs, artifactMtimeMs, read });
|
|
22773
|
+
return read;
|
|
22764
22774
|
}
|
|
22765
22775
|
var corpusCache = /* @__PURE__ */ new Map();
|
|
22766
22776
|
function corpusTexts(profile) {
|
|
@@ -22880,58 +22890,95 @@ function parseModuleCached(filePath) {
|
|
|
22880
22890
|
_moduleParseCache.set(filePath, { mtimeMs, parsed });
|
|
22881
22891
|
return parsed;
|
|
22882
22892
|
}
|
|
22883
|
-
function
|
|
22893
|
+
function exportOrigin(body, exported) {
|
|
22894
|
+
const stars = [];
|
|
22884
22895
|
for (const st of body) {
|
|
22896
|
+
if (st.type === "ExportAllDeclaration") {
|
|
22897
|
+
const from = st.source?.value;
|
|
22898
|
+
if (st.exported == null && from !== void 0) stars.push(from);
|
|
22899
|
+
continue;
|
|
22900
|
+
}
|
|
22885
22901
|
if (st.type !== "ExportNamedDeclaration") continue;
|
|
22902
|
+
const decl = st.declaration;
|
|
22903
|
+
if (decl != null) {
|
|
22904
|
+
const ids = decl.type === "VariableDeclaration" ? (decl.declarations ?? []).map((d) => d.id?.name) : [decl.id?.name];
|
|
22905
|
+
if (ids.includes(exported)) return "local";
|
|
22906
|
+
}
|
|
22886
22907
|
for (const sp of st.specifiers ?? []) {
|
|
22887
22908
|
const exp = sp.exported;
|
|
22888
22909
|
if ((exp?.name ?? exp?.value) !== exported) continue;
|
|
22889
22910
|
const local = sp.local;
|
|
22890
22911
|
const name = local?.name ?? local?.value;
|
|
22891
|
-
if (name === void 0) return
|
|
22912
|
+
if (name === void 0) return "local";
|
|
22892
22913
|
const from = st.source?.value;
|
|
22893
|
-
|
|
22914
|
+
if (from !== void 0) return { from, imported: name };
|
|
22915
|
+
const imported = extractImportBindings(body).get(name);
|
|
22916
|
+
return imported === void 0 ? "local" : { from: imported.source, imported: imported.imported };
|
|
22917
|
+
}
|
|
22918
|
+
}
|
|
22919
|
+
return { stars };
|
|
22920
|
+
}
|
|
22921
|
+
async function followCarried(sinks, moduleId, name, depth = 0) {
|
|
22922
|
+
if (depth > 64) return void 0;
|
|
22923
|
+
const own = sinks.get(moduleId)?.get(name);
|
|
22924
|
+
if (own !== void 0) return { items: own, recorder: moduleId };
|
|
22925
|
+
const code = this.getModuleInfo(moduleId)?.code;
|
|
22926
|
+
if (!code) return void 0;
|
|
22927
|
+
const parsed = parseSync5(moduleId, code);
|
|
22928
|
+
if (parsed.errors.length > 0) return void 0;
|
|
22929
|
+
const origin = exportOrigin(parsed.program.body, name);
|
|
22930
|
+
if (origin === "local") return null;
|
|
22931
|
+
const follow = async (source, imported) => {
|
|
22932
|
+
const resolved = await this.resolve(source, moduleId);
|
|
22933
|
+
if (resolved === null || resolved.external) return void 0;
|
|
22934
|
+
return followCarried.call(this, sinks, resolved.id, imported, depth + 1);
|
|
22935
|
+
};
|
|
22936
|
+
if ("from" in origin) return follow(origin.from, origin.imported);
|
|
22937
|
+
let found;
|
|
22938
|
+
let unknown = false;
|
|
22939
|
+
for (const source of origin.stars) {
|
|
22940
|
+
const got = await follow(source, name);
|
|
22941
|
+
if (got === void 0) unknown = true;
|
|
22942
|
+
else if (got !== null) {
|
|
22943
|
+
if (found !== void 0 && found.items !== got.items) return null;
|
|
22944
|
+
found = got;
|
|
22894
22945
|
}
|
|
22895
22946
|
}
|
|
22896
|
-
return null;
|
|
22897
|
-
}
|
|
22898
|
-
async function followCarried(sinks, moduleId, name) {
|
|
22899
|
-
for (let hop = 0; hop < 64; hop++) {
|
|
22900
|
-
const own = sinks.get(moduleId)?.get(name);
|
|
22901
|
-
if (own !== void 0) return own;
|
|
22902
|
-
const code = this.getModuleInfo(moduleId)?.code;
|
|
22903
|
-
if (!code) return void 0;
|
|
22904
|
-
const parsed = parseSync5(moduleId, code);
|
|
22905
|
-
if (parsed.errors.length > 0) return void 0;
|
|
22906
|
-
const next = reexportSource(parsed.program.body, name);
|
|
22907
|
-
if (next === null) return void 0;
|
|
22908
|
-
const resolved = await this.resolve(next.source, moduleId);
|
|
22909
|
-
if (resolved === null || resolved.external) return void 0;
|
|
22910
|
-
moduleId = resolved.id;
|
|
22911
|
-
name = next.imported;
|
|
22912
|
-
}
|
|
22913
|
-
return void 0;
|
|
22947
|
+
return found ?? (unknown || origin.stars.length === 0 ? void 0 : null);
|
|
22914
22948
|
}
|
|
22915
22949
|
async function emitCarriedSidecars(sinks, bundle) {
|
|
22916
|
-
const
|
|
22917
|
-
|
|
22950
|
+
const write = async (rec) => {
|
|
22951
|
+
const out = [];
|
|
22952
|
+
for (const item of rec.items) {
|
|
22953
|
+
if ("ir" in item) {
|
|
22954
|
+
out.push(item);
|
|
22955
|
+
continue;
|
|
22956
|
+
}
|
|
22957
|
+
const resolved = item.expanded === void 0 ? null : await this.resolve(item.from, rec.recorder);
|
|
22958
|
+
if (resolved !== null && !resolved.external) out.push(...item.expanded);
|
|
22959
|
+
else out.push({ from: item.from, name: item.name });
|
|
22960
|
+
}
|
|
22961
|
+
return out;
|
|
22962
|
+
};
|
|
22918
22963
|
for (const chunk of Object.values(bundle)) {
|
|
22919
22964
|
if (chunk.type !== "chunk") continue;
|
|
22920
22965
|
const exports = {};
|
|
22921
22966
|
for (const name of chunk.exports ?? []) {
|
|
22922
22967
|
const followed = chunk.facadeModuleId ? await followCarried.call(this, sinks, chunk.facadeModuleId, name) : void 0;
|
|
22968
|
+
if (followed === null) continue;
|
|
22923
22969
|
if (followed !== void 0) {
|
|
22924
|
-
exports[name] = followed;
|
|
22970
|
+
exports[name] = await write(followed);
|
|
22925
22971
|
continue;
|
|
22926
22972
|
}
|
|
22927
|
-
const
|
|
22928
|
-
if (
|
|
22929
|
-
const own = ids.filter((m) => chunk.moduleIds?.includes(m));
|
|
22930
|
-
const moduleId = own.length === 1 ? own[0] : own.length === 0 && ids.length === 1 ? ids[0] : void 0;
|
|
22931
|
-
if (moduleId !== void 0) exports[name] = sinks.get(moduleId).get(name);
|
|
22973
|
+
const own = (chunk.moduleIds ?? []).filter((m) => sinks.get(m)?.has(name) === true);
|
|
22974
|
+
if (own.length === 1) exports[name] = await write({ items: sinks.get(own[0]).get(name), recorder: own[0] });
|
|
22932
22975
|
}
|
|
22933
22976
|
if (Object.keys(exports).length === 0) continue;
|
|
22934
|
-
const sidecar = {
|
|
22977
|
+
const sidecar = {
|
|
22978
|
+
parseman: PARSEMAN_VERSION,
|
|
22979
|
+
...chunk.code === void 0 ? {} : { artifact: artifactDigest(chunk.code) },
|
|
22980
|
+
exports
|
|
22981
|
+
};
|
|
22935
22982
|
this.emitFile({ type: "asset", fileName: chunk.fileName + CARRIED_SIDECAR_SUFFIX, source: JSON.stringify(sidecar) });
|
|
22936
22983
|
}
|
|
22937
22984
|
}
|
|
@@ -22939,8 +22986,11 @@ var SIDECAR_FRAMEWORKS = /* @__PURE__ */ new Set(["rollup", "rolldown", "vite"])
|
|
|
22939
22986
|
var plugin_default = createUnplugin((opts = {}, meta) => {
|
|
22940
22987
|
const sinks = SIDECAR_FRAMEWORKS.has(meta.framework) ? /* @__PURE__ */ new Map() : void 0;
|
|
22941
22988
|
const generateBundle = sinks === void 0 ? void 0 : {
|
|
22942
|
-
generateBundle
|
|
22943
|
-
|
|
22989
|
+
generateBundle: {
|
|
22990
|
+
order: "post",
|
|
22991
|
+
handler(_options, bundle) {
|
|
22992
|
+
return emitCarriedSidecars.call(this, sinks, bundle);
|
|
22993
|
+
}
|
|
22944
22994
|
}
|
|
22945
22995
|
};
|
|
22946
22996
|
return {
|
|
@@ -22954,16 +23004,14 @@ var plugin_default = createUnplugin((opts = {}, meta) => {
|
|
|
22954
23004
|
return /\.[jt]sx?$/.test(id) && !id.includes("node_modules");
|
|
22955
23005
|
},
|
|
22956
23006
|
transform(code, id) {
|
|
23007
|
+
sinks?.delete(id);
|
|
22957
23008
|
if (!code.includes("parseman")) return null;
|
|
22958
23009
|
if (!code.includes("macro")) return null;
|
|
22959
23010
|
for (const file of opts.assemblyProfile?.files ?? []) this?.addWatchFile?.(file);
|
|
22960
23011
|
const moduleAliases = /* @__PURE__ */ new Set([PARSEMAN_MODULE, ...opts.moduleAliases ?? []]);
|
|
22961
23012
|
const sink = sinks && /* @__PURE__ */ new Map();
|
|
22962
23013
|
const result = transformMacro(code, id, moduleAliases, opts.warnUnloweredRegex === true, opts.recovery === true, opts.grammarCoverage === true, opts.assemblyProfile, opts.assemblyBudget, sink);
|
|
22963
|
-
if (sinks && sink)
|
|
22964
|
-
if (sink.size > 0) sinks.set(id, sink);
|
|
22965
|
-
else sinks.delete(id);
|
|
22966
|
-
}
|
|
23014
|
+
if (sinks && sink && sink.size > 0) sinks.set(id, sink);
|
|
22967
23015
|
if (result?.warnings.length) {
|
|
22968
23016
|
for (const w of result.warnings) {
|
|
22969
23017
|
if (typeof this?.warn === "function") this.warn(`[parseman] ${w}`);
|
|
@@ -23737,7 +23785,12 @@ ${names.map((n) => ` - ${n}`).join("\n")}` : " (it is not a static combinator/v
|
|
|
23737
23785
|
unresolved.why ??= `${exportName} in ${file}: ${why}`;
|
|
23738
23786
|
return null;
|
|
23739
23787
|
};
|
|
23740
|
-
const
|
|
23788
|
+
const sidecarRead = module.source || local ? null : readCarriedSidecar(file);
|
|
23789
|
+
if (sidecarRead?.stale === true) {
|
|
23790
|
+
return fail(`${path2.basename(file)}${CARRIED_SIDECAR_SUFFIX} was written for a different build of ${path2.basename(file)} (the artifact digest it records does not match). Rebuild the package so the two are written together`);
|
|
23791
|
+
}
|
|
23792
|
+
const sidecarExports = sidecarRead?.sidecar.exports;
|
|
23793
|
+
const sidecarItems = sidecarExports !== void 0 && Object.hasOwn(sidecarExports, exportName) ? sidecarExports[exportName] : void 0;
|
|
23741
23794
|
if (sidecarItems !== void 0) {
|
|
23742
23795
|
const list = [];
|
|
23743
23796
|
for (const item of sidecarItems) {
|
|
@@ -23760,7 +23813,20 @@ ${names.map((n) => ` - ${n}`).join("\n")}` : " (it is not a static combinator/v
|
|
|
23760
23813
|
const initNode = localFor ? topLevelInit(mod.body, localFor) : null;
|
|
23761
23814
|
const literalRange = initNode ? findCarriedPiecesLiteral(initNode) : null;
|
|
23762
23815
|
if (!literalRange) {
|
|
23763
|
-
|
|
23816
|
+
if (initNode !== null && !module.source && mod.src.slice(initNode.start, initNode.end).includes("tableRules(")) {
|
|
23817
|
+
return fail(`is a compiled grammar with no carried pieces \u2014 no inline literal, and no entry in ${path2.basename(file)}${CARRIED_SIDECAR_SUFFIX}. Rebuild it with this parseman, and keep that file beside the artifact`);
|
|
23818
|
+
}
|
|
23819
|
+
if (module.source || local) return null;
|
|
23820
|
+
const origin = exportOrigin(mod.body, exportName);
|
|
23821
|
+
const targets = origin === "local" ? [] : "from" in origin ? [{ source: origin.from, imported: origin.imported }] : origin.stars.map((source) => ({ source, imported: exportName }));
|
|
23822
|
+
for (const target of targets) {
|
|
23823
|
+
const sub = resolveGrammarModule(file, target.source);
|
|
23824
|
+
if (sub === null || seen.has(sub.file)) continue;
|
|
23825
|
+
const pieces = resolveModulePieces(sub, target.imported, new Set(seen).add(sub.file), unresolved);
|
|
23826
|
+
if (pieces !== null) return pieces;
|
|
23827
|
+
}
|
|
23828
|
+
if (unresolved.why === void 0 && !mod.src.includes(TABLE_RUNTIME_SPECIFIER)) return null;
|
|
23829
|
+
return fail(`is exported by a compiled grammar artifact, but no carried pieces could be found for it \u2014 no inline literal, no entry in ${path2.basename(file)}${CARRIED_SIDECAR_SUFFIX}, and no re-export of it that has either. Rebuild it with this parseman, and keep each chunk's .parseman.json beside it`);
|
|
23764
23830
|
}
|
|
23765
23831
|
const literal2 = mod.src.slice(literalRange.start, literalRange.end);
|
|
23766
23832
|
const imports = extractImportBindings(mod.body);
|
|
@@ -23822,7 +23888,8 @@ ${names.map((n) => ` - ${n}`).join("\n")}` : " (it is not a static combinator/v
|
|
|
23822
23888
|
const b = importBindings.get(it.__spreadLocal);
|
|
23823
23889
|
if (b === void 0) return false;
|
|
23824
23890
|
if (!b.source.startsWith(".") && !path2.isAbsolute(b.source)) {
|
|
23825
|
-
|
|
23891
|
+
const expanded = importedPieces(it.__spreadLocal);
|
|
23892
|
+
out.push({ from: b.source, name: b.imported, ...expanded === null ? {} : { expanded } });
|
|
23826
23893
|
continue;
|
|
23827
23894
|
}
|
|
23828
23895
|
const pieces = importedPieces(it.__spreadLocal);
|
|
@@ -24567,6 +24634,7 @@ ${lines2.join("\n")}`);
|
|
|
24567
24634
|
}
|
|
24568
24635
|
export {
|
|
24569
24636
|
CARRIED_SIDECAR_SUFFIX,
|
|
24637
|
+
artifactDigest,
|
|
24570
24638
|
plugin_default as default,
|
|
24571
24639
|
transformMacro
|
|
24572
24640
|
};
|