@thi.ng/transclude 0.1.90 → 0.1.92

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-05-08T18:24:32Z
3
+ - **Last updated**: 2024-06-29T09:28:36Z
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
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
10
+ > This is one of 189 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.90",
3
+ "version": "0.1.92",
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://github.com/thi-ng/umbrella/tree/develop/packages/transclude#readme",
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.2",
40
- "@thi.ng/checks": "^3.6.4",
41
- "@thi.ng/file-io": "^2.1.2",
42
- "@thi.ng/logger": "^3.0.12",
43
- "@thi.ng/strings": "^3.7.33",
44
- "@thi.ng/transducers": "^9.0.5"
39
+ "@thi.ng/api": "^8.11.4",
40
+ "@thi.ng/checks": "^3.6.6",
41
+ "@thi.ng/file-io": "^2.1.4",
42
+ "@thi.ng/logger": "^3.0.14",
43
+ "@thi.ng/strings": "^3.7.35",
44
+ "@thi.ng/transducers": "^9.0.7"
45
45
  },
46
46
  "devDependencies": {
47
- "@microsoft/api-extractor": "^7.43.2",
48
- "@thi.ng/testament": "^0.4.29",
49
- "esbuild": "^0.21.1",
47
+ "@microsoft/api-extractor": "^7.47.0",
48
+ "@thi.ng/testament": "^0.4.31",
49
+ "esbuild": "^0.21.5",
50
50
  "typedoc": "^0.25.13",
51
- "typescript": "^5.4.5"
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": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
113
+ "gitHead": "7b950c112fba0b2e7c450765b15624c3382f1354\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.contributors": ({ user, eol }) => {
130
- const people = pkg(user).contributors;
131
- return people ? $opts.hdContributors + contributors(people, eol) : "";
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, (...xs) => {
16
- const [orig, id] = xs;
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, xs, path) : tpl;
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;