@flint.fyi/markdown-language 0.17.1 → 0.17.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/index.d.mts CHANGED
@@ -31,6 +31,6 @@ type WithPosition<T> = T & {
31
31
  interface MarkdownFileServices {
32
32
  root: WithPosition<mdast.Root>;
33
33
  }
34
- declare const markdownLanguage: Language<MarkdownNodeVisitors, MarkdownFileServices>;
34
+ export declare const markdownLanguage: Language<MarkdownNodeVisitors, MarkdownFileServices>;
35
35
  //#endregion
36
- export { type MarkdownFileServices, type MarkdownNodeVisitors, type MarkdownNodesByName, type PointWithOffset, type PositionWithOffsets, type RootContentMapWithChildren, type WithPosition, markdownLanguage };
36
+ export type { MarkdownFileServices, MarkdownNodeVisitors, MarkdownNodesByName, PointWithOffset, PositionWithOffsets, RootContentMapWithChildren, WithPosition };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { fromMarkdown } from "mdast-util-from-markdown";
2
2
  import { gfmFromMarkdown } from "mdast-util-gfm";
3
3
  import { gfm } from "micromark-extension-gfm";
4
- import { DirectivesCollector, createLanguage } from "@flint.fyi/core";
4
+ import { DirectivesCollector, createLanguage, groupFileVisitors, runFileVisitorSubscriptions } from "@flint.fyi/core";
5
5
  import { visit } from "unist-util-visit";
6
6
  import { nullThrows } from "@flint.fyi/utils";
7
7
  //#region src/directives/parseDirectivesFromMarkdownFile.ts
@@ -49,18 +49,14 @@ const markdownLanguage = createLanguage({
49
49
  };
50
50
  } };
51
51
  },
52
- runFileVisitors: (file, options, runtime) => {
53
- if (!runtime.visitors) return;
54
- const { visitors } = runtime;
55
- const visitorServices = {
56
- options,
57
- ...file.services
58
- };
52
+ runFileVisitors: (file, fileVisitors) => {
53
+ const { enter, exit } = groupFileVisitors(fileVisitors);
59
54
  const visit = (node) => {
60
- const key = node.type;
61
- visitors[key]?.(node, visitorServices);
55
+ const entering = enter?.get(node.type);
56
+ if (entering !== void 0) runFileVisitorSubscriptions(entering, node);
62
57
  if ("children" in node && Array.isArray(node.children)) for (const child of node.children) visit(child);
63
- visitors[`${key}:exit`]?.(node, visitorServices);
58
+ const exiting = exit?.get(node.type);
59
+ if (exiting !== void 0) runFileVisitorSubscriptions(exiting, node);
64
60
  };
65
61
  visit(file.services.root);
66
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flint.fyi/markdown-language",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "[Experimental] Markdown language for Flint.",
5
5
  "homepage": "https://flint.fyi",
6
6
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
- "@flint.fyi/core": "^0.26.0",
25
+ "@flint.fyi/core": "^0.27.0",
26
26
  "@flint.fyi/utils": "^0.16.0",
27
27
  "@types/mdast": "^4.0.4",
28
28
  "@types/unist": "^3.0.3",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@flint.fyi/build": "^0.1.0",
36
- "tsdown": "0.22.14",
37
- "vitest": "4.1.11"
36
+ "tsdown": "0.23.0",
37
+ "vitest": "5.0.1"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=26.1.0"