@hugojosefson/cli 0.11.0 → 0.12.0
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/esm/deno.js +16 -8
- package/esm/node_modules/@conventional-changelog/template/LICENSE.md +21 -0
- package/esm/node_modules/@conventional-changelog/template/README.md +66 -0
- package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts +78 -0
- package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/elements.js +132 -0
- package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts +6 -0
- package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/index.js +5 -0
- package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts +20 -0
- package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/legacy.js +22 -0
- package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts +43 -0
- package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/references.js +82 -0
- package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts +74 -0
- package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/templates.js +125 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts +37 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/commit.js +2 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts +113 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/context.js +2 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts +4 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/index.js +2 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts +2 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/utils.js +2 -0
- package/esm/node_modules/@conventional-changelog/template/package.json +38 -0
- package/esm/node_modules/@simple-libs/stream-utils/LICENSE +21 -0
- package/esm/node_modules/@simple-libs/stream-utils/README.md +79 -0
- package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts +51 -0
- package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts.map +1 -0
- package/esm/node_modules/@simple-libs/stream-utils/dist/index.js +116 -0
- package/esm/node_modules/@simple-libs/stream-utils/package.json +38 -0
- package/esm/node_modules/argue-cli/LICENSE +21 -0
- package/esm/node_modules/argue-cli/README.md +239 -0
- package/esm/node_modules/argue-cli/dist/args.d.ts +30 -0
- package/esm/node_modules/argue-cli/dist/args.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/argv.d.ts +14 -0
- package/esm/node_modules/argue-cli/dist/argv.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/core.d.ts +24 -0
- package/esm/node_modules/argue-cli/dist/core.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/index.d.ts +6 -0
- package/esm/node_modules/argue-cli/dist/index.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/index.js +254 -0
- package/esm/node_modules/argue-cli/dist/index.js.map +1 -0
- package/esm/node_modules/argue-cli/dist/options.d.ts +9 -0
- package/esm/node_modules/argue-cli/dist/options.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/types.d.ts +16 -0
- package/esm/node_modules/argue-cli/dist/types.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/utils.d.ts +24 -0
- package/esm/node_modules/argue-cli/dist/utils.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/package.json +34 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/LICENSE.md +21 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/README.md +369 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/package.json +53 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/LICENSE +21 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/README.md +184 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/package.json +31 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/LICENSE.md +21 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/README.md +383 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/package.json +47 -0
- package/esm/node_modules/conventional-changelog-writer/README.md +49 -342
- package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts +3 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/index.js +68 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts +4 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.js +39 -0
- package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts +10 -0
- package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/commit.js +43 -0
- package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts +27 -0
- package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/context.js +134 -0
- package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts +7 -0
- package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/index.js +6 -0
- package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts +25 -0
- package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/options.js +79 -0
- package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts +10 -0
- package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/template.js +18 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts +8 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/index.js +2 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts +122 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/options.js +2 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts +9 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/utils.js +2 -0
- package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts +20 -0
- package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/utils.js +70 -0
- package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts +29 -0
- package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/writers.js +94 -0
- package/esm/node_modules/conventional-changelog-writer/package.json +24 -26
- package/esm/node_modules/conventional-commits-filter/README.md +51 -170
- package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts +17 -0
- package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.js +46 -0
- package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts +19 -0
- package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/filters.js +34 -0
- package/esm/node_modules/conventional-commits-filter/dist/index.d.ts +4 -0
- package/esm/node_modules/conventional-commits-filter/dist/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/index.js +3 -0
- package/esm/node_modules/conventional-commits-filter/dist/types.d.ts +6 -0
- package/esm/node_modules/conventional-commits-filter/dist/types.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/types.js +2 -0
- package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts +16 -0
- package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/utils.js +43 -0
- package/esm/node_modules/conventional-commits-filter/package.json +22 -16
- package/esm/node_modules/conventional-commits-parser/README.md +49 -353
- package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts +40 -0
- package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/CommitParser.js +319 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts +3 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/index.js +67 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts +3 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/options.js +40 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts +5 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/utils.js +49 -0
- package/esm/node_modules/conventional-commits-parser/dist/index.d.ts +4 -0
- package/esm/node_modules/conventional-commits-parser/dist/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/index.js +3 -0
- package/esm/node_modules/conventional-commits-parser/dist/options.d.ts +3 -0
- package/esm/node_modules/conventional-commits-parser/dist/options.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/options.js +27 -0
- package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts +8 -0
- package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/regex.js +63 -0
- package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts +14 -0
- package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/stream.js +38 -0
- package/esm/node_modules/conventional-commits-parser/dist/types.d.ts +100 -0
- package/esm/node_modules/conventional-commits-parser/dist/types.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/types.js +2 -0
- package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts +41 -0
- package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/utils.js +75 -0
- package/esm/node_modules/conventional-commits-parser/package.json +22 -23
- package/esm/src/cli/command-help.js +15 -0
- package/esm/src/cli/repair-configuration-description.js +98 -0
- package/esm/src/cli/run-changelog.js +51 -0
- package/esm/src/cli/run-cli.js +8 -0
- package/esm/src/features/built-in-feature-registry.js +2 -0
- package/esm/src/features/changelog-feature.js +155 -0
- package/esm/src/features/github-ci-artifacts.js +17 -3
- package/esm/src/features/github-ci-runtime-matrix.js +50 -0
- package/esm/src/features/github-release-publish-artifacts.js +5 -4
- package/esm/src/features/github-release-publish-feature.js +4 -0
- package/esm/src/features/github-workflow-cache.js +18 -0
- package/esm/src/features/workflow-deno.js +1 -1
- package/esm/src/release/changelog-markdown.js +41 -0
- package/esm/src/release/changelog.js +155 -7
- package/esm/src/release/format-changelog.js +15 -0
- package/esm/src/release/migrate-changelog.js +92 -0
- package/esm/src/release/publish-github.js +7 -3
- package/esm/src/release/publish-tag-prepare.js +63 -78
- package/esm/src/release/release-history.js +53 -0
- package/npm-dependencies.lock.json +115 -48
- package/package.json +5 -3
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/dependencies.js +0 -11036
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.d.ts +0 -1416
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.js +0 -100
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/licenses.md +0 -1767
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/options.js +0 -92
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/parser.js +0 -84
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/utils.js +0 -7
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/validate.js +0 -122
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/license +0 -9
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/package.json +0 -107
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/readme.md +0 -314
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/cli.mjs +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/index.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/lib/util.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/commit.hbs +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/footer.hbs +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/header.hbs +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/template.hbs +0 -0
- /package/esm/node_modules/{conventional-commits-filter → conventional-changelog-core/node_modules/conventional-commits-filter}/index.js +0 -0
- /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/cli.mjs +0 -0
- /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/index.js +0 -0
- /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/lib/parser.js +0 -0
- /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/lib/regex.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/dependencies.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/index.d.ts +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/index.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/licenses.md +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/options.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/parser.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/utils.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/validate.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/license +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/package.json +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/readme.md +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { each, link, list, small, heading, segments, strings, words, newline, url } from './elements.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a repository URL from template context fields.
|
|
4
|
+
* @param context - Template context.
|
|
5
|
+
* @returns Repository URL.
|
|
6
|
+
*/
|
|
7
|
+
export function repositoryUrl(context) {
|
|
8
|
+
if (context.repository) {
|
|
9
|
+
return url(context.host, context.owner, context.repository);
|
|
10
|
+
}
|
|
11
|
+
return context.repoUrl || '';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Builds a repository URL for a commit reference.
|
|
15
|
+
* @param context - Template context.
|
|
16
|
+
* @param reference - Commit reference.
|
|
17
|
+
* @returns Reference repository URL.
|
|
18
|
+
*/
|
|
19
|
+
export function referenceRepositoryUrl(context, reference) {
|
|
20
|
+
if (!context.repository) {
|
|
21
|
+
return context.repoUrl || '';
|
|
22
|
+
}
|
|
23
|
+
if (reference.repository) {
|
|
24
|
+
return url(context.host, reference.owner, reference.repository);
|
|
25
|
+
}
|
|
26
|
+
return url(context.host, context.owner, context.repository);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Builds a release comparison URL and encodes tag names as URL path segments.
|
|
30
|
+
* @param context - Template context.
|
|
31
|
+
* @returns Release comparison URL.
|
|
32
|
+
*/
|
|
33
|
+
export function compareUrl(context) {
|
|
34
|
+
const previousTag = encodeURIComponent(context.previousTag || '');
|
|
35
|
+
const currentTag = encodeURIComponent(context.currentTag || '');
|
|
36
|
+
return url(repositoryUrl(context), context.compare || 'compare', `${previousTag}...${currentTag}`);
|
|
37
|
+
}
|
|
38
|
+
export const BREAKING_CHANGE_KEYWORDS = ['BREAKING CHANGE', 'BREAKING-CHANGE'];
|
|
39
|
+
export const BREAKING_CHANGES_TITLE = 'BREAKING CHANGES';
|
|
40
|
+
/**
|
|
41
|
+
* Renders a note group title.
|
|
42
|
+
* Breaking change keywords are merged into a single title,
|
|
43
|
+
* every other keyword is uppercased to group its spellings together.
|
|
44
|
+
* @param title - Note title as it was written in a commit.
|
|
45
|
+
* @returns Note group title.
|
|
46
|
+
*/
|
|
47
|
+
export function noteTitle(title) {
|
|
48
|
+
const upperCaseTitle = title.toUpperCase();
|
|
49
|
+
return BREAKING_CHANGE_KEYWORDS.includes(upperCaseTitle)
|
|
50
|
+
? BREAKING_CHANGES_TITLE
|
|
51
|
+
: upperCaseTitle;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a note is a breaking change note.
|
|
55
|
+
* @param note - Commit note.
|
|
56
|
+
* @returns Is it a breaking change note.
|
|
57
|
+
*/
|
|
58
|
+
export function isBreakingNote(note) {
|
|
59
|
+
return noteTitle(note.title) === BREAKING_CHANGES_TITLE;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Renders a commit reference label.
|
|
63
|
+
* @param reference - Commit reference.
|
|
64
|
+
* @returns Commit reference label.
|
|
65
|
+
*/
|
|
66
|
+
export function reference(reference) {
|
|
67
|
+
return strings(reference.owner && `${reference.owner}/`, reference.repository, reference.issue && `${reference.prefix || '#'}${reference.issue}`);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Renders the default changelog header.
|
|
71
|
+
* @param context - Template context.
|
|
72
|
+
* @returns Changelog header.
|
|
73
|
+
*/
|
|
74
|
+
export function headerPartial({ isPatch, title, version, date }) {
|
|
75
|
+
const versionText = words(version, title && `"${title}"`, date && `(${date})`);
|
|
76
|
+
return heading(2, isPatch ? small(versionText) : versionText);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Renders the default changelog preamble.
|
|
80
|
+
* @param context - Template context.
|
|
81
|
+
* @returns Changelog preamble.
|
|
82
|
+
*/
|
|
83
|
+
export function preamblePartial({ preamble }) {
|
|
84
|
+
return strings(preamble);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Renders the default changelog footer.
|
|
88
|
+
* @param context - Template context.
|
|
89
|
+
* @returns Changelog footer.
|
|
90
|
+
*/
|
|
91
|
+
export function footerPartial({ noteGroups }) {
|
|
92
|
+
return each(noteGroups, group => segments(heading(3, group.title), list(group.notes, note => note.text)), newline(2));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Renders the default changelog commit line.
|
|
96
|
+
* @param context - Template context.
|
|
97
|
+
* @param commit - Transformed commit.
|
|
98
|
+
* @returns Changelog commit line.
|
|
99
|
+
*/
|
|
100
|
+
export function commitPartial(context, commit) {
|
|
101
|
+
const { linkReferences, issue, commit: commitUrlPath } = context;
|
|
102
|
+
const { hash, references, header } = commit;
|
|
103
|
+
const commitLink = hash
|
|
104
|
+
? linkReferences
|
|
105
|
+
? `(${link(hash, url(repositoryUrl(context), commitUrlPath, hash))})`
|
|
106
|
+
: hash
|
|
107
|
+
: '';
|
|
108
|
+
const renderedReferences = each(references, (linkReference) => {
|
|
109
|
+
if (linkReferences) {
|
|
110
|
+
return link(reference(linkReference), url(referenceRepositoryUrl(context, linkReference), issue, linkReference.issue));
|
|
111
|
+
}
|
|
112
|
+
return reference(linkReference);
|
|
113
|
+
}, ' ');
|
|
114
|
+
return strings(words(header, commitLink), renderedReferences && `, closes ${renderedReferences}`);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Renders the default changelog template.
|
|
118
|
+
* @param context - Template context.
|
|
119
|
+
* @returns Changelog text.
|
|
120
|
+
*/
|
|
121
|
+
export function template(context) {
|
|
122
|
+
const { headerPartial, preamblePartial, commitPartial, footerPartial, commitGroups } = context;
|
|
123
|
+
return segments(headerPartial(context), preamblePartial(context), each(commitGroups, group => list(group.commits, commit => commitPartial(context, commit))), footerPartial(context));
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVtcGxhdGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3RlbXBsYXRlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEVBQ0wsSUFBSSxFQUNKLElBQUksRUFDSixJQUFJLEVBQ0osS0FBSyxFQUNMLE9BQU8sRUFDUCxRQUFRLEVBQ1IsT0FBTyxFQUNQLEtBQUssRUFDTCxPQUFPLEVBQ1AsR0FBRyxFQUN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CLE9BQXFDO0lBRXJDLE1BQU0sRUFDSixhQUFhLEVBQ2IsZUFBZSxFQUNmLGFBQWEsRUFDYixhQUFhLEVBQ2IsWUFBWSxFQUNiLEdBQUcsT0FBTyxDQUFBO0lBRVgsT0FBTyxRQUFRLENBQ2IsYUFBYSxDQUFDLE9BQU8sQ0FBQyxFQUN0QixlQUFlLENBQUMsT0FBTyxDQUFDLEVBQ3hCLElBQUksQ0FDRixZQUFZLEVBQ1osS0FBSyxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQ1gsS0FBSyxDQUFDLE9BQU8sRUFDYixNQUFNLENBQUMsRUFBRSxDQUFDLGFBQWEsQ0FBQyxPQUFPLEVBQUUsTUFBTSxDQUFDLENBQ3pDLENBQ0YsRUFDRCxhQUFhLENBQUMsT0FBTyxDQUFDLENBQ3ZCLENBQUE7QUFDSCxDQUFDIn0=
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AnyObject } from './utils.js';
|
|
2
|
+
export interface CommitReference {
|
|
3
|
+
raw: string;
|
|
4
|
+
action: string | null;
|
|
5
|
+
owner: string | null;
|
|
6
|
+
repository: string | null;
|
|
7
|
+
issue: string;
|
|
8
|
+
prefix: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CommitNote {
|
|
11
|
+
title: string;
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CommitKnownProps {
|
|
15
|
+
type?: string | null;
|
|
16
|
+
header?: string | null;
|
|
17
|
+
version?: string | null;
|
|
18
|
+
hash?: string | null;
|
|
19
|
+
committerDate?: string | null;
|
|
20
|
+
references?: CommitReference[] | null;
|
|
21
|
+
notes: CommitNote[];
|
|
22
|
+
revert?: AnyObject | null;
|
|
23
|
+
body?: string | null;
|
|
24
|
+
footer?: string | null;
|
|
25
|
+
}
|
|
26
|
+
export type TransformedCommit<Commit> = Commit & {
|
|
27
|
+
raw?: Commit;
|
|
28
|
+
};
|
|
29
|
+
export interface CommitGroup<Commit extends CommitKnownProps = CommitKnownProps> {
|
|
30
|
+
title: string;
|
|
31
|
+
commits: Commit[];
|
|
32
|
+
}
|
|
33
|
+
export interface NoteGroup {
|
|
34
|
+
title: string;
|
|
35
|
+
notes: CommitNote[];
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/types/commit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,UAAU,CAAC,EAAE,eAAe,EAAE,GAAG,IAAI,CAAA;IACrC,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED,MAAM,MAAM,iBAAiB,CAAC,MAAM,IAAI,MAAM,GAAG;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,WAAW,WAAW,CAAC,MAAM,SAAS,gBAAgB,GAAG,gBAAgB;IAC7E,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { CommitKnownProps, CommitGroup, NoteGroup, TransformedCommit } from './commit.js';
|
|
2
|
+
export type HeaderPartialFunction<Commit extends CommitKnownProps = CommitKnownProps> = (context: FinalTemplateContext<Commit>) => string;
|
|
3
|
+
export type PreamblePartialFunction<Commit extends CommitKnownProps = CommitKnownProps> = (context: FinalTemplateContext<Commit>) => string;
|
|
4
|
+
export type CommitPartialFunction<Commit extends CommitKnownProps = CommitKnownProps> = (context: FinalTemplateContext<Commit>, commit: TransformedCommit<Commit>) => string;
|
|
5
|
+
export type FooterPartialFunction<Commit extends CommitKnownProps = CommitKnownProps> = (context: FinalTemplateContext<Commit>) => string;
|
|
6
|
+
export interface TemplateContext<Commit extends CommitKnownProps = CommitKnownProps> {
|
|
7
|
+
/**
|
|
8
|
+
* Version number of the upcoming release.
|
|
9
|
+
* If `version` is found in the last commit before generating logs, it will be overwritten.
|
|
10
|
+
*/
|
|
11
|
+
version?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Is this a patch release?
|
|
14
|
+
*/
|
|
15
|
+
isPatch?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The title of the release.
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The release date.
|
|
22
|
+
*/
|
|
23
|
+
date?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Introductory text rendered after the release header.
|
|
26
|
+
*/
|
|
27
|
+
preamble?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Should all references be linked?
|
|
30
|
+
*/
|
|
31
|
+
linkReferences?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Commit base url path.
|
|
34
|
+
*/
|
|
35
|
+
commit?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Issue base url.
|
|
38
|
+
*/
|
|
39
|
+
issue?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Release comparison base url path.
|
|
42
|
+
*/
|
|
43
|
+
compare?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Repository name.
|
|
46
|
+
* Eg: `'conventional-changelog-writer'`
|
|
47
|
+
*/
|
|
48
|
+
repository?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Repository host.
|
|
51
|
+
* Eg: `'https://github.com'` or `'https://bitbucket.org'`
|
|
52
|
+
*/
|
|
53
|
+
host?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Repository owner.
|
|
56
|
+
* Eg: `'conventional-changelog'`
|
|
57
|
+
*/
|
|
58
|
+
owner?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Full repository url.
|
|
61
|
+
* Eg: `'https://github.com/conventional-changelog/conventional-changelog-writer'`.
|
|
62
|
+
* Should be used as a fallback when `context.repository` doesn't exist.
|
|
63
|
+
*/
|
|
64
|
+
repoUrl?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Commit groups.
|
|
67
|
+
*/
|
|
68
|
+
commitGroups?: CommitGroup<Commit>[];
|
|
69
|
+
/**
|
|
70
|
+
* Note groups.
|
|
71
|
+
*/
|
|
72
|
+
noteGroups?: NoteGroup[];
|
|
73
|
+
/**
|
|
74
|
+
* Previous release tag.
|
|
75
|
+
*/
|
|
76
|
+
previousTag?: string | null;
|
|
77
|
+
/**
|
|
78
|
+
* Current release tag.
|
|
79
|
+
*/
|
|
80
|
+
currentTag?: string | null;
|
|
81
|
+
/**
|
|
82
|
+
* Add a link to compare changes.
|
|
83
|
+
*/
|
|
84
|
+
linkCompare?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Function that renders the release header.
|
|
87
|
+
*/
|
|
88
|
+
headerPartial?: HeaderPartialFunction<Commit>;
|
|
89
|
+
/**
|
|
90
|
+
* Function that renders introductory text after the release header.
|
|
91
|
+
*/
|
|
92
|
+
preamblePartial?: PreamblePartialFunction<Commit>;
|
|
93
|
+
/**
|
|
94
|
+
* Function that renders a single commit entry.
|
|
95
|
+
*/
|
|
96
|
+
commitPartial?: CommitPartialFunction<Commit>;
|
|
97
|
+
/**
|
|
98
|
+
* Function that renders release footer notes.
|
|
99
|
+
*/
|
|
100
|
+
footerPartial?: FooterPartialFunction<Commit>;
|
|
101
|
+
}
|
|
102
|
+
type RequiredTemplateContext<Commit extends CommitKnownProps = CommitKnownProps> = Required<TemplateContext<Commit>>;
|
|
103
|
+
export interface FinalTemplateContext<Commit extends CommitKnownProps = CommitKnownProps> extends TemplateContext<Commit> {
|
|
104
|
+
commit: RequiredTemplateContext<Commit>['commit'];
|
|
105
|
+
issue: RequiredTemplateContext<Commit>['issue'];
|
|
106
|
+
date: RequiredTemplateContext<Commit>['date'];
|
|
107
|
+
headerPartial: RequiredTemplateContext<Commit>['headerPartial'];
|
|
108
|
+
preamblePartial: RequiredTemplateContext<Commit>['preamblePartial'];
|
|
109
|
+
commitPartial: RequiredTemplateContext<Commit>['commitPartial'];
|
|
110
|
+
footerPartial: RequiredTemplateContext<Commit>['footerPartial'];
|
|
111
|
+
}
|
|
112
|
+
export {};
|
|
113
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,iBAAiB,EAClB,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,qBAAqB,CAAC,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,IAClF,CAAC,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,aAAa,CAAA;AAChC,mBAAmB,cAAc,CAAA;AACjC,mBAAmB,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@conventional-changelog/template",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"description": "Template utilities for conventional changelog generation.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Dan Onoshko",
|
|
8
|
+
"email": "danon0404@gmail.com",
|
|
9
|
+
"url": "https://github.com/dangreen"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"homepage": "https://conventional-changelog.js.org/template/",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/conventional-changelog/conventional-changelog.git",
|
|
16
|
+
"directory": "packages/template"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/conventional-changelog/conventional-changelog/issues"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"conventional-changelog",
|
|
23
|
+
"changelog",
|
|
24
|
+
"template",
|
|
25
|
+
"render",
|
|
26
|
+
"helpers"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 - present, TrigenSoftware
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @simple-libs/stream-utils
|
|
2
|
+
|
|
3
|
+
[![ESM-only package][package]][package-url]
|
|
4
|
+
[![NPM version][npm]][npm-url]
|
|
5
|
+
[![Node version][node]][node-url]
|
|
6
|
+
[![Dependencies status][deps]][deps-url]
|
|
7
|
+
[![Install size][size]][size-url]
|
|
8
|
+
[![Build status][build]][build-url]
|
|
9
|
+
[![Coverage status][coverage]][coverage-url]
|
|
10
|
+
|
|
11
|
+
[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
|
|
12
|
+
[package-url]: https://nodejs.org/api/esm.html
|
|
13
|
+
|
|
14
|
+
[npm]: https://img.shields.io/npm/v/@simple-libs/stream-utils.svg
|
|
15
|
+
[npm-url]: https://www.npmjs.com/package/@simple-libs/stream-utils
|
|
16
|
+
|
|
17
|
+
[node]: https://img.shields.io/node/v/@simple-libs/stream-utils.svg
|
|
18
|
+
[node-url]: https://nodejs.org
|
|
19
|
+
|
|
20
|
+
[deps]: https://img.shields.io/librariesio/release/npm/@simple-libs/stream-utils
|
|
21
|
+
[deps-url]: https://libraries.io/npm/@simple-libs%2Fstream-utils
|
|
22
|
+
|
|
23
|
+
[size]: https://packagephobia.com/badge?p=@simple-libs/stream-utils
|
|
24
|
+
[size-url]: https://packagephobia.com/result?p=@simple-libs/stream-utils
|
|
25
|
+
|
|
26
|
+
[build]: https://img.shields.io/github/actions/workflow/status/TrigenSoftware/simple-libs/tests.yml?branch=main
|
|
27
|
+
[build-url]: https://github.com/TrigenSoftware/simple-libs/actions
|
|
28
|
+
|
|
29
|
+
[coverage]: https://coveralls.io/repos/github/TrigenSoftware/simple-libs/badge.svg?branch=main
|
|
30
|
+
[coverage-url]: https://coveralls.io/github/TrigenSoftware/simple-libs?branch=main
|
|
31
|
+
|
|
32
|
+
A small set of utilities for streams.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# pnpm
|
|
38
|
+
pnpm add @simple-libs/stream-utils
|
|
39
|
+
# yarn
|
|
40
|
+
yarn add @simple-libs/stream-utils
|
|
41
|
+
# npm
|
|
42
|
+
npm i @simple-libs/stream-utils
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import {
|
|
49
|
+
toArray,
|
|
50
|
+
concatBufferStream,
|
|
51
|
+
concatStringStream,
|
|
52
|
+
firstFromStream,
|
|
53
|
+
mergeReadables
|
|
54
|
+
} from '@simple-libs/stream-utils'
|
|
55
|
+
|
|
56
|
+
// Convert a readable stream to an array
|
|
57
|
+
await toArray(Readable.from(['foo', 'bar', 'baz']))
|
|
58
|
+
// Returns ['foo', 'bar', 'baz']
|
|
59
|
+
|
|
60
|
+
// Concatenate a stream of buffers into a single buffer
|
|
61
|
+
await concatBufferStream(Readable.from([Buffer.from('foo'), Buffer.from('bar')]))
|
|
62
|
+
// Returns <Buffer 66 6f 6f 62 61 72>
|
|
63
|
+
|
|
64
|
+
// Concatenate a stream of strings into a single string
|
|
65
|
+
await concatStringStream(Readable.from(['foo', 'bar']))
|
|
66
|
+
// Returns 'foobar'
|
|
67
|
+
|
|
68
|
+
// Get the first value from a stream
|
|
69
|
+
await firstFromStream(Readable.from(['foo', 'bar']))
|
|
70
|
+
// Returns 'foo'
|
|
71
|
+
|
|
72
|
+
// Merges multiple Readable streams into a single Readable stream.
|
|
73
|
+
// Each chunk will be an object containing the source stream name and the chunk data.
|
|
74
|
+
await mergeReadables({
|
|
75
|
+
foo: Readable.from(['foo1', 'foo2']),
|
|
76
|
+
bar: Readable.from(['bar1', 'bar2'])
|
|
77
|
+
})
|
|
78
|
+
// Returns [{ source: 'foo', chunk: 'foo1' }, { source: 'foo', chunk: 'foo2' }, { source: 'bar', chunk: 'bar1' }, { source: 'bar', chunk: 'bar2' }]
|
|
79
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Readable } from 'stream';
|
|
2
|
+
/**
|
|
3
|
+
* Get all items from an async iterable and return them as an array.
|
|
4
|
+
* @param iterable
|
|
5
|
+
* @returns A promise that resolves to an array of items.
|
|
6
|
+
*/
|
|
7
|
+
export declare function toArray<T>(iterable: AsyncIterable<T>): Promise<T[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Concatenate all buffers from an async iterable into a single Buffer.
|
|
10
|
+
* @param iterable
|
|
11
|
+
* @returns A promise that resolves to a single Buffer containing all concatenated buffers.
|
|
12
|
+
*/
|
|
13
|
+
export declare function concatBufferStream(iterable: AsyncIterable<Buffer>): Promise<Buffer<ArrayBuffer>>;
|
|
14
|
+
/**
|
|
15
|
+
* Concatenate all strings from an async iterable into a single string.
|
|
16
|
+
* @param iterable
|
|
17
|
+
* @returns A promise that resolves to a single string containing all concatenated strings.
|
|
18
|
+
*/
|
|
19
|
+
export declare function concatStringStream(iterable: AsyncIterable<string>): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Get the first item from an async iterable.
|
|
22
|
+
* @param stream
|
|
23
|
+
* @returns A promise that resolves to the first item, or null if the iterable is empty.
|
|
24
|
+
*/
|
|
25
|
+
export declare function firstFromStream<T>(stream: AsyncIterable<T>): Promise<T | null>;
|
|
26
|
+
export interface MergedReadableChunk<K extends string, T = Buffer> {
|
|
27
|
+
source: K;
|
|
28
|
+
chunk: T;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Merges multiple Readable streams into a single Readable stream.
|
|
32
|
+
* Each chunk will be an object containing the source stream name and the chunk data.
|
|
33
|
+
* @param streams - An object where keys are stream names and values are Readable streams.
|
|
34
|
+
* @returns A merged Readable stream.
|
|
35
|
+
*/
|
|
36
|
+
export declare function mergeReadables<K extends string, T = Buffer>(streams: Record<K, Readable>): Readable & AsyncIterable<MergedReadableChunk<K, T>>;
|
|
37
|
+
/**
|
|
38
|
+
* Split stream by separator.
|
|
39
|
+
* @param stream
|
|
40
|
+
* @param separator
|
|
41
|
+
* @yields String chunks.
|
|
42
|
+
*/
|
|
43
|
+
export declare function splitStream(stream: AsyncIterable<string | Buffer>, separator: string): AsyncGenerator<string, void, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* Parse JSON objects from a stream, separated by a delimiter (default is newline).
|
|
46
|
+
* @param stream
|
|
47
|
+
* @param delimiter
|
|
48
|
+
* @yields Parsed JSON objects of type T.
|
|
49
|
+
*/
|
|
50
|
+
export declare function parseJsonStream<T>(stream: AsyncIterable<string | Buffer>, delimiter?: RegExp): AsyncGenerator<Awaited<T>, void, unknown>;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjC;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAQzE;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,gCAEvE;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,mBAEvE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,qBAMhE;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,MAAM;IAC/D,MAAM,EAAE,CAAC,CAAA;IACT,KAAK,EAAE,CAAC,CAAA;CACT;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,CAAC,SAAS,MAAM,EAChB,CAAC,GAAG,MAAM,EAEV,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,GAC3B,QAAQ,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAwBrD;AAED;;;;;GAKG;AACH,wBAAuB,WAAW,CAChC,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,EACtC,SAAS,EAAE,MAAM,yCAoBlB;AAED;;;;;GAKG;AACH,wBAAuB,eAAe,CAAC,CAAC,EACtC,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,EACtC,SAAS,SAAU,6CAuBpB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Readable } from 'stream';
|
|
2
|
+
/**
|
|
3
|
+
* Get all items from an async iterable and return them as an array.
|
|
4
|
+
* @param iterable
|
|
5
|
+
* @returns A promise that resolves to an array of items.
|
|
6
|
+
*/
|
|
7
|
+
export async function toArray(iterable) {
|
|
8
|
+
const result = [];
|
|
9
|
+
for await (const item of iterable) {
|
|
10
|
+
result.push(item);
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Concatenate all buffers from an async iterable into a single Buffer.
|
|
16
|
+
* @param iterable
|
|
17
|
+
* @returns A promise that resolves to a single Buffer containing all concatenated buffers.
|
|
18
|
+
*/
|
|
19
|
+
export async function concatBufferStream(iterable) {
|
|
20
|
+
return Buffer.concat(await toArray(iterable));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Concatenate all strings from an async iterable into a single string.
|
|
24
|
+
* @param iterable
|
|
25
|
+
* @returns A promise that resolves to a single string containing all concatenated strings.
|
|
26
|
+
*/
|
|
27
|
+
export async function concatStringStream(iterable) {
|
|
28
|
+
return (await toArray(iterable)).join('');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the first item from an async iterable.
|
|
32
|
+
* @param stream
|
|
33
|
+
* @returns A promise that resolves to the first item, or null if the iterable is empty.
|
|
34
|
+
*/
|
|
35
|
+
export async function firstFromStream(stream) {
|
|
36
|
+
for await (const tag of stream) {
|
|
37
|
+
return tag;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Merges multiple Readable streams into a single Readable stream.
|
|
43
|
+
* Each chunk will be an object containing the source stream name and the chunk data.
|
|
44
|
+
* @param streams - An object where keys are stream names and values are Readable streams.
|
|
45
|
+
* @returns A merged Readable stream.
|
|
46
|
+
*/
|
|
47
|
+
export function mergeReadables(streams) {
|
|
48
|
+
const mergedStream = new Readable({
|
|
49
|
+
objectMode: true,
|
|
50
|
+
read() { }
|
|
51
|
+
});
|
|
52
|
+
let ended = 0;
|
|
53
|
+
Object.entries(streams).forEach(([name, stream], _i, entries) => {
|
|
54
|
+
stream
|
|
55
|
+
.on('data', (chunk) => mergedStream.push({
|
|
56
|
+
source: name,
|
|
57
|
+
chunk
|
|
58
|
+
}))
|
|
59
|
+
.on('end', () => {
|
|
60
|
+
ended += 1;
|
|
61
|
+
if (ended === entries.length) {
|
|
62
|
+
mergedStream.push(null);
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
.on('error', err => mergedStream.destroy(err));
|
|
66
|
+
});
|
|
67
|
+
return mergedStream;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Split stream by separator.
|
|
71
|
+
* @param stream
|
|
72
|
+
* @param separator
|
|
73
|
+
* @yields String chunks.
|
|
74
|
+
*/
|
|
75
|
+
export async function* splitStream(stream, separator) {
|
|
76
|
+
let chunk;
|
|
77
|
+
let payload;
|
|
78
|
+
let buffer = '';
|
|
79
|
+
for await (chunk of stream) {
|
|
80
|
+
buffer += chunk.toString();
|
|
81
|
+
if (buffer.includes(separator)) {
|
|
82
|
+
payload = buffer.split(separator);
|
|
83
|
+
buffer = payload.pop() || '';
|
|
84
|
+
yield* payload;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (buffer) {
|
|
88
|
+
yield buffer;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Parse JSON objects from a stream, separated by a delimiter (default is newline).
|
|
93
|
+
* @param stream
|
|
94
|
+
* @param delimiter
|
|
95
|
+
* @yields Parsed JSON objects of type T.
|
|
96
|
+
*/
|
|
97
|
+
export async function* parseJsonStream(stream, delimiter = /\r?\n/) {
|
|
98
|
+
let chunk;
|
|
99
|
+
let payload;
|
|
100
|
+
let buffer = '';
|
|
101
|
+
let json;
|
|
102
|
+
for await (chunk of stream) {
|
|
103
|
+
buffer += chunk.toString();
|
|
104
|
+
if (delimiter.test(buffer)) {
|
|
105
|
+
payload = buffer.split(delimiter);
|
|
106
|
+
buffer = payload.pop() || '';
|
|
107
|
+
for (json of payload) {
|
|
108
|
+
yield JSON.parse(json);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (buffer) {
|
|
113
|
+
yield JSON.parse(buffer);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLFFBQVEsQ0FBQTtBQUVqQzs7OztHQUlHO0FBQ0gsTUFBTSxDQUFDLEtBQUssVUFBVSxPQUFPLENBQUksUUFBMEI7SUFDekQsTUFBTSxNQUFNLEdBQVEsRUFBRSxDQUFBO0lBRXRCLElBQUksS0FBSyxFQUFFLE1BQU0sSUFBSSxJQUFJLFFBQVEsRUFBRSxDQUFDO1FBQ2xDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUE7SUFDbkIsQ0FBQztJQUVELE9BQU8sTUFBTSxDQUFBO0FBQ2YsQ0FBQztBQUVEOzs7O0dBSUc7QUFDSCxNQUFNLENBQUMsS0FBSyxVQUFVLGtCQUFrQixDQUFDLFFBQStCO0lBQ3RFLE9BQU8sTUFBTSxDQUFDLE1BQU0sQ0FBQyxNQUFNLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFBO0FBQy9DLENBQUM7QUFFRDs7OztHQUlHO0FBQ0gsTUFBTSxDQUFDLEtBQUssVUFBVSxrQkFBa0IsQ0FBQyxRQUErQjtJQUN0RSxPQUFPLENBQUMsTUFBTSxPQUFPLENBQUMsUUFBUSxDQUFDLEN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