@savvy-web/changesets 0.1.0 → 0.1.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/README.md +14 -36
- package/cjs/changelog.cjs +670 -0
- package/cjs/index.cjs +1302 -0
- package/cjs/markdownlint.cjs +312 -0
- package/cjs/remark.cjs +559 -0
- package/{bin → esm/bin}/savvy-changesets.js +143 -17
- package/esm/changelog.d.ts +21 -0
- package/esm/index.d.ts +795 -0
- package/esm/markdownlint.d.ts +61 -0
- package/esm/remark.d.ts +92 -0
- package/package.json +21 -27
- /package/{changelog.d.ts → cjs/changelog.d.cts} +0 -0
- /package/{index.d.ts → cjs/index.d.cts} +0 -0
- /package/{markdownlint.d.ts → cjs/markdownlint.d.cts} +0 -0
- /package/{remark.d.ts → cjs/remark.d.cts} +0 -0
- /package/{160.js → esm/160.js} +0 -0
- /package/{234.js → esm/234.js} +0 -0
- /package/{245.js → esm/245.js} +0 -0
- /package/{273.js → esm/273.js} +0 -0
- /package/{60.js → esm/60.js} +0 -0
- /package/{689.js → esm/689.js} +0 -0
- /package/{changelog.js → esm/changelog.js} +0 -0
- /package/{index.js → esm/index.js} +0 -0
- /package/{markdownlint.js → esm/markdownlint.js} +0 -0
- /package/{remark.js → esm/remark.js} +0 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./src/categories/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
+
JY: ()=>fromHeading,
|
|
6
|
+
OH: ()=>resolveCommitType
|
|
7
|
+
});
|
|
8
|
+
const BREAKING_CHANGES = {
|
|
9
|
+
heading: "Breaking Changes",
|
|
10
|
+
priority: 1,
|
|
11
|
+
commitTypes: [],
|
|
12
|
+
description: "Backward-incompatible changes"
|
|
13
|
+
};
|
|
14
|
+
const FEATURES = {
|
|
15
|
+
heading: "Features",
|
|
16
|
+
priority: 2,
|
|
17
|
+
commitTypes: [
|
|
18
|
+
"feat"
|
|
19
|
+
],
|
|
20
|
+
description: "New functionality"
|
|
21
|
+
};
|
|
22
|
+
const BUG_FIXES = {
|
|
23
|
+
heading: "Bug Fixes",
|
|
24
|
+
priority: 3,
|
|
25
|
+
commitTypes: [
|
|
26
|
+
"fix"
|
|
27
|
+
],
|
|
28
|
+
description: "Bug corrections"
|
|
29
|
+
};
|
|
30
|
+
const PERFORMANCE = {
|
|
31
|
+
heading: "Performance",
|
|
32
|
+
priority: 4,
|
|
33
|
+
commitTypes: [
|
|
34
|
+
"perf"
|
|
35
|
+
],
|
|
36
|
+
description: "Performance improvements"
|
|
37
|
+
};
|
|
38
|
+
const DOCUMENTATION = {
|
|
39
|
+
heading: "Documentation",
|
|
40
|
+
priority: 5,
|
|
41
|
+
commitTypes: [
|
|
42
|
+
"docs"
|
|
43
|
+
],
|
|
44
|
+
description: "Documentation changes"
|
|
45
|
+
};
|
|
46
|
+
const REFACTORING = {
|
|
47
|
+
heading: "Refactoring",
|
|
48
|
+
priority: 6,
|
|
49
|
+
commitTypes: [
|
|
50
|
+
"refactor"
|
|
51
|
+
],
|
|
52
|
+
description: "Code restructuring"
|
|
53
|
+
};
|
|
54
|
+
const TESTS = {
|
|
55
|
+
heading: "Tests",
|
|
56
|
+
priority: 7,
|
|
57
|
+
commitTypes: [
|
|
58
|
+
"test"
|
|
59
|
+
],
|
|
60
|
+
description: "Test additions or modifications"
|
|
61
|
+
};
|
|
62
|
+
const BUILD_SYSTEM = {
|
|
63
|
+
heading: "Build System",
|
|
64
|
+
priority: 8,
|
|
65
|
+
commitTypes: [
|
|
66
|
+
"build"
|
|
67
|
+
],
|
|
68
|
+
description: "Build configuration changes"
|
|
69
|
+
};
|
|
70
|
+
const CI = {
|
|
71
|
+
heading: "CI",
|
|
72
|
+
priority: 9,
|
|
73
|
+
commitTypes: [
|
|
74
|
+
"ci"
|
|
75
|
+
],
|
|
76
|
+
description: "Continuous integration changes"
|
|
77
|
+
};
|
|
78
|
+
const DEPENDENCIES = {
|
|
79
|
+
heading: "Dependencies",
|
|
80
|
+
priority: 10,
|
|
81
|
+
commitTypes: [
|
|
82
|
+
"deps"
|
|
83
|
+
],
|
|
84
|
+
description: "Dependency updates"
|
|
85
|
+
};
|
|
86
|
+
const MAINTENANCE = {
|
|
87
|
+
heading: "Maintenance",
|
|
88
|
+
priority: 11,
|
|
89
|
+
commitTypes: [
|
|
90
|
+
"chore",
|
|
91
|
+
"style"
|
|
92
|
+
],
|
|
93
|
+
description: "General maintenance"
|
|
94
|
+
};
|
|
95
|
+
const REVERTS = {
|
|
96
|
+
heading: "Reverts",
|
|
97
|
+
priority: 12,
|
|
98
|
+
commitTypes: [
|
|
99
|
+
"revert"
|
|
100
|
+
],
|
|
101
|
+
description: "Reverted changes"
|
|
102
|
+
};
|
|
103
|
+
const OTHER = {
|
|
104
|
+
heading: "Other",
|
|
105
|
+
priority: 13,
|
|
106
|
+
commitTypes: [],
|
|
107
|
+
description: "Uncategorized changes"
|
|
108
|
+
};
|
|
109
|
+
const CATEGORIES = [
|
|
110
|
+
BREAKING_CHANGES,
|
|
111
|
+
FEATURES,
|
|
112
|
+
BUG_FIXES,
|
|
113
|
+
PERFORMANCE,
|
|
114
|
+
DOCUMENTATION,
|
|
115
|
+
REFACTORING,
|
|
116
|
+
TESTS,
|
|
117
|
+
BUILD_SYSTEM,
|
|
118
|
+
CI,
|
|
119
|
+
DEPENDENCIES,
|
|
120
|
+
MAINTENANCE,
|
|
121
|
+
REVERTS,
|
|
122
|
+
OTHER
|
|
123
|
+
];
|
|
124
|
+
const headingToCategory = new Map(CATEGORIES.map((cat)=>[
|
|
125
|
+
cat.heading.toLowerCase(),
|
|
126
|
+
cat
|
|
127
|
+
]));
|
|
128
|
+
const commitTypeToCategory = new Map();
|
|
129
|
+
for (const cat of CATEGORIES)for (const commitType of cat.commitTypes)commitTypeToCategory.set(commitType, cat);
|
|
130
|
+
function resolveCommitType(type, scope, breaking) {
|
|
131
|
+
if (breaking) return BREAKING_CHANGES;
|
|
132
|
+
if ("chore" === type && "deps" === scope) return DEPENDENCIES;
|
|
133
|
+
return commitTypeToCategory.get(type) ?? OTHER;
|
|
134
|
+
}
|
|
135
|
+
function fromHeading(heading) {
|
|
136
|
+
return headingToCategory.get(heading.toLowerCase());
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"./src/errors.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
140
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
141
|
+
OS: ()=>GitHubApiError,
|
|
142
|
+
j1: ()=>ConfigurationError
|
|
143
|
+
});
|
|
144
|
+
var effect__rspack_import_0 = __webpack_require__("effect");
|
|
145
|
+
effect__rspack_import_0.Data.TaggedError("ChangesetValidationError");
|
|
146
|
+
const GitHubApiErrorBase = effect__rspack_import_0.Data.TaggedError("GitHubApiError");
|
|
147
|
+
class GitHubApiError extends GitHubApiErrorBase {
|
|
148
|
+
get message() {
|
|
149
|
+
const status = this.statusCode ? ` (${this.statusCode})` : "";
|
|
150
|
+
return `GitHub API error during ${this.operation}${status}: ${this.reason}`;
|
|
151
|
+
}
|
|
152
|
+
get isRateLimited() {
|
|
153
|
+
return 403 === this.statusCode || 429 === this.statusCode;
|
|
154
|
+
}
|
|
155
|
+
get isRetryable() {
|
|
156
|
+
return void 0 !== this.statusCode && (this.statusCode >= 500 || this.isRateLimited);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
effect__rspack_import_0.Data.TaggedError("MarkdownParseError");
|
|
160
|
+
const ConfigurationErrorBase = effect__rspack_import_0.Data.TaggedError("ConfigurationError");
|
|
161
|
+
class ConfigurationError extends ConfigurationErrorBase {
|
|
162
|
+
get message() {
|
|
163
|
+
return `Configuration error (${this.field}): ${this.reason}`;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"./src/schemas/github.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
168
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
169
|
+
lo: ()=>GitHubInfoSchema
|
|
170
|
+
});
|
|
171
|
+
var effect__rspack_import_0 = __webpack_require__("effect");
|
|
172
|
+
var _utils_markdown_link_js__rspack_import_2 = __webpack_require__("./src/utils/markdown-link.ts");
|
|
173
|
+
var _primitives_js__rspack_import_1 = __webpack_require__("./src/schemas/primitives.ts");
|
|
174
|
+
function isValidUrl(value) {
|
|
175
|
+
try {
|
|
176
|
+
new URL(value);
|
|
177
|
+
return true;
|
|
178
|
+
} catch {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const UsernameSchema = effect__rspack_import_0.Schema.String.pipe(effect__rspack_import_0.Schema.pattern(/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/, {
|
|
183
|
+
message: ()=>"Invalid GitHub username format"
|
|
184
|
+
}));
|
|
185
|
+
const IssueNumberSchema = _primitives_js__rspack_import_1.e.annotations({
|
|
186
|
+
title: "IssueNumber",
|
|
187
|
+
description: "GitHub issue or pull request number"
|
|
188
|
+
});
|
|
189
|
+
const UrlOrMarkdownLinkSchema = effect__rspack_import_0.Schema.String.pipe(effect__rspack_import_0.Schema.filter((value)=>{
|
|
190
|
+
if (isValidUrl(value)) return true;
|
|
191
|
+
const match = _utils_markdown_link_js__rspack_import_2.o.exec(value);
|
|
192
|
+
return match?.[2] ? isValidUrl(match[2]) : false;
|
|
193
|
+
}, {
|
|
194
|
+
message: ()=>"Invalid URL or markdown link format"
|
|
195
|
+
}));
|
|
196
|
+
const GitHubInfoSchema = effect__rspack_import_0.Schema.Struct({
|
|
197
|
+
user: effect__rspack_import_0.Schema.optional(UsernameSchema),
|
|
198
|
+
pull: effect__rspack_import_0.Schema.optional(IssueNumberSchema),
|
|
199
|
+
links: effect__rspack_import_0.Schema.Struct({
|
|
200
|
+
commit: UrlOrMarkdownLinkSchema,
|
|
201
|
+
pull: effect__rspack_import_0.Schema.optional(UrlOrMarkdownLinkSchema),
|
|
202
|
+
user: effect__rspack_import_0.Schema.optional(UrlOrMarkdownLinkSchema)
|
|
203
|
+
})
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
"./src/schemas/options.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
207
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
208
|
+
jb: ()=>validateChangesetOptions
|
|
209
|
+
});
|
|
210
|
+
var effect__rspack_import_0 = __webpack_require__("effect");
|
|
211
|
+
var _errors_js__rspack_import_1 = __webpack_require__("./src/errors.ts");
|
|
212
|
+
const REPO_PATTERN = /^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/;
|
|
213
|
+
const RepoSchema = effect__rspack_import_0.Schema.String.pipe(effect__rspack_import_0.Schema.pattern(REPO_PATTERN, {
|
|
214
|
+
message: ()=>'Repository must be in format "owner/repository" (e.g., "microsoft/vscode")'
|
|
215
|
+
}));
|
|
216
|
+
const ChangesetOptionsSchema = effect__rspack_import_0.Schema.Struct({
|
|
217
|
+
repo: RepoSchema,
|
|
218
|
+
commitLinks: effect__rspack_import_0.Schema.optional(effect__rspack_import_0.Schema.Boolean),
|
|
219
|
+
prLinks: effect__rspack_import_0.Schema.optional(effect__rspack_import_0.Schema.Boolean),
|
|
220
|
+
issueLinks: effect__rspack_import_0.Schema.optional(effect__rspack_import_0.Schema.Boolean),
|
|
221
|
+
issuePrefixes: effect__rspack_import_0.Schema.optional(effect__rspack_import_0.Schema.Array(effect__rspack_import_0.Schema.String))
|
|
222
|
+
});
|
|
223
|
+
function validateChangesetOptions(input) {
|
|
224
|
+
if (null == input) return effect__rspack_import_0.Effect.fail(new _errors_js__rspack_import_1.j1({
|
|
225
|
+
field: "options",
|
|
226
|
+
reason: 'Configuration is required. Add options to your changesets config:\n"changelog": ["@savvy-web/changesets", { "repo": "owner/repository" }]'
|
|
227
|
+
}));
|
|
228
|
+
if ("object" != typeof input) return effect__rspack_import_0.Effect.fail(new _errors_js__rspack_import_1.j1({
|
|
229
|
+
field: "options",
|
|
230
|
+
reason: "Configuration must be an object"
|
|
231
|
+
}));
|
|
232
|
+
const obj = input;
|
|
233
|
+
if (!("repo" in obj) || void 0 === obj.repo) return effect__rspack_import_0.Effect.fail(new _errors_js__rspack_import_1.j1({
|
|
234
|
+
field: "repo",
|
|
235
|
+
reason: 'Repository name is required. Add the "repo" option to your changesets config:\n"changelog": ["@savvy-web/changesets", { "repo": "owner/repository" }]'
|
|
236
|
+
}));
|
|
237
|
+
if ("string" == typeof obj.repo && !REPO_PATTERN.test(obj.repo)) return effect__rspack_import_0.Effect.fail(new _errors_js__rspack_import_1.j1({
|
|
238
|
+
field: "repo",
|
|
239
|
+
reason: `Invalid repository format: "${obj.repo}". Expected format is "owner/repository" (e.g., "microsoft/vscode")`
|
|
240
|
+
}));
|
|
241
|
+
return effect__rspack_import_0.Schema.decodeUnknown(ChangesetOptionsSchema)(input).pipe(effect__rspack_import_0.Effect.mapError((parseError)=>new _errors_js__rspack_import_1.j1({
|
|
242
|
+
field: "options",
|
|
243
|
+
reason: String(parseError)
|
|
244
|
+
})));
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"./src/schemas/primitives.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
248
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
249
|
+
e: ()=>PositiveInteger
|
|
250
|
+
});
|
|
251
|
+
var effect__rspack_import_0 = __webpack_require__("effect");
|
|
252
|
+
effect__rspack_import_0.Schema.String.pipe(effect__rspack_import_0.Schema.minLength(1));
|
|
253
|
+
const PositiveInteger = effect__rspack_import_0.Schema.Number.pipe(effect__rspack_import_0.Schema.int(), effect__rspack_import_0.Schema.positive());
|
|
254
|
+
},
|
|
255
|
+
"./src/services/github.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
256
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
257
|
+
Xx: ()=>GitHubService,
|
|
258
|
+
cH: ()=>GitHubLive
|
|
259
|
+
});
|
|
260
|
+
var external_effect_ = __webpack_require__("effect");
|
|
261
|
+
var errors = __webpack_require__("./src/errors.ts");
|
|
262
|
+
const get_github_info_namespaceObject = require("@changesets/get-github-info");
|
|
263
|
+
function getGitHubInfo(params) {
|
|
264
|
+
return external_effect_.Effect.tryPromise({
|
|
265
|
+
try: ()=>(0, get_github_info_namespaceObject.getInfo)({
|
|
266
|
+
commit: params.commit,
|
|
267
|
+
repo: params.repo
|
|
268
|
+
}),
|
|
269
|
+
catch: (error)=>new errors.OS({
|
|
270
|
+
operation: "getInfo",
|
|
271
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
272
|
+
})
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
const _tag = external_effect_.Context.Tag("GitHubService");
|
|
276
|
+
const GitHubServiceBase = _tag();
|
|
277
|
+
class GitHubService extends GitHubServiceBase {
|
|
278
|
+
}
|
|
279
|
+
const GitHubLive = external_effect_.Layer.succeed(GitHubService, {
|
|
280
|
+
getInfo: getGitHubInfo
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
"./src/services/markdown.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
284
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
285
|
+
Am: ()=>MarkdownLive
|
|
286
|
+
});
|
|
287
|
+
var effect__rspack_import_0 = __webpack_require__("effect");
|
|
288
|
+
var _utils_remark_pipeline_js__rspack_import_1 = __webpack_require__("./src/utils/remark-pipeline.ts");
|
|
289
|
+
const _tag = effect__rspack_import_0.Context.Tag("MarkdownService");
|
|
290
|
+
const MarkdownServiceBase = _tag();
|
|
291
|
+
class MarkdownService extends MarkdownServiceBase {
|
|
292
|
+
}
|
|
293
|
+
const MarkdownLive = effect__rspack_import_0.Layer.succeed(MarkdownService, {
|
|
294
|
+
parse: (content)=>effect__rspack_import_0.Effect.sync(()=>(0, _utils_remark_pipeline_js__rspack_import_1.Dd)(content)),
|
|
295
|
+
stringify: (tree)=>effect__rspack_import_0.Effect.sync(()=>(0, _utils_remark_pipeline_js__rspack_import_1.FH)(tree))
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
"./src/utils/markdown-link.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
299
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
300
|
+
W: ()=>extractUrlFromMarkdown,
|
|
301
|
+
o: ()=>MARKDOWN_LINK_PATTERN
|
|
302
|
+
});
|
|
303
|
+
const MARKDOWN_LINK_PATTERN = /\[([^\]]+)\]\(([^)]+)\)/;
|
|
304
|
+
function extractUrlFromMarkdown(linkOrUrl) {
|
|
305
|
+
const match = MARKDOWN_LINK_PATTERN.exec(linkOrUrl);
|
|
306
|
+
return match ? match[2] : linkOrUrl;
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"./src/utils/remark-pipeline.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
310
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
311
|
+
Dd: ()=>parseMarkdown,
|
|
312
|
+
FH: ()=>stringifyMarkdown
|
|
313
|
+
});
|
|
314
|
+
var remark_gfm__rspack_import_0 = __webpack_require__("remark-gfm");
|
|
315
|
+
var remark_gfm__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(remark_gfm__rspack_import_0);
|
|
316
|
+
var remark_parse__rspack_import_1 = __webpack_require__("remark-parse");
|
|
317
|
+
var remark_parse__rspack_import_1_default = /*#__PURE__*/ __webpack_require__.n(remark_parse__rspack_import_1);
|
|
318
|
+
var remark_stringify__rspack_import_2 = __webpack_require__("remark-stringify");
|
|
319
|
+
var remark_stringify__rspack_import_2_default = /*#__PURE__*/ __webpack_require__.n(remark_stringify__rspack_import_2);
|
|
320
|
+
var unified__rspack_import_3 = __webpack_require__("unified");
|
|
321
|
+
function createRemarkProcessor() {
|
|
322
|
+
return (0, unified__rspack_import_3.unified)().use(remark_parse__rspack_import_1_default()).use(remark_gfm__rspack_import_0_default()).use(remark_stringify__rspack_import_2_default());
|
|
323
|
+
}
|
|
324
|
+
function parseMarkdown(content) {
|
|
325
|
+
const processor = createRemarkProcessor();
|
|
326
|
+
return processor.parse(content);
|
|
327
|
+
}
|
|
328
|
+
function stringifyMarkdown(tree) {
|
|
329
|
+
const processor = createRemarkProcessor();
|
|
330
|
+
return processor.stringify(tree);
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
effect (module) {
|
|
334
|
+
module.exports = require("effect");
|
|
335
|
+
},
|
|
336
|
+
"mdast-util-to-string" (module) {
|
|
337
|
+
module.exports = require("mdast-util-to-string");
|
|
338
|
+
},
|
|
339
|
+
"remark-gfm" (module) {
|
|
340
|
+
module.exports = require("remark-gfm");
|
|
341
|
+
},
|
|
342
|
+
"remark-parse" (module) {
|
|
343
|
+
module.exports = require("remark-parse");
|
|
344
|
+
},
|
|
345
|
+
"remark-stringify" (module) {
|
|
346
|
+
module.exports = require("remark-stringify");
|
|
347
|
+
},
|
|
348
|
+
unified (module) {
|
|
349
|
+
module.exports = require("unified");
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
var __webpack_module_cache__ = {};
|
|
353
|
+
function __webpack_require__(moduleId) {
|
|
354
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
355
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
356
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
357
|
+
exports: {}
|
|
358
|
+
};
|
|
359
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
360
|
+
return module.exports;
|
|
361
|
+
}
|
|
362
|
+
(()=>{
|
|
363
|
+
__webpack_require__.n = (module)=>{
|
|
364
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
365
|
+
__webpack_require__.d(getter, {
|
|
366
|
+
a: getter
|
|
367
|
+
});
|
|
368
|
+
return getter;
|
|
369
|
+
};
|
|
370
|
+
})();
|
|
371
|
+
(()=>{
|
|
372
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
373
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
374
|
+
enumerable: true,
|
|
375
|
+
get: definition[key]
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
})();
|
|
379
|
+
(()=>{
|
|
380
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
381
|
+
})();
|
|
382
|
+
(()=>{
|
|
383
|
+
__webpack_require__.r = (exports1)=>{
|
|
384
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
385
|
+
value: 'Module'
|
|
386
|
+
});
|
|
387
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
388
|
+
value: true
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
})();
|
|
392
|
+
var __webpack_exports__ = {};
|
|
393
|
+
(()=>{
|
|
394
|
+
__webpack_require__.r(__webpack_exports__);
|
|
395
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
396
|
+
default: ()=>changelog
|
|
397
|
+
});
|
|
398
|
+
var external_effect_ = __webpack_require__("effect");
|
|
399
|
+
var schemas_options = __webpack_require__("./src/schemas/options.ts");
|
|
400
|
+
var services_github = __webpack_require__("./src/services/github.ts");
|
|
401
|
+
var markdown = __webpack_require__("./src/services/markdown.ts");
|
|
402
|
+
function logWarning(message, ...args) {
|
|
403
|
+
if ("u" > typeof process && "true" === process.env.GITHUB_ACTIONS) {
|
|
404
|
+
const text = args.length > 0 ? `${message} ${args.join(" ")}` : message;
|
|
405
|
+
console.warn(`::warning::${text}`);
|
|
406
|
+
} else console.warn(message, ...args);
|
|
407
|
+
}
|
|
408
|
+
function getDependencyReleaseLine(changesets, dependenciesUpdated, options) {
|
|
409
|
+
return external_effect_.Effect.gen(function*() {
|
|
410
|
+
if (0 === dependenciesUpdated.length) return "";
|
|
411
|
+
const github = yield* services_github.Xx;
|
|
412
|
+
let apiFailures = 0;
|
|
413
|
+
const totalWithCommit = changesets.filter((cs)=>cs.commit).length;
|
|
414
|
+
const commitLinks = yield* external_effect_.Effect.forEach(changesets, (cs)=>{
|
|
415
|
+
const commit = cs.commit;
|
|
416
|
+
if (!commit) return external_effect_.Effect.succeed(null);
|
|
417
|
+
return github.getInfo({
|
|
418
|
+
commit,
|
|
419
|
+
repo: options.repo
|
|
420
|
+
}).pipe(external_effect_.Effect.map((info)=>info.links.commit), external_effect_.Effect.catchAll((error)=>{
|
|
421
|
+
apiFailures++;
|
|
422
|
+
logWarning(`Failed to fetch GitHub info for commit ${commit}:`, String(error));
|
|
423
|
+
return external_effect_.Effect.succeed(`[\`${commit.substring(0, 7)}\`](https://github.com/${options.repo}/commit/${commit})`);
|
|
424
|
+
}));
|
|
425
|
+
}, {
|
|
426
|
+
concurrency: 10
|
|
427
|
+
});
|
|
428
|
+
if (apiFailures > 0) {
|
|
429
|
+
const successRate = ((totalWithCommit - apiFailures) / totalWithCommit * 100).toFixed(1);
|
|
430
|
+
logWarning(`GitHub API calls completed with ${apiFailures}/${totalWithCommit} failures (${successRate}% success rate)`);
|
|
431
|
+
}
|
|
432
|
+
const validLinks = commitLinks.filter(Boolean);
|
|
433
|
+
const changesetLink = validLinks.length > 0 ? `- Updated dependencies [${validLinks.join(", ")}]:` : "- Updated dependencies:";
|
|
434
|
+
const updatedDependenciesList = dependenciesUpdated.map((dep)=>` - ${dep.name}@${dep.newVersion}`);
|
|
435
|
+
return [
|
|
436
|
+
changesetLink,
|
|
437
|
+
...updatedDependenciesList
|
|
438
|
+
].join("\n");
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
var categories = __webpack_require__("./src/categories/index.ts");
|
|
442
|
+
var schemas_github = __webpack_require__("./src/schemas/github.ts");
|
|
443
|
+
const CONVENTIONAL_COMMIT_PATTERN = /^(\w+)(?:\(([^)]+)\))?(!)?\s*:\s*(.+)/;
|
|
444
|
+
function parseCommitMessage(message) {
|
|
445
|
+
const match = CONVENTIONAL_COMMIT_PATTERN.exec(message);
|
|
446
|
+
if (match) {
|
|
447
|
+
const [, type, scope, bang, description] = match;
|
|
448
|
+
const lines = message.split("\n");
|
|
449
|
+
const body = lines.slice(1).join("\n").trim();
|
|
450
|
+
const result = {
|
|
451
|
+
type,
|
|
452
|
+
description: description.trim()
|
|
453
|
+
};
|
|
454
|
+
if (scope) result.scope = scope;
|
|
455
|
+
if ("!" === bang) result.breaking = true;
|
|
456
|
+
if (body) result.body = body;
|
|
457
|
+
return result;
|
|
458
|
+
}
|
|
459
|
+
return {
|
|
460
|
+
description: message
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
const CLOSES_ISSUE_PATTERN = /closes?:?\s*#?(\d+(?:, *#?\d+)*)/i;
|
|
464
|
+
const FIXES_ISSUE_PATTERN = /fix(?:es)?:?\s*#?(\d+(?:, *#?\d+)*)/i;
|
|
465
|
+
const REFS_ISSUE_PATTERN = /refs?:?\s*#?(\d+(?:, *#?\d+)*)/i;
|
|
466
|
+
const ISSUE_NUMBER_SPLIT_PATTERN = /, */;
|
|
467
|
+
function extractIssueNumbers(pattern, message) {
|
|
468
|
+
const safeMessage = message.slice(0, 10000);
|
|
469
|
+
const match = pattern.exec(safeMessage);
|
|
470
|
+
if (!match?.[1]) return [];
|
|
471
|
+
return match[1].split(ISSUE_NUMBER_SPLIT_PATTERN).map((num)=>num.replace("#", "").trim());
|
|
472
|
+
}
|
|
473
|
+
function parseIssueReferences(commitMessage) {
|
|
474
|
+
return {
|
|
475
|
+
closes: extractIssueNumbers(CLOSES_ISSUE_PATTERN, commitMessage),
|
|
476
|
+
fixes: extractIssueNumbers(FIXES_ISSUE_PATTERN, commitMessage),
|
|
477
|
+
refs: extractIssueNumbers(REFS_ISSUE_PATTERN, commitMessage)
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
var external_mdast_util_to_string_ = __webpack_require__("mdast-util-to-string");
|
|
481
|
+
var remark_pipeline = __webpack_require__("./src/utils/remark-pipeline.ts");
|
|
482
|
+
function parseChangesetSections(summary) {
|
|
483
|
+
const tree = (0, remark_pipeline.Dd)(summary);
|
|
484
|
+
const h2Indices = [];
|
|
485
|
+
for(let i = 0; i < tree.children.length; i++){
|
|
486
|
+
const node = tree.children[i];
|
|
487
|
+
if ("heading" === node.type && 2 === node.depth) h2Indices.push(i);
|
|
488
|
+
}
|
|
489
|
+
if (0 === h2Indices.length) return {
|
|
490
|
+
preamble: summary.trim(),
|
|
491
|
+
sections: []
|
|
492
|
+
};
|
|
493
|
+
const result = {
|
|
494
|
+
sections: []
|
|
495
|
+
};
|
|
496
|
+
if (h2Indices[0] > 0) {
|
|
497
|
+
const preambleNodes = tree.children.slice(0, h2Indices[0]);
|
|
498
|
+
result.preamble = stringifyAstSlice(preambleNodes);
|
|
499
|
+
}
|
|
500
|
+
for(let i = 0; i < h2Indices.length; i++){
|
|
501
|
+
const headingIndex = h2Indices[i];
|
|
502
|
+
const headingNode = tree.children[headingIndex];
|
|
503
|
+
const headingText = (0, external_mdast_util_to_string_.toString)(headingNode);
|
|
504
|
+
const nextIndex = i + 1 < h2Indices.length ? h2Indices[i + 1] : tree.children.length;
|
|
505
|
+
const contentNodes = tree.children.slice(headingIndex + 1, nextIndex);
|
|
506
|
+
const content = stringifyAstSlice(contentNodes);
|
|
507
|
+
const category = (0, categories.JY)(headingText);
|
|
508
|
+
if (category) result.sections.push({
|
|
509
|
+
category,
|
|
510
|
+
heading: headingText,
|
|
511
|
+
content
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
return result;
|
|
515
|
+
}
|
|
516
|
+
function stringifyAstSlice(nodes) {
|
|
517
|
+
if (0 === nodes.length) return "";
|
|
518
|
+
const root = {
|
|
519
|
+
type: "root",
|
|
520
|
+
children: nodes
|
|
521
|
+
};
|
|
522
|
+
return (0, remark_pipeline.FH)(root).trim();
|
|
523
|
+
}
|
|
524
|
+
var markdown_link = __webpack_require__("./src/utils/markdown-link.ts");
|
|
525
|
+
const ISSUE_CATEGORIES = [
|
|
526
|
+
{
|
|
527
|
+
key: "closes",
|
|
528
|
+
label: "Closes"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
key: "fixes",
|
|
532
|
+
label: "Fixes"
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
key: "refs",
|
|
536
|
+
label: "Refs"
|
|
537
|
+
}
|
|
538
|
+
];
|
|
539
|
+
function formatChangelogEntry(entry, options) {
|
|
540
|
+
const parts = [];
|
|
541
|
+
if (entry.commit) {
|
|
542
|
+
const shortHash = entry.commit.substring(0, 7);
|
|
543
|
+
parts.push(`[\`${shortHash}\`](https://github.com/${options.repo}/commit/${entry.commit})`);
|
|
544
|
+
}
|
|
545
|
+
parts.push(entry.summary.trim());
|
|
546
|
+
const issueLinks = [];
|
|
547
|
+
for (const { key, label } of ISSUE_CATEGORIES){
|
|
548
|
+
const numbers = entry.issues[key];
|
|
549
|
+
if (numbers.length > 0) {
|
|
550
|
+
const links = numbers.map((num)=>`[#${num}](https://github.com/${options.repo}/issues/${num})`);
|
|
551
|
+
issueLinks.push(`${label}: ${links.join(", ")}`);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (issueLinks.length > 0) parts.push(`\n\n${issueLinks.join(". ")}`);
|
|
555
|
+
return parts.join(" ");
|
|
556
|
+
}
|
|
557
|
+
function formatPRAndUserAttribution(pr, user, links) {
|
|
558
|
+
let prReference = "";
|
|
559
|
+
if (pr) if (links?.pull) {
|
|
560
|
+
const pullUrl = (0, markdown_link.W)(links.pull);
|
|
561
|
+
prReference = ` [#${String(pr)}](${pullUrl})`;
|
|
562
|
+
} else prReference = ` (#${String(pr)})`;
|
|
563
|
+
if (user) {
|
|
564
|
+
if (links?.user) {
|
|
565
|
+
const userUrl = (0, markdown_link.W)(links.user);
|
|
566
|
+
return `${prReference} Thanks [@${user}](${userUrl})!`;
|
|
567
|
+
}
|
|
568
|
+
return `${prReference} Thanks @${user}!`;
|
|
569
|
+
}
|
|
570
|
+
return prReference;
|
|
571
|
+
}
|
|
572
|
+
function getReleaseLine(changeset, versionType, options) {
|
|
573
|
+
return external_effect_.Effect.gen(function*() {
|
|
574
|
+
let commitInfo = null;
|
|
575
|
+
if (changeset.commit) {
|
|
576
|
+
const github = yield* services_github.Xx;
|
|
577
|
+
commitInfo = yield* github.getInfo({
|
|
578
|
+
commit: changeset.commit,
|
|
579
|
+
repo: options.repo
|
|
580
|
+
}).pipe(external_effect_.Effect.flatMap((raw)=>external_effect_.Schema.decodeUnknown(schemas_github.lo)(raw).pipe(external_effect_.Effect.map(()=>raw), external_effect_.Effect.catchAll(()=>external_effect_.Effect.succeed(raw)))), external_effect_.Effect.catchAll((error)=>{
|
|
581
|
+
logWarning("Could not fetch GitHub info for commit:", changeset.commit ?? "", String(error));
|
|
582
|
+
return external_effect_.Effect.succeed(null);
|
|
583
|
+
}));
|
|
584
|
+
}
|
|
585
|
+
const parsed = parseChangesetSections(changeset.summary);
|
|
586
|
+
const firstLine = changeset.summary.split("\n")[0];
|
|
587
|
+
const commitMsg = parseCommitMessage(firstLine);
|
|
588
|
+
const bodyText = changeset.summary.split("\n").slice(1).join("\n");
|
|
589
|
+
const issueRefs = parseIssueReferences(bodyText);
|
|
590
|
+
const attribution = commitInfo ? formatPRAndUserAttribution(commitInfo.pull ?? void 0, commitInfo.user ?? void 0, commitInfo.links) : "";
|
|
591
|
+
if (parsed.sections.length > 0) {
|
|
592
|
+
const lines = [];
|
|
593
|
+
if (parsed.preamble) {
|
|
594
|
+
lines.push(parsed.preamble);
|
|
595
|
+
lines.push("");
|
|
596
|
+
}
|
|
597
|
+
for (const section of parsed.sections){
|
|
598
|
+
lines.push(`### ${section.category.heading}`);
|
|
599
|
+
lines.push("");
|
|
600
|
+
const commitPrefix = changeset.commit ? `[\`${changeset.commit.substring(0, 7)}\`](https://github.com/${options.repo}/commit/${changeset.commit}) ` : "";
|
|
601
|
+
if (section.content) {
|
|
602
|
+
const contentLines = section.content.split("\n");
|
|
603
|
+
const firstContentLine = contentLines[0];
|
|
604
|
+
if (firstContentLine.startsWith("- ") || firstContentLine.startsWith("* ")) {
|
|
605
|
+
lines.push(`${firstContentLine.substring(0, 2)}${commitPrefix}${firstContentLine.substring(2)}`);
|
|
606
|
+
lines.push(...contentLines.slice(1));
|
|
607
|
+
} else lines.push(`- ${commitPrefix}${section.content}`);
|
|
608
|
+
}
|
|
609
|
+
lines.push("");
|
|
610
|
+
}
|
|
611
|
+
const result = lines.join("\n").trimEnd();
|
|
612
|
+
return `${result}${attribution}`;
|
|
613
|
+
}
|
|
614
|
+
const commitType = commitMsg.type ?? versionType;
|
|
615
|
+
const category = (0, categories.OH)(commitType, commitMsg.scope, commitMsg.breaking);
|
|
616
|
+
const entryInput = {
|
|
617
|
+
type: category.heading,
|
|
618
|
+
summary: changeset.summary,
|
|
619
|
+
issues: issueRefs,
|
|
620
|
+
...changeset.commit ? {
|
|
621
|
+
commit: changeset.commit
|
|
622
|
+
} : {}
|
|
623
|
+
};
|
|
624
|
+
const entry = formatChangelogEntry(entryInput, {
|
|
625
|
+
repo: options.repo
|
|
626
|
+
});
|
|
627
|
+
return `- ${entry}${attribution}`;
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
const MainLayer = external_effect_.Layer.mergeAll(services_github.cH, markdown.Am);
|
|
631
|
+
const changelogFunctions = {
|
|
632
|
+
getReleaseLine: async (changeset, versionType, options)=>{
|
|
633
|
+
const program = external_effect_.Effect.gen(function*() {
|
|
634
|
+
const opts = yield* (0, schemas_options.jb)(options);
|
|
635
|
+
return yield* getReleaseLine(changeset, versionType, opts);
|
|
636
|
+
});
|
|
637
|
+
return external_effect_.Effect.runPromise(program.pipe(external_effect_.Effect.provide(MainLayer)));
|
|
638
|
+
},
|
|
639
|
+
getDependencyReleaseLine: async (changesets, dependenciesUpdated, options)=>{
|
|
640
|
+
const program = external_effect_.Effect.gen(function*() {
|
|
641
|
+
const opts = yield* (0, schemas_options.jb)(options);
|
|
642
|
+
return yield* getDependencyReleaseLine(changesets, dependenciesUpdated, opts);
|
|
643
|
+
});
|
|
644
|
+
return external_effect_.Effect.runPromise(program.pipe(external_effect_.Effect.provide(MainLayer)));
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
const changelog = changelogFunctions;
|
|
648
|
+
})();
|
|
649
|
+
exports["default"] = __webpack_exports__["default"];
|
|
650
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
651
|
+
"default"
|
|
652
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
653
|
+
Object.defineProperty(exports, '__esModule', {
|
|
654
|
+
value: true
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
if (module.exports && module.exports.__esModule && 'default' in module.exports) {
|
|
659
|
+
var _def = module.exports.default;
|
|
660
|
+
if (_def !== null && _def !== undefined && (typeof _def === 'object' || typeof _def === 'function')) {
|
|
661
|
+
var _keys = Object.keys(module.exports);
|
|
662
|
+
for (var _i = 0; _i < _keys.length; _i++) {
|
|
663
|
+
var _key = _keys[_i];
|
|
664
|
+
if (_key !== 'default' && _key !== '__esModule' && !(_key in _def)) {
|
|
665
|
+
_def[_key] = module.exports[_key];
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
module.exports = _def;
|
|
670
|
+
}
|