@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,108 +0,0 @@
1
- import { ChangesetConfigError } from "../errors/ChangesetConfigError.js";
2
- import { ChangesetConfigFile, SilkChangesetConfigFile } from "../schemas/VersioningSchemas.js";
3
- import { Context, Effect, Layer, Schema } from "effect";
4
- import { FileSystem } from "@effect/platform";
5
-
6
- //#region ../silk-effects/dist/dev/pkg/services/ChangesetConfigReader.js
7
- /**
8
- * Substrings that identify a Silk changelog adapter entry in `.changeset/config.json`.
9
- *
10
- * Both the standalone package (`@savvy-web/changesets/changelog`) and the
11
- * consolidated Silk re-export (`@savvy-web/silk/changesets/changelog`) are Silk
12
- * adapters. The `/silk/` segment in the consolidated path breaks the original
13
- * `@savvy-web/changesets` substring, so each form needs its own marker.
14
- */
15
- const SILK_CHANGELOG_MARKERS = ["@savvy-web/changesets", "@savvy-web/silk/changesets"];
16
- function matchesSilkMarker(value) {
17
- return SILK_CHANGELOG_MARKERS.some((marker) => value.includes(marker));
18
- }
19
- function isSilkChangelog(changelog) {
20
- if (typeof changelog === "string") return matchesSilkMarker(changelog);
21
- if (Array.isArray(changelog) && changelog.length > 0) return typeof changelog[0] === "string" && matchesSilkMarker(changelog[0]);
22
- return false;
23
- }
24
- /**
25
- * Service that reads and decodes the `.changeset/config.json` for a given workspace root.
26
- *
27
- * @remarks
28
- * Automatically detects whether the config uses the Silk changelog adapter
29
- * (`@savvy-web/changesets`) and decodes as {@link (SilkChangesetConfigFile:type)} or the
30
- * standard {@link (ChangesetConfigFile:type)} accordingly.
31
- *
32
- * @example
33
- * ```typescript
34
- * const result = await Effect.runPromise(
35
- * Effect.gen(function* () {
36
- * const reader = yield* ChangesetConfigReader;
37
- * return yield* reader.read(process.cwd());
38
- * }).pipe(
39
- * Effect.provide(ChangesetConfigReaderLive),
40
- * Effect.provide(NodeContext.layer),
41
- * )
42
- * );
43
- * ```
44
- *
45
- * @since 0.1.0
46
- * @public
47
- */
48
- var ChangesetConfigReader = class extends Context.Tag("@savvy-web/silk-effects/ChangesetConfigReader")() {};
49
- /**
50
- * Live implementation of {@link ChangesetConfigReader}.
51
- *
52
- * @remarks
53
- * Requires `FileSystem` from `@effect/platform`. Provide `NodeContext.layer` or
54
- * `BunContext.layer` to satisfy this dependency.
55
- *
56
- * @since 0.1.0
57
- * @public
58
- */
59
- const ChangesetConfigReaderLive = Layer.effect(ChangesetConfigReader, Effect.gen(function* () {
60
- const fs = yield* FileSystem.FileSystem;
61
- const read = (root) => {
62
- const configPath = `${root}/.changeset/config.json`;
63
- return Effect.gen(function* () {
64
- if (!(yield* fs.exists(configPath).pipe(Effect.mapError(
65
- /* v8 ignore next 4 -- error path requires fs.exists to fail */
66
- (cause) => new ChangesetConfigError({
67
- path: configPath,
68
- reason: String(cause)
69
- })
70
- )))) return yield* Effect.fail(new ChangesetConfigError({
71
- path: configPath,
72
- reason: "File not found"
73
- }));
74
- const raw = yield* fs.readFileString(configPath).pipe(Effect.mapError(
75
- /* v8 ignore next 4 -- error path requires fs.readFileString to fail */
76
- (cause) => new ChangesetConfigError({
77
- path: configPath,
78
- reason: String(cause)
79
- })
80
- ));
81
- const parsed = yield* Effect.try({
82
- try: () => JSON.parse(raw),
83
- catch: (cause) => new ChangesetConfigError({
84
- path: configPath,
85
- reason: `Invalid JSON: ${String(cause)}`
86
- })
87
- });
88
- if (isSilkChangelog(parsed.changelog)) return yield* Schema.decodeUnknown(SilkChangesetConfigFile)(parsed).pipe(Effect.mapError(
89
- /* v8 ignore next 4 -- error path requires schema decode failure */
90
- (cause) => new ChangesetConfigError({
91
- path: configPath,
92
- reason: `Schema decode failed: ${String(cause)}`
93
- })
94
- ));
95
- return yield* Schema.decodeUnknown(ChangesetConfigFile)(parsed).pipe(Effect.mapError(
96
- /* v8 ignore next 4 -- error path requires schema decode failure */
97
- (cause) => new ChangesetConfigError({
98
- path: configPath,
99
- reason: `Schema decode failed: ${String(cause)}`
100
- })
101
- ));
102
- });
103
- };
104
- return { read };
105
- }));
106
-
107
- //#endregion
108
- export { ChangesetConfigReader, ChangesetConfigReaderLive };
@@ -1,238 +0,0 @@
1
- const require_ChangesetConfig = require('./ChangesetConfig.cjs');
2
- const require_WorkspaceDiscovery = require('../../../../../../node_modules/.pnpm/workspaces-effect@2.0.1_@effect_platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/WorkspaceDiscovery.cjs');
3
- const require_publish = require('../../../../../../node_modules/.pnpm/workspaces-effect@2.0.1_@effect_platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/publish.cjs');
4
- const require_PublishabilityDetector = require('../../../../../../node_modules/.pnpm/workspaces-effect@2.0.1_@effect_platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/PublishabilityDetector.cjs');
5
- const require_PublishabilityDetectorLive = require('../../../../../../node_modules/.pnpm/workspaces-effect@2.0.1_@effect_platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/PublishabilityDetectorLive.cjs');
6
- let effect = require("effect");
7
- let _effect_platform = require("@effect/platform");
8
- let node_path = require("node:path");
9
-
10
- //#region ../silk-effects/dist/dev/pkg/services/SilkPublishability.js
11
- const NPM_DEFAULT = "https://registry.npmjs.org/";
12
- /**
13
- * Default registry endpoints for the well-known target keys. Kept in sync with the
14
- * bundler's `resolveTargets` so the pre-build fallback matches what the binding will carry
15
- * (no trailing slash).
16
- */
17
- const DEFAULT_REGISTRIES = {
18
- npm: "https://registry.npmjs.org",
19
- github: "https://npm.pkg.github.com"
20
- };
21
- /**
22
- * Whether a registry endpoint participates in npm-style SLSA provenance.
23
- *
24
- * @remarks
25
- * The npm public registry and GitHub Packages both accept provenance attestations through the
26
- * Sigstore/OIDC trusted-publishing flow, so a `PublishTarget` bound to either is marked
27
- * `provenance: true` by default — this is what gates the release action's attestation step. JSR
28
- * and custom registries do not participate and resolve to `false`. Matching is endpoint-based
29
- * (not target-key based) so a custom key pointed at one of these registries still opts in.
30
- */
31
- const provenanceForRegistry = (registry) => {
32
- const normalized = /^[a-z]+:\/\//i.test(registry) ? registry : `https://${registry}`;
33
- let hostname;
34
- try {
35
- hostname = new URL(normalized).hostname.toLowerCase();
36
- } catch {
37
- return false;
38
- }
39
- return hostname === "registry.npmjs.org" || hostname === "npm.pkg.github.com";
40
- };
41
- /**
42
- * Silk publishability rules over `workspaces-effect`'s `PublishTarget`.
43
- *
44
- * @remarks
45
- * In silk mode `private: true` is the norm on workspace `package.json`; publishability is
46
- * derived from `publishConfig`, with the `private` flag consulted only as a last-resort
47
- * default. All helpers are static so a consumer sees the full rule surface in one place.
48
- *
49
- * @since 0.4.0
50
- * @public
51
- */
52
- var SilkPublishability = class {
53
- /**
54
- * Apply silk publishability rules to a raw `package.json` and the bundler's resolved
55
- * target binding. Targets-first precedence:
56
- *
57
- * - A non-empty `publishConfig.targets` map (the bundler's Record-map form) makes the
58
- * package publishable regardless of `private`. With a `binding` (post-prod-build), one
59
- * `PublishTarget` is emitted per resolved registry target, its `directory` set to
60
- * the bound group's `dist/prod/<group>/pkg` dir. Without a binding (pre-build), one
61
- * placeholder target is emitted per declared key so publishability and target counts
62
- * are correct; the directory is best-effort and unused until the build writes the
63
- * binding.
64
- * - Else `publishConfig.access` → one target at `publishConfig.directory`.
65
- * - Else `private !== true` → one default public target.
66
- * - Else `[]`.
67
- *
68
- * @param pkgName - The package's name (the base name for `true`/empty-object targets).
69
- * @param raw - The raw `package.json` (silk reads the unschematized `publishConfig`).
70
- * @param binding - The parsed `dist/prod/targets.json` binding, or `null` when the prod
71
- * build has not run yet. See {@link readTargetsBinding}.
72
- */
73
- static detect(pkgName, raw, binding) {
74
- const pc = raw.publishConfig;
75
- const targets = pc?.targets;
76
- if (targets && typeof targets === "object" && !Array.isArray(targets) && Object.keys(targets).length > 0) {
77
- const access = pc?.access ?? "public";
78
- if (binding) {
79
- const dirByGroup = new Map(binding.groups.map((g) => [g.id, g.dir]));
80
- return binding.targets.map((t) => new require_publish.PublishTarget({
81
- name: t.name,
82
- registry: t.registry,
83
- directory: dirByGroup.get(t.group) ?? `dist/prod/${t.group}/pkg`,
84
- access,
85
- provenance: provenanceForRegistry(t.registry)
86
- }));
87
- }
88
- return Object.entries(targets).map(([id, target]) => {
89
- const registry = typeof target === "object" && target !== null && typeof target.registry === "string" ? target.registry : DEFAULT_REGISTRIES[id] ?? pc?.registry ?? NPM_DEFAULT;
90
- return new require_publish.PublishTarget({
91
- name: pkgName,
92
- registry,
93
- directory: `dist/prod/${id}/pkg`,
94
- access,
95
- provenance: provenanceForRegistry(registry)
96
- });
97
- });
98
- }
99
- if (pc && (pc.access === "public" || pc.access === "restricted")) {
100
- const registry = pc.registry ?? NPM_DEFAULT;
101
- return [new require_publish.PublishTarget({
102
- name: pkgName,
103
- registry,
104
- directory: pc.directory ?? ".",
105
- access: pc.access,
106
- provenance: provenanceForRegistry(registry)
107
- })];
108
- }
109
- if (raw.private !== true) {
110
- const registry = pc?.registry ?? NPM_DEFAULT;
111
- return [new require_publish.PublishTarget({
112
- name: pkgName,
113
- registry,
114
- directory: pc?.directory ?? ".",
115
- access: pc?.access ?? "public",
116
- provenance: provenanceForRegistry(registry)
117
- })];
118
- }
119
- return [];
120
- }
121
- /**
122
- * Resolve a package's publish targets via {@link SilkPublishability}, then drop any
123
- * whose built `directory` package.json is `private: true`. Returned targets keep the
124
- * detector's original (possibly package-relative) `directory`.
125
- */
126
- static resolveTargets(pkg, root) {
127
- return effect.Effect.gen(function* () {
128
- const detector = yield* require_PublishabilityDetector.PublishabilityDetector;
129
- const fs = yield* _effect_platform.FileSystem.FileSystem;
130
- const targets = yield* detector.detect(pkg, root);
131
- const kept = [];
132
- for (const t of targets) {
133
- const dir = (0, node_path.isAbsolute)(t.directory) ? t.directory : (0, node_path.join)(pkg.path, t.directory);
134
- if (!(yield* isTargetPrivate(fs, dir))) kept.push(t);
135
- }
136
- return kept;
137
- });
138
- }
139
- /**
140
- * The publishable, non-ignored packages, resolved through the single
141
- * {@link SilkPublishability} (which already honors changeset ignore in adaptive mode).
142
- */
143
- static listPublishable(root) {
144
- return effect.Effect.gen(function* () {
145
- const discovery = yield* require_WorkspaceDiscovery.WorkspaceDiscovery;
146
- const detector = yield* require_PublishabilityDetector.PublishabilityDetector;
147
- const packages = yield* discovery.listPackages().pipe(effect.Effect.orDie);
148
- const out = [];
149
- for (const pkg of packages) {
150
- const targets = yield* detector.detect(pkg, root);
151
- if (targets.length > 0) out.push({
152
- name: pkg.name,
153
- version: pkg.version,
154
- path: pkg.path,
155
- targetCount: targets.length
156
- });
157
- }
158
- return out;
159
- });
160
- }
161
- };
162
- /** True when a built target directory's package.json is `private: true`. Missing/unreadable/malformed → false. */
163
- const isTargetPrivate = (fs, targetDir) => fs.readFileString((0, node_path.join)(targetDir, "package.json")).pipe(effect.Effect.flatMap((content) => effect.Effect.try({
164
- try: () => JSON.parse(content).private === true,
165
- catch: () => /* @__PURE__ */ new Error("invalid package.json")
166
- })), effect.Effect.orElseSucceed(() => false));
167
- /** Read a raw `package.json` from disk via FileSystem; missing/unreadable/malformed → null. */
168
- const readRaw = (fs, packageJsonPath) => fs.readFileString(packageJsonPath).pipe(effect.Effect.flatMap((content) => effect.Effect.try({
169
- try: () => JSON.parse(content),
170
- catch: () => /* @__PURE__ */ new Error("invalid package.json")
171
- })), effect.Effect.orElseSucceed(() => null));
172
- /**
173
- * Read the bundler's `<pkgPath>/dist/prod/targets.json` binding via FileSystem.
174
- *
175
- * @remarks
176
- * Returns `null` when the file is missing/unreadable/malformed — i.e. before the prod build
177
- * has run. `SilkPublishability.detect` falls back to declared-key placeholders in that
178
- * case. Used by the silk {@link SilkPublishability} layers and the workspace analyzer.
179
- *
180
- * @param fs - The FileSystem service.
181
- * @param pkgPath - Absolute path to the package directory.
182
- * @since 1.0.0
183
- * @public
184
- */
185
- const readTargetsBinding = (fs, pkgPath) => fs.readFileString((0, node_path.join)(pkgPath, "dist", "prod", "targets.json")).pipe(effect.Effect.flatMap((content) => effect.Effect.try({
186
- try: () => JSON.parse(content),
187
- catch: () => /* @__PURE__ */ new Error("invalid targets.json")
188
- })), effect.Effect.orElseSucceed(() => null));
189
- /**
190
- * Override of `workspaces-effect`'s {@link SilkPublishability} Tag with pure silk rules.
191
- *
192
- * @remarks Requires `FileSystem` (captured at layer build); `detect` reads the raw
193
- * `package.json` from `pkg.packageJsonPath` and applies `SilkPublishability.detect`.
194
- *
195
- * @since 0.4.0
196
- * @public
197
- */
198
- const SilkPublishabilityDetectorLive = effect.Layer.effect(require_PublishabilityDetector.PublishabilityDetector, effect.Effect.gen(function* () {
199
- const fs = yield* _effect_platform.FileSystem.FileSystem;
200
- return { detect: (pkg, _root) => effect.Effect.gen(function* () {
201
- const raw = yield* readRaw(fs, pkg.packageJsonPath);
202
- if (!raw) return [];
203
- const binding = yield* readTargetsBinding(fs, pkg.path);
204
- return SilkPublishability.detect(pkg.name, raw, binding);
205
- }) };
206
- }));
207
- /**
208
- * Ignore-aware override of {@link SilkPublishability}. `detect` short-circuits to `[]`
209
- * for changeset-ignored packages, then dispatches on `ChangesetConfig.mode`:
210
- * `none` → `[]`; `silk` → `SilkPublishability.detect`; `vanilla` → the library default.
211
- *
212
- * @remarks Requires `FileSystem` + {@link ChangesetConfig} at build.
213
- *
214
- * @since 0.4.0
215
- * @public
216
- */
217
- const PublishabilityDetectorAdaptiveLive = effect.Layer.effect(require_PublishabilityDetector.PublishabilityDetector, effect.Effect.gen(function* () {
218
- const fs = yield* _effect_platform.FileSystem.FileSystem;
219
- const config = yield* require_ChangesetConfig.ChangesetConfig;
220
- const vanilla = yield* effect.Effect.provide(require_PublishabilityDetector.PublishabilityDetector, require_PublishabilityDetectorLive.PublishabilityDetectorLive);
221
- return { detect: (pkg, root) => effect.Effect.gen(function* () {
222
- if (yield* config.isIgnored(pkg.name, root)) return [];
223
- const mode = yield* config.mode(root);
224
- if (mode === "none") return [];
225
- if (mode === "silk") {
226
- const raw = yield* readRaw(fs, pkg.packageJsonPath);
227
- if (!raw) return [];
228
- const binding = yield* readTargetsBinding(fs, pkg.path);
229
- return SilkPublishability.detect(pkg.name, raw, binding);
230
- }
231
- return yield* vanilla.detect(pkg, root);
232
- }) };
233
- }));
234
-
235
- //#endregion
236
- exports.PublishabilityDetectorAdaptiveLive = PublishabilityDetectorAdaptiveLive;
237
- exports.SilkPublishability = SilkPublishability;
238
- exports.readTargetsBinding = readTargetsBinding;
@@ -1,236 +0,0 @@
1
- import { ChangesetConfig } from "./ChangesetConfig.js";
2
- import { WorkspaceDiscovery } from "../../../../../../node_modules/.pnpm/workspaces-effect@2.0.1_@effect_platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/WorkspaceDiscovery.js";
3
- import { PublishTarget } from "../../../../../../node_modules/.pnpm/workspaces-effect@2.0.1_@effect_platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/schemas/publish.js";
4
- import { PublishabilityDetector } from "../../../../../../node_modules/.pnpm/workspaces-effect@2.0.1_@effect_platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/services/PublishabilityDetector.js";
5
- import { PublishabilityDetectorLive } from "../../../../../../node_modules/.pnpm/workspaces-effect@2.0.1_@effect_platform@0.96.2_effect@3.21.4__effect@3.21.4/node_modules/workspaces-effect/layers/PublishabilityDetectorLive.js";
6
- import { Effect, Layer } from "effect";
7
- import { FileSystem } from "@effect/platform";
8
- import { isAbsolute, join } from "node:path";
9
-
10
- //#region ../silk-effects/dist/dev/pkg/services/SilkPublishability.js
11
- const NPM_DEFAULT = "https://registry.npmjs.org/";
12
- /**
13
- * Default registry endpoints for the well-known target keys. Kept in sync with the
14
- * bundler's `resolveTargets` so the pre-build fallback matches what the binding will carry
15
- * (no trailing slash).
16
- */
17
- const DEFAULT_REGISTRIES = {
18
- npm: "https://registry.npmjs.org",
19
- github: "https://npm.pkg.github.com"
20
- };
21
- /**
22
- * Whether a registry endpoint participates in npm-style SLSA provenance.
23
- *
24
- * @remarks
25
- * The npm public registry and GitHub Packages both accept provenance attestations through the
26
- * Sigstore/OIDC trusted-publishing flow, so a `PublishTarget` bound to either is marked
27
- * `provenance: true` by default — this is what gates the release action's attestation step. JSR
28
- * and custom registries do not participate and resolve to `false`. Matching is endpoint-based
29
- * (not target-key based) so a custom key pointed at one of these registries still opts in.
30
- */
31
- const provenanceForRegistry = (registry) => {
32
- const normalized = /^[a-z]+:\/\//i.test(registry) ? registry : `https://${registry}`;
33
- let hostname;
34
- try {
35
- hostname = new URL(normalized).hostname.toLowerCase();
36
- } catch {
37
- return false;
38
- }
39
- return hostname === "registry.npmjs.org" || hostname === "npm.pkg.github.com";
40
- };
41
- /**
42
- * Silk publishability rules over `workspaces-effect`'s `PublishTarget`.
43
- *
44
- * @remarks
45
- * In silk mode `private: true` is the norm on workspace `package.json`; publishability is
46
- * derived from `publishConfig`, with the `private` flag consulted only as a last-resort
47
- * default. All helpers are static so a consumer sees the full rule surface in one place.
48
- *
49
- * @since 0.4.0
50
- * @public
51
- */
52
- var SilkPublishability = class {
53
- /**
54
- * Apply silk publishability rules to a raw `package.json` and the bundler's resolved
55
- * target binding. Targets-first precedence:
56
- *
57
- * - A non-empty `publishConfig.targets` map (the bundler's Record-map form) makes the
58
- * package publishable regardless of `private`. With a `binding` (post-prod-build), one
59
- * `PublishTarget` is emitted per resolved registry target, its `directory` set to
60
- * the bound group's `dist/prod/<group>/pkg` dir. Without a binding (pre-build), one
61
- * placeholder target is emitted per declared key so publishability and target counts
62
- * are correct; the directory is best-effort and unused until the build writes the
63
- * binding.
64
- * - Else `publishConfig.access` → one target at `publishConfig.directory`.
65
- * - Else `private !== true` → one default public target.
66
- * - Else `[]`.
67
- *
68
- * @param pkgName - The package's name (the base name for `true`/empty-object targets).
69
- * @param raw - The raw `package.json` (silk reads the unschematized `publishConfig`).
70
- * @param binding - The parsed `dist/prod/targets.json` binding, or `null` when the prod
71
- * build has not run yet. See {@link readTargetsBinding}.
72
- */
73
- static detect(pkgName, raw, binding) {
74
- const pc = raw.publishConfig;
75
- const targets = pc?.targets;
76
- if (targets && typeof targets === "object" && !Array.isArray(targets) && Object.keys(targets).length > 0) {
77
- const access = pc?.access ?? "public";
78
- if (binding) {
79
- const dirByGroup = new Map(binding.groups.map((g) => [g.id, g.dir]));
80
- return binding.targets.map((t) => new PublishTarget({
81
- name: t.name,
82
- registry: t.registry,
83
- directory: dirByGroup.get(t.group) ?? `dist/prod/${t.group}/pkg`,
84
- access,
85
- provenance: provenanceForRegistry(t.registry)
86
- }));
87
- }
88
- return Object.entries(targets).map(([id, target]) => {
89
- const registry = typeof target === "object" && target !== null && typeof target.registry === "string" ? target.registry : DEFAULT_REGISTRIES[id] ?? pc?.registry ?? NPM_DEFAULT;
90
- return new PublishTarget({
91
- name: pkgName,
92
- registry,
93
- directory: `dist/prod/${id}/pkg`,
94
- access,
95
- provenance: provenanceForRegistry(registry)
96
- });
97
- });
98
- }
99
- if (pc && (pc.access === "public" || pc.access === "restricted")) {
100
- const registry = pc.registry ?? NPM_DEFAULT;
101
- return [new PublishTarget({
102
- name: pkgName,
103
- registry,
104
- directory: pc.directory ?? ".",
105
- access: pc.access,
106
- provenance: provenanceForRegistry(registry)
107
- })];
108
- }
109
- if (raw.private !== true) {
110
- const registry = pc?.registry ?? NPM_DEFAULT;
111
- return [new PublishTarget({
112
- name: pkgName,
113
- registry,
114
- directory: pc?.directory ?? ".",
115
- access: pc?.access ?? "public",
116
- provenance: provenanceForRegistry(registry)
117
- })];
118
- }
119
- return [];
120
- }
121
- /**
122
- * Resolve a package's publish targets via {@link SilkPublishability}, then drop any
123
- * whose built `directory` package.json is `private: true`. Returned targets keep the
124
- * detector's original (possibly package-relative) `directory`.
125
- */
126
- static resolveTargets(pkg, root) {
127
- return Effect.gen(function* () {
128
- const detector = yield* PublishabilityDetector;
129
- const fs = yield* FileSystem.FileSystem;
130
- const targets = yield* detector.detect(pkg, root);
131
- const kept = [];
132
- for (const t of targets) {
133
- const dir = isAbsolute(t.directory) ? t.directory : join(pkg.path, t.directory);
134
- if (!(yield* isTargetPrivate(fs, dir))) kept.push(t);
135
- }
136
- return kept;
137
- });
138
- }
139
- /**
140
- * The publishable, non-ignored packages, resolved through the single
141
- * {@link SilkPublishability} (which already honors changeset ignore in adaptive mode).
142
- */
143
- static listPublishable(root) {
144
- return Effect.gen(function* () {
145
- const discovery = yield* WorkspaceDiscovery;
146
- const detector = yield* PublishabilityDetector;
147
- const packages = yield* discovery.listPackages().pipe(Effect.orDie);
148
- const out = [];
149
- for (const pkg of packages) {
150
- const targets = yield* detector.detect(pkg, root);
151
- if (targets.length > 0) out.push({
152
- name: pkg.name,
153
- version: pkg.version,
154
- path: pkg.path,
155
- targetCount: targets.length
156
- });
157
- }
158
- return out;
159
- });
160
- }
161
- };
162
- /** True when a built target directory's package.json is `private: true`. Missing/unreadable/malformed → false. */
163
- const isTargetPrivate = (fs, targetDir) => fs.readFileString(join(targetDir, "package.json")).pipe(Effect.flatMap((content) => Effect.try({
164
- try: () => JSON.parse(content).private === true,
165
- catch: () => /* @__PURE__ */ new Error("invalid package.json")
166
- })), Effect.orElseSucceed(() => false));
167
- /** Read a raw `package.json` from disk via FileSystem; missing/unreadable/malformed → null. */
168
- const readRaw = (fs, packageJsonPath) => fs.readFileString(packageJsonPath).pipe(Effect.flatMap((content) => Effect.try({
169
- try: () => JSON.parse(content),
170
- catch: () => /* @__PURE__ */ new Error("invalid package.json")
171
- })), Effect.orElseSucceed(() => null));
172
- /**
173
- * Read the bundler's `<pkgPath>/dist/prod/targets.json` binding via FileSystem.
174
- *
175
- * @remarks
176
- * Returns `null` when the file is missing/unreadable/malformed — i.e. before the prod build
177
- * has run. `SilkPublishability.detect` falls back to declared-key placeholders in that
178
- * case. Used by the silk {@link SilkPublishability} layers and the workspace analyzer.
179
- *
180
- * @param fs - The FileSystem service.
181
- * @param pkgPath - Absolute path to the package directory.
182
- * @since 1.0.0
183
- * @public
184
- */
185
- const readTargetsBinding = (fs, pkgPath) => fs.readFileString(join(pkgPath, "dist", "prod", "targets.json")).pipe(Effect.flatMap((content) => Effect.try({
186
- try: () => JSON.parse(content),
187
- catch: () => /* @__PURE__ */ new Error("invalid targets.json")
188
- })), Effect.orElseSucceed(() => null));
189
- /**
190
- * Override of `workspaces-effect`'s {@link SilkPublishability} Tag with pure silk rules.
191
- *
192
- * @remarks Requires `FileSystem` (captured at layer build); `detect` reads the raw
193
- * `package.json` from `pkg.packageJsonPath` and applies `SilkPublishability.detect`.
194
- *
195
- * @since 0.4.0
196
- * @public
197
- */
198
- const SilkPublishabilityDetectorLive = Layer.effect(PublishabilityDetector, Effect.gen(function* () {
199
- const fs = yield* FileSystem.FileSystem;
200
- return { detect: (pkg, _root) => Effect.gen(function* () {
201
- const raw = yield* readRaw(fs, pkg.packageJsonPath);
202
- if (!raw) return [];
203
- const binding = yield* readTargetsBinding(fs, pkg.path);
204
- return SilkPublishability.detect(pkg.name, raw, binding);
205
- }) };
206
- }));
207
- /**
208
- * Ignore-aware override of {@link SilkPublishability}. `detect` short-circuits to `[]`
209
- * for changeset-ignored packages, then dispatches on `ChangesetConfig.mode`:
210
- * `none` → `[]`; `silk` → `SilkPublishability.detect`; `vanilla` → the library default.
211
- *
212
- * @remarks Requires `FileSystem` + {@link ChangesetConfig} at build.
213
- *
214
- * @since 0.4.0
215
- * @public
216
- */
217
- const PublishabilityDetectorAdaptiveLive = Layer.effect(PublishabilityDetector, Effect.gen(function* () {
218
- const fs = yield* FileSystem.FileSystem;
219
- const config = yield* ChangesetConfig;
220
- const vanilla = yield* Effect.provide(PublishabilityDetector, PublishabilityDetectorLive);
221
- return { detect: (pkg, root) => Effect.gen(function* () {
222
- if (yield* config.isIgnored(pkg.name, root)) return [];
223
- const mode = yield* config.mode(root);
224
- if (mode === "none") return [];
225
- if (mode === "silk") {
226
- const raw = yield* readRaw(fs, pkg.packageJsonPath);
227
- if (!raw) return [];
228
- const binding = yield* readTargetsBinding(fs, pkg.path);
229
- return SilkPublishability.detect(pkg.name, raw, binding);
230
- }
231
- return yield* vanilla.detect(pkg, root);
232
- }) };
233
- }));
234
-
235
- //#endregion
236
- export { PublishabilityDetectorAdaptiveLive, SilkPublishability, readTargetsBinding };