@savvy-web/silk 1.3.11 → 2.1.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.
Files changed (159) hide show
  1. package/README.md +7 -5
  2. package/changesets-changelog.cjs +39298 -96760
  3. package/changesets-changelog.d.cts +24 -14
  4. package/changesets-changelog.d.ts +24 -14
  5. package/changesets-changelog.js +54057 -1
  6. package/changesets-markdownlint.cjs +39295 -96757
  7. package/changesets-markdownlint.d.cts +24 -14
  8. package/changesets-markdownlint.d.ts +24 -14
  9. package/changesets-markdownlint.js +54057 -1
  10. package/package.json +6 -5
  11. package/tsconfig/node/dist/tsconfig.tsbuildinfo +1 -1
  12. package/_virtual/_rolldown/runtime.cjs +0 -45
  13. package/_virtual/_rolldown/runtime.js +0 -45
  14. package/packages/silk-effects/dist/dev/pkg/_virtual/_rolldown/runtime.cjs +0 -15
  15. package/packages/silk-effects/dist/dev/pkg/_virtual/_rolldown/runtime.js +0 -14
  16. package/packages/silk-effects/dist/dev/pkg/changesets/api/categories.cjs +0 -247
  17. package/packages/silk-effects/dist/dev/pkg/changesets/api/categories.js +0 -247
  18. package/packages/silk-effects/dist/dev/pkg/changesets/api/changelog.cjs +0 -134
  19. package/packages/silk-effects/dist/dev/pkg/changesets/api/changelog.js +0 -134
  20. package/packages/silk-effects/dist/dev/pkg/changesets/api/dependency-table.cjs +0 -163
  21. package/packages/silk-effects/dist/dev/pkg/changesets/api/dependency-table.js +0 -163
  22. package/packages/silk-effects/dist/dev/pkg/changesets/api/linter.cjs +0 -170
  23. package/packages/silk-effects/dist/dev/pkg/changesets/api/linter.js +0 -170
  24. package/packages/silk-effects/dist/dev/pkg/changesets/api/transformer.cjs +0 -134
  25. package/packages/silk-effects/dist/dev/pkg/changesets/api/transformer.js +0 -134
  26. package/packages/silk-effects/dist/dev/pkg/changesets/categories/index.cjs +0 -317
  27. package/packages/silk-effects/dist/dev/pkg/changesets/categories/index.js +0 -299
  28. package/packages/silk-effects/dist/dev/pkg/changesets/categories/types.cjs +0 -65
  29. package/packages/silk-effects/dist/dev/pkg/changesets/categories/types.js +0 -65
  30. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/formatting.cjs +0 -114
  31. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/formatting.js +0 -113
  32. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.cjs +0 -118
  33. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.js +0 -118
  34. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.cjs +0 -122
  35. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.js +0 -122
  36. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/index.cjs +0 -97
  37. package/packages/silk-effects/dist/dev/pkg/changesets/changelog/index.js +0 -97
  38. package/packages/silk-effects/dist/dev/pkg/changesets/constants.cjs +0 -43
  39. package/packages/silk-effects/dist/dev/pkg/changesets/constants.js +0 -42
  40. package/packages/silk-effects/dist/dev/pkg/changesets/errors.cjs +0 -386
  41. package/packages/silk-effects/dist/dev/pkg/changesets/errors.js +0 -371
  42. package/packages/silk-effects/dist/dev/pkg/changesets/index.cjs +0 -300
  43. package/packages/silk-effects/dist/dev/pkg/changesets/index.js +0 -179
  44. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/index.cjs +0 -34
  45. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/index.js +0 -29
  46. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/content-structure.cjs +0 -98
  47. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/content-structure.js +0 -98
  48. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.cjs +0 -170
  49. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.js +0 -170
  50. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.cjs +0 -61
  51. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.js +0 -61
  52. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.cjs +0 -54
  53. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.js +0 -54
  54. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.cjs +0 -54
  55. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.js +0 -54
  56. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.cjs +0 -31
  57. package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.js +0 -30
  58. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.cjs +0 -47
  59. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.js +0 -47
  60. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/contributor-footnotes.cjs +0 -123
  61. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/contributor-footnotes.js +0 -123
  62. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/deduplicate-items.cjs +0 -32
  63. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/deduplicate-items.js +0 -32
  64. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/issue-link-refs.cjs +0 -59
  65. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/issue-link-refs.js +0 -59
  66. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/maintenance-note.cjs +0 -61
  67. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/maintenance-note.js +0 -61
  68. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/merge-sections.cjs +0 -43
  69. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/merge-sections.js +0 -43
  70. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/normalize-format.cjs +0 -47
  71. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/normalize-format.js +0 -47
  72. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/reorder-sections.cjs +0 -34
  73. package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/reorder-sections.js +0 -34
  74. package/packages/silk-effects/dist/dev/pkg/changesets/remark/presets.cjs +0 -120
  75. package/packages/silk-effects/dist/dev/pkg/changesets/remark/presets.js +0 -119
  76. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/content-structure.cjs +0 -22
  77. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/content-structure.js +0 -22
  78. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/dependency-table-format.cjs +0 -40
  79. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/dependency-table-format.js +0 -40
  80. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/heading-hierarchy.cjs +0 -19
  81. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/heading-hierarchy.js +0 -19
  82. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/required-sections.cjs +0 -17
  83. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/required-sections.js +0 -17
  84. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/uncategorized-content.cjs +0 -31
  85. package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/uncategorized-content.js +0 -31
  86. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/changeset.cjs +0 -148
  87. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/changeset.js +0 -145
  88. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/dependency-table.cjs +0 -203
  89. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/dependency-table.js +0 -198
  90. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/git.cjs +0 -69
  91. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/git.js +0 -68
  92. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/github.cjs +0 -177
  93. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/github.js +0 -174
  94. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/options.cjs +0 -183
  95. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/options.js +0 -181
  96. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/package-scope.cjs +0 -129
  97. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/package-scope.js +0 -127
  98. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/primitives.cjs +0 -72
  99. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/primitives.js +0 -71
  100. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/release-plan.cjs +0 -62
  101. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/release-plan.js +0 -56
  102. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/version-files.cjs +0 -154
  103. package/packages/silk-effects/dist/dev/pkg/changesets/schemas/version-files.js +0 -150
  104. package/packages/silk-effects/dist/dev/pkg/changesets/services/branch-analyzer.cjs +0 -300
  105. package/packages/silk-effects/dist/dev/pkg/changesets/services/branch-analyzer.js +0 -294
  106. package/packages/silk-effects/dist/dev/pkg/changesets/services/changelog.cjs +0 -50
  107. package/packages/silk-effects/dist/dev/pkg/changesets/services/changelog.js +0 -49
  108. package/packages/silk-effects/dist/dev/pkg/changesets/services/config-inspector.cjs +0 -489
  109. package/packages/silk-effects/dist/dev/pkg/changesets/services/config-inspector.js +0 -481
  110. package/packages/silk-effects/dist/dev/pkg/changesets/services/deps-regen.cjs +0 -375
  111. package/packages/silk-effects/dist/dev/pkg/changesets/services/deps-regen.js +0 -371
  112. package/packages/silk-effects/dist/dev/pkg/changesets/services/github.cjs +0 -160
  113. package/packages/silk-effects/dist/dev/pkg/changesets/services/github.js +0 -157
  114. package/packages/silk-effects/dist/dev/pkg/changesets/services/maintenance-reason.cjs +0 -68
  115. package/packages/silk-effects/dist/dev/pkg/changesets/services/maintenance-reason.js +0 -66
  116. package/packages/silk-effects/dist/dev/pkg/changesets/services/markdown.cjs +0 -87
  117. package/packages/silk-effects/dist/dev/pkg/changesets/services/markdown.js +0 -85
  118. package/packages/silk-effects/dist/dev/pkg/changesets/services/release-planner.cjs +0 -338
  119. package/packages/silk-effects/dist/dev/pkg/changesets/services/release-planner.js +0 -334
  120. package/packages/silk-effects/dist/dev/pkg/changesets/utils/commit-parser.cjs +0 -81
  121. package/packages/silk-effects/dist/dev/pkg/changesets/utils/commit-parser.js +0 -80
  122. package/packages/silk-effects/dist/dev/pkg/changesets/utils/dep-diff.cjs +0 -111
  123. package/packages/silk-effects/dist/dev/pkg/changesets/utils/dep-diff.js +0 -111
  124. package/packages/silk-effects/dist/dev/pkg/changesets/utils/dependency-table.cjs +0 -351
  125. package/packages/silk-effects/dist/dev/pkg/changesets/utils/dependency-table.js +0 -347
  126. package/packages/silk-effects/dist/dev/pkg/changesets/utils/git.cjs +0 -51
  127. package/packages/silk-effects/dist/dev/pkg/changesets/utils/git.js +0 -51
  128. package/packages/silk-effects/dist/dev/pkg/changesets/utils/issue-refs.cjs +0 -102
  129. package/packages/silk-effects/dist/dev/pkg/changesets/utils/issue-refs.js +0 -101
  130. package/packages/silk-effects/dist/dev/pkg/changesets/utils/jsonpath.cjs +0 -178
  131. package/packages/silk-effects/dist/dev/pkg/changesets/utils/jsonpath.js +0 -175
  132. package/packages/silk-effects/dist/dev/pkg/changesets/utils/logger.cjs +0 -51
  133. package/packages/silk-effects/dist/dev/pkg/changesets/utils/logger.js +0 -50
  134. package/packages/silk-effects/dist/dev/pkg/changesets/utils/markdown-link.cjs +0 -59
  135. package/packages/silk-effects/dist/dev/pkg/changesets/utils/markdown-link.js +0 -57
  136. package/packages/silk-effects/dist/dev/pkg/changesets/utils/publishability.cjs +0 -50
  137. package/packages/silk-effects/dist/dev/pkg/changesets/utils/publishability.js +0 -50
  138. package/packages/silk-effects/dist/dev/pkg/changesets/utils/remark-pipeline.cjs +0 -81
  139. package/packages/silk-effects/dist/dev/pkg/changesets/utils/remark-pipeline.js +0 -79
  140. package/packages/silk-effects/dist/dev/pkg/changesets/utils/section-parser.cjs +0 -94
  141. package/packages/silk-effects/dist/dev/pkg/changesets/utils/section-parser.js +0 -94
  142. package/packages/silk-effects/dist/dev/pkg/changesets/utils/strip-frontmatter.cjs +0 -47
  143. package/packages/silk-effects/dist/dev/pkg/changesets/utils/strip-frontmatter.js +0 -46
  144. package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-blocks.cjs +0 -110
  145. package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-blocks.js +0 -108
  146. package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-files.cjs +0 -336
  147. package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-files.js +0 -336
  148. package/packages/silk-effects/dist/dev/pkg/changesets/vendor/github-info.cjs +0 -55
  149. package/packages/silk-effects/dist/dev/pkg/changesets/vendor/github-info.js +0 -55
  150. package/packages/silk-effects/dist/dev/pkg/errors/ChangesetConfigError.cjs +0 -21
  151. package/packages/silk-effects/dist/dev/pkg/errors/ChangesetConfigError.js +0 -21
  152. package/packages/silk-effects/dist/dev/pkg/schemas/VersioningSchemas.cjs +0 -101
  153. package/packages/silk-effects/dist/dev/pkg/schemas/VersioningSchemas.js +0 -99
  154. package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfig.cjs +0 -81
  155. package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfig.js +0 -80
  156. package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfigReader.cjs +0 -109
  157. package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfigReader.js +0 -108
  158. package/packages/silk-effects/dist/dev/pkg/services/SilkPublishability.cjs +0 -238
  159. package/packages/silk-effects/dist/dev/pkg/services/SilkPublishability.js +0 -236
@@ -1,170 +0,0 @@
1
- const require_index = require('../../../../../../../node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.cjs');
2
- const require_index$1 = require('../../../../../../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.cjs');
3
- const require_index$2 = require('../../../../../../../node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.cjs');
4
- const require_index$3 = require('../../../../../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs');
5
- const require_content_structure = require('../remark/rules/content-structure.cjs');
6
- const require_dependency_table_format = require('../remark/rules/dependency-table-format.cjs');
7
- const require_heading_hierarchy = require('../remark/rules/heading-hierarchy.cjs');
8
- const require_required_sections = require('../remark/rules/required-sections.cjs');
9
- const require_uncategorized_content = require('../remark/rules/uncategorized-content.cjs');
10
- const require_strip_frontmatter = require('../utils/strip-frontmatter.cjs');
11
- let node_path = require("node:path");
12
- let node_fs = require("node:fs");
13
-
14
- //#region ../silk-effects/dist/dev/pkg/changesets/api/linter.js
15
- /**
16
- * Class-based API wrapper for changeset linting.
17
- *
18
- * Provides a static class interface that runs all five remark-lint rules
19
- * against changeset markdown files and returns structured diagnostics.
20
- *
21
- * @internal
22
- */
23
- /**
24
- * Static class for linting changeset markdown files.
25
- *
26
- * Runs the five remark-lint rules (heading-hierarchy, required-sections,
27
- * content-structure, dependency-table-format, uncategorized-content) against
28
- * changeset markdown and returns structured {@link LintMessage} diagnostics.
29
- *
30
- * @remarks
31
- * This class implements the pre-validation layer of the three-layer
32
- * pipeline. It validates that changeset markdown conforms to the
33
- * expected structure before the changelog formatter processes it.
34
- *
35
- * YAML frontmatter (the `---` delimited block at the top of changeset
36
- * files containing package bump declarations) is automatically stripped
37
- * before validation, since frontmatter is managed by Changesets itself
38
- * and is not part of the markdown structure being validated.
39
- *
40
- * The class provides three granularity levels:
41
- *
42
- * - {@link ChangesetLinter.validateContent} -- validate a markdown string directly
43
- * - {@link ChangesetLinter.validateFile} -- validate a single file by path
44
- * - {@link ChangesetLinter.validate} -- validate all changeset files in a directory
45
- *
46
- * @example Validate a single file and report errors
47
- * ```typescript
48
- * import { ChangesetLinter } from "\@savvy-web/changesets";
49
- * import type { LintMessage } from "\@savvy-web/changesets";
50
- *
51
- * const messages: LintMessage[] = ChangesetLinter.validateFile(
52
- * ".changeset/brave-pandas-learn.md",
53
- * );
54
- *
55
- * if (messages.length > 0) {
56
- * for (const msg of messages) {
57
- * console.error(`${msg.file}:${msg.line}:${msg.column} [${msg.rule}] ${msg.message}`);
58
- * }
59
- * process.exitCode = 1;
60
- * }
61
- * ```
62
- *
63
- * @example Validate all changesets in a directory
64
- * ```typescript
65
- * import { ChangesetLinter } from "\@savvy-web/changesets";
66
- * import type { LintMessage } from "\@savvy-web/changesets";
67
- *
68
- * const allMessages: LintMessage[] = ChangesetLinter.validate(".changeset");
69
- *
70
- * const errorsByFile = new Map<string, LintMessage[]>();
71
- * for (const msg of allMessages) {
72
- * const existing = errorsByFile.get(msg.file) ?? [];
73
- * existing.push(msg);
74
- * errorsByFile.set(msg.file, existing);
75
- * }
76
- *
77
- * for (const [file, msgs] of errorsByFile) {
78
- * console.error(`${file}: ${msgs.length} issue(s)`);
79
- * }
80
- * ```
81
- *
82
- * @example Validate markdown content directly (useful in tests)
83
- * ```typescript
84
- * import { ChangesetLinter } from "\@savvy-web/changesets";
85
- * import type { LintMessage } from "\@savvy-web/changesets";
86
- *
87
- * const content = [
88
- * "---",
89
- * '"\@savvy-web/core": patch',
90
- * "---",
91
- * "",
92
- * "## Bug Fixes",
93
- * "",
94
- * "Fixed an edge case in token validation.",
95
- * ].join("\n");
96
- *
97
- * const messages: LintMessage[] = ChangesetLinter.validateContent(content);
98
- * // messages.length === 0 (valid changeset)
99
- * ```
100
- *
101
- * @see {@link LintMessage} for the diagnostic message shape
102
- * @see {@link Categories} for the valid section headings checked by the rules
103
- *
104
- * @public
105
- */
106
- var ChangesetLinter = class ChangesetLinter {
107
- /* v8 ignore next -- private constructor prevents direct instantiation */
108
- constructor() {}
109
- /**
110
- * Validate a single changeset file by path.
111
- *
112
- * @remarks
113
- * Reads the file synchronously, strips YAML frontmatter, and runs all
114
- * five lint rules. The file path is preserved in each returned
115
- * {@link LintMessage} for error reporting.
116
- *
117
- * @param filePath - Absolute or relative path to the changeset `.md` file
118
- * @returns Array of {@link LintMessage} diagnostics (empty if the file is valid)
119
- */
120
- static validateFile(filePath) {
121
- const raw = (0, node_fs.readFileSync)(filePath, "utf-8");
122
- return ChangesetLinter.validateContent(raw, filePath);
123
- }
124
- /**
125
- * Validate a markdown string directly.
126
- *
127
- * @remarks
128
- * Strips YAML frontmatter (if present) and runs all five lint rules
129
- * against the remaining content. This method is useful for validating
130
- * changeset content that is already in memory, such as in test suites
131
- * or editor integrations.
132
- *
133
- * @param content - Raw markdown content (may include YAML frontmatter)
134
- * @param filePath - File path for error reporting; defaults to `"<input>"`
135
- * when validating in-memory content
136
- * @returns Array of {@link LintMessage} diagnostics (empty if the content is valid)
137
- */
138
- static validateContent(content, filePath = "<input>") {
139
- const body = require_strip_frontmatter.stripFrontmatter(content);
140
- return require_index$3.unified().use(require_index$1.default).use(require_index.default).use(require_index$2.default).use(require_heading_hierarchy.HeadingHierarchyRule).use(require_required_sections.RequiredSectionsRule).use(require_content_structure.ContentStructureRule).use(require_dependency_table_format.DependencyTableFormatRule).use(require_uncategorized_content.UncategorizedContentRule).processSync(body).messages.map((msg) => ({
141
- file: filePath,
142
- /* v8 ignore next 3 -- ruleId/line/column fallbacks; remark-lint always provides these */
143
- rule: msg.ruleId ?? msg.source ?? "unknown",
144
- line: msg.line ?? 1,
145
- column: msg.column ?? 1,
146
- message: msg.message
147
- }));
148
- }
149
- /**
150
- * Validate all changeset `.md` files in a directory.
151
- *
152
- * @remarks
153
- * Scans the directory for `*.md` files (excluding `README.md`) and runs
154
- * {@link ChangesetLinter.validateFile} on each. Results are aggregated
155
- * into a single array. The directory is read synchronously.
156
- *
157
- * This is the method used by the Effect CLI's `lint` and `check`
158
- * subcommands to validate the `.changeset/` directory.
159
- *
160
- * @param dir - Path to the directory containing changeset files
161
- * (typically `.changeset/`)
162
- * @returns Aggregated array of {@link LintMessage} diagnostics from all files
163
- */
164
- static validate(dir) {
165
- return (0, node_fs.readdirSync)(dir).filter((f) => f.endsWith(".md") && f !== "README.md").flatMap((filename) => ChangesetLinter.validateFile((0, node_path.join)(dir, filename)));
166
- }
167
- };
168
-
169
- //#endregion
170
- exports.ChangesetLinter = ChangesetLinter;
@@ -1,170 +0,0 @@
1
- import remarkGfm from "../../../../../../../node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js";
2
- import remarkParse from "../../../../../../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.js";
3
- import remarkStringify from "../../../../../../../node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.js";
4
- import { unified } from "../../../../../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.js";
5
- import { ContentStructureRule } from "../remark/rules/content-structure.js";
6
- import { DependencyTableFormatRule } from "../remark/rules/dependency-table-format.js";
7
- import { HeadingHierarchyRule } from "../remark/rules/heading-hierarchy.js";
8
- import { RequiredSectionsRule } from "../remark/rules/required-sections.js";
9
- import { UncategorizedContentRule } from "../remark/rules/uncategorized-content.js";
10
- import { stripFrontmatter } from "../utils/strip-frontmatter.js";
11
- import { join } from "node:path";
12
- import { readFileSync, readdirSync } from "node:fs";
13
-
14
- //#region ../silk-effects/dist/dev/pkg/changesets/api/linter.js
15
- /**
16
- * Class-based API wrapper for changeset linting.
17
- *
18
- * Provides a static class interface that runs all five remark-lint rules
19
- * against changeset markdown files and returns structured diagnostics.
20
- *
21
- * @internal
22
- */
23
- /**
24
- * Static class for linting changeset markdown files.
25
- *
26
- * Runs the five remark-lint rules (heading-hierarchy, required-sections,
27
- * content-structure, dependency-table-format, uncategorized-content) against
28
- * changeset markdown and returns structured {@link LintMessage} diagnostics.
29
- *
30
- * @remarks
31
- * This class implements the pre-validation layer of the three-layer
32
- * pipeline. It validates that changeset markdown conforms to the
33
- * expected structure before the changelog formatter processes it.
34
- *
35
- * YAML frontmatter (the `---` delimited block at the top of changeset
36
- * files containing package bump declarations) is automatically stripped
37
- * before validation, since frontmatter is managed by Changesets itself
38
- * and is not part of the markdown structure being validated.
39
- *
40
- * The class provides three granularity levels:
41
- *
42
- * - {@link ChangesetLinter.validateContent} -- validate a markdown string directly
43
- * - {@link ChangesetLinter.validateFile} -- validate a single file by path
44
- * - {@link ChangesetLinter.validate} -- validate all changeset files in a directory
45
- *
46
- * @example Validate a single file and report errors
47
- * ```typescript
48
- * import { ChangesetLinter } from "\@savvy-web/changesets";
49
- * import type { LintMessage } from "\@savvy-web/changesets";
50
- *
51
- * const messages: LintMessage[] = ChangesetLinter.validateFile(
52
- * ".changeset/brave-pandas-learn.md",
53
- * );
54
- *
55
- * if (messages.length > 0) {
56
- * for (const msg of messages) {
57
- * console.error(`${msg.file}:${msg.line}:${msg.column} [${msg.rule}] ${msg.message}`);
58
- * }
59
- * process.exitCode = 1;
60
- * }
61
- * ```
62
- *
63
- * @example Validate all changesets in a directory
64
- * ```typescript
65
- * import { ChangesetLinter } from "\@savvy-web/changesets";
66
- * import type { LintMessage } from "\@savvy-web/changesets";
67
- *
68
- * const allMessages: LintMessage[] = ChangesetLinter.validate(".changeset");
69
- *
70
- * const errorsByFile = new Map<string, LintMessage[]>();
71
- * for (const msg of allMessages) {
72
- * const existing = errorsByFile.get(msg.file) ?? [];
73
- * existing.push(msg);
74
- * errorsByFile.set(msg.file, existing);
75
- * }
76
- *
77
- * for (const [file, msgs] of errorsByFile) {
78
- * console.error(`${file}: ${msgs.length} issue(s)`);
79
- * }
80
- * ```
81
- *
82
- * @example Validate markdown content directly (useful in tests)
83
- * ```typescript
84
- * import { ChangesetLinter } from "\@savvy-web/changesets";
85
- * import type { LintMessage } from "\@savvy-web/changesets";
86
- *
87
- * const content = [
88
- * "---",
89
- * '"\@savvy-web/core": patch',
90
- * "---",
91
- * "",
92
- * "## Bug Fixes",
93
- * "",
94
- * "Fixed an edge case in token validation.",
95
- * ].join("\n");
96
- *
97
- * const messages: LintMessage[] = ChangesetLinter.validateContent(content);
98
- * // messages.length === 0 (valid changeset)
99
- * ```
100
- *
101
- * @see {@link LintMessage} for the diagnostic message shape
102
- * @see {@link Categories} for the valid section headings checked by the rules
103
- *
104
- * @public
105
- */
106
- var ChangesetLinter = class ChangesetLinter {
107
- /* v8 ignore next -- private constructor prevents direct instantiation */
108
- constructor() {}
109
- /**
110
- * Validate a single changeset file by path.
111
- *
112
- * @remarks
113
- * Reads the file synchronously, strips YAML frontmatter, and runs all
114
- * five lint rules. The file path is preserved in each returned
115
- * {@link LintMessage} for error reporting.
116
- *
117
- * @param filePath - Absolute or relative path to the changeset `.md` file
118
- * @returns Array of {@link LintMessage} diagnostics (empty if the file is valid)
119
- */
120
- static validateFile(filePath) {
121
- const raw = readFileSync(filePath, "utf-8");
122
- return ChangesetLinter.validateContent(raw, filePath);
123
- }
124
- /**
125
- * Validate a markdown string directly.
126
- *
127
- * @remarks
128
- * Strips YAML frontmatter (if present) and runs all five lint rules
129
- * against the remaining content. This method is useful for validating
130
- * changeset content that is already in memory, such as in test suites
131
- * or editor integrations.
132
- *
133
- * @param content - Raw markdown content (may include YAML frontmatter)
134
- * @param filePath - File path for error reporting; defaults to `"<input>"`
135
- * when validating in-memory content
136
- * @returns Array of {@link LintMessage} diagnostics (empty if the content is valid)
137
- */
138
- static validateContent(content, filePath = "<input>") {
139
- const body = stripFrontmatter(content);
140
- return unified().use(remarkParse).use(remarkGfm).use(remarkStringify).use(HeadingHierarchyRule).use(RequiredSectionsRule).use(ContentStructureRule).use(DependencyTableFormatRule).use(UncategorizedContentRule).processSync(body).messages.map((msg) => ({
141
- file: filePath,
142
- /* v8 ignore next 3 -- ruleId/line/column fallbacks; remark-lint always provides these */
143
- rule: msg.ruleId ?? msg.source ?? "unknown",
144
- line: msg.line ?? 1,
145
- column: msg.column ?? 1,
146
- message: msg.message
147
- }));
148
- }
149
- /**
150
- * Validate all changeset `.md` files in a directory.
151
- *
152
- * @remarks
153
- * Scans the directory for `*.md` files (excluding `README.md`) and runs
154
- * {@link ChangesetLinter.validateFile} on each. Results are aggregated
155
- * into a single array. The directory is read synchronously.
156
- *
157
- * This is the method used by the Effect CLI's `lint` and `check`
158
- * subcommands to validate the `.changeset/` directory.
159
- *
160
- * @param dir - Path to the directory containing changeset files
161
- * (typically `.changeset/`)
162
- * @returns Aggregated array of {@link LintMessage} diagnostics from all files
163
- */
164
- static validate(dir) {
165
- return readdirSync(dir).filter((f) => f.endsWith(".md") && f !== "README.md").flatMap((filename) => ChangesetLinter.validateFile(join(dir, filename)));
166
- }
167
- };
168
-
169
- //#endregion
170
- export { ChangesetLinter };
@@ -1,134 +0,0 @@
1
- const require_index = require('../../../../../../../node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.cjs');
2
- const require_index$1 = require('../../../../../../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.cjs');
3
- const require_index$2 = require('../../../../../../../node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.cjs');
4
- const require_index$3 = require('../../../../../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs');
5
- const require_maintenance_note = require('../remark/plugins/maintenance-note.cjs');
6
- const require_presets = require('../remark/presets.cjs');
7
- let node_fs = require("node:fs");
8
-
9
- //#region ../silk-effects/dist/dev/pkg/changesets/api/transformer.js
10
- /**
11
- * Class-based API wrapper for changelog transformation.
12
- *
13
- * Provides a static class interface that runs all remark transform
14
- * plugins against CHANGELOG markdown content as the post-processing
15
- * layer of the three-layer pipeline.
16
- *
17
- * @internal
18
- */
19
- /**
20
- * Static class for post-processing CHANGELOG.md files.
21
- *
22
- * Implements the third layer of the three-layer pipeline by running
23
- * the {@link SilkChangesetTransformPreset} plugins (currently seven) in a
24
- * fixed order to clean up, normalize, and enhance changelog output produced
25
- * by the formatter layer.
26
- *
27
- * @remarks
28
- * See {@link SilkChangesetTransformPreset} for the ordered plugin list and
29
- * the rationale behind each plugin's position.
30
- *
31
- * The transformer operates on the full CHANGELOG.md content (all versions),
32
- * not just the latest release block. It is idempotent -- running it multiple
33
- * times produces the same output.
34
- *
35
- * @example Transform changelog content in memory
36
- * ```typescript
37
- * import { ChangelogTransformer } from "\@savvy-web/changesets";
38
- *
39
- * const rawChangelog = [
40
- * "# Changelog",
41
- * "",
42
- * "## 1.2.0",
43
- * "",
44
- * "### Features",
45
- * "",
46
- * "- Added new auth endpoint",
47
- * "",
48
- * "### Features",
49
- * "",
50
- * "- Added rate limiting",
51
- * ].join("\n");
52
- *
53
- * const cleaned: string = ChangelogTransformer.transformContent(rawChangelog);
54
- * // Duplicate "Features" sections are merged into one
55
- * ```
56
- *
57
- * @example Transform a CHANGELOG.md file in-place
58
- * ```typescript
59
- * import { ChangelogTransformer } from "\@savvy-web/changesets";
60
- *
61
- * // Reads, transforms, and writes back to the same path
62
- * ChangelogTransformer.transformFile("CHANGELOG.md");
63
- * ```
64
- *
65
- * @example Check for changes without writing (dry-run pattern)
66
- * ```typescript
67
- * import { readFileSync } from "node:fs";
68
- * import { ChangelogTransformer } from "\@savvy-web/changesets";
69
- *
70
- * const original: string = readFileSync("CHANGELOG.md", "utf-8");
71
- * const transformed: string = ChangelogTransformer.transformContent(original);
72
- *
73
- * if (original !== transformed) {
74
- * console.error("CHANGELOG.md needs transformation");
75
- * process.exitCode = 1;
76
- * }
77
- * ```
78
- *
79
- * @see {@link Categories} for the priority order used by ReorderSectionsPlugin
80
- * @see {@link ChangesetLinter} for the pre-validation layer (layer 1)
81
- * @see {@link Changelog} for the formatter layer (layer 2)
82
- *
83
- * @public
84
- */
85
- var ChangelogTransformer = class ChangelogTransformer {
86
- /* v8 ignore next -- private constructor prevents direct instantiation */
87
- constructor() {}
88
- /**
89
- * Transform CHANGELOG markdown content by running the
90
- * {@link SilkChangesetTransformPreset} plugins.
91
- *
92
- * @remarks
93
- * The input is parsed with `remark-parse` and `remark-gfm` (for table
94
- * support), processed through every plugin in {@link SilkChangesetTransformPreset}
95
- * in order, and stringified back to markdown. The operation is synchronous
96
- * and idempotent.
97
- *
98
- * @param content - Raw CHANGELOG markdown string (may contain multiple
99
- * version blocks, GFM tables, footnotes, and reference links)
100
- * @param options - Optional transformation options, including maintenance note configuration
101
- * @returns The transformed markdown string with dependency tables aggregated,
102
- * sections merged, reordered, deduplicated, and normalized
103
- */
104
- static transformContent(content, options) {
105
- const processor = require_index$3.unified().use(require_index$1.default).use(require_index.default);
106
- for (const plugin of require_presets.SilkChangesetTransformPreset) processor.use(plugin);
107
- if (options?.maintenance) processor.use(require_maintenance_note.MaintenanceNotePlugin, options.maintenance);
108
- processor.use(require_index$2.default);
109
- const file = processor.processSync(content);
110
- return String(file);
111
- }
112
- /**
113
- * Transform a CHANGELOG file in-place.
114
- *
115
- * @remarks
116
- * Reads the file synchronously, runs all transform plugins via
117
- * {@link ChangelogTransformer.transformContent}, and writes the result
118
- * back to the same path. The file is overwritten atomically (single
119
- * `writeFileSync` call).
120
- *
121
- * This is the method used by the Effect CLI's `transform` subcommand
122
- * when invoked without the `--dry-run` or `--check` flags.
123
- *
124
- * @param filePath - Absolute or relative path to the CHANGELOG.md file
125
- * @param options - Optional transformation options, including maintenance note configuration
126
- */
127
- static transformFile(filePath, options) {
128
- const content = (0, node_fs.readFileSync)(filePath, "utf-8");
129
- (0, node_fs.writeFileSync)(filePath, ChangelogTransformer.transformContent(content, options), "utf-8");
130
- }
131
- };
132
-
133
- //#endregion
134
- exports.ChangelogTransformer = ChangelogTransformer;
@@ -1,134 +0,0 @@
1
- import remarkGfm from "../../../../../../../node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js";
2
- import remarkParse from "../../../../../../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.js";
3
- import remarkStringify from "../../../../../../../node_modules/.pnpm/remark-stringify@11.0.0/node_modules/remark-stringify/lib/index.js";
4
- import { unified } from "../../../../../../../node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.js";
5
- import { MaintenanceNotePlugin } from "../remark/plugins/maintenance-note.js";
6
- import { SilkChangesetTransformPreset } from "../remark/presets.js";
7
- import { readFileSync, writeFileSync } from "node:fs";
8
-
9
- //#region ../silk-effects/dist/dev/pkg/changesets/api/transformer.js
10
- /**
11
- * Class-based API wrapper for changelog transformation.
12
- *
13
- * Provides a static class interface that runs all remark transform
14
- * plugins against CHANGELOG markdown content as the post-processing
15
- * layer of the three-layer pipeline.
16
- *
17
- * @internal
18
- */
19
- /**
20
- * Static class for post-processing CHANGELOG.md files.
21
- *
22
- * Implements the third layer of the three-layer pipeline by running
23
- * the {@link SilkChangesetTransformPreset} plugins (currently seven) in a
24
- * fixed order to clean up, normalize, and enhance changelog output produced
25
- * by the formatter layer.
26
- *
27
- * @remarks
28
- * See {@link SilkChangesetTransformPreset} for the ordered plugin list and
29
- * the rationale behind each plugin's position.
30
- *
31
- * The transformer operates on the full CHANGELOG.md content (all versions),
32
- * not just the latest release block. It is idempotent -- running it multiple
33
- * times produces the same output.
34
- *
35
- * @example Transform changelog content in memory
36
- * ```typescript
37
- * import { ChangelogTransformer } from "\@savvy-web/changesets";
38
- *
39
- * const rawChangelog = [
40
- * "# Changelog",
41
- * "",
42
- * "## 1.2.0",
43
- * "",
44
- * "### Features",
45
- * "",
46
- * "- Added new auth endpoint",
47
- * "",
48
- * "### Features",
49
- * "",
50
- * "- Added rate limiting",
51
- * ].join("\n");
52
- *
53
- * const cleaned: string = ChangelogTransformer.transformContent(rawChangelog);
54
- * // Duplicate "Features" sections are merged into one
55
- * ```
56
- *
57
- * @example Transform a CHANGELOG.md file in-place
58
- * ```typescript
59
- * import { ChangelogTransformer } from "\@savvy-web/changesets";
60
- *
61
- * // Reads, transforms, and writes back to the same path
62
- * ChangelogTransformer.transformFile("CHANGELOG.md");
63
- * ```
64
- *
65
- * @example Check for changes without writing (dry-run pattern)
66
- * ```typescript
67
- * import { readFileSync } from "node:fs";
68
- * import { ChangelogTransformer } from "\@savvy-web/changesets";
69
- *
70
- * const original: string = readFileSync("CHANGELOG.md", "utf-8");
71
- * const transformed: string = ChangelogTransformer.transformContent(original);
72
- *
73
- * if (original !== transformed) {
74
- * console.error("CHANGELOG.md needs transformation");
75
- * process.exitCode = 1;
76
- * }
77
- * ```
78
- *
79
- * @see {@link Categories} for the priority order used by ReorderSectionsPlugin
80
- * @see {@link ChangesetLinter} for the pre-validation layer (layer 1)
81
- * @see {@link Changelog} for the formatter layer (layer 2)
82
- *
83
- * @public
84
- */
85
- var ChangelogTransformer = class ChangelogTransformer {
86
- /* v8 ignore next -- private constructor prevents direct instantiation */
87
- constructor() {}
88
- /**
89
- * Transform CHANGELOG markdown content by running the
90
- * {@link SilkChangesetTransformPreset} plugins.
91
- *
92
- * @remarks
93
- * The input is parsed with `remark-parse` and `remark-gfm` (for table
94
- * support), processed through every plugin in {@link SilkChangesetTransformPreset}
95
- * in order, and stringified back to markdown. The operation is synchronous
96
- * and idempotent.
97
- *
98
- * @param content - Raw CHANGELOG markdown string (may contain multiple
99
- * version blocks, GFM tables, footnotes, and reference links)
100
- * @param options - Optional transformation options, including maintenance note configuration
101
- * @returns The transformed markdown string with dependency tables aggregated,
102
- * sections merged, reordered, deduplicated, and normalized
103
- */
104
- static transformContent(content, options) {
105
- const processor = unified().use(remarkParse).use(remarkGfm);
106
- for (const plugin of SilkChangesetTransformPreset) processor.use(plugin);
107
- if (options?.maintenance) processor.use(MaintenanceNotePlugin, options.maintenance);
108
- processor.use(remarkStringify);
109
- const file = processor.processSync(content);
110
- return String(file);
111
- }
112
- /**
113
- * Transform a CHANGELOG file in-place.
114
- *
115
- * @remarks
116
- * Reads the file synchronously, runs all transform plugins via
117
- * {@link ChangelogTransformer.transformContent}, and writes the result
118
- * back to the same path. The file is overwritten atomically (single
119
- * `writeFileSync` call).
120
- *
121
- * This is the method used by the Effect CLI's `transform` subcommand
122
- * when invoked without the `--dry-run` or `--check` flags.
123
- *
124
- * @param filePath - Absolute or relative path to the CHANGELOG.md file
125
- * @param options - Optional transformation options, including maintenance note configuration
126
- */
127
- static transformFile(filePath, options) {
128
- const content = readFileSync(filePath, "utf-8");
129
- writeFileSync(filePath, ChangelogTransformer.transformContent(content, options), "utf-8");
130
- }
131
- };
132
-
133
- //#endregion
134
- export { ChangelogTransformer };