parseman 0.61.3 → 0.61.5

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.
Files changed (45) hide show
  1. package/dist/analysis/diagnostics.js +844 -522
  2. package/dist/analysis/diagnostics.js.map +3 -3
  3. package/dist/cli/index.js +846 -522
  4. package/dist/cli/index.js.map +3 -3
  5. package/dist/cst/capture-buffer.d.ts +3 -2
  6. package/dist/cst/capture-buffer.d.ts.map +1 -1
  7. package/dist/index.js +846 -520
  8. package/dist/index.js.map +3 -3
  9. package/dist/plugin/index.d.ts +22 -3
  10. package/dist/plugin/index.d.ts.map +1 -1
  11. package/dist/plugin/index.js +872 -520
  12. package/dist/plugin/index.js.map +3 -3
  13. package/dist/table/assemble.d.ts.map +1 -1
  14. package/dist/table/child-slots.d.ts.map +1 -1
  15. package/dist/table/emit-assembly.d.ts +1 -1
  16. package/dist/table/emit-assembly.d.ts.map +1 -1
  17. package/dist/table/encode.d.ts.map +1 -1
  18. package/dist/table/exec.d.ts.map +1 -1
  19. package/dist/table/fail-clean.d.ts.map +1 -1
  20. package/dist/table/hold-gap.d.ts.map +1 -1
  21. package/dist/table/index.js +368 -42
  22. package/dist/table/index.js.map +3 -3
  23. package/dist/table/late-frame.d.ts +18 -0
  24. package/dist/table/late-frame.d.ts.map +1 -0
  25. package/dist/table/ops.d.ts +17 -0
  26. package/dist/table/ops.d.ts.map +1 -1
  27. package/dist/table/select-hot.d.ts.map +1 -1
  28. package/dist/table/site-labels.d.ts +5 -1
  29. package/dist/table/site-labels.d.ts.map +1 -1
  30. package/dist/version.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/src/cst/capture-buffer.ts +20 -11
  33. package/src/plugin/index.ts +76 -23
  34. package/src/table/assemble.ts +124 -4
  35. package/src/table/child-slots.ts +9 -1
  36. package/src/table/emit-assembly.ts +101 -14
  37. package/src/table/encode.ts +69 -6
  38. package/src/table/exec.ts +7 -1
  39. package/src/table/fail-clean.ts +8 -1
  40. package/src/table/hold-gap.ts +5 -1
  41. package/src/table/late-frame.ts +54 -0
  42. package/src/table/ops.ts +19 -0
  43. package/src/table/select-hot.ts +7 -1
  44. package/src/table/site-labels.ts +38 -14
  45. package/src/version.ts +1 -1
@@ -83,13 +83,29 @@ export type ParsecraftPluginOptions = {
83
83
  };
84
84
  /** A corpus a build parses to rank selective-assembly sites — see `assemblyProfile`. */
85
85
  export type AssemblyProfile = {
86
- /** The rule each corpus file is parsed from, e.g. `'Stylesheet'`. A grammar
87
- * without this rule keeps the static ranking. */
86
+ /** The rule each corpus file is parsed from, e.g. `'Stylesheet'`. A grammar without
87
+ * this rule keeps the static ranking. A build fails when grammars were profiled and
88
+ * none has the rule. A direct `transformMacro` caller gets `assemblyProfile:
89
+ * 'no-entry'` on the result instead, and has to read it. */
88
90
  readonly entry: string;
89
91
  /** Paths of representative inputs. At least one must have content, and each that
90
92
  * does has to parse in full without recovery, or the build fails. A file with only
91
- * whitespace counts as empty. */
93
+ * whitespace counts as empty. A callback the corpus doesn't reach is never run, so
94
+ * nothing checks it. */
92
95
  readonly files: readonly string[];
96
+ /**
97
+ * The values of names a grammar's reducers and gates import, for the corpus run.
98
+ * Their source runs at build time with no module around it, so a grammar whose
99
+ * callbacks read imported helpers passes those helpers here. See
100
+ * `docs/guide/macro-mode.md` for what this does and doesn't cover.
101
+ *
102
+ * It's one flat namespace, so two modules can't bind one name to different helpers.
103
+ * A name that's already a global fails the build. A helper named like a global and
104
+ * left out of `scope` silently uses the global. A direct `node()` builder doesn't
105
+ * run in the corpus run: a plain node stands in for it, so a helper only a builder
106
+ * reads is neither needed here nor checked.
107
+ */
108
+ readonly scope?: Readonly<Record<string, unknown>>;
93
109
  };
94
110
  declare const _default: import("unplugin").UnpluginInstance<ParsecraftPluginOptions, boolean>;
95
111
  export default _default;
@@ -98,6 +114,9 @@ export type TransformMacroResult = {
98
114
  map: ReturnType<MagicString['generateMap']>;
99
115
  /** Diagnostics for macro-referencing shapes that fell back to the interpreter. */
100
116
  warnings: string[];
117
+ /** With an `assemblyProfile`: `'ran'` when a grammar here parsed the corpus,
118
+ * `'no-entry'` when the grammars that could have don't have its `entry` rule. */
119
+ assemblyProfile?: 'ran' | 'no-entry';
101
120
  /** The sites the module's `assemblyBudget` bought, by program offset, in rank order. */
102
121
  assemblySites: number[];
103
122
  };
@@ -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,EAAsC,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAA;AA6BxF;;;;;;;;;;;;;;;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,CA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