@thi.ng/transclude 0.1.68 → 0.1.70
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/CHANGELOG.md +13 -1
- package/README.md +1 -1
- package/package.json +9 -9
- package/tpl/file.js +1 -1
- package/tpl/markdown.d.ts +12 -0
- package/tpl/markdown.js +8 -8
- package/transclude.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-02-
|
|
3
|
+
- **Last updated**: 2024-02-22T23:15:26Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,18 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [0.1.70](https://github.com/thi-ng/umbrella/tree/@thi.ng/transclude@0.1.70) (2024-02-22)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update object destructuring in all pkgs & examples ([f36aeb0](https://github.com/thi-ng/umbrella/commit/f36aeb0))
|
|
17
|
+
|
|
18
|
+
### [0.1.69](https://github.com/thi-ng/umbrella/tree/@thi.ng/transclude@0.1.69) (2024-02-22)
|
|
19
|
+
|
|
20
|
+
#### ♻️ Refactoring
|
|
21
|
+
|
|
22
|
+
- update all `node:*` imports ([c71a526](https://github.com/thi-ng/umbrella/commit/c71a526))
|
|
23
|
+
|
|
12
24
|
### [0.1.46](https://github.com/thi-ng/umbrella/tree/@thi.ng/transclude@0.1.46) (2023-11-09)
|
|
13
25
|
|
|
14
26
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
[](https://mastodon.thi.ng/@toxi)
|
|
19
19
|
|
|
20
20
|
> [!NOTE]
|
|
21
|
-
> This is one of
|
|
21
|
+
> This is one of 190 standalone projects, maintained as part
|
|
22
22
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
23
23
|
> and anti-framework.
|
|
24
24
|
>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/transclude",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.70",
|
|
4
4
|
"description": "Extensible functional template engine for text document generation, incl. various high-level Markdown features",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"test": "testament test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.9.
|
|
39
|
-
"@thi.ng/checks": "^3.
|
|
40
|
-
"@thi.ng/file-io": "^1.3.
|
|
41
|
-
"@thi.ng/logger": "^3.0.
|
|
42
|
-
"@thi.ng/strings": "^3.7.
|
|
43
|
-
"@thi.ng/transducers": "^8.9.
|
|
38
|
+
"@thi.ng/api": "^8.9.25",
|
|
39
|
+
"@thi.ng/checks": "^3.5.0",
|
|
40
|
+
"@thi.ng/file-io": "^1.3.3",
|
|
41
|
+
"@thi.ng/logger": "^3.0.2",
|
|
42
|
+
"@thi.ng/strings": "^3.7.16",
|
|
43
|
+
"@thi.ng/transducers": "^8.9.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@microsoft/api-extractor": "^7.40.1",
|
|
47
|
-
"@thi.ng/testament": "^0.4.
|
|
47
|
+
"@thi.ng/testament": "^0.4.19",
|
|
48
48
|
"esbuild": "^0.20.0",
|
|
49
49
|
"rimraf": "^5.0.5",
|
|
50
50
|
"typedoc": "^0.25.7",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"status": "alpha",
|
|
111
111
|
"year": 2022
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "16f2b92b5410bd35dcde6c2971c8e62783ebc472\n"
|
|
114
114
|
}
|
package/tpl/file.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readText } from "@thi.ng/file-io";
|
|
2
|
-
import { resolve } from "path";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
3
|
const includeFile = ({ logger }, args, currPath) => readText(resolve(resolve(currPath, ".."), args[2].trim()), logger);
|
|
4
4
|
const preincludeFile = ({ logger }, [src], currPath) => src.replace(
|
|
5
5
|
new RegExp(`<!-- include (.+) -->`, "g"),
|
package/tpl/markdown.d.ts
CHANGED
|
@@ -19,6 +19,18 @@ export interface TOCOpts {
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
title: string;
|
|
22
|
+
/**
|
|
23
|
+
* Placeholder pattern for injected TOC
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue "\<!-- toc --\>"
|
|
26
|
+
*/
|
|
27
|
+
match: string | RegExp;
|
|
28
|
+
/**
|
|
29
|
+
* Test pattern for disabling TOC. If this pattern is found no TOC will be injected.
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue "\<!-- notoc --\>"
|
|
32
|
+
*/
|
|
33
|
+
disable: RegExp;
|
|
22
34
|
}
|
|
23
35
|
/**
|
|
24
36
|
* Higher order, configurable post-processing template function. Injects a table
|
package/tpl/markdown.js
CHANGED
|
@@ -13,14 +13,14 @@ const list = (items, eol = "\n") => transduce(
|
|
|
13
13
|
str(eol),
|
|
14
14
|
items
|
|
15
15
|
);
|
|
16
|
-
const toc = (opts) => ({ src, eol }) => {
|
|
17
|
-
const {
|
|
18
|
-
min
|
|
19
|
-
max
|
|
20
|
-
match
|
|
21
|
-
disable
|
|
22
|
-
|
|
23
|
-
};
|
|
16
|
+
const toc = (opts = {}) => ({ src, eol }) => {
|
|
17
|
+
const {
|
|
18
|
+
min = 2,
|
|
19
|
+
max = 4,
|
|
20
|
+
match = /<\!-- toc -->/i,
|
|
21
|
+
disable = /<\!-- notoc -->/i,
|
|
22
|
+
title
|
|
23
|
+
} = opts;
|
|
24
24
|
const isHeading = new RegExp(`^#{${min},${max}}\\s`);
|
|
25
25
|
const reHeading = new RegExp(`^(#{${min},${max}})\\s(.+)`);
|
|
26
26
|
const toc2 = transduce(
|
package/transclude.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readText } from "@thi.ng/file-io/text";
|
|
2
2
|
import { ConsoleLogger } from "@thi.ng/logger";
|
|
3
|
-
import { resolve } from "path";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
4
|
const DEFAULT_LOGGER = new ConsoleLogger("transclude");
|
|
5
5
|
const transclude = (ctx, path) => {
|
|
6
6
|
const $ctx = {
|