parseman 0.60.1 → 0.60.3
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/commitment.d.ts +1 -1
- package/dist/analysis/commitment.d.ts.map +1 -1
- package/dist/analysis/diagnostics.js +128 -43
- package/dist/analysis/diagnostics.js.map +2 -2
- package/dist/cli/index.js +128 -43
- package/dist/cli/index.js.map +2 -2
- package/dist/index.js +128 -43
- package/dist/index.js.map +2 -2
- package/dist/plugin/index.d.ts +18 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +240 -87
- package/dist/plugin/index.js.map +2 -2
- package/dist/table/assemble.d.ts +11 -0
- package/dist/table/assemble.d.ts.map +1 -1
- package/dist/table/emit-assembly.d.ts +1 -0
- package/dist/table/emit-assembly.d.ts.map +1 -1
- package/dist/table/encode.d.ts.map +1 -1
- package/dist/table/exec.d.ts.map +1 -1
- package/dist/table/index.js +128 -43
- package/dist/table/index.js.map +2 -2
- package/dist/table/program.d.ts +9 -0
- package/dist/table/program.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/analysis/commitment.ts +29 -15
- package/src/plugin/index.ts +189 -63
- package/src/table/assemble.ts +35 -10
- package/src/table/emit-assembly.ts +41 -11
- package/src/table/encode.ts +57 -9
- package/src/table/exec.ts +5 -2
- package/src/table/program.ts +19 -0
- package/src/version.ts +1 -1
package/dist/table/program.d.ts
CHANGED
|
@@ -448,6 +448,8 @@ export declare function ownTableProgram(prog: TableProgram, resolved?: ResolvedT
|
|
|
448
448
|
readonly choiceRollbackMasks?: ReadonlyMap<number, number>;
|
|
449
449
|
readonly failureRollbackCleanSites?: ReadonlySet<number>;
|
|
450
450
|
readonly nonCommittingChoiceSites?: ReadonlySet<number>;
|
|
451
|
+
readonly choiceLogRollbackMasks?: ReadonlyMap<number, number>;
|
|
452
|
+
readonly failureLogRollbackSites?: ReadonlySet<number>;
|
|
451
453
|
}): TableProgram;
|
|
452
454
|
/** Compiler-only choice rollback authority, consumed while printing a static
|
|
453
455
|
* assembly and never serialized into the shipped table. */
|
|
@@ -459,6 +461,13 @@ export declare function choiceCannotCommit(prog: TableProgram, ip: number): bool
|
|
|
459
461
|
* capture, trivia, field, or error sink. Static assembly consumes it to omit the
|
|
460
462
|
* enclosing mark and rollback; it is never serialized into the shipped table. */
|
|
461
463
|
export declare function failureRollbackClean(prog: TableProgram, ip: number): boolean;
|
|
464
|
+
/** The arms of the choice at `ip` the census counts as clean whose failure can
|
|
465
|
+
* still leave trivia-log rows: a node they reach fails after recording trivia
|
|
466
|
+
* (`encode.ts` `choiceLogRollbackMasks`). Zero without that authority. */
|
|
467
|
+
export declare function choiceLogRollbackMask(prog: TableProgram, ip: number): number;
|
|
468
|
+
/** An `optional()` or `attempt()` row `failureRollbackClean` admits whose failed
|
|
469
|
+
* child can still leave trivia-log rows, for the same reason. */
|
|
470
|
+
export declare function failureLogRollback(prog: TableProgram, ip: number): boolean;
|
|
462
471
|
/** A compiled entry, shaped exactly like a codegen rule function. */
|
|
463
472
|
export type TableRule = (input: string, pos: number, ctx: ParseContext) => ParseResult<unknown>;
|
|
464
473
|
/** Encode consecutive `[lo, hi]` code-point pairs without truncating astral endpoints. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/table/program.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAExE,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAKzF,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAA0B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE/E;;;;;;;;;;;;;GAa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AK,WAAW,GAAG,KAAK,CAAA;AACxB,KAAK,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AAC1G,KAAK,WAAW,CAAC,CAAC,SAAS,KAAK,IAAI,CAAC,CAAA;AACrC,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,YAAY,EAAE,cAAc,CAAC,CAAC,CAAA;AAErF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,EAChD,QAAQ,EAAE,MAAM,GACf,aAAa,CAwEf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CA6B/E;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAWnE"}
|
package/dist/version.d.ts
CHANGED
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* Kept in sync with `package.json` by `test/unit/version-sync.test.ts`, which fails
|
|
14
14
|
* the build if this constant drifts from the published version.
|
|
15
15
|
*/
|
|
16
|
-
export declare const PARSEMAN_VERSION = "0.60.
|
|
16
|
+
export declare const PARSEMAN_VERSION = "0.60.3";
|
|
17
17
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -186,7 +186,10 @@ export function alwaysConsumes(p: Combinator<unknown>, seen: Set<Combinator<unkn
|
|
|
186
186
|
* internally. optional/many never "fail" with partial output. Delegating
|
|
187
187
|
* wrappers (transform/label/grammar/withCtx/expect) pass through to inner.
|
|
188
188
|
*/
|
|
189
|
-
export function mayLeavePartialCapture(
|
|
189
|
+
export function mayLeavePartialCapture(
|
|
190
|
+
p: Combinator<unknown>, seen: Set<Combinator<unknown>> = new Set(), triviaActive = true,
|
|
191
|
+
throughNodes: boolean | ((choice: Combinator<unknown>) => boolean) = false,
|
|
192
|
+
): boolean {
|
|
190
193
|
if (seen.has(p)) return false
|
|
191
194
|
seen.add(p)
|
|
192
195
|
const d = p._def
|
|
@@ -211,15 +214,26 @@ export function mayLeavePartialCapture(p: Combinator<unknown>, seen: Set<Combina
|
|
|
211
214
|
return false
|
|
212
215
|
// A run's prefixes are probed detached; only its body can capture.
|
|
213
216
|
case 'lines':
|
|
214
|
-
return mayLeavePartialCapture(d.body, seen, triviaActive)
|
|
215
|
-
// node() captures into its own
|
|
216
|
-
// failure
|
|
217
|
+
return mayLeavePartialCapture(d.body, seen, triviaActive, throughNodes)
|
|
218
|
+
// node() captures its children into a frame of its own and drops it on
|
|
219
|
+
// failure. The trivia logs (`_triviaLog`, `_rootTriviaLog`) are not part of
|
|
220
|
+
// that frame: trivia its body scanned before failing stays recorded. With
|
|
221
|
+
// `throughNodes` (a program that installs trivia somewhere) a node leaves
|
|
222
|
+
// what its body leaves; without, it leaves nothing.
|
|
217
223
|
case 'node':
|
|
218
|
-
return
|
|
219
|
-
// choice/firstMatch already roll back each failed arm; on overall
|
|
220
|
-
// nothing committed remains.
|
|
224
|
+
return throughNodes && mayLeavePartialCapture(d.parser, seen, triviaActive, throughNodes)
|
|
225
|
+
// choice/firstMatch already roll back each failed arm's captures; on overall
|
|
226
|
+
// failure nothing committed remains. The trivia logs are the exception: a
|
|
227
|
+
// choice the table lowers as an exclusive dispatch runs its one selected arm
|
|
228
|
+
// with no mark of its own (`emit-assembly.ts`, `table.exclusive`), so the
|
|
229
|
+
// rows that arm's trivia scans recorded stay when it fails. With
|
|
230
|
+
// `throughNodes` a choice leaves what one of its arms leaves, unless
|
|
231
|
+
// `throughNodes` is the encoder's answer that this choice marks and restores
|
|
232
|
+
// each arm it enters.
|
|
221
233
|
case 'choice':
|
|
222
|
-
return false
|
|
234
|
+
return throughNodes !== false
|
|
235
|
+
&& !(typeof throughNodes === 'function' && throughNodes(p))
|
|
236
|
+
&& d.parsers.some(arm => mayLeavePartialCapture(arm, new Set(seen), triviaActive, throughNodes))
|
|
223
237
|
case 'dispatch':
|
|
224
238
|
// These are independent graph predicates. Sharing one mutable `seen` set
|
|
225
239
|
// between them made the first walk hide the arm from the second: an atomic
|
|
@@ -228,9 +242,9 @@ export function mayLeavePartialCapture(p: Combinator<unknown>, seen: Set<Combina
|
|
|
228
242
|
// Fork the ancestor set for each proof so cycle protection remains, while
|
|
229
243
|
// one proof cannot erase evidence needed by another.
|
|
230
244
|
return capturesLeaf(d.selector, new Set(seen)) ||
|
|
231
|
-
d.cases.some(x => mayLeavePartialCapture(x.parser, new Set(seen), triviaActive) || capturesLeaf(x.parser, new Set(seen))) ||
|
|
232
|
-
(d.matchers ? d.matchers.some(x => mayLeavePartialCapture(x.parser, new Set(seen), triviaActive) || capturesLeaf(x.parser, new Set(seen))) : false) ||
|
|
233
|
-
(d.otherwise ? mayLeavePartialCapture(d.otherwise, new Set(seen), triviaActive) || capturesLeaf(d.otherwise, new Set(seen)) : false)
|
|
245
|
+
d.cases.some(x => mayLeavePartialCapture(x.parser, new Set(seen), triviaActive, throughNodes) || capturesLeaf(x.parser, new Set(seen))) ||
|
|
246
|
+
(d.matchers ? d.matchers.some(x => mayLeavePartialCapture(x.parser, new Set(seen), triviaActive, throughNodes) || capturesLeaf(x.parser, new Set(seen))) : false) ||
|
|
247
|
+
(d.otherwise ? mayLeavePartialCapture(d.otherwise, new Set(seen), triviaActive, throughNodes) || capturesLeaf(d.otherwise, new Set(seen)) : false)
|
|
234
248
|
case 'attempt':
|
|
235
249
|
return false
|
|
236
250
|
// optional never fails; many/oneOrMore only "fail" with zero captured items.
|
|
@@ -272,7 +286,7 @@ export function mayLeavePartialCapture(p: Combinator<unknown>, seen: Set<Combina
|
|
|
272
286
|
const part = parts[i]!
|
|
273
287
|
if (i > 0 && triviaActive) captured = true
|
|
274
288
|
if (captured && mayFail(part)) return true
|
|
275
|
-
if (mayLeavePartialCapture(part, seen, triviaActive)) return true
|
|
289
|
+
if (mayLeavePartialCapture(part, seen, triviaActive, throughNodes)) return true
|
|
276
290
|
if (capturesLeaf(part) || hasNodeDef(part)) captured = true
|
|
277
291
|
}
|
|
278
292
|
return false
|
|
@@ -284,11 +298,11 @@ export function mayLeavePartialCapture(p: Combinator<unknown>, seen: Set<Combina
|
|
|
284
298
|
case 'expect':
|
|
285
299
|
case 'withCtx':
|
|
286
300
|
case 'grammar':
|
|
287
|
-
return mayLeavePartialCapture(d.parser, seen, triviaActive)
|
|
301
|
+
return mayLeavePartialCapture(d.parser, seen, triviaActive, throughNodes)
|
|
288
302
|
case 'recover':
|
|
289
|
-
return mayLeavePartialCapture(d.parser, seen, triviaActive)
|
|
303
|
+
return mayLeavePartialCapture(d.parser, seen, triviaActive, throughNodes)
|
|
290
304
|
case 'lazy': {
|
|
291
|
-
try { return mayLeavePartialCapture(d.thunk(), seen, triviaActive) } catch { return true }
|
|
305
|
+
try { return mayLeavePartialCapture(d.thunk(), seen, triviaActive, throughNodes) } catch { return true }
|
|
292
306
|
}
|
|
293
307
|
// Unknown shapes: be safe and keep the rollback.
|
|
294
308
|
default:
|
package/src/plugin/index.ts
CHANGED
|
@@ -83,29 +83,60 @@ const TABLE_RUNTIME_SPECIFIER = 'parseman/table'
|
|
|
83
83
|
* from the artifact's own location.
|
|
84
84
|
*/
|
|
85
85
|
export type CarriedSidecarItem = IRPiece | { from: string; name: string }
|
|
86
|
+
/**
|
|
87
|
+
* A recorded item: a reference also carries the pieces it stands for, expanded, so a
|
|
88
|
+
* build that BUNDLES the referenced package rather than keeping it external writes
|
|
89
|
+
* those pieces instead of a reference to a package its artifact no longer imports
|
|
90
|
+
* (`emitCarriedSidecars`).
|
|
91
|
+
*/
|
|
92
|
+
export type CarriedSinkItem = IRPiece | { from: string; name: string; expanded?: readonly CarriedSidecarItem[] }
|
|
86
93
|
/** One module's carried lists, by export name. */
|
|
87
|
-
export type CarriedSink = Map<string,
|
|
94
|
+
export type CarriedSink = Map<string, CarriedSinkItem[]>
|
|
88
95
|
export const CARRIED_SIDECAR_SUFFIX = '.parseman.json'
|
|
89
|
-
|
|
96
|
+
/**
|
|
97
|
+
* `artifact` is `artifactDigest` of the chunk the sidecar was written beside. A
|
|
98
|
+
* reader that finds a different artifact there is reading a sidecar some other
|
|
99
|
+
* build left behind, and fails. A sidecar without one predates the check.
|
|
100
|
+
*/
|
|
101
|
+
type CarriedSidecar = { parseman: string; artifact?: string; exports: Record<string, CarriedSidecarItem[]> }
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The digest a sidecar records of its artifact: SHA-256 of the chunk's code, less a
|
|
105
|
+
* trailing `sourceMappingURL` comment, which a bundler appends after the hook that
|
|
106
|
+
* writes the sidecar has seen the code.
|
|
107
|
+
*/
|
|
108
|
+
export function artifactDigest(code: string): string {
|
|
109
|
+
const body = code.replace(/\n?\/\/# sourceMappingURL=[^\n]*\n?$/, '')
|
|
110
|
+
return createHash('sha256').update(body).digest('hex').slice(0, 32)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
type SidecarRead = { sidecar: CarriedSidecar; stale: boolean } | null
|
|
114
|
+
const _sidecarCache = new Map<string, { mtimeMs: number; artifactMtimeMs: number; read: SidecarRead }>()
|
|
115
|
+
/**
|
|
116
|
+
* The carried-pieces sidecar written beside a compiled artifact, or null; `stale`
|
|
117
|
+
* when it records a digest the artifact beside it does not have.
|
|
118
|
+
*/
|
|
119
|
+
function readCarriedSidecar(artifact: string): SidecarRead {
|
|
94
120
|
const file = artifact + CARRIED_SIDECAR_SUFFIX
|
|
95
121
|
let mtimeMs: number
|
|
96
|
-
|
|
122
|
+
let artifactMtimeMs: number
|
|
123
|
+
try { mtimeMs = fs.statSync(file).mtimeMs; artifactMtimeMs = fs.statSync(artifact).mtimeMs } catch { return null }
|
|
97
124
|
const hit = _sidecarCache.get(file)
|
|
98
|
-
if (hit && hit.mtimeMs === mtimeMs) return hit.
|
|
99
|
-
let
|
|
125
|
+
if (hit && hit.mtimeMs === mtimeMs && hit.artifactMtimeMs === artifactMtimeMs) return hit.read
|
|
126
|
+
let read: SidecarRead = null
|
|
100
127
|
try {
|
|
101
128
|
// A file without an `exports` object is not a sidecar this plugin wrote: treat
|
|
102
129
|
// it as absent, so the inline literal is looked for and a missing one reports.
|
|
103
130
|
const parsed: unknown = JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
104
131
|
const exports = typeof parsed === 'object' && parsed !== null ? (parsed as { exports?: unknown }).exports : undefined
|
|
105
|
-
if (typeof exports === 'object' && exports !== null)
|
|
132
|
+
if (typeof exports === 'object' && exports !== null) {
|
|
133
|
+
const sidecar = parsed as CarriedSidecar
|
|
134
|
+
const stale = typeof sidecar.artifact === 'string' && sidecar.artifact !== artifactDigest(fs.readFileSync(artifact, 'utf8'))
|
|
135
|
+
read = { sidecar, stale }
|
|
136
|
+
}
|
|
106
137
|
} catch { /* unreadable: no sidecar */ }
|
|
107
|
-
_sidecarCache.set(file, { mtimeMs,
|
|
108
|
-
return
|
|
138
|
+
_sidecarCache.set(file, { mtimeMs, artifactMtimeMs, read })
|
|
139
|
+
return read
|
|
109
140
|
}
|
|
110
141
|
|
|
111
142
|
export type ParsecraftPluginOptions = {
|
|
@@ -360,7 +391,9 @@ function parseModuleCached(filePath: string): ParsedModule | null {
|
|
|
360
391
|
}
|
|
361
392
|
|
|
362
393
|
/** The rollup-family hook that writes each chunk's carried pieces beside it. */
|
|
363
|
-
type SidecarBundle = Record<string, { type: string; fileName: string; exports?: string[]; moduleIds?: string[]; facadeModuleId?: string | null }>
|
|
394
|
+
type SidecarBundle = Record<string, { type: string; fileName: string; code?: string; exports?: string[]; moduleIds?: string[]; facadeModuleId?: string | null }>
|
|
395
|
+
/** A module's recorded list for one export, and the module that recorded it. */
|
|
396
|
+
type Recorded = { readonly items: readonly CarriedSinkItem[]; readonly recorder: string }
|
|
364
397
|
type SidecarEmitter = {
|
|
365
398
|
emitFile: (file: { type: 'asset'; fileName: string; source: string }) => unknown
|
|
366
399
|
getModuleInfo: (id: string) => { code: string | null } | null
|
|
@@ -368,77 +401,131 @@ type SidecarEmitter = {
|
|
|
368
401
|
}
|
|
369
402
|
|
|
370
403
|
/**
|
|
371
|
-
* Where a module's export `exported` comes from
|
|
372
|
-
*
|
|
373
|
-
*
|
|
404
|
+
* Where a module's export `exported` comes from: a re-export, possibly renamed
|
|
405
|
+
* (`export { base as renamed } from './grammar'`, or an imported binding exported
|
|
406
|
+
* under another name); the module's own declaration (`'local'`); or, when the
|
|
407
|
+
* module neither declares nor names it, its `export * from` sources, in source
|
|
408
|
+
* order (none: a form this does not read, such as `export default`).
|
|
374
409
|
*/
|
|
375
|
-
|
|
410
|
+
type ExportOrigin = { readonly from: string; readonly imported: string } | { readonly stars: readonly string[] } | 'local'
|
|
411
|
+
|
|
412
|
+
function exportOrigin(body: AnyNode[], exported: string): ExportOrigin {
|
|
413
|
+
const stars: string[] = []
|
|
376
414
|
for (const st of body) {
|
|
415
|
+
if (st.type === 'ExportAllDeclaration') {
|
|
416
|
+
const from = (st.source as { value?: string } | null | undefined)?.value
|
|
417
|
+
if (st.exported == null && from !== undefined) stars.push(from)
|
|
418
|
+
continue
|
|
419
|
+
}
|
|
377
420
|
if (st.type !== 'ExportNamedDeclaration') continue
|
|
421
|
+
const decl = st.declaration as AnyNode | null | undefined
|
|
422
|
+
if (decl != null) {
|
|
423
|
+
const ids = decl.type === 'VariableDeclaration'
|
|
424
|
+
? ((decl.declarations as AnyNode[] | undefined) ?? []).map(d => (d.id as { name?: string } | undefined)?.name)
|
|
425
|
+
: [(decl.id as { name?: string } | null | undefined)?.name]
|
|
426
|
+
if (ids.includes(exported)) return 'local'
|
|
427
|
+
}
|
|
378
428
|
for (const sp of (st.specifiers as AnyNode[] | undefined) ?? []) {
|
|
379
429
|
const exp = sp.exported as { name?: string; value?: string } | undefined
|
|
380
430
|
if ((exp?.name ?? exp?.value) !== exported) continue
|
|
381
431
|
const local = sp.local as { name?: string; value?: string } | undefined
|
|
382
432
|
const name = local?.name ?? local?.value
|
|
383
|
-
if (name === undefined) return
|
|
433
|
+
if (name === undefined) return 'local'
|
|
384
434
|
const from = (st.source as { value?: string } | null | undefined)?.value
|
|
385
|
-
|
|
435
|
+
if (from !== undefined) return { from, imported: name }
|
|
436
|
+
const imported = extractImportBindings(body).get(name)
|
|
437
|
+
return imported === undefined ? 'local' : { from: imported.source, imported: imported.imported }
|
|
386
438
|
}
|
|
387
439
|
}
|
|
388
|
-
return
|
|
440
|
+
return { stars }
|
|
389
441
|
}
|
|
390
442
|
|
|
391
443
|
/**
|
|
392
444
|
* The carried list behind an entry chunk's export, followed from the entry module
|
|
393
|
-
* through its re-exports to the module that
|
|
394
|
-
* exports it as. A chunk's export names are its entry
|
|
395
|
-
* renames a grammar (`export { base as renamed } from
|
|
396
|
-
* pieces recorded as `base`.
|
|
445
|
+
* through its re-exports (named or `export *`) to the module that declares it,
|
|
446
|
+
* under the name that module exports it as. A chunk's export names are its entry
|
|
447
|
+
* module's, so an entry that renames a grammar (`export { base as renamed } from
|
|
448
|
+
* './grammar'`) still finds the pieces recorded as `base`.
|
|
449
|
+
*
|
|
450
|
+
* `null` when the export is traced to a module that recorded nothing under that
|
|
451
|
+
* name — a precompiled dependency, or a value that is not a grammar: it has no
|
|
452
|
+
* carried pieces, and no other module's may stand in for them. `undefined` when
|
|
453
|
+
* the trace cannot be completed (no module code, an external, a parse error).
|
|
397
454
|
*/
|
|
398
|
-
async function followCarried(
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
455
|
+
async function followCarried(
|
|
456
|
+
this: SidecarEmitter, sinks: Map<string, CarriedSink>, moduleId: string, name: string, depth = 0,
|
|
457
|
+
): Promise<Recorded | null | undefined> {
|
|
458
|
+
if (depth > 64) return undefined
|
|
459
|
+
const own = sinks.get(moduleId)?.get(name)
|
|
460
|
+
if (own !== undefined) return { items: own, recorder: moduleId }
|
|
461
|
+
const code = this.getModuleInfo(moduleId)?.code
|
|
462
|
+
if (!code) return undefined
|
|
463
|
+
const parsed = parseSync(moduleId, code)
|
|
464
|
+
if (parsed.errors.length > 0) return undefined
|
|
465
|
+
const origin = exportOrigin(parsed.program.body as unknown as AnyNode[], name)
|
|
466
|
+
if (origin === 'local') return null
|
|
467
|
+
const follow = async (source: string, imported: string): Promise<Recorded | null | undefined> => {
|
|
468
|
+
const resolved = await this.resolve(source, moduleId)
|
|
409
469
|
if (resolved === null || resolved.external) return undefined
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
470
|
+
return followCarried.call(this, sinks, resolved.id, imported, depth + 1)
|
|
471
|
+
}
|
|
472
|
+
if ('from' in origin) return follow(origin.from, origin.imported)
|
|
473
|
+
// `export *` re-exports a name only from the one star source that has it; two
|
|
474
|
+
// that reach different declarations make it ambiguous, and ESM exports neither.
|
|
475
|
+
// Two paths to the same declaration are one binding.
|
|
476
|
+
let found: Recorded | undefined
|
|
477
|
+
let unknown = false
|
|
478
|
+
for (const source of origin.stars) {
|
|
479
|
+
const got = await follow(source, name)
|
|
480
|
+
if (got === undefined) unknown = true
|
|
481
|
+
else if (got !== null) {
|
|
482
|
+
if (found !== undefined && found.items !== got.items) return null
|
|
483
|
+
found = got
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return found ?? (unknown || origin.stars.length === 0 ? undefined : null)
|
|
414
487
|
}
|
|
415
488
|
|
|
416
489
|
/**
|
|
417
490
|
* Write `<chunk>.parseman.json` for every chunk that exports a grammar with carried
|
|
418
491
|
* pieces. An entry chunk's export is followed from its entry module to the module
|
|
419
|
-
* that
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* and
|
|
423
|
-
* artifact.
|
|
492
|
+
* that declares it (`followCarried`). An export that cannot be followed is matched
|
|
493
|
+
* by name to the one module of the chunk itself that recorded it. Nothing else is
|
|
494
|
+
* written: a module outside the chunk recording the same name is not the export's
|
|
495
|
+
* source, and a downstream compose of an export with no pieces fails its build
|
|
496
|
+
* naming the artifact.
|
|
424
497
|
*/
|
|
425
498
|
async function emitCarriedSidecars(this: SidecarEmitter, sinks: Map<string, CarriedSink>, bundle: SidecarBundle): Promise<void> {
|
|
426
|
-
|
|
427
|
-
|
|
499
|
+
// A reference names an export of another package, resolved from the artifact's
|
|
500
|
+
// location. That holds only where this build keeps the package EXTERNAL; a
|
|
501
|
+
// bundled one is in the chunk and may be missing, or a different version,
|
|
502
|
+
// wherever the artifact is composed. So a bundled reference is written expanded.
|
|
503
|
+
const write = async (rec: Recorded): Promise<CarriedSidecarItem[]> => {
|
|
504
|
+
const out: CarriedSidecarItem[] = []
|
|
505
|
+
for (const item of rec.items) {
|
|
506
|
+
if ('ir' in item) { out.push(item); continue }
|
|
507
|
+
const resolved = item.expanded === undefined ? null : await this.resolve(item.from, rec.recorder)
|
|
508
|
+
if (resolved !== null && !resolved.external) out.push(...item.expanded!)
|
|
509
|
+
else out.push({ from: item.from, name: item.name })
|
|
510
|
+
}
|
|
511
|
+
return out
|
|
512
|
+
}
|
|
428
513
|
for (const chunk of Object.values(bundle)) {
|
|
429
514
|
if (chunk.type !== 'chunk') continue
|
|
430
515
|
const exports: Record<string, CarriedSidecarItem[]> = {}
|
|
431
516
|
for (const name of chunk.exports ?? []) {
|
|
432
517
|
const followed = chunk.facadeModuleId ? await followCarried.call(this, sinks, chunk.facadeModuleId, name) : undefined
|
|
433
|
-
if (followed
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
const moduleId = own.length === 1 ? own[0] : own.length === 0 && ids.length === 1 ? ids[0] : undefined
|
|
438
|
-
if (moduleId !== undefined) exports[name] = sinks.get(moduleId)!.get(name)!
|
|
518
|
+
if (followed === null) continue
|
|
519
|
+
if (followed !== undefined) { exports[name] = await write(followed); continue }
|
|
520
|
+
const own = (chunk.moduleIds ?? []).filter(m => sinks.get(m)?.has(name) === true)
|
|
521
|
+
if (own.length === 1) exports[name] = await write({ items: sinks.get(own[0]!)!.get(name)!, recorder: own[0]! })
|
|
439
522
|
}
|
|
440
523
|
if (Object.keys(exports).length === 0) continue
|
|
441
|
-
const sidecar: CarriedSidecar = {
|
|
524
|
+
const sidecar: CarriedSidecar = {
|
|
525
|
+
parseman: PARSEMAN_VERSION,
|
|
526
|
+
...(chunk.code === undefined ? {} : { artifact: artifactDigest(chunk.code) }),
|
|
527
|
+
exports,
|
|
528
|
+
}
|
|
442
529
|
this.emitFile({ type: 'asset', fileName: chunk.fileName + CARRIED_SIDECAR_SUFFIX, source: JSON.stringify(sidecar) })
|
|
443
530
|
}
|
|
444
531
|
}
|
|
@@ -449,8 +536,14 @@ export default createUnplugin((opts: ParsecraftPluginOptions = {}, meta) => {
|
|
|
449
536
|
// Module id → its carried lists, under a bundler that writes them beside the chunk.
|
|
450
537
|
// Any other bundler gets them inline, as before.
|
|
451
538
|
const sinks = SIDECAR_FRAMEWORKS.has(meta.framework) ? new Map<string, CarriedSink>() : undefined
|
|
539
|
+
// `order: 'post'`: the sidecar records a digest of each chunk's code, so it is
|
|
540
|
+
// taken after every other plugin's `generateBundle` has rewritten that code (Vite
|
|
541
|
+
// rewrites a dynamic `import()` through its preload helper there).
|
|
452
542
|
const generateBundle = sinks === undefined ? undefined : {
|
|
453
|
-
generateBundle
|
|
543
|
+
generateBundle: {
|
|
544
|
+
order: 'post' as const,
|
|
545
|
+
handler(this: SidecarEmitter, _options: unknown, bundle: SidecarBundle) { return emitCarriedSidecars.call(this, sinks, bundle) },
|
|
546
|
+
},
|
|
454
547
|
}
|
|
455
548
|
return {
|
|
456
549
|
name: 'parseman',
|
|
@@ -465,6 +558,9 @@ export default createUnplugin((opts: ParsecraftPluginOptions = {}, meta) => {
|
|
|
465
558
|
},
|
|
466
559
|
|
|
467
560
|
transform(this: { warn?: (msg: string) => void; addWatchFile?: (file: string) => void }, code: string, id: string) {
|
|
561
|
+
// What this module recorded on an earlier build of a watch session is stale
|
|
562
|
+
// from here: it records again below, or it no longer lowers anything.
|
|
563
|
+
sinks?.delete(id)
|
|
468
564
|
if (!code.includes('parseman')) return null
|
|
469
565
|
if (!code.includes('macro')) return null
|
|
470
566
|
// A corpus edit changes which sites a profiled build generates, so a watch
|
|
@@ -473,10 +569,7 @@ export default createUnplugin((opts: ParsecraftPluginOptions = {}, meta) => {
|
|
|
473
569
|
const moduleAliases = new Set([PARSEMAN_MODULE, ...(opts.moduleAliases ?? [])])
|
|
474
570
|
const sink: CarriedSink | undefined = sinks && new Map()
|
|
475
571
|
const result = transformMacro(code, id, moduleAliases, opts.warnUnloweredRegex === true, opts.recovery === true, opts.grammarCoverage === true, opts.assemblyProfile, opts.assemblyBudget, sink)
|
|
476
|
-
if (sinks && sink)
|
|
477
|
-
if (sink.size > 0) sinks.set(id, sink)
|
|
478
|
-
else sinks.delete(id)
|
|
479
|
-
}
|
|
572
|
+
if (sinks && sink && sink.size > 0) sinks.set(id, sink)
|
|
480
573
|
if (result?.warnings.length) {
|
|
481
574
|
for (const w of result.warnings) {
|
|
482
575
|
if (typeof this?.warn === 'function') this.warn(`[parseman] ${w}`)
|
|
@@ -1797,7 +1890,13 @@ function transformMacroImpl(
|
|
|
1797
1890
|
const fail = (why: string): null => { unresolved.why ??= `${exportName} in ${file}: ${why}`; return null }
|
|
1798
1891
|
// A build-only sidecar wins over an inline literal: an artifact that has one
|
|
1799
1892
|
// carries no literal (see `CarriedSidecarItem`).
|
|
1800
|
-
const
|
|
1893
|
+
const sidecarRead = module.source || local ? null : readCarriedSidecar(file)
|
|
1894
|
+
if (sidecarRead?.stale === true) {
|
|
1895
|
+
return fail(`${path.basename(file)}${CARRIED_SIDECAR_SUFFIX} was written for a different build of ${path.basename(file)} `
|
|
1896
|
+
+ '(the artifact digest it records does not match). Rebuild the package so the two are written together')
|
|
1897
|
+
}
|
|
1898
|
+
const sidecarExports = sidecarRead?.sidecar.exports
|
|
1899
|
+
const sidecarItems = sidecarExports !== undefined && Object.hasOwn(sidecarExports, exportName) ? sidecarExports[exportName] : undefined
|
|
1801
1900
|
if (sidecarItems !== undefined) {
|
|
1802
1901
|
const list: RawItem[] = []
|
|
1803
1902
|
for (const item of sidecarItems) {
|
|
@@ -1821,10 +1920,32 @@ function transformMacroImpl(
|
|
|
1821
1920
|
if (!literalRange) {
|
|
1822
1921
|
// A compiled grammar with neither a literal nor a sidecar entry was built to be
|
|
1823
1922
|
// composed or it was not, and a runtime compose() cannot link it either way.
|
|
1824
|
-
|
|
1825
|
-
|
|
1923
|
+
if (initNode !== null && !module.source && mod.src.slice(initNode.start, initNode.end).includes('tableRules(')) {
|
|
1924
|
+
return fail(`is a compiled grammar with no carried pieces — no inline literal, and no entry in ${path.basename(file)}${CARRIED_SIDECAR_SUFFIX}. `
|
|
1826
1925
|
+ 'Rebuild it with this parseman, and keep that file beside the artifact')
|
|
1827
|
-
|
|
1926
|
+
}
|
|
1927
|
+
// A COMPILED ARTIFACT RE-EXPORTING ITS GRAMMAR — a bundler's facade chunk,
|
|
1928
|
+
// `import { t as grammar } from './shared-HASH.js'; export { grammar }`, or an
|
|
1929
|
+
// `export *` entry. Follow the export to the module that declares it. A
|
|
1930
|
+
// compiled artifact whose export cannot be followed to carried pieces fails
|
|
1931
|
+
// the build: falling back to a runtime compose() of it would throw at import.
|
|
1932
|
+
if (module.source || local) return null
|
|
1933
|
+
const origin = exportOrigin(mod.body as AnyNode[], exportName)
|
|
1934
|
+
const targets = origin === 'local' ? [] : 'from' in origin
|
|
1935
|
+
? [{ source: origin.from, imported: origin.imported }]
|
|
1936
|
+
: origin.stars.map(source => ({ source, imported: exportName }))
|
|
1937
|
+
for (const target of targets) {
|
|
1938
|
+
const sub = resolveGrammarModule(file, target.source)
|
|
1939
|
+
if (sub === null || seen.has(sub.file)) continue
|
|
1940
|
+
const pieces = resolveModulePieces(sub, target.imported, new Set(seen).add(sub.file), unresolved)
|
|
1941
|
+
if (pieces !== null) return pieces
|
|
1942
|
+
}
|
|
1943
|
+
// Neither this module nor anything it re-exports from is a compiled grammar:
|
|
1944
|
+
// not a build-compiled argument, so the caller decides.
|
|
1945
|
+
if (unresolved.why === undefined && !mod.src.includes(TABLE_RUNTIME_SPECIFIER)) return null
|
|
1946
|
+
return fail(`is exported by a compiled grammar artifact, but no carried pieces could be found for it — no inline literal, `
|
|
1947
|
+
+ `no entry in ${path.basename(file)}${CARRIED_SIDECAR_SUFFIX}, and no re-export of it that has either. `
|
|
1948
|
+
+ 'Rebuild it with this parseman, and keep each chunk\'s .parseman.json beside it')
|
|
1828
1949
|
}
|
|
1829
1950
|
const literal = mod.src.slice(literalRange.start, literalRange.end)
|
|
1830
1951
|
|
|
@@ -1909,12 +2030,17 @@ function transformMacroImpl(
|
|
|
1909
2030
|
*/
|
|
1910
2031
|
const sinkCarried = (name: string, list: CarriedItem[]): boolean => {
|
|
1911
2032
|
if (carriedSink === undefined) return false
|
|
1912
|
-
const out:
|
|
2033
|
+
const out: CarriedSinkItem[] = []
|
|
1913
2034
|
for (const it of list) {
|
|
1914
2035
|
if (!isSpread(it)) { out.push(it); continue }
|
|
1915
2036
|
const b = importBindings.get(it.__spreadLocal)
|
|
1916
2037
|
if (b === undefined) return false
|
|
1917
|
-
if (!b.source.startsWith('.') && !path.isAbsolute(b.source)) {
|
|
2038
|
+
if (!b.source.startsWith('.') && !path.isAbsolute(b.source)) {
|
|
2039
|
+
// Expanded too, for a build that bundles the package (`emitCarriedSidecars`).
|
|
2040
|
+
const expanded = importedPieces(it.__spreadLocal)
|
|
2041
|
+
out.push({ from: b.source, name: b.imported, ...(expanded === null ? {} : { expanded: expanded as CarriedSidecarItem[] }) })
|
|
2042
|
+
continue
|
|
2043
|
+
}
|
|
1918
2044
|
const pieces = importedPieces(it.__spreadLocal)
|
|
1919
2045
|
if (pieces === null) return false
|
|
1920
2046
|
out.push(...pieces)
|