@thi.ng/transclude 0.1.89 → 0.1.91
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 +8 -1
- package/README.md +1 -1
- package/package.json +14 -14
- package/tpl/pkg.js +22 -36
- package/transclude.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
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,13 @@ 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.91](https://github.com/thi-ng/umbrella/tree/@thi.ng/transclude@0.1.91) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
|
|
17
|
+
- dedupe packageTemplates() internals ([31bbbdd](https://github.com/thi-ng/umbrella/commit/31bbbdd))
|
|
18
|
+
|
|
12
19
|
### [0.1.79](https://github.com/thi-ng/umbrella/tree/@thi.ng/transclude@0.1.79) (2024-03-18)
|
|
13
20
|
|
|
14
21
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/transclude",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.91",
|
|
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",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/transclude",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/file-io": "^2.1.
|
|
42
|
-
"@thi.ng/logger": "^3.0.
|
|
43
|
-
"@thi.ng/strings": "^3.7.
|
|
44
|
-
"@thi.ng/transducers": "^9.0.
|
|
39
|
+
"@thi.ng/api": "^8.11.3",
|
|
40
|
+
"@thi.ng/checks": "^3.6.5",
|
|
41
|
+
"@thi.ng/file-io": "^2.1.3",
|
|
42
|
+
"@thi.ng/logger": "^3.0.13",
|
|
43
|
+
"@thi.ng/strings": "^3.7.34",
|
|
44
|
+
"@thi.ng/transducers": "^9.0.6"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@microsoft/api-extractor": "^7.
|
|
48
|
-
"@thi.ng/testament": "^0.4.
|
|
49
|
-
"esbuild": "^0.
|
|
50
|
-
"typedoc": "^0.25.
|
|
51
|
-
"typescript": "^5.
|
|
47
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
48
|
+
"@thi.ng/testament": "^0.4.30",
|
|
49
|
+
"esbuild": "^0.21.5",
|
|
50
|
+
"typedoc": "^0.25.13",
|
|
51
|
+
"typescript": "^5.5.2"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"engine",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"status": "alpha",
|
|
111
111
|
"year": 2022
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
114
114
|
}
|
package/tpl/pkg.js
CHANGED
|
@@ -126,47 +126,33 @@ const packageTemplates = (pkg, opts) => {
|
|
|
126
126
|
"pkg.link": ({ user }) => link(pkg(user).name, pkg(user).homepage),
|
|
127
127
|
"pkg.author": ({ user }) => author(pkg(user).author),
|
|
128
128
|
"pkg.authorLink": ({ user }) => authorLink(pkg(user).author),
|
|
129
|
-
"pkg.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
"pkg.contributorLinks": ({ user, eol }) => {
|
|
134
|
-
const people = pkg(user).contributors;
|
|
135
|
-
return people ? $opts.hdContributors + contributorLinks(people, eol) : "";
|
|
136
|
-
},
|
|
137
|
-
"pkg.allAuthors": ({ user, eol }) => {
|
|
138
|
-
const $pkg = pkg(user);
|
|
139
|
-
const $author = author($pkg.author);
|
|
140
|
-
const res = [];
|
|
141
|
-
if ($pkg.contributors) {
|
|
142
|
-
res.push(
|
|
143
|
-
$author + " (Main author)",
|
|
144
|
-
...$pkg.contributors.map(author)
|
|
145
|
-
);
|
|
146
|
-
} else {
|
|
147
|
-
res.push($author);
|
|
148
|
-
}
|
|
149
|
-
return list(res, eol);
|
|
150
|
-
},
|
|
151
|
-
"pkg.allAuthorLinks": ({ user, eol }) => {
|
|
152
|
-
const $pkg = pkg(user);
|
|
153
|
-
const $author = authorLink($pkg.author);
|
|
154
|
-
const res = [];
|
|
155
|
-
if ($pkg.contributors) {
|
|
156
|
-
res.push(
|
|
157
|
-
$author + " (Main author)",
|
|
158
|
-
...$pkg.contributors.map(authorLink)
|
|
159
|
-
);
|
|
160
|
-
} else {
|
|
161
|
-
res.push($author);
|
|
162
|
-
}
|
|
163
|
-
return list(res, eol);
|
|
164
|
-
},
|
|
129
|
+
"pkg.allAuthors": __allAuthors(pkg, author),
|
|
130
|
+
"pkg.allAuthorLinks": __allAuthors(pkg, authorLink),
|
|
131
|
+
"pkg.contributors": __allContribs(pkg, $opts, contributors),
|
|
132
|
+
"pkg.contributorLinks": __allContribs(pkg, $opts, contributorLinks),
|
|
165
133
|
"pkg.license": ({ user }) => license(pkg(user).license),
|
|
166
134
|
"pkg.licenseLink": ({ user }) => licenseLink(pkg(user).license)
|
|
167
135
|
};
|
|
168
136
|
return tpls;
|
|
169
137
|
};
|
|
138
|
+
const __allAuthors = (pkg, itemFn) => ({ user, eol }) => {
|
|
139
|
+
const $pkg = pkg(user);
|
|
140
|
+
const $author = itemFn($pkg.author);
|
|
141
|
+
const res = [];
|
|
142
|
+
if ($pkg.contributors) {
|
|
143
|
+
res.push(
|
|
144
|
+
$author + " (Main author)",
|
|
145
|
+
...$pkg.contributors.map(itemFn)
|
|
146
|
+
);
|
|
147
|
+
} else {
|
|
148
|
+
res.push($author);
|
|
149
|
+
}
|
|
150
|
+
return list(res, eol);
|
|
151
|
+
};
|
|
152
|
+
const __allContribs = (pkg, opts, itemFn) => ({ user, eol }) => {
|
|
153
|
+
const people = pkg(user).contributors;
|
|
154
|
+
return people ? opts.hdContributors + itemFn(people, eol) : "";
|
|
155
|
+
};
|
|
170
156
|
export {
|
|
171
157
|
LICENSES,
|
|
172
158
|
author,
|
package/transclude.js
CHANGED
|
@@ -12,11 +12,11 @@ const transclude = (ctx, path) => {
|
|
|
12
12
|
...ctx
|
|
13
13
|
};
|
|
14
14
|
$ctx.pre.reduce((acc, fn) => $ctx.src = fn($ctx, [acc], path), $ctx.src);
|
|
15
|
-
$ctx.src = $ctx.src.replace($ctx.match, (...
|
|
16
|
-
const [orig, id] =
|
|
15
|
+
$ctx.src = $ctx.src.replace($ctx.match, (...args) => {
|
|
16
|
+
const [orig, id] = args;
|
|
17
17
|
const tpl = $ctx.templates[id];
|
|
18
18
|
if (tpl !== void 0) {
|
|
19
|
-
return typeof tpl === "function" ? tpl($ctx,
|
|
19
|
+
return typeof tpl === "function" ? tpl($ctx, args, path) : tpl;
|
|
20
20
|
} else {
|
|
21
21
|
$ctx.logger.warn(`skipping unknown tpl ID: "${id}"`);
|
|
22
22
|
return orig;
|