@savvy-web/silk 2.0.0 → 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.
- package/README.md +7 -5
- package/changesets-changelog.cjs +10 -4
- package/changesets-changelog.js +54057 -1
- package/changesets-markdownlint.cjs +10 -4
- package/changesets-markdownlint.js +54057 -1
- package/package.json +5 -4
- package/tsconfig/node/dist/tsconfig.tsbuildinfo +1 -1
- package/_virtual/_rolldown/runtime.cjs +0 -45
- package/_virtual/_rolldown/runtime.js +0 -45
- package/packages/silk-effects/dist/dev/pkg/_virtual/_rolldown/runtime.cjs +0 -15
- package/packages/silk-effects/dist/dev/pkg/_virtual/_rolldown/runtime.js +0 -14
- package/packages/silk-effects/dist/dev/pkg/changesets/api/categories.cjs +0 -247
- package/packages/silk-effects/dist/dev/pkg/changesets/api/categories.js +0 -247
- package/packages/silk-effects/dist/dev/pkg/changesets/api/changelog.cjs +0 -134
- package/packages/silk-effects/dist/dev/pkg/changesets/api/changelog.js +0 -134
- package/packages/silk-effects/dist/dev/pkg/changesets/api/dependency-table.cjs +0 -163
- package/packages/silk-effects/dist/dev/pkg/changesets/api/dependency-table.js +0 -163
- package/packages/silk-effects/dist/dev/pkg/changesets/api/linter.cjs +0 -170
- package/packages/silk-effects/dist/dev/pkg/changesets/api/linter.js +0 -170
- package/packages/silk-effects/dist/dev/pkg/changesets/api/transformer.cjs +0 -134
- package/packages/silk-effects/dist/dev/pkg/changesets/api/transformer.js +0 -134
- package/packages/silk-effects/dist/dev/pkg/changesets/categories/index.cjs +0 -317
- package/packages/silk-effects/dist/dev/pkg/changesets/categories/index.js +0 -299
- package/packages/silk-effects/dist/dev/pkg/changesets/categories/types.cjs +0 -65
- package/packages/silk-effects/dist/dev/pkg/changesets/categories/types.js +0 -65
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/formatting.cjs +0 -114
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/formatting.js +0 -113
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.cjs +0 -118
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.js +0 -118
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.cjs +0 -122
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.js +0 -122
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/index.cjs +0 -97
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/index.js +0 -97
- package/packages/silk-effects/dist/dev/pkg/changesets/constants.cjs +0 -43
- package/packages/silk-effects/dist/dev/pkg/changesets/constants.js +0 -42
- package/packages/silk-effects/dist/dev/pkg/changesets/errors.cjs +0 -386
- package/packages/silk-effects/dist/dev/pkg/changesets/errors.js +0 -371
- package/packages/silk-effects/dist/dev/pkg/changesets/index.cjs +0 -300
- package/packages/silk-effects/dist/dev/pkg/changesets/index.js +0 -179
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/index.cjs +0 -34
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/index.js +0 -29
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/content-structure.cjs +0 -98
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/content-structure.js +0 -98
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.cjs +0 -170
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.js +0 -170
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.cjs +0 -61
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.js +0 -61
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.cjs +0 -54
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.js +0 -54
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.cjs +0 -54
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.js +0 -54
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.cjs +0 -31
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.js +0 -30
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.cjs +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.js +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/contributor-footnotes.cjs +0 -123
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/contributor-footnotes.js +0 -123
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/deduplicate-items.cjs +0 -32
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/deduplicate-items.js +0 -32
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/issue-link-refs.cjs +0 -59
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/issue-link-refs.js +0 -59
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/maintenance-note.cjs +0 -61
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/maintenance-note.js +0 -61
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/merge-sections.cjs +0 -43
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/merge-sections.js +0 -43
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/normalize-format.cjs +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/normalize-format.js +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/reorder-sections.cjs +0 -34
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/reorder-sections.js +0 -34
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/presets.cjs +0 -120
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/presets.js +0 -119
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/content-structure.cjs +0 -22
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/content-structure.js +0 -22
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/dependency-table-format.cjs +0 -40
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/dependency-table-format.js +0 -40
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/heading-hierarchy.cjs +0 -19
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/heading-hierarchy.js +0 -19
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/required-sections.cjs +0 -17
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/required-sections.js +0 -17
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/uncategorized-content.cjs +0 -31
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/uncategorized-content.js +0 -31
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/changeset.cjs +0 -148
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/changeset.js +0 -145
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/dependency-table.cjs +0 -203
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/dependency-table.js +0 -198
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/git.cjs +0 -69
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/git.js +0 -68
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/github.cjs +0 -177
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/github.js +0 -174
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/options.cjs +0 -183
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/options.js +0 -181
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/package-scope.cjs +0 -129
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/package-scope.js +0 -127
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/primitives.cjs +0 -72
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/primitives.js +0 -71
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/release-plan.cjs +0 -62
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/release-plan.js +0 -56
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/version-files.cjs +0 -154
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/version-files.js +0 -150
- package/packages/silk-effects/dist/dev/pkg/changesets/services/branch-analyzer.cjs +0 -300
- package/packages/silk-effects/dist/dev/pkg/changesets/services/branch-analyzer.js +0 -294
- package/packages/silk-effects/dist/dev/pkg/changesets/services/changelog.cjs +0 -50
- package/packages/silk-effects/dist/dev/pkg/changesets/services/changelog.js +0 -49
- package/packages/silk-effects/dist/dev/pkg/changesets/services/config-inspector.cjs +0 -489
- package/packages/silk-effects/dist/dev/pkg/changesets/services/config-inspector.js +0 -481
- package/packages/silk-effects/dist/dev/pkg/changesets/services/deps-regen.cjs +0 -375
- package/packages/silk-effects/dist/dev/pkg/changesets/services/deps-regen.js +0 -371
- package/packages/silk-effects/dist/dev/pkg/changesets/services/github.cjs +0 -160
- package/packages/silk-effects/dist/dev/pkg/changesets/services/github.js +0 -157
- package/packages/silk-effects/dist/dev/pkg/changesets/services/maintenance-reason.cjs +0 -68
- package/packages/silk-effects/dist/dev/pkg/changesets/services/maintenance-reason.js +0 -66
- package/packages/silk-effects/dist/dev/pkg/changesets/services/markdown.cjs +0 -87
- package/packages/silk-effects/dist/dev/pkg/changesets/services/markdown.js +0 -85
- package/packages/silk-effects/dist/dev/pkg/changesets/services/release-planner.cjs +0 -352
- package/packages/silk-effects/dist/dev/pkg/changesets/services/release-planner.js +0 -348
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/commit-parser.cjs +0 -81
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/commit-parser.js +0 -80
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/dep-diff.cjs +0 -111
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/dep-diff.js +0 -111
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/dependency-table.cjs +0 -351
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/dependency-table.js +0 -347
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/git.cjs +0 -51
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/git.js +0 -51
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/issue-refs.cjs +0 -102
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/issue-refs.js +0 -101
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/jsonpath.cjs +0 -178
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/jsonpath.js +0 -175
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/logger.cjs +0 -51
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/logger.js +0 -50
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/markdown-link.cjs +0 -59
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/markdown-link.js +0 -57
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/publishability.cjs +0 -50
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/publishability.js +0 -50
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/remark-pipeline.cjs +0 -81
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/remark-pipeline.js +0 -79
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/section-parser.cjs +0 -94
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/section-parser.js +0 -94
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/strip-frontmatter.cjs +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/strip-frontmatter.js +0 -46
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-blocks.cjs +0 -110
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-blocks.js +0 -108
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-files.cjs +0 -336
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-files.js +0 -336
- package/packages/silk-effects/dist/dev/pkg/changesets/vendor/github-info.cjs +0 -77
- package/packages/silk-effects/dist/dev/pkg/changesets/vendor/github-info.js +0 -77
- package/packages/silk-effects/dist/dev/pkg/errors/ChangesetConfigError.cjs +0 -21
- package/packages/silk-effects/dist/dev/pkg/errors/ChangesetConfigError.js +0 -21
- package/packages/silk-effects/dist/dev/pkg/schemas/VersioningSchemas.cjs +0 -101
- package/packages/silk-effects/dist/dev/pkg/schemas/VersioningSchemas.js +0 -99
- package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfig.cjs +0 -81
- package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfig.js +0 -80
- package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfigReader.cjs +0 -109
- package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfigReader.js +0 -108
- package/packages/silk-effects/dist/dev/pkg/services/SilkPublishability.cjs +0 -238
- package/packages/silk-effects/dist/dev/pkg/services/SilkPublishability.js +0 -236
package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { VERSION_RE } from "../../schemas/dependency-table.js";
|
|
2
|
-
import { RULE_DOCS } from "../../constants.js";
|
|
3
|
-
import { getHeadingLevel, getHeadingText } from "./utils.js";
|
|
4
|
-
|
|
5
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.js
|
|
6
|
-
const EM_DASH = "—";
|
|
7
|
-
const VALID_TYPES = /* @__PURE__ */ new Set([
|
|
8
|
-
"dependency",
|
|
9
|
-
"devDependency",
|
|
10
|
-
"peerDependency",
|
|
11
|
-
"optionalDependency",
|
|
12
|
-
"workspace",
|
|
13
|
-
"config"
|
|
14
|
-
]);
|
|
15
|
-
const VALID_ACTIONS = /* @__PURE__ */ new Set([
|
|
16
|
-
"added",
|
|
17
|
-
"updated",
|
|
18
|
-
"removed"
|
|
19
|
-
]);
|
|
20
|
-
const EXPECTED_HEADERS = [
|
|
21
|
-
"dependency",
|
|
22
|
-
"type",
|
|
23
|
-
"action",
|
|
24
|
-
"from",
|
|
25
|
-
"to"
|
|
26
|
-
];
|
|
27
|
-
/**
|
|
28
|
-
* Extract text from a `tableHeader` or `tableData` cell token.
|
|
29
|
-
*
|
|
30
|
-
* The cell contains: `tableCellDivider`, whitespace, `tableContent`, whitespace.
|
|
31
|
-
* The `tableContent` token has a `.text` property with the cell value.
|
|
32
|
-
*
|
|
33
|
-
* @param cell - A GFM table cell token (header or data)
|
|
34
|
-
* @returns The trimmed text content of the cell, or an empty string
|
|
35
|
-
*
|
|
36
|
-
* @internal
|
|
37
|
-
*/
|
|
38
|
-
function getCellText(cell) {
|
|
39
|
-
const content = cell.children.find((c) => c.type === "tableContent");
|
|
40
|
-
return content ? content.text.trim() : "";
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Extract all cell texts from a `tableRow` token.
|
|
44
|
-
*
|
|
45
|
-
* @param row - A GFM `tableRow` token
|
|
46
|
-
* @returns An array of trimmed cell text values
|
|
47
|
-
*
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
function getRowCells(row) {
|
|
51
|
-
return row.children.filter((c) => c.type === "tableHeader" || c.type === "tableData").map(getCellText);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* The markdownlint `Rule` object for CSH005 (`changeset-dependency-table-format`).
|
|
55
|
-
*
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
const DependencyTableFormatRule = {
|
|
59
|
-
names: ["changeset-dependency-table-format", "CSH005"],
|
|
60
|
-
description: "Dependencies section must contain a valid dependency table",
|
|
61
|
-
tags: ["changeset"],
|
|
62
|
-
parser: "micromark",
|
|
63
|
-
function: function CSH005(params, onError) {
|
|
64
|
-
const tokens = params.parsers.micromark.tokens;
|
|
65
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
66
|
-
const token = tokens[i];
|
|
67
|
-
if (token.type !== "atxHeading") continue;
|
|
68
|
-
if (getHeadingLevel(token) !== 2) continue;
|
|
69
|
-
if (getHeadingText(token).toLowerCase() !== "dependencies") continue;
|
|
70
|
-
const headingLine = token.startLine;
|
|
71
|
-
let tableToken = null;
|
|
72
|
-
for (let j = i + 1; j < tokens.length; j++) {
|
|
73
|
-
const next = tokens[j];
|
|
74
|
-
if (next.type === "lineEnding" || next.type === "lineEndingBlank") continue;
|
|
75
|
-
if (next.type === "atxHeading") break;
|
|
76
|
-
if (next.type === "table") tableToken = next;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
if (tableToken === null) {
|
|
80
|
-
onError({
|
|
81
|
-
lineNumber: headingLine,
|
|
82
|
-
detail: `Dependencies section must contain a table, not a list or paragraph. See: ${RULE_DOCS.CSH005}`
|
|
83
|
-
});
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
const tableHead = tableToken.children.find((c) => c.type === "tableHead");
|
|
87
|
-
if (!tableHead) {
|
|
88
|
-
onError({
|
|
89
|
-
lineNumber: tableToken.startLine,
|
|
90
|
-
detail: `Dependencies table is missing a header row. See: ${RULE_DOCS.CSH005}`
|
|
91
|
-
});
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
const headerRow = tableHead.children.find((c) => c.type === "tableRow");
|
|
95
|
-
if (!headerRow) {
|
|
96
|
-
onError({
|
|
97
|
-
lineNumber: tableToken.startLine,
|
|
98
|
-
detail: `Dependencies table is missing a header row. See: ${RULE_DOCS.CSH005}`
|
|
99
|
-
});
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
const headers = getRowCells(headerRow).map((h) => h.toLowerCase());
|
|
103
|
-
if (headers.length !== EXPECTED_HEADERS.length || !headers.every((h, idx) => h === EXPECTED_HEADERS[idx])) {
|
|
104
|
-
onError({
|
|
105
|
-
lineNumber: headerRow.startLine,
|
|
106
|
-
detail: `Dependencies table must have columns: Dependency, Type, Action, From, To. Got: ${headers.join(", ")}. See: ${RULE_DOCS.CSH005}`
|
|
107
|
-
});
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
const tableBody = tableToken.children.find((c) => c.type === "tableBody");
|
|
111
|
-
if (!tableBody) {
|
|
112
|
-
onError({
|
|
113
|
-
lineNumber: tableToken.startLine,
|
|
114
|
-
detail: `Dependencies table must have at least one data row. See: ${RULE_DOCS.CSH005}`
|
|
115
|
-
});
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const dataRows = tableBody.children.filter((c) => c.type === "tableRow");
|
|
119
|
-
if (dataRows.length === 0) {
|
|
120
|
-
onError({
|
|
121
|
-
lineNumber: tableToken.startLine,
|
|
122
|
-
detail: `Dependencies table must have at least one data row. See: ${RULE_DOCS.CSH005}`
|
|
123
|
-
});
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
for (const row of dataRows) {
|
|
127
|
-
const cells = getRowCells(row);
|
|
128
|
-
if (cells.length < 5) {
|
|
129
|
-
onError({
|
|
130
|
-
lineNumber: row.startLine,
|
|
131
|
-
detail: `Dependencies table row has too few columns (expected 5, got ${cells.length}). See: ${RULE_DOCS.CSH005}`
|
|
132
|
-
});
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
const [dependency, type, action, from, to] = cells;
|
|
136
|
-
if (!dependency) onError({
|
|
137
|
-
lineNumber: row.startLine,
|
|
138
|
-
detail: `Dependencies table row has an empty 'Dependency' cell. See: ${RULE_DOCS.CSH005}`
|
|
139
|
-
});
|
|
140
|
-
if (!VALID_TYPES.has(type)) onError({
|
|
141
|
-
lineNumber: row.startLine,
|
|
142
|
-
detail: `Invalid dependency type '${type}'. Valid types are: ${[...VALID_TYPES].join(", ")}. See: ${RULE_DOCS.CSH005}`
|
|
143
|
-
});
|
|
144
|
-
if (!VALID_ACTIONS.has(action)) onError({
|
|
145
|
-
lineNumber: row.startLine,
|
|
146
|
-
detail: `Invalid dependency action '${action}'. Valid actions are: ${[...VALID_ACTIONS].join(", ")}. See: ${RULE_DOCS.CSH005}`
|
|
147
|
-
});
|
|
148
|
-
if (from && !VERSION_RE.test(from)) onError({
|
|
149
|
-
lineNumber: row.startLine,
|
|
150
|
-
detail: `Invalid 'from' value '${from}'. Must be a semver string or em dash (\u2014). See: ${RULE_DOCS.CSH005}`
|
|
151
|
-
});
|
|
152
|
-
if (to && !VERSION_RE.test(to)) onError({
|
|
153
|
-
lineNumber: row.startLine,
|
|
154
|
-
detail: `Invalid 'to' value '${to}'. Must be a semver string or em dash (\u2014). See: ${RULE_DOCS.CSH005}`
|
|
155
|
-
});
|
|
156
|
-
if (action === "added" && from !== EM_DASH) onError({
|
|
157
|
-
lineNumber: row.startLine,
|
|
158
|
-
detail: `'from' must be '\u2014' when action is 'added' (got '${from}'). See: ${RULE_DOCS.CSH005}`
|
|
159
|
-
});
|
|
160
|
-
if (action === "removed" && to !== EM_DASH) onError({
|
|
161
|
-
lineNumber: row.startLine,
|
|
162
|
-
detail: `'to' must be '\u2014' when action is 'removed' (got '${to}'). See: ${RULE_DOCS.CSH005}`
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
//#endregion
|
|
170
|
-
export { DependencyTableFormatRule };
|
package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.cjs
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const require_constants = require('../../constants.cjs');
|
|
2
|
-
const require_utils = require('./utils.cjs');
|
|
3
|
-
|
|
4
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.js
|
|
5
|
-
/**
|
|
6
|
-
* markdownlint rule: `changeset-heading-hierarchy` (CSH001).
|
|
7
|
-
*
|
|
8
|
-
* Validates heading structure in changeset markdown files by inspecting
|
|
9
|
-
* `atxHeading` micromark tokens for three constraints:
|
|
10
|
-
*
|
|
11
|
-
* 1. **No h1 headings** -- h1 is reserved for the version title generated by
|
|
12
|
-
* the changelog formatter.
|
|
13
|
-
* 2. **Start at h2** -- the first heading in a changeset must be h2.
|
|
14
|
-
* 3. **No depth skips** -- heading levels must increase sequentially
|
|
15
|
-
* (h2 then h3, not h2 then h4).
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* This rule mirrors the remark-lint rule `remarkLintHeadingHierarchy` but uses
|
|
19
|
-
* markdownlint's micromark token API so it can run inside markdownlint-cli2 and
|
|
20
|
-
* the VS Code markdownlint extension.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```json
|
|
24
|
-
* {
|
|
25
|
-
* "changeset-heading-hierarchy": true
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @see {@link https://github.com/savvy-web/changesets/blob/main/docs/rules/CSH001.md | CSH001 rule documentation}
|
|
30
|
-
* @see `src/remark/rules/heading-hierarchy.ts` for the corresponding remark-lint rule
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
const HeadingHierarchyRule = {
|
|
35
|
-
names: ["changeset-heading-hierarchy", "CSH001"],
|
|
36
|
-
description: "Heading hierarchy must start at h2 with no h1 or depth skips",
|
|
37
|
-
tags: ["changeset"],
|
|
38
|
-
parser: "micromark",
|
|
39
|
-
function: function CSH001(params, onError) {
|
|
40
|
-
let prevDepth = 0;
|
|
41
|
-
for (const token of params.parsers.micromark.tokens) {
|
|
42
|
-
if (token.type !== "atxHeading") continue;
|
|
43
|
-
const depth = require_utils.getHeadingLevel(token);
|
|
44
|
-
if (depth === 1) {
|
|
45
|
-
onError({
|
|
46
|
-
lineNumber: token.startLine,
|
|
47
|
-
detail: `h1 headings are not allowed in changeset files. Use h2 (##) for top-level sections like "## Features" or "## Bug Fixes". h1 is reserved for the version title generated by the changelog formatter. See: ${require_constants.RULE_DOCS.CSH001}`
|
|
48
|
-
});
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (prevDepth > 0 && depth > prevDepth + 1) onError({
|
|
52
|
-
lineNumber: token.startLine,
|
|
53
|
-
detail: `Heading level skipped: expected h${prevDepth + 1} or lower, found h${depth}. Headings must increase sequentially (h2 → h3 → h4). Add the missing intermediate level or reduce this heading's depth. See: ${require_constants.RULE_DOCS.CSH001}`
|
|
54
|
-
});
|
|
55
|
-
prevDepth = depth;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
//#endregion
|
|
61
|
-
exports.HeadingHierarchyRule = HeadingHierarchyRule;
|
package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { RULE_DOCS } from "../../constants.js";
|
|
2
|
-
import { getHeadingLevel } from "./utils.js";
|
|
3
|
-
|
|
4
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.js
|
|
5
|
-
/**
|
|
6
|
-
* markdownlint rule: `changeset-heading-hierarchy` (CSH001).
|
|
7
|
-
*
|
|
8
|
-
* Validates heading structure in changeset markdown files by inspecting
|
|
9
|
-
* `atxHeading` micromark tokens for three constraints:
|
|
10
|
-
*
|
|
11
|
-
* 1. **No h1 headings** -- h1 is reserved for the version title generated by
|
|
12
|
-
* the changelog formatter.
|
|
13
|
-
* 2. **Start at h2** -- the first heading in a changeset must be h2.
|
|
14
|
-
* 3. **No depth skips** -- heading levels must increase sequentially
|
|
15
|
-
* (h2 then h3, not h2 then h4).
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* This rule mirrors the remark-lint rule `remarkLintHeadingHierarchy` but uses
|
|
19
|
-
* markdownlint's micromark token API so it can run inside markdownlint-cli2 and
|
|
20
|
-
* the VS Code markdownlint extension.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```json
|
|
24
|
-
* {
|
|
25
|
-
* "changeset-heading-hierarchy": true
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @see {@link https://github.com/savvy-web/changesets/blob/main/docs/rules/CSH001.md | CSH001 rule documentation}
|
|
30
|
-
* @see `src/remark/rules/heading-hierarchy.ts` for the corresponding remark-lint rule
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
const HeadingHierarchyRule = {
|
|
35
|
-
names: ["changeset-heading-hierarchy", "CSH001"],
|
|
36
|
-
description: "Heading hierarchy must start at h2 with no h1 or depth skips",
|
|
37
|
-
tags: ["changeset"],
|
|
38
|
-
parser: "micromark",
|
|
39
|
-
function: function CSH001(params, onError) {
|
|
40
|
-
let prevDepth = 0;
|
|
41
|
-
for (const token of params.parsers.micromark.tokens) {
|
|
42
|
-
if (token.type !== "atxHeading") continue;
|
|
43
|
-
const depth = getHeadingLevel(token);
|
|
44
|
-
if (depth === 1) {
|
|
45
|
-
onError({
|
|
46
|
-
lineNumber: token.startLine,
|
|
47
|
-
detail: `h1 headings are not allowed in changeset files. Use h2 (##) for top-level sections like "## Features" or "## Bug Fixes". h1 is reserved for the version title generated by the changelog formatter. See: ${RULE_DOCS.CSH001}`
|
|
48
|
-
});
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (prevDepth > 0 && depth > prevDepth + 1) onError({
|
|
52
|
-
lineNumber: token.startLine,
|
|
53
|
-
detail: `Heading level skipped: expected h${prevDepth + 1} or lower, found h${depth}. Headings must increase sequentially (h2 → h3 → h4). Add the missing intermediate level or reduce this heading's depth. See: ${RULE_DOCS.CSH001}`
|
|
54
|
-
});
|
|
55
|
-
prevDepth = depth;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
//#endregion
|
|
61
|
-
export { HeadingHierarchyRule };
|
package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.cjs
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const require_index = require('../../categories/index.cjs');
|
|
2
|
-
const require_constants = require('../../constants.cjs');
|
|
3
|
-
const require_utils = require('./utils.cjs');
|
|
4
|
-
|
|
5
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.js
|
|
6
|
-
/**
|
|
7
|
-
* markdownlint rule: `changeset-required-sections` (CSH002).
|
|
8
|
-
*
|
|
9
|
-
* Validates that every h2 (`atxHeading` with depth 2) in a changeset markdown
|
|
10
|
-
* file matches a known category heading from the category system. When an
|
|
11
|
-
* unrecognized heading is found, the error detail lists all valid headings.
|
|
12
|
-
*
|
|
13
|
-
* @remarks
|
|
14
|
-
* Heading comparison is case-insensitive. The set of valid headings is provided
|
|
15
|
-
* by `allHeadings()` and `isValidHeading()` from the category system
|
|
16
|
-
* (`src/categories/index.ts`). This rule inspects `atxHeading` micromark
|
|
17
|
-
* tokens and extracts their text via the {@link getHeadingText} utility.
|
|
18
|
-
*
|
|
19
|
-
* This rule mirrors the remark-lint rule `remarkLintRequiredSections` but uses
|
|
20
|
-
* markdownlint's micromark token API so it can run inside markdownlint-cli2 and
|
|
21
|
-
* the VS Code markdownlint extension.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```json
|
|
25
|
-
* {
|
|
26
|
-
* "changeset-required-sections": true
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @see {@link https://github.com/savvy-web/changesets/blob/main/docs/rules/CSH002.md | CSH002 rule documentation}
|
|
31
|
-
* @see `src/remark/rules/required-sections.ts` for the corresponding remark-lint rule
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
const RequiredSectionsRule = {
|
|
36
|
-
names: ["changeset-required-sections", "CSH002"],
|
|
37
|
-
description: "Section headings must match known changeset categories",
|
|
38
|
-
tags: ["changeset"],
|
|
39
|
-
parser: "micromark",
|
|
40
|
-
function: function CSH002(params, onError) {
|
|
41
|
-
for (const token of params.parsers.micromark.tokens) {
|
|
42
|
-
if (token.type !== "atxHeading") continue;
|
|
43
|
-
if (require_utils.getHeadingLevel(token) !== 2) continue;
|
|
44
|
-
const text = require_utils.getHeadingText(token);
|
|
45
|
-
if (!require_index.isValidHeading(text)) onError({
|
|
46
|
-
lineNumber: token.startLine,
|
|
47
|
-
detail: `Unknown section "${text}". Valid h2 headings are: ${require_index.allHeadings().join(", ")}. Heading comparison is case-insensitive. See: ${require_constants.RULE_DOCS.CSH002}`
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
exports.RequiredSectionsRule = RequiredSectionsRule;
|
package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { allHeadings, isValidHeading } from "../../categories/index.js";
|
|
2
|
-
import { RULE_DOCS } from "../../constants.js";
|
|
3
|
-
import { getHeadingLevel, getHeadingText } from "./utils.js";
|
|
4
|
-
|
|
5
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.js
|
|
6
|
-
/**
|
|
7
|
-
* markdownlint rule: `changeset-required-sections` (CSH002).
|
|
8
|
-
*
|
|
9
|
-
* Validates that every h2 (`atxHeading` with depth 2) in a changeset markdown
|
|
10
|
-
* file matches a known category heading from the category system. When an
|
|
11
|
-
* unrecognized heading is found, the error detail lists all valid headings.
|
|
12
|
-
*
|
|
13
|
-
* @remarks
|
|
14
|
-
* Heading comparison is case-insensitive. The set of valid headings is provided
|
|
15
|
-
* by `allHeadings()` and `isValidHeading()` from the category system
|
|
16
|
-
* (`src/categories/index.ts`). This rule inspects `atxHeading` micromark
|
|
17
|
-
* tokens and extracts their text via the {@link getHeadingText} utility.
|
|
18
|
-
*
|
|
19
|
-
* This rule mirrors the remark-lint rule `remarkLintRequiredSections` but uses
|
|
20
|
-
* markdownlint's micromark token API so it can run inside markdownlint-cli2 and
|
|
21
|
-
* the VS Code markdownlint extension.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```json
|
|
25
|
-
* {
|
|
26
|
-
* "changeset-required-sections": true
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @see {@link https://github.com/savvy-web/changesets/blob/main/docs/rules/CSH002.md | CSH002 rule documentation}
|
|
31
|
-
* @see `src/remark/rules/required-sections.ts` for the corresponding remark-lint rule
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
const RequiredSectionsRule = {
|
|
36
|
-
names: ["changeset-required-sections", "CSH002"],
|
|
37
|
-
description: "Section headings must match known changeset categories",
|
|
38
|
-
tags: ["changeset"],
|
|
39
|
-
parser: "micromark",
|
|
40
|
-
function: function CSH002(params, onError) {
|
|
41
|
-
for (const token of params.parsers.micromark.tokens) {
|
|
42
|
-
if (token.type !== "atxHeading") continue;
|
|
43
|
-
if (getHeadingLevel(token) !== 2) continue;
|
|
44
|
-
const text = getHeadingText(token);
|
|
45
|
-
if (!isValidHeading(text)) onError({
|
|
46
|
-
lineNumber: token.startLine,
|
|
47
|
-
detail: `Unknown section "${text}". Valid h2 headings are: ${allHeadings().join(", ")}. Heading comparison is case-insensitive. See: ${RULE_DOCS.CSH002}`
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
export { RequiredSectionsRule };
|
package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.cjs
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const require_constants = require('../../constants.cjs');
|
|
2
|
-
const require_utils = require('./utils.cjs');
|
|
3
|
-
|
|
4
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.js
|
|
5
|
-
/**
|
|
6
|
-
* markdownlint rule: `changeset-uncategorized-content` (CSH004).
|
|
7
|
-
*
|
|
8
|
-
* Detects content that appears before the first h2 heading in a changeset
|
|
9
|
-
* markdown file. All substantive content must be placed under a categorized
|
|
10
|
-
* section (`## heading`).
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* The rule iterates over the top-level micromark token stream and stops at the
|
|
14
|
-
* first `atxHeading` with depth 2. Any token encountered before that heading
|
|
15
|
-
* that is not a `lineEnding`, `lineEndingBlank`, or `htmlFlow` (HTML comments)
|
|
16
|
-
* triggers an error. This ensures that changeset content is always grouped
|
|
17
|
-
* under a recognized category heading.
|
|
18
|
-
*
|
|
19
|
-
* This rule mirrors the remark-lint rule `remarkLintUncategorizedContent` but
|
|
20
|
-
* uses markdownlint's micromark token API so it can run inside
|
|
21
|
-
* markdownlint-cli2 and the VS Code markdownlint extension.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```json
|
|
25
|
-
* {
|
|
26
|
-
* "changeset-uncategorized-content": true
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @see {@link https://github.com/savvy-web/changesets/blob/main/docs/rules/CSH004.md | CSH004 rule documentation}
|
|
31
|
-
* @see `src/remark/rules/uncategorized-content.ts` for the corresponding remark-lint rule
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
const UncategorizedContentRule = {
|
|
36
|
-
names: ["changeset-uncategorized-content", "CSH004"],
|
|
37
|
-
description: "All content must be placed under a category heading (## heading)",
|
|
38
|
-
tags: ["changeset"],
|
|
39
|
-
parser: "micromark",
|
|
40
|
-
function: function CSH004(params, onError) {
|
|
41
|
-
const tokens = params.parsers.micromark.tokens;
|
|
42
|
-
for (const token of tokens) {
|
|
43
|
-
if (token.type === "atxHeading" && require_utils.getHeadingLevel(token) === 2) break;
|
|
44
|
-
if (token.type === "lineEnding" || token.type === "lineEndingBlank" || token.type === "htmlFlow") continue;
|
|
45
|
-
if (token.type !== "atxHeading") onError({
|
|
46
|
-
lineNumber: token.startLine,
|
|
47
|
-
detail: `Content must be placed under a category heading (## heading). Move this content under an appropriate section like "## Features" or "## Bug Fixes". If it doesn't fit an existing category, use "## Other". See: ${require_constants.RULE_DOCS.CSH004}`
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
exports.UncategorizedContentRule = UncategorizedContentRule;
|
package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { RULE_DOCS } from "../../constants.js";
|
|
2
|
-
import { getHeadingLevel } from "./utils.js";
|
|
3
|
-
|
|
4
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.js
|
|
5
|
-
/**
|
|
6
|
-
* markdownlint rule: `changeset-uncategorized-content` (CSH004).
|
|
7
|
-
*
|
|
8
|
-
* Detects content that appears before the first h2 heading in a changeset
|
|
9
|
-
* markdown file. All substantive content must be placed under a categorized
|
|
10
|
-
* section (`## heading`).
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* The rule iterates over the top-level micromark token stream and stops at the
|
|
14
|
-
* first `atxHeading` with depth 2. Any token encountered before that heading
|
|
15
|
-
* that is not a `lineEnding`, `lineEndingBlank`, or `htmlFlow` (HTML comments)
|
|
16
|
-
* triggers an error. This ensures that changeset content is always grouped
|
|
17
|
-
* under a recognized category heading.
|
|
18
|
-
*
|
|
19
|
-
* This rule mirrors the remark-lint rule `remarkLintUncategorizedContent` but
|
|
20
|
-
* uses markdownlint's micromark token API so it can run inside
|
|
21
|
-
* markdownlint-cli2 and the VS Code markdownlint extension.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```json
|
|
25
|
-
* {
|
|
26
|
-
* "changeset-uncategorized-content": true
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @see {@link https://github.com/savvy-web/changesets/blob/main/docs/rules/CSH004.md | CSH004 rule documentation}
|
|
31
|
-
* @see `src/remark/rules/uncategorized-content.ts` for the corresponding remark-lint rule
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
const UncategorizedContentRule = {
|
|
36
|
-
names: ["changeset-uncategorized-content", "CSH004"],
|
|
37
|
-
description: "All content must be placed under a category heading (## heading)",
|
|
38
|
-
tags: ["changeset"],
|
|
39
|
-
parser: "micromark",
|
|
40
|
-
function: function CSH004(params, onError) {
|
|
41
|
-
const tokens = params.parsers.micromark.tokens;
|
|
42
|
-
for (const token of tokens) {
|
|
43
|
-
if (token.type === "atxHeading" && getHeadingLevel(token) === 2) break;
|
|
44
|
-
if (token.type === "lineEnding" || token.type === "lineEndingBlank" || token.type === "htmlFlow") continue;
|
|
45
|
-
if (token.type !== "atxHeading") onError({
|
|
46
|
-
lineNumber: token.startLine,
|
|
47
|
-
detail: `Content must be placed under a category heading (## heading). Move this content under an appropriate section like "## Features" or "## Bug Fixes". If it doesn't fit an existing category, use "## Other". See: ${RULE_DOCS.CSH004}`
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
//#endregion
|
|
54
|
-
export { UncategorizedContentRule };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const require_constants = require('../../constants.cjs');
|
|
2
|
-
|
|
3
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.js
|
|
4
|
-
/**
|
|
5
|
-
* Get the heading level (1-6) from an `atxHeading` token.
|
|
6
|
-
*
|
|
7
|
-
* @param heading - The `atxHeading` micromark token
|
|
8
|
-
* @returns The heading depth (number of `#` characters), or 0 if no sequence found
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
function getHeadingLevel(heading) {
|
|
13
|
-
const sequence = heading.children.find((c) => c.type === "atxHeadingSequence");
|
|
14
|
-
return sequence ? sequence.text.length : 0;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get the plain text content of an `atxHeading` token.
|
|
18
|
-
*
|
|
19
|
-
* @param heading - The `atxHeading` micromark token
|
|
20
|
-
* @returns The heading text, or empty string if no text token found
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
function getHeadingText(heading) {
|
|
25
|
-
const textToken = heading.children.find((c) => c.type === "atxHeadingText");
|
|
26
|
-
return textToken ? textToken.text : "";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
exports.getHeadingLevel = getHeadingLevel;
|
|
31
|
-
exports.getHeadingText = getHeadingText;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { RULE_DOCS } from "../../constants.js";
|
|
2
|
-
|
|
3
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.js
|
|
4
|
-
/**
|
|
5
|
-
* Get the heading level (1-6) from an `atxHeading` token.
|
|
6
|
-
*
|
|
7
|
-
* @param heading - The `atxHeading` micromark token
|
|
8
|
-
* @returns The heading depth (number of `#` characters), or 0 if no sequence found
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
function getHeadingLevel(heading) {
|
|
13
|
-
const sequence = heading.children.find((c) => c.type === "atxHeadingSequence");
|
|
14
|
-
return sequence ? sequence.text.length : 0;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get the plain text content of an `atxHeading` token.
|
|
18
|
-
*
|
|
19
|
-
* @param heading - The `atxHeading` micromark token
|
|
20
|
-
* @returns The heading text, or empty string if no text token found
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
function getHeadingText(heading) {
|
|
25
|
-
const textToken = heading.children.find((c) => c.type === "atxHeadingText");
|
|
26
|
-
return textToken ? textToken.text : "";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
export { getHeadingLevel, getHeadingText };
|
package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.cjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const require_dependency_table = require('../../utils/dependency-table.cjs');
|
|
2
|
-
const require_version_blocks = require('../../utils/version-blocks.cjs');
|
|
3
|
-
|
|
4
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.js
|
|
5
|
-
const AggregateDependencyTablesPlugin = () => {
|
|
6
|
-
return (tree) => {
|
|
7
|
-
const blocks = require_version_blocks.getVersionBlocks(tree);
|
|
8
|
-
for (let b = blocks.length - 1; b >= 0; b--) {
|
|
9
|
-
const depSections = require_version_blocks.getBlockSections(tree, blocks[b]).filter((s) => require_version_blocks.getHeadingText(s.heading).toLowerCase() === "dependencies");
|
|
10
|
-
if (depSections.length === 0) continue;
|
|
11
|
-
const allRows = [];
|
|
12
|
-
const legacyContent = [];
|
|
13
|
-
for (const section of depSections) for (const node of section.contentNodes) if (node.type === "table") try {
|
|
14
|
-
const rows = require_dependency_table.parseDependencyTable(node);
|
|
15
|
-
allRows.push(...rows);
|
|
16
|
-
} catch {
|
|
17
|
-
legacyContent.push(node);
|
|
18
|
-
}
|
|
19
|
-
else legacyContent.push(node);
|
|
20
|
-
const collapsed = require_dependency_table.sortDependencyRows(require_dependency_table.collapseDependencyRows(allRows));
|
|
21
|
-
const indicesToRemove = [];
|
|
22
|
-
for (const section of depSections) {
|
|
23
|
-
indicesToRemove.push(section.headingIndex);
|
|
24
|
-
for (let c = 0; c < section.contentNodes.length; c++) indicesToRemove.push(section.headingIndex + 1 + c);
|
|
25
|
-
}
|
|
26
|
-
indicesToRemove.sort((a, b) => b - a);
|
|
27
|
-
for (const idx of indicesToRemove) tree.children.splice(idx, 1);
|
|
28
|
-
if (collapsed.length === 0 && legacyContent.length === 0) continue;
|
|
29
|
-
const insertAt = depSections[0].headingIndex;
|
|
30
|
-
const newNodes = [];
|
|
31
|
-
newNodes.push({
|
|
32
|
-
type: "heading",
|
|
33
|
-
depth: 3,
|
|
34
|
-
children: [{
|
|
35
|
-
type: "text",
|
|
36
|
-
value: "Dependencies"
|
|
37
|
-
}]
|
|
38
|
-
});
|
|
39
|
-
if (collapsed.length > 0) newNodes.push(require_dependency_table.serializeDependencyTable(collapsed));
|
|
40
|
-
newNodes.push(...legacyContent);
|
|
41
|
-
tree.children.splice(insertAt, 0, ...newNodes);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
exports.AggregateDependencyTablesPlugin = AggregateDependencyTablesPlugin;
|
package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { collapseDependencyRows, parseDependencyTable, serializeDependencyTable, sortDependencyRows } from "../../utils/dependency-table.js";
|
|
2
|
-
import { getBlockSections, getHeadingText, getVersionBlocks } from "../../utils/version-blocks.js";
|
|
3
|
-
|
|
4
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.js
|
|
5
|
-
const AggregateDependencyTablesPlugin = () => {
|
|
6
|
-
return (tree) => {
|
|
7
|
-
const blocks = getVersionBlocks(tree);
|
|
8
|
-
for (let b = blocks.length - 1; b >= 0; b--) {
|
|
9
|
-
const depSections = getBlockSections(tree, blocks[b]).filter((s) => getHeadingText(s.heading).toLowerCase() === "dependencies");
|
|
10
|
-
if (depSections.length === 0) continue;
|
|
11
|
-
const allRows = [];
|
|
12
|
-
const legacyContent = [];
|
|
13
|
-
for (const section of depSections) for (const node of section.contentNodes) if (node.type === "table") try {
|
|
14
|
-
const rows = parseDependencyTable(node);
|
|
15
|
-
allRows.push(...rows);
|
|
16
|
-
} catch {
|
|
17
|
-
legacyContent.push(node);
|
|
18
|
-
}
|
|
19
|
-
else legacyContent.push(node);
|
|
20
|
-
const collapsed = sortDependencyRows(collapseDependencyRows(allRows));
|
|
21
|
-
const indicesToRemove = [];
|
|
22
|
-
for (const section of depSections) {
|
|
23
|
-
indicesToRemove.push(section.headingIndex);
|
|
24
|
-
for (let c = 0; c < section.contentNodes.length; c++) indicesToRemove.push(section.headingIndex + 1 + c);
|
|
25
|
-
}
|
|
26
|
-
indicesToRemove.sort((a, b) => b - a);
|
|
27
|
-
for (const idx of indicesToRemove) tree.children.splice(idx, 1);
|
|
28
|
-
if (collapsed.length === 0 && legacyContent.length === 0) continue;
|
|
29
|
-
const insertAt = depSections[0].headingIndex;
|
|
30
|
-
const newNodes = [];
|
|
31
|
-
newNodes.push({
|
|
32
|
-
type: "heading",
|
|
33
|
-
depth: 3,
|
|
34
|
-
children: [{
|
|
35
|
-
type: "text",
|
|
36
|
-
value: "Dependencies"
|
|
37
|
-
}]
|
|
38
|
-
});
|
|
39
|
-
if (collapsed.length > 0) newNodes.push(serializeDependencyTable(collapsed));
|
|
40
|
-
newNodes.push(...legacyContent);
|
|
41
|
-
tree.children.splice(insertAt, 0, ...newNodes);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
export { AggregateDependencyTablesPlugin };
|