@orgajs/reorg-rehype 4.2.0 → 4.3.1

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/index.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ export default reorg2rehype;
2
+ export type Options = import("oast-to-hast").Options;
3
+ /**
4
+ * Mutate-mode.
5
+ *
6
+ * Further transformers run on the hast tree.
7
+ */
8
+ export type TransformMutate = (tree: Document, file: VFile) => HastRoot;
9
+ /**
10
+ * @param {Partial<Options>} [options]
11
+ * @returns {TransformMutate}
12
+ */
13
+ declare function reorg2rehype(options?: Partial<Options>): TransformMutate;
14
+ import type { Document } from 'orga';
15
+ import type { VFile } from 'vfile';
16
+ import type { Root as HastRoot } from 'hast';
17
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";sBAKa,OAAO,cAAc,EAAE,OAAO;;;;;;qCAMhC,QAAQ,QAER,KAAK,KAEH,QAAQ;AAMrB;;;GAGG;AACH,wCAHW,OAAO,CAAC,OAAO,CAAC,GACd,eAAe,CAW3B;8BAjC0B,MAAM;2BAET,OAAO;sCADI,MAAM"}
package/index.js ADDED
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @import {Document} from 'orga'
3
+ * @import {Root as HastRoot} from 'hast'
4
+ * @import {VFile} from 'vfile'
5
+ *
6
+ * @typedef {import('oast-to-hast').Options} Options
7
+ *
8
+ * @callback TransformMutate
9
+ * Mutate-mode.
10
+ *
11
+ * Further transformers run on the hast tree.
12
+ * @param {Document} tree
13
+ * Tree.
14
+ * @param {VFile} file
15
+ * File.
16
+ * @returns {HastRoot}
17
+ * Tree (hast).
18
+ */
19
+
20
+ import toHAST from 'oast-to-hast'
21
+
22
+ /**
23
+ * @param {Partial<Options>} [options]
24
+ * @returns {TransformMutate}
25
+ */
26
+ function reorg2rehype(options = {}) {
27
+ return transformer
28
+
29
+ /**
30
+ * @type {TransformMutate}
31
+ */
32
+ function transformer(tree) {
33
+ return /** @type {HastRoot} */ (toHAST(tree, options))
34
+ }
35
+ }
36
+
37
+ export default reorg2rehype
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@orgajs/reorg-rehype",
3
- "version": "4.2.0",
3
+ "version": "4.3.1",
4
4
  "description": "rehype support for orga",
5
5
  "files": [
6
- "dist"
6
+ "index.js",
7
+ "index.d.ts",
8
+ "index.d.ts.map"
7
9
  ],
8
- "main": "dist/index.js",
10
+ "exports": "./index.js",
9
11
  "type": "module",
10
12
  "author": "Xiaoxing Hu <hi@xiaoxing.dev>",
11
13
  "license": "MIT",
@@ -16,14 +18,14 @@
16
18
  "directory": "packages/reorg-rehype"
17
19
  },
18
20
  "dependencies": {
19
- "oast-to-hast": "4.2.0"
21
+ "oast-to-hast": "4.3.1"
20
22
  },
21
23
  "devDependencies": {
24
+ "@types/hast": "^3.0.4",
22
25
  "@types/unist": "^3.0.3",
23
- "unified": "^11.0.5"
26
+ "unified": "^11.0.5",
27
+ "vfile": "^6.0.3",
28
+ "orga": "4.5.0"
24
29
  },
25
- "scripts": {
26
- "clean": "tsc --build --clean",
27
- "build": "tsc --build"
28
- }
30
+ "scripts": {}
29
31
  }
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Options } from 'oast-to-hast';
2
- import { Transformer } from 'unified';
3
- export type { Options };
4
- declare function reorg2rehype(options?: Partial<Options>): Transformer;
5
- export default reorg2rehype;
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
- import toHAST from 'oast-to-hast';
2
- function reorg2rehype(options = {}) {
3
- return transformer;
4
- function transformer(node) {
5
- return toHAST(node, options);
6
- }
7
- }
8
- export default reorg2rehype;