@savvy-web/silk-effects 1.5.2 → 2.0.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.
@@ -1,8 +1,10 @@
1
1
  import { ContentStructureRule } from "../remark/rules/content-structure.js";
2
+ import { DependencyTableFormatRule } from "../remark/rules/dependency-table-format.js";
2
3
  import { HeadingHierarchyRule } from "../remark/rules/heading-hierarchy.js";
3
4
  import { RequiredSectionsRule } from "../remark/rules/required-sections.js";
4
5
  import { UncategorizedContentRule } from "../remark/rules/uncategorized-content.js";
5
6
  import { stripFrontmatter } from "../utils/strip-frontmatter.js";
7
+ import remarkGfm from "remark-gfm";
6
8
  import remarkParse from "remark-parse";
7
9
  import remarkStringify from "remark-stringify";
8
10
  import { unified } from "unified";
@@ -13,7 +15,7 @@ import { join } from "node:path";
13
15
  /**
14
16
  * Class-based API wrapper for changeset linting.
15
17
  *
16
- * Provides a static class interface that runs all remark-lint rules
18
+ * Provides a static class interface that runs all five remark-lint rules
17
19
  * against changeset markdown files and returns structured diagnostics.
18
20
  *
19
21
  * @internal
@@ -21,9 +23,9 @@ import { join } from "node:path";
21
23
  /**
22
24
  * Static class for linting changeset markdown files.
23
25
  *
24
- * Runs the four remark-lint rules (heading-hierarchy, required-sections,
25
- * content-structure, uncategorized-content) against changeset markdown
26
- * and returns structured {@link LintMessage} diagnostics.
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.
27
29
  *
28
30
  * @remarks
29
31
  * This class implements the pre-validation layer of the three-layer
@@ -109,7 +111,7 @@ var ChangesetLinter = class ChangesetLinter {
109
111
  *
110
112
  * @remarks
111
113
  * Reads the file synchronously, strips YAML frontmatter, and runs all
112
- * four lint rules. The file path is preserved in each returned
114
+ * five lint rules. The file path is preserved in each returned
113
115
  * {@link LintMessage} for error reporting.
114
116
  *
115
117
  * @param filePath - Absolute or relative path to the changeset `.md` file
@@ -123,7 +125,7 @@ var ChangesetLinter = class ChangesetLinter {
123
125
  * Validate a markdown string directly.
124
126
  *
125
127
  * @remarks
126
- * Strips YAML frontmatter (if present) and runs all four lint rules
128
+ * Strips YAML frontmatter (if present) and runs all five lint rules
127
129
  * against the remaining content. This method is useful for validating
128
130
  * changeset content that is already in memory, such as in test suites
129
131
  * or editor integrations.
@@ -135,7 +137,7 @@ var ChangesetLinter = class ChangesetLinter {
135
137
  */
136
138
  static validateContent(content, filePath = "<input>") {
137
139
  const body = stripFrontmatter(content);
138
- return unified().use(remarkParse).use(remarkStringify).use(HeadingHierarchyRule).use(RequiredSectionsRule).use(ContentStructureRule).use(UncategorizedContentRule).processSync(body).messages.map((msg) => ({
140
+ return unified().use(remarkParse).use(remarkGfm).use(remarkStringify).use(HeadingHierarchyRule).use(RequiredSectionsRule).use(ContentStructureRule).use(DependencyTableFormatRule).use(UncategorizedContentRule).processSync(body).messages.map((msg) => ({
139
141
  file: filePath,
140
142
  /* v8 ignore next 3 -- ruleId/line/column fallbacks; remark-lint always provides these */
141
143
  rule: msg.ruleId ?? msg.source ?? "unknown",
@@ -300,6 +300,49 @@ var GitError = class extends GitErrorBase {
300
300
  }
301
301
  };
302
302
  /**
303
+ * Base class for {@link ChangesetIOError}.
304
+ *
305
+ * @privateRemarks
306
+ * Effect's `Data.TaggedError` creates an anonymous base class that
307
+ * api-extractor cannot follow without an explicit export.
308
+ *
309
+ * @internal
310
+ */
311
+ const ChangesetIOErrorBase = Data.TaggedError("ChangesetIOError");
312
+ /**
313
+ * Changeset file I/O failure.
314
+ *
315
+ * @remarks
316
+ * Raised by {@link DepsRegen} when reading, writing, listing, or deleting
317
+ * `.changeset/*.md` files fails. Deletion failures during
318
+ * {@link DepsRegenShape.execute} are tolerated (stale changesets are
319
+ * skip-and-continue, so an interrupted run stays safely re-runnable);
320
+ * read, list, and write failures are loud.
321
+ *
322
+ * @example
323
+ * ```typescript
324
+ * import { Effect } from "effect";
325
+ * import { ChangesetIOError } from "@savvy-web/changesets";
326
+ *
327
+ * declare const program: Effect.Effect<void, ChangesetIOError>;
328
+ *
329
+ * const handled = program.pipe(
330
+ * Effect.catchTag("ChangesetIOError", (err) =>
331
+ * Effect.logError(`changeset ${err.operation} failed at ${err.path}: ${err.reason}`)
332
+ * ),
333
+ * );
334
+ * ```
335
+ *
336
+ * @see {@link DepsRegen} which produces these errors during plan/execute
337
+ *
338
+ * @public
339
+ */
340
+ var ChangesetIOError = class extends ChangesetIOErrorBase {
341
+ get message() {
342
+ return `changeset ${this.operation} failed at ${this.path}: ${this.reason}`;
343
+ }
344
+ };
345
+ /**
303
346
  * Base class for {@link ReleasePlanError}.
304
347
  *
305
348
  * @privateRemarks
@@ -325,4 +368,4 @@ var ReleasePlanError = class extends ReleasePlanErrorBase {
325
368
  };
326
369
 
327
370
  //#endregion
328
- export { ChangesetValidationError, ChangesetValidationErrorBase, ConfigurationError, ConfigurationErrorBase, GitError, GitErrorBase, GitHubApiError, GitHubApiErrorBase, MarkdownParseError, MarkdownParseErrorBase, ReleasePlanError, ReleasePlanErrorBase, VersionFileError, VersionFileErrorBase };
371
+ export { ChangesetIOError, ChangesetIOErrorBase, ChangesetValidationError, ChangesetValidationErrorBase, ConfigurationError, ConfigurationErrorBase, GitError, GitErrorBase, GitHubApiError, GitHubApiErrorBase, MarkdownParseError, MarkdownParseErrorBase, ReleasePlanError, ReleasePlanErrorBase, VersionFileError, VersionFileErrorBase };
@@ -1,19 +1,20 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { Categories } from "./api/categories.js";
3
- import { ChangesetValidationError, ChangesetValidationErrorBase, ConfigurationError, ConfigurationErrorBase, GitError, GitErrorBase, GitHubApiError, GitHubApiErrorBase, MarkdownParseError, MarkdownParseErrorBase, ReleasePlanError, ReleasePlanErrorBase, VersionFileError, VersionFileErrorBase } from "./errors.js";
3
+ import { ChangesetIOError, ChangesetIOErrorBase, ChangesetValidationError, ChangesetValidationErrorBase, ConfigurationError, ConfigurationErrorBase, GitError, GitErrorBase, GitHubApiError, GitHubApiErrorBase, MarkdownParseError, MarkdownParseErrorBase, ReleasePlanError, ReleasePlanErrorBase, VersionFileError, VersionFileErrorBase } from "./errors.js";
4
4
  import { JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, VersionFileConfigSchema, VersionFilesSchema } from "./schemas/version-files.js";
5
5
  import { GlobSchema, PackageScopeSchema, PackagesRecordSchema } from "./schemas/package-scope.js";
6
6
  import { ChangesetOptionsSchema, RepoSchema } from "./schemas/options.js";
7
7
  import { GitHubLive, GitHubService, GitHubServiceBase, makeGitHubTest } from "./services/github.js";
8
8
  import { MarkdownLive, MarkdownService, MarkdownServiceBase } from "./services/markdown.js";
9
9
  import { NonEmptyString, PositiveInteger } from "./schemas/primitives.js";
10
- import { DependencyActionSchema, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, VersionOrEmptySchema } from "./schemas/dependency-table.js";
10
+ import { DependencyActionSchema, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, VERSION_RE, VersionOrEmptySchema } from "./schemas/dependency-table.js";
11
11
  import { serializeDependencyTableToMarkdown } from "./utils/dependency-table.js";
12
12
  import { GitHubInfoSchema, IssueNumberSchema, UrlOrMarkdownLinkSchema, UsernameSchema } from "./schemas/github.js";
13
13
  import changelogFunctions from "./changelog/index.js";
14
14
  import { Changelog } from "./api/changelog.js";
15
15
  import { DependencyTable } from "./api/dependency-table.js";
16
16
  import { ContentStructureRule } from "./remark/rules/content-structure.js";
17
+ import { DependencyTableFormatRule } from "./remark/rules/dependency-table-format.js";
17
18
  import { HeadingHierarchyRule } from "./remark/rules/heading-hierarchy.js";
18
19
  import { RequiredSectionsRule } from "./remark/rules/required-sections.js";
19
20
  import { UncategorizedContentRule } from "./remark/rules/uncategorized-content.js";
@@ -28,24 +29,23 @@ import { ChangelogTransformer } from "./api/transformer.js";
28
29
  import { ClassificationReasonSchema, ClassificationSchema, ConfigInspector, ConfigInspectorBase, ConfigInspectorLive, InspectedConfigSchema, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, makeConfigInspectorTest } from "./services/config-inspector.js";
29
30
  import { BranchAnalysisSchema, BranchAnalyzer, BranchAnalyzerBase, BranchAnalyzerLive, BranchFileEntrySchema, FileStatusSchema, makeBranchAnalyzerTest } from "./services/branch-analyzer.js";
30
31
  import { ChangelogService, ChangelogServiceBase } from "./services/changelog.js";
32
+ import { computeWorkspaceDependencyDiffs } from "./utils/dep-diff.js";
33
+ import { gitMergeBase } from "./utils/git.js";
34
+ import { listPublishablePackageNames } from "./utils/publishability.js";
35
+ import { DepsRegen, DepsRegenBase, DepsRegenDefault, DepsRegenLive, isPureDependencyChangeset } from "./services/deps-regen.js";
31
36
  import { VersionFiles } from "./utils/version-files.js";
32
37
  import { ReleasePlanner, ReleasePlannerBase, ReleasePlannerLive, makeReleasePlannerTest } from "./services/release-planner.js";
33
- import { WorkspaceSnapshotReader, WorkspaceSnapshotReaderBase, WorkspaceSnapshotReaderLive } from "./services/workspace-snapshot.js";
34
38
  import { SectionCategorySchema } from "./categories/types.js";
35
39
  import { CommitHashSchema, VersionTypeSchema } from "./schemas/git.js";
36
40
  import { ChangesetSchema, ChangesetSummarySchema, DependencyTypeSchema, DependencyUpdateSchema } from "./schemas/changeset.js";
37
41
  import { AppliedReleaseEntrySchema, AppliedReleaseSchema, BumpTypeSchema, ChangesetPreviewSchema, PendingChangesetSchema, PreviewReleaseSchema, VersionFileUpdateRecordSchema } from "./schemas/release-plan.js";
38
- import { computeWorkspaceDependencyDiffs } from "./utils/dep-diff.js";
39
- import { listPublishablePackageNames } from "./utils/publishability.js";
40
- import { gitMergeBase, snapshotFromWorktree } from "./utils/worktree-snapshot.js";
41
42
  import { ContentStructureRule as ContentStructureRule$1 } from "./markdownlint/rules/content-structure.js";
42
- import { DependencyTableFormatRule } from "./markdownlint/rules/dependency-table-format.js";
43
+ import { DependencyTableFormatRule as DependencyTableFormatRule$1 } from "./markdownlint/rules/dependency-table-format.js";
43
44
  import { HeadingHierarchyRule as HeadingHierarchyRule$1 } from "./markdownlint/rules/heading-hierarchy.js";
44
45
  import { RequiredSectionsRule as RequiredSectionsRule$1 } from "./markdownlint/rules/required-sections.js";
45
46
  import { UncategorizedContentRule as UncategorizedContentRule$1 } from "./markdownlint/rules/uncategorized-content.js";
46
47
  import SilkChangesetsRules from "./markdownlint/index.js";
47
48
  import { AggregateDependencyTablesPlugin } from "./remark/plugins/aggregate-dependency-tables.js";
48
- import { DependencyTableFormatRule as DependencyTableFormatRule$1 } from "./remark/rules/dependency-table-format.js";
49
49
  import { SilkChangesetPreset, SilkChangesetTransformPreset } from "./remark/presets.js";
50
50
 
51
51
  //#region src/changesets/index.ts
@@ -64,6 +64,8 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
64
64
  ChangelogService: () => ChangelogService,
65
65
  ChangelogServiceBase: () => ChangelogServiceBase,
66
66
  ChangelogTransformer: () => ChangelogTransformer,
67
+ ChangesetIOError: () => ChangesetIOError,
68
+ ChangesetIOErrorBase: () => ChangesetIOErrorBase,
67
69
  ChangesetLinter: () => ChangesetLinter,
68
70
  ChangesetOptionsSchema: () => ChangesetOptionsSchema,
69
71
  ChangesetPreviewSchema: () => ChangesetPreviewSchema,
@@ -84,12 +86,16 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
84
86
  DeduplicateItemsPlugin: () => DeduplicateItemsPlugin,
85
87
  DependencyActionSchema: () => DependencyActionSchema,
86
88
  DependencyTable: () => DependencyTable,
87
- DependencyTableFormatRule: () => DependencyTableFormatRule$1,
89
+ DependencyTableFormatRule: () => DependencyTableFormatRule,
88
90
  DependencyTableRowSchema: () => DependencyTableRowSchema,
89
91
  DependencyTableSchema: () => DependencyTableSchema,
90
92
  DependencyTableTypeSchema: () => DependencyTableTypeSchema,
91
93
  DependencyTypeSchema: () => DependencyTypeSchema,
92
94
  DependencyUpdateSchema: () => DependencyUpdateSchema,
95
+ DepsRegen: () => DepsRegen,
96
+ DepsRegenBase: () => DepsRegenBase,
97
+ DepsRegenDefault: () => DepsRegenDefault,
98
+ DepsRegenLive: () => DepsRegenLive,
93
99
  FileStatusSchema: () => FileStatusSchema,
94
100
  GitError: () => GitError,
95
101
  GitErrorBase: () => GitErrorBase,
@@ -113,7 +119,7 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
113
119
  MarkdownService: () => MarkdownService,
114
120
  MarkdownServiceBase: () => MarkdownServiceBase,
115
121
  MarkdownlintContentStructureRule: () => ContentStructureRule$1,
116
- MarkdownlintDependencyTableFormatRule: () => DependencyTableFormatRule,
122
+ MarkdownlintDependencyTableFormatRule: () => DependencyTableFormatRule$1,
117
123
  MarkdownlintHeadingHierarchyRule: () => HeadingHierarchyRule$1,
118
124
  MarkdownlintRequiredSectionsRule: () => RequiredSectionsRule$1,
119
125
  MarkdownlintUncategorizedContentRule: () => UncategorizedContentRule$1,
@@ -142,6 +148,7 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
142
148
  UncategorizedContentRule: () => UncategorizedContentRule,
143
149
  UrlOrMarkdownLinkSchema: () => UrlOrMarkdownLinkSchema,
144
150
  UsernameSchema: () => UsernameSchema,
151
+ VERSION_RE: () => VERSION_RE,
145
152
  VersionFileConfigSchema: () => VersionFileConfigSchema,
146
153
  VersionFileError: () => VersionFileError,
147
154
  VersionFileErrorBase: () => VersionFileErrorBase,
@@ -150,20 +157,17 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
150
157
  VersionFilesSchema: () => VersionFilesSchema,
151
158
  VersionOrEmptySchema: () => VersionOrEmptySchema,
152
159
  VersionTypeSchema: () => VersionTypeSchema,
153
- WorkspaceSnapshotReader: () => WorkspaceSnapshotReader,
154
- WorkspaceSnapshotReaderBase: () => WorkspaceSnapshotReaderBase,
155
- WorkspaceSnapshotReaderLive: () => WorkspaceSnapshotReaderLive,
156
160
  changelogFunctions: () => changelogFunctions,
157
161
  computeWorkspaceDependencyDiffs: () => computeWorkspaceDependencyDiffs,
158
162
  gitMergeBase: () => gitMergeBase,
163
+ isPureDependencyChangeset: () => isPureDependencyChangeset,
159
164
  listPublishablePackageNames: () => listPublishablePackageNames,
160
165
  makeBranchAnalyzerTest: () => makeBranchAnalyzerTest,
161
166
  makeConfigInspectorTest: () => makeConfigInspectorTest,
162
167
  makeGitHubTest: () => makeGitHubTest,
163
168
  makeReleasePlannerTest: () => makeReleasePlannerTest,
164
- serializeDependencyTableToMarkdown: () => serializeDependencyTableToMarkdown,
165
- snapshotFromWorktree: () => snapshotFromWorktree
169
+ serializeDependencyTableToMarkdown: () => serializeDependencyTableToMarkdown
166
170
  });
167
171
 
168
172
  //#endregion
169
- export { AggregateDependencyTablesPlugin, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysisSchema, BranchAnalyzer, BranchAnalyzerBase, BranchAnalyzerLive, BranchFileEntrySchema, BumpTypeSchema, Categories, Changelog, ChangelogService, ChangelogServiceBase, ChangelogTransformer, ChangesetLinter, ChangesetOptionsSchema, ChangesetPreviewSchema, ChangesetSchema, ChangesetSummarySchema, ChangesetValidationError, ChangesetValidationErrorBase, ClassificationReasonSchema, ClassificationSchema, CommitHashSchema, ConfigInspector, ConfigInspectorBase, ConfigInspectorLive, ConfigurationError, ConfigurationErrorBase, ContentStructureRule, ContributorFootnotesPlugin, DeduplicateItemsPlugin, DependencyActionSchema, DependencyTable, DependencyTableFormatRule$1 as DependencyTableFormatRule, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, DependencyTypeSchema, DependencyUpdateSchema, FileStatusSchema, GitError, GitErrorBase, GitHubApiError, GitHubApiErrorBase, GitHubInfoSchema, GitHubLive, GitHubService, GitHubServiceBase, GlobSchema, HeadingHierarchyRule, InspectedConfigSchema, IssueLinkRefsPlugin, IssueNumberSchema, JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, MarkdownLive, MarkdownParseError, MarkdownParseErrorBase, MarkdownService, MarkdownServiceBase, ContentStructureRule$1 as MarkdownlintContentStructureRule, DependencyTableFormatRule as MarkdownlintDependencyTableFormatRule, HeadingHierarchyRule$1 as MarkdownlintHeadingHierarchyRule, RequiredSectionsRule$1 as MarkdownlintRequiredSectionsRule, UncategorizedContentRule$1 as MarkdownlintUncategorizedContentRule, MergeSectionsPlugin, NonEmptyString, NormalizeFormatPlugin, PackageScopeSchema, PackagesRecordSchema, PendingChangesetSchema, PositiveInteger, PreviewReleaseSchema, ReleasePlanError, ReleasePlanErrorBase, ReleasePlanner, ReleasePlannerBase, ReleasePlannerLive, ReorderSectionsPlugin, RepoSchema, RequiredSectionsRule, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, SectionCategorySchema, SilkChangesetPreset, SilkChangesetTransformPreset, SilkChangesetsRules, UncategorizedContentRule, UrlOrMarkdownLinkSchema, UsernameSchema, VersionFileConfigSchema, VersionFileError, VersionFileErrorBase, VersionFileUpdateRecordSchema, VersionFiles, VersionFilesSchema, VersionOrEmptySchema, VersionTypeSchema, WorkspaceSnapshotReader, WorkspaceSnapshotReaderBase, WorkspaceSnapshotReaderLive, changelogFunctions, changesets_exports, computeWorkspaceDependencyDiffs, gitMergeBase, listPublishablePackageNames, makeBranchAnalyzerTest, makeConfigInspectorTest, makeGitHubTest, makeReleasePlannerTest, serializeDependencyTableToMarkdown, snapshotFromWorktree };
173
+ export { AggregateDependencyTablesPlugin, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysisSchema, BranchAnalyzer, BranchAnalyzerBase, BranchAnalyzerLive, BranchFileEntrySchema, BumpTypeSchema, Categories, Changelog, ChangelogService, ChangelogServiceBase, ChangelogTransformer, ChangesetIOError, ChangesetIOErrorBase, ChangesetLinter, ChangesetOptionsSchema, ChangesetPreviewSchema, ChangesetSchema, ChangesetSummarySchema, ChangesetValidationError, ChangesetValidationErrorBase, ClassificationReasonSchema, ClassificationSchema, CommitHashSchema, ConfigInspector, ConfigInspectorBase, ConfigInspectorLive, ConfigurationError, ConfigurationErrorBase, ContentStructureRule, ContributorFootnotesPlugin, DeduplicateItemsPlugin, DependencyActionSchema, DependencyTable, DependencyTableFormatRule, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, DependencyTypeSchema, DependencyUpdateSchema, DepsRegen, DepsRegenBase, DepsRegenDefault, DepsRegenLive, FileStatusSchema, GitError, GitErrorBase, GitHubApiError, GitHubApiErrorBase, GitHubInfoSchema, GitHubLive, GitHubService, GitHubServiceBase, GlobSchema, HeadingHierarchyRule, InspectedConfigSchema, IssueLinkRefsPlugin, IssueNumberSchema, JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, MarkdownLive, MarkdownParseError, MarkdownParseErrorBase, MarkdownService, MarkdownServiceBase, ContentStructureRule$1 as MarkdownlintContentStructureRule, DependencyTableFormatRule$1 as MarkdownlintDependencyTableFormatRule, HeadingHierarchyRule$1 as MarkdownlintHeadingHierarchyRule, RequiredSectionsRule$1 as MarkdownlintRequiredSectionsRule, UncategorizedContentRule$1 as MarkdownlintUncategorizedContentRule, MergeSectionsPlugin, NonEmptyString, NormalizeFormatPlugin, PackageScopeSchema, PackagesRecordSchema, PendingChangesetSchema, PositiveInteger, PreviewReleaseSchema, ReleasePlanError, ReleasePlanErrorBase, ReleasePlanner, ReleasePlannerBase, ReleasePlannerLive, ReorderSectionsPlugin, RepoSchema, RequiredSectionsRule, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, SectionCategorySchema, SilkChangesetPreset, SilkChangesetTransformPreset, SilkChangesetsRules, UncategorizedContentRule, UrlOrMarkdownLinkSchema, UsernameSchema, VERSION_RE, VersionFileConfigSchema, VersionFileError, VersionFileErrorBase, VersionFileUpdateRecordSchema, VersionFiles, VersionFilesSchema, VersionOrEmptySchema, VersionTypeSchema, changelogFunctions, changesets_exports, computeWorkspaceDependencyDiffs, gitMergeBase, isPureDependencyChangeset, listPublishablePackageNames, makeBranchAnalyzerTest, makeConfigInspectorTest, makeGitHubTest, makeReleasePlannerTest, serializeDependencyTableToMarkdown };
@@ -1,3 +1,4 @@
1
+ import { VERSION_RE } from "../../schemas/dependency-table.js";
1
2
  import { RULE_DOCS } from "../../constants.js";
2
3
  import { getHeadingLevel, getHeadingText } from "./utils.js";
3
4
 
@@ -23,7 +24,6 @@ const EXPECTED_HEADERS = [
23
24
  "from",
24
25
  "to"
25
26
  ];
26
- const VERSION_RE = /^(\u2014|[~^]?\d+\.\d+\.\d+(?:[-+.][\w.+-]*)?)$/;
27
27
  /**
28
28
  * Extract text from a `tableHeader` or `tableData` cell token.
29
29
  *
@@ -1,4 +1,5 @@
1
1
  import { ContentStructureRule } from "./rules/content-structure.js";
2
+ import { DependencyTableFormatRule } from "./rules/dependency-table-format.js";
2
3
  import { HeadingHierarchyRule } from "./rules/heading-hierarchy.js";
3
4
  import { RequiredSectionsRule } from "./rules/required-sections.js";
4
5
  import { UncategorizedContentRule } from "./rules/uncategorized-content.js";
@@ -9,7 +10,6 @@ import { MergeSectionsPlugin } from "./plugins/merge-sections.js";
9
10
  import { NormalizeFormatPlugin } from "./plugins/normalize-format.js";
10
11
  import { ReorderSectionsPlugin } from "./plugins/reorder-sections.js";
11
12
  import { AggregateDependencyTablesPlugin } from "./plugins/aggregate-dependency-tables.js";
12
- import { DependencyTableFormatRule } from "./rules/dependency-table-format.js";
13
13
 
14
14
  //#region src/changesets/remark/presets.ts
15
15
  /**
@@ -68,6 +68,16 @@ const DependencyActionSchema = Schema.Literal("added", "updated", "removed");
68
68
  */
69
69
  const DependencyTableTypeSchema = Schema.Literal("dependency", "devDependency", "peerDependency", "optionalDependency", "workspace", "config");
70
70
  /**
71
+ * The canonical accepted-value pattern for a dependency-table From/To cell:
72
+ * the em-dash sentinel (U+2014), a bare/`~`/`^` semver, or — as a last-resort
73
+ * fallback when a `catalog:`/`workspace:` specifier could not be resolved to a
74
+ * concrete version — a pnpm protocol string. Non-overlapping alternatives keep
75
+ * this free of polynomial backtracking (CodeQL).
76
+ *
77
+ * @public
78
+ */
79
+ const VERSION_RE = /^(\u2014|[~^]?\d+\.\d+\.\d+(?:[-+.][\w.+-]+)?|(?:catalog|workspace|npm|jsr|file|link|portal):[^\s|]+)$/;
80
+ /**
71
81
  * Version string or em dash (U+2014) sentinel for added/removed entries.
72
82
  *
73
83
  * @remarks
@@ -93,7 +103,7 @@ const DependencyTableTypeSchema = Schema.Literal("dependency", "devDependency",
93
103
  *
94
104
  * @public
95
105
  */
96
- const VersionOrEmptySchema = Schema.String.pipe(Schema.pattern(/^(\u2014|[~^]?\d+\.\d+\.\d+(?:[-+.][\w.+-]*)?)$/));
106
+ const VersionOrEmptySchema = Schema.String.pipe(Schema.pattern(VERSION_RE));
97
107
  /**
98
108
  * Schema for a single dependency table row.
99
109
  *
@@ -185,4 +195,4 @@ const DependencyTableRowSchema = Schema.Struct({
185
195
  const DependencyTableSchema = Schema.Array(DependencyTableRowSchema).pipe(Schema.minItems(1));
186
196
 
187
197
  //#endregion
188
- export { DependencyActionSchema, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, VersionOrEmptySchema };
198
+ export { DependencyActionSchema, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, VERSION_RE, VersionOrEmptySchema };