@savvy-web/silk-effects 1.6.0 → 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.
- package/changesets/errors.js +44 -1
- package/changesets/index.js +8 -11
- package/changesets/services/deps-regen.js +152 -113
- package/changesets/services/release-planner.js +105 -81
- package/changesets/utils/dep-diff.js +81 -47
- package/changesets/utils/git.js +51 -0
- package/changesets/utils/publishability.js +14 -2
- package/index.d.ts +157 -141
- package/package.json +2 -2
- package/changesets/services/workspace-snapshot.js +0 -181
- package/changesets/utils/worktree-snapshot.js +0 -142
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Data, Effect, Equal, Hash, Layer, Option, Schema, Stream } from "effect";
|
|
2
|
-
import { Command, CommandExecutor, FileSystem } from "@effect/platform";
|
|
3
|
-
import {
|
|
2
|
+
import { Command, CommandExecutor, FileSystem, Path } from "@effect/platform";
|
|
3
|
+
import { PackageManagerDetector, PointInTimeReadError, PointInTimeWorkspace, PublishConfig, PublishTarget, PublishabilityDetector, TopologicalSorter, WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspacePackage, WorkspaceRoot, WorkspaceStateSnapshot } from "workspaces-effect";
|
|
4
4
|
import { Plugin } from "unified";
|
|
5
5
|
import { PlatformError } from "@effect/platform/Error";
|
|
6
6
|
|
|
@@ -2506,6 +2506,53 @@ declare class GitError extends GitErrorBase<{
|
|
|
2506
2506
|
}> {
|
|
2507
2507
|
get message(): string;
|
|
2508
2508
|
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Base class for {@link ChangesetIOError}.
|
|
2511
|
+
*
|
|
2512
|
+
* @privateRemarks
|
|
2513
|
+
* Effect's `Data.TaggedError` creates an anonymous base class that
|
|
2514
|
+
* api-extractor cannot follow without an explicit export.
|
|
2515
|
+
*
|
|
2516
|
+
* @internal
|
|
2517
|
+
*/
|
|
2518
|
+
declare const ChangesetIOErrorBase: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
2519
|
+
readonly _tag: "ChangesetIOError";
|
|
2520
|
+
} & Readonly<A>;
|
|
2521
|
+
/**
|
|
2522
|
+
* Changeset file I/O failure.
|
|
2523
|
+
*
|
|
2524
|
+
* @remarks
|
|
2525
|
+
* Raised by {@link DepsRegen} when reading, writing, listing, or deleting
|
|
2526
|
+
* `.changeset/*.md` files fails. Deletion failures during
|
|
2527
|
+
* {@link DepsRegenShape.execute} are tolerated (stale changesets are
|
|
2528
|
+
* skip-and-continue, so an interrupted run stays safely re-runnable);
|
|
2529
|
+
* read, list, and write failures are loud.
|
|
2530
|
+
*
|
|
2531
|
+
* @example
|
|
2532
|
+
* ```typescript
|
|
2533
|
+
* import { Effect } from "effect";
|
|
2534
|
+
* import { ChangesetIOError } from "@savvy-web/changesets";
|
|
2535
|
+
*
|
|
2536
|
+
* declare const program: Effect.Effect<void, ChangesetIOError>;
|
|
2537
|
+
*
|
|
2538
|
+
* const handled = program.pipe(
|
|
2539
|
+
* Effect.catchTag("ChangesetIOError", (err) =>
|
|
2540
|
+
* Effect.logError(`changeset ${err.operation} failed at ${err.path}: ${err.reason}`)
|
|
2541
|
+
* ),
|
|
2542
|
+
* );
|
|
2543
|
+
* ```
|
|
2544
|
+
*
|
|
2545
|
+
* @see {@link DepsRegen} which produces these errors during plan/execute
|
|
2546
|
+
*
|
|
2547
|
+
* @public
|
|
2548
|
+
*/
|
|
2549
|
+
declare class ChangesetIOError extends ChangesetIOErrorBase<{
|
|
2550
|
+
/** Absolute path of the file or directory the operation targeted. */readonly path: string; /** The failed operation. */
|
|
2551
|
+
readonly operation: "read" | "write" | "delete" | "list"; /** Human-readable failure reason. */
|
|
2552
|
+
readonly reason: string;
|
|
2553
|
+
}> {
|
|
2554
|
+
get message(): string;
|
|
2555
|
+
}
|
|
2509
2556
|
/**
|
|
2510
2557
|
* Base class for {@link ReleasePlanError}.
|
|
2511
2558
|
*
|
|
@@ -3492,60 +3539,50 @@ declare const ChangelogServiceBase: Context.TagClass<ChangelogService, "Changelo
|
|
|
3492
3539
|
*/
|
|
3493
3540
|
declare class ChangelogService extends ChangelogServiceBase {}
|
|
3494
3541
|
//#endregion
|
|
3495
|
-
//#region src/
|
|
3542
|
+
//#region src/services/ChangesetConfig.d.ts
|
|
3496
3543
|
/**
|
|
3497
|
-
*
|
|
3498
|
-
*
|
|
3544
|
+
* Changeset operating mode for a workspace root.
|
|
3499
3545
|
* @public
|
|
3500
3546
|
*/
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
readonly
|
|
3504
|
-
|
|
3505
|
-
readonly
|
|
3506
|
-
|
|
3507
|
-
readonly
|
|
3508
|
-
|
|
3509
|
-
readonly dependencies: Readonly<Record<string, string>>;
|
|
3510
|
-
/** Declared `devDependencies`. */
|
|
3511
|
-
readonly devDependencies: Readonly<Record<string, string>>;
|
|
3512
|
-
/** Declared `peerDependencies`. */
|
|
3513
|
-
readonly peerDependencies: Readonly<Record<string, string>>;
|
|
3514
|
-
/** Declared `optionalDependencies`. */
|
|
3515
|
-
readonly optionalDependencies: Readonly<Record<string, string>>;
|
|
3516
|
-
}
|
|
3547
|
+
type ChangesetMode = "silk" | "vanilla" | "none";
|
|
3548
|
+
declare const ChangesetConfig_base: Context.TagClass<ChangesetConfig, "@savvy-web/silk-effects/ChangesetConfig", {
|
|
3549
|
+
readonly mode: (root: string) => Effect.Effect<ChangesetMode>;
|
|
3550
|
+
readonly versionPrivate: (root: string) => Effect.Effect<boolean>;
|
|
3551
|
+
readonly ignorePatterns: (root: string) => Effect.Effect<ReadonlyArray<string>>;
|
|
3552
|
+
readonly isIgnored: (name: string, root: string) => Effect.Effect<boolean>;
|
|
3553
|
+
readonly fixed: (root: string) => Effect.Effect<ReadonlyArray<ReadonlyArray<string>>>;
|
|
3554
|
+
}>;
|
|
3517
3555
|
/**
|
|
3518
|
-
*
|
|
3556
|
+
* Accessor service over a workspace root's `.changeset/config.json`.
|
|
3519
3557
|
*
|
|
3558
|
+
* @remarks
|
|
3559
|
+
* Reads through {@link ChangesetConfigReader} (FileSystem-based) with a per-root cache.
|
|
3560
|
+
* Every accessor is total (error channel `never`): a missing or unreadable config collapses
|
|
3561
|
+
* to `mode: "none"` and empty/false defaults.
|
|
3562
|
+
*
|
|
3563
|
+
* @since 0.4.0
|
|
3520
3564
|
* @public
|
|
3521
3565
|
*/
|
|
3522
|
-
|
|
3566
|
+
declare class ChangesetConfig extends ChangesetConfig_base {
|
|
3523
3567
|
/**
|
|
3524
|
-
*
|
|
3568
|
+
* The one ignore matcher: exact name match, or `@scope/*` wildcard.
|
|
3525
3569
|
*
|
|
3526
|
-
* @
|
|
3527
|
-
*
|
|
3528
|
-
* @returns Effect resolving to one {@link WorkspaceSnapshot} per workspace
|
|
3529
|
-
* package present at that ref, or failing with {@link GitError}
|
|
3570
|
+
* `"@scope/*"` matches `"@scope/anything"` (prefix kept includes the trailing slash),
|
|
3571
|
+
* but not the bare scope `"@scope"`.
|
|
3530
3572
|
*/
|
|
3531
|
-
|
|
3573
|
+
static matches(name: string, pattern: string): boolean;
|
|
3532
3574
|
}
|
|
3533
3575
|
/**
|
|
3534
|
-
* @
|
|
3535
|
-
*/
|
|
3536
|
-
declare const WorkspaceSnapshotReaderBase: Context.TagClass<WorkspaceSnapshotReader, "WorkspaceSnapshotReader", WorkspaceSnapshotReaderShape>;
|
|
3537
|
-
/**
|
|
3538
|
-
* Effect service tag for {@link WorkspaceSnapshotReaderShape}.
|
|
3576
|
+
* Live {@link ChangesetConfig} reading via {@link ChangesetConfigReader}, cached per root.
|
|
3539
3577
|
*
|
|
3540
|
-
* @
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
/**
|
|
3544
|
-
* Production layer for {@link WorkspaceSnapshotReader}.
|
|
3578
|
+
* @remarks
|
|
3579
|
+
* Requires `ChangesetConfigReader` (which requires `FileSystem`). Provide
|
|
3580
|
+
* `ChangesetConfigReaderLive` + a platform layer (`NodeContext.layer`).
|
|
3545
3581
|
*
|
|
3582
|
+
* @since 0.4.0
|
|
3546
3583
|
* @public
|
|
3547
3584
|
*/
|
|
3548
|
-
declare const
|
|
3585
|
+
declare const ChangesetConfigLive: Layer.Layer<ChangesetConfig, never, ChangesetConfigReader>;
|
|
3549
3586
|
//#endregion
|
|
3550
3587
|
//#region src/changesets/utils/dep-diff.d.ts
|
|
3551
3588
|
/**
|
|
@@ -3556,39 +3593,27 @@ declare const WorkspaceSnapshotReaderLive: Layer.Layer<WorkspaceSnapshotReader>;
|
|
|
3556
3593
|
interface WorkspaceDependencyDiff {
|
|
3557
3594
|
/** The workspace package whose `package.json` changed. */
|
|
3558
3595
|
readonly package: string;
|
|
3559
|
-
/** Repo-relative path of the package directory (taken from the `after` snapshot
|
|
3596
|
+
/** Repo-relative path of the package directory (taken from the `after` snapshot). */
|
|
3560
3597
|
readonly relativePath: string;
|
|
3561
3598
|
/** One row per dependency change, sorted by the existing `sortDependencyRows` convention. */
|
|
3562
3599
|
readonly rows: ReadonlyArray<DependencyTableRow>;
|
|
3563
3600
|
}
|
|
3564
3601
|
/**
|
|
3565
|
-
* Diff two workspace snapshots and return per-package dependency-table rows
|
|
3602
|
+
* Diff two workspace snapshots and return per-package dependency-table rows,
|
|
3603
|
+
* comparing already-resolved specifier values per side.
|
|
3566
3604
|
*
|
|
3567
|
-
* @param before - Snapshot at the older ref (typically the merge base).
|
|
3568
|
-
*
|
|
3569
|
-
* declared dep is then reported as `"added"`.
|
|
3605
|
+
* @param before - Snapshot at the older ref (typically the merge base). A
|
|
3606
|
+
* workspace package absent here reports every declared dep as `"added"`.
|
|
3570
3607
|
* @param after - Snapshot at the newer ref (typically the working tree).
|
|
3571
3608
|
* @returns One {@link WorkspaceDependencyDiff} entry per workspace package
|
|
3572
|
-
* that has at least one row. Packages with no changes are
|
|
3609
|
+
* that has at least one row. Packages with no resolved-value changes are
|
|
3610
|
+
* omitted.
|
|
3573
3611
|
*
|
|
3574
3612
|
* @public
|
|
3575
3613
|
*/
|
|
3576
|
-
declare function computeWorkspaceDependencyDiffs(
|
|
3614
|
+
declare function computeWorkspaceDependencyDiffs(before: WorkspaceStateSnapshot, after: WorkspaceStateSnapshot): ReadonlyArray<WorkspaceDependencyDiff>;
|
|
3577
3615
|
//#endregion
|
|
3578
3616
|
//#region src/changesets/services/deps-regen.d.ts
|
|
3579
|
-
/**
|
|
3580
|
-
* Resolve protocol From/To cells to concrete versions (raw-string fallback
|
|
3581
|
-
* when unresolved or on resolver error), leave em-dash sentinels untouched,
|
|
3582
|
-
* then optionally drop `devDependency` rows, and re-sort.
|
|
3583
|
-
*
|
|
3584
|
-
* @param diff - One workspace package's dependency-table rows.
|
|
3585
|
-
* @param keepDevDeps - When `true`, retain `devDependency` rows; otherwise
|
|
3586
|
-
* drop them unconditionally (the regen default).
|
|
3587
|
-
* @returns An Effect yielding the transformed {@link WorkspaceDependencyDiff}.
|
|
3588
|
-
*
|
|
3589
|
-
* @public
|
|
3590
|
-
*/
|
|
3591
|
-
declare const resolveDiffRows: (diff: WorkspaceDependencyDiff, keepDevDeps?: boolean) => Effect.Effect<WorkspaceDependencyDiff, never, CatalogResolver>;
|
|
3592
3617
|
/**
|
|
3593
3618
|
* Strict detection of "pure dependency changesets" per the documented
|
|
3594
3619
|
* rules: single-package frontmatter, single `## Dependencies` heading,
|
|
@@ -3659,7 +3684,7 @@ interface DepsRegenOptions {
|
|
|
3659
3684
|
readonly from?: string;
|
|
3660
3685
|
/**
|
|
3661
3686
|
* Newer ref to diff to. Defaults to the working tree (staged + unstaged
|
|
3662
|
-
* + untracked) via
|
|
3687
|
+
* + untracked) via `PointInTimeWorkspace.worktree`.
|
|
3663
3688
|
*/
|
|
3664
3689
|
readonly to?: string;
|
|
3665
3690
|
}
|
|
@@ -3670,19 +3695,27 @@ interface DepsRegenOptions {
|
|
|
3670
3695
|
*/
|
|
3671
3696
|
interface DepsRegenShape {
|
|
3672
3697
|
/**
|
|
3673
|
-
* Compute a complete {@link RegenPlan}
|
|
3698
|
+
* Compute a complete {@link RegenPlan}. Read-only against the filesystem:
|
|
3699
|
+
* only inspects the existing `.changeset/*.md` files to detect
|
|
3700
|
+
* stale/mixed changesets.
|
|
3674
3701
|
*
|
|
3675
3702
|
* @param options - See {@link DepsRegenOptions}.
|
|
3676
|
-
* @returns An Effect yielding the plan, or failing with {@link GitError}
|
|
3703
|
+
* @returns An Effect yielding the plan, or failing with {@link GitError},
|
|
3704
|
+
* `WorkspaceDiscoveryError`, {@link ChangesetIOError} (an unreadable
|
|
3705
|
+
* `.changeset` directory or a genuinely unreadable changeset file list),
|
|
3706
|
+
* or `PointInTimeReadError` (a snapshot read failed for either ref).
|
|
3677
3707
|
*/
|
|
3678
|
-
readonly plan: (options: DepsRegenOptions) => Effect.Effect<RegenPlan, GitError | WorkspaceDiscoveryError, never>;
|
|
3708
|
+
readonly plan: (options: DepsRegenOptions) => Effect.Effect<RegenPlan, GitError | WorkspaceDiscoveryError | ChangesetIOError | PointInTimeReadError, never>;
|
|
3679
3709
|
/**
|
|
3680
|
-
* Apply a {@link RegenPlan}:
|
|
3710
|
+
* Apply a {@link RegenPlan}: write fresh changesets first, then delete
|
|
3711
|
+
* stale ones. Writes fail loudly with {@link ChangesetIOError}; deletion
|
|
3712
|
+
* failures are tolerated (skip-and-continue) so an interrupted run stays
|
|
3713
|
+
* safely re-runnable.
|
|
3681
3714
|
*
|
|
3682
3715
|
* @param plan - The plan produced by {@link DepsRegenShape.plan}.
|
|
3683
3716
|
* @returns An Effect yielding a {@link RegenResult}.
|
|
3684
3717
|
*/
|
|
3685
|
-
readonly execute: (plan: RegenPlan) => Effect.Effect<RegenResult,
|
|
3718
|
+
readonly execute: (plan: RegenPlan) => Effect.Effect<RegenResult, ChangesetIOError, never>;
|
|
3686
3719
|
}
|
|
3687
3720
|
/**
|
|
3688
3721
|
* @internal
|
|
@@ -3709,13 +3742,42 @@ declare class DepsRegen extends DepsRegenBase {}
|
|
|
3709
3742
|
/**
|
|
3710
3743
|
* Live layer for {@link DepsRegen}.
|
|
3711
3744
|
*
|
|
3712
|
-
* Requires
|
|
3713
|
-
* `
|
|
3714
|
-
*
|
|
3745
|
+
* Requires `PointInTimeWorkspace`, `WorkspaceDiscovery`,
|
|
3746
|
+
* `PublishabilityDetector` (all from `workspaces-effect`),
|
|
3747
|
+
* {@link ConfigInspector}, {@link ChangesetConfig}, and
|
|
3748
|
+
* `FileSystem.FileSystem` (resolved once at construction and closed over by
|
|
3749
|
+
* the shape, keeping `plan`/`execute` themselves requirement-free).
|
|
3715
3750
|
*
|
|
3716
3751
|
* @public
|
|
3717
3752
|
*/
|
|
3718
|
-
declare const DepsRegenLive: Layer.Layer<DepsRegen, never,
|
|
3753
|
+
declare const DepsRegenLive: Layer.Layer<DepsRegen, never, PointInTimeWorkspace | ConfigInspector | WorkspaceDiscovery | PublishabilityDetector | ChangesetConfig | FileSystem.FileSystem>;
|
|
3754
|
+
/**
|
|
3755
|
+
* Batteries-included {@link DepsRegen} layer: silk's opinionated default
|
|
3756
|
+
* composition of the full dependency graph. Only the platform services
|
|
3757
|
+
* remain — note that {@link PointInTimeWorkspace} reads git history, so
|
|
3758
|
+
* this layer genuinely requires `CommandExecutor` in addition to
|
|
3759
|
+
* `FileSystem`/`Path`: provide a git-capable platform layer
|
|
3760
|
+
* (`NodeContext.layer`), not a bare filesystem-only layer.
|
|
3761
|
+
*
|
|
3762
|
+
* Gating uses silk's adaptive publishability detector
|
|
3763
|
+
* ({@link PublishabilityDetectorAdaptiveLive}), so the default semantics
|
|
3764
|
+
* are "versionable minus ignored" — identical to the savvy CLI and MCP
|
|
3765
|
+
* runtimes. Consumers who need to swap any dependency (test detectors,
|
|
3766
|
+
* alternate config sources) should keep composing {@link DepsRegenLive}
|
|
3767
|
+
* directly; this layer is purely additive.
|
|
3768
|
+
*
|
|
3769
|
+
* @example
|
|
3770
|
+
* ```typescript
|
|
3771
|
+
* import { NodeContext } from "@effect/platform-node";
|
|
3772
|
+
* import { Layer } from "effect";
|
|
3773
|
+
* import { Changesets } from "@savvy-web/silk-effects";
|
|
3774
|
+
*
|
|
3775
|
+
* const depsRegen = Changesets.DepsRegenDefault.pipe(Layer.provide(NodeContext.layer));
|
|
3776
|
+
* ```
|
|
3777
|
+
*
|
|
3778
|
+
* @public
|
|
3779
|
+
*/
|
|
3780
|
+
declare const DepsRegenDefault: Layer.Layer<DepsRegen, never, FileSystem.FileSystem | Path.Path | CommandExecutor.CommandExecutor>;
|
|
3719
3781
|
//#endregion
|
|
3720
3782
|
//#region src/changesets/schemas/release-plan.d.ts
|
|
3721
3783
|
/** A semantic-version bump level (the `"none"` plan type is filtered out upstream). @public */
|
|
@@ -3817,8 +3879,8 @@ interface ReleasePlannerShape {
|
|
|
3817
3879
|
declare const ReleasePlannerBase: Context.TagClass<ReleasePlanner, "ReleasePlanner", ReleasePlannerShape>;
|
|
3818
3880
|
/** Effect service tag for the release planner. @public */
|
|
3819
3881
|
declare class ReleasePlanner extends ReleasePlannerBase {}
|
|
3820
|
-
/** Production layer. Requires {@link ConfigInspector} (used by `apply`)
|
|
3821
|
-
declare const ReleasePlannerLive: Layer.Layer<ReleasePlanner, never, ConfigInspector>;
|
|
3882
|
+
/** Production layer. Requires {@link ConfigInspector} (used by `apply`) and `FileSystem`. @public */
|
|
3883
|
+
declare const ReleasePlannerLive: Layer.Layer<ReleasePlanner, never, ConfigInspector | FileSystem.FileSystem>;
|
|
3822
3884
|
/**
|
|
3823
3885
|
* Test factory — supply fixed results for any subset of methods. Unsupplied
|
|
3824
3886
|
* methods fail with a `ReleasePlanError`.
|
|
@@ -4500,6 +4562,15 @@ declare const LegacyVersionFilesSchema: Schema.Array$<Schema.Struct<{
|
|
|
4500
4562
|
*/
|
|
4501
4563
|
declare function serializeDependencyTableToMarkdown(rows: DependencyTableRow[]): string;
|
|
4502
4564
|
//#endregion
|
|
4565
|
+
//#region src/changesets/utils/git.d.ts
|
|
4566
|
+
/**
|
|
4567
|
+
* Run `git merge-base <base> HEAD`, returning the SHA. Errors propagate
|
|
4568
|
+
* as {@link GitError}.
|
|
4569
|
+
*
|
|
4570
|
+
* @internal
|
|
4571
|
+
*/
|
|
4572
|
+
declare function gitMergeBase(cwd: string, base: string): Effect.Effect<string, GitError>;
|
|
4573
|
+
//#endregion
|
|
4503
4574
|
//#region src/changesets/utils/publishability.d.ts
|
|
4504
4575
|
/**
|
|
4505
4576
|
* Compute the set of currently-publishable workspace package names.
|
|
@@ -4508,12 +4579,24 @@ declare function serializeDependencyTableToMarkdown(rows: DependencyTableRow[]):
|
|
|
4508
4579
|
* Uses the currently-active {@link SilkPublishability} — wire the
|
|
4509
4580
|
* {@link SilkPublishabilityDetectorLive} layer to get silk semantics.
|
|
4510
4581
|
*
|
|
4582
|
+
* `root` is passed through verbatim to `detector.detect(pkg, root)` for every
|
|
4583
|
+
* package — it must be the project root (the directory containing
|
|
4584
|
+
* `.changeset/`), NOT the individual package's directory. The vanilla
|
|
4585
|
+
* `PublishabilityDetectorLive` and plain `SilkPublishabilityDetectorLive`
|
|
4586
|
+
* both ignore this argument, but the ignore/mode-aware
|
|
4587
|
+
* `PublishabilityDetectorAdaptiveLive` reads `.changeset/config.json`
|
|
4588
|
+
* relative to it, so passing a package subdirectory silently makes every
|
|
4589
|
+
* package resolve to "not publishable". Mirrors
|
|
4590
|
+
* {@link SilkPublishability.listPublishable}, which takes the same
|
|
4591
|
+
* single-root parameter for the same reason.
|
|
4592
|
+
*
|
|
4511
4593
|
* @param packages - The workspace packages to evaluate
|
|
4594
|
+
* @param root - Absolute path to the project root containing `.changeset/`
|
|
4512
4595
|
* @returns An Effect yielding a `Set` of publishable package names
|
|
4513
4596
|
*
|
|
4514
4597
|
* @public
|
|
4515
4598
|
*/
|
|
4516
|
-
declare function listPublishablePackageNames(packages: ReadonlyArray<WorkspacePackage
|
|
4599
|
+
declare function listPublishablePackageNames(packages: ReadonlyArray<WorkspacePackage>, root: string): Effect.Effect<ReadonlySet<string>, never, PublishabilityDetector>;
|
|
4517
4600
|
//#endregion
|
|
4518
4601
|
//#region src/changesets/utils/version-files.d.ts
|
|
4519
4602
|
/**
|
|
@@ -4720,28 +4803,6 @@ declare class VersionFiles {
|
|
|
4720
4803
|
static processResolvedVersionFiles(scopes: ReadonlyArray<ResolvedPackageScope>, dryRun?: boolean): VersionFileUpdate[];
|
|
4721
4804
|
}
|
|
4722
4805
|
//#endregion
|
|
4723
|
-
//#region src/changesets/utils/worktree-snapshot.d.ts
|
|
4724
|
-
/**
|
|
4725
|
-
* Run `git merge-base <base> HEAD`, returning the SHA. Errors propagate
|
|
4726
|
-
* as {@link GitError}.
|
|
4727
|
-
*
|
|
4728
|
-
* @internal
|
|
4729
|
-
*/
|
|
4730
|
-
declare function gitMergeBase(cwd: string, base: string): Effect.Effect<string, GitError>;
|
|
4731
|
-
/**
|
|
4732
|
-
* Read every workspace package's `package.json` from the live working
|
|
4733
|
-
* tree, returning {@link WorkspaceSnapshot} entries matching the shape
|
|
4734
|
-
* `WorkspaceSnapshotReader.snapshotAt` produces for git refs.
|
|
4735
|
-
*
|
|
4736
|
-
* @remarks
|
|
4737
|
-
* Falls back to root-only when `pnpm-workspace.yaml` is missing or
|
|
4738
|
-
* unparseable. Uses `node:fs.readdirSync` for directory expansion
|
|
4739
|
-
* (portable across platforms — `execFileSync("ls")` is not).
|
|
4740
|
-
*
|
|
4741
|
-
* @internal
|
|
4742
|
-
*/
|
|
4743
|
-
declare function snapshotFromWorktree(cwd: string): ReadonlyArray<WorkspaceSnapshot>;
|
|
4744
|
-
//#endregion
|
|
4745
4806
|
//#region ../../node_modules/.pnpm/micromark-util-types@2.0.2/node_modules/micromark-util-types/index.d.ts
|
|
4746
4807
|
/**
|
|
4747
4808
|
* Enum of allowed token types.
|
|
@@ -5416,7 +5477,7 @@ declare const RequiredSectionsRule: import("unified-lint-rule").Plugin<Root, unk
|
|
|
5416
5477
|
//#region src/changesets/remark/rules/uncategorized-content.d.ts
|
|
5417
5478
|
declare const UncategorizedContentRule: import("unified-lint-rule").Plugin<Root, unknown>;
|
|
5418
5479
|
declare namespace index_d_exports {
|
|
5419
|
-
export { AggregateDependencyTablesPlugin, AppliedRelease, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysis, BranchAnalysisSchema, BranchAnalyzer, BranchAnalyzerBase, BranchAnalyzerLive, BranchAnalyzerShape, BranchFileEntry, BranchFileEntrySchema, BumpType, BumpTypeSchema, Categories, Changelog, ChangelogService, ChangelogServiceBase, ChangelogServiceShape, ChangelogTransformer, Changeset, ChangesetLinter, ChangesetOptions, ChangesetOptionsSchema, ChangesetPreview, ChangesetPreviewSchema, ChangesetSchema, ChangesetSummarySchema, ChangesetValidationError, ChangesetValidationErrorBase, Classification, ClassificationReason, ClassificationReasonSchema, ClassificationSchema, CommitHashSchema, ConfigInspector, ConfigInspectorBase, ConfigInspectorLive, ConfigInspectorShape, ConfigurationError, ConfigurationErrorBase, ContentStructureRule, ContributorFootnotesPlugin, DeduplicateItemsPlugin, DependencyAction, DependencyActionSchema, DependencyTable, DependencyTableFormatRule, DependencyTableRow, DependencyTableRowSchema, DependencyTableSchema, DependencyTableType, DependencyTableTypeSchema, DependencyType, DependencyTypeSchema, DependencyUpdate, DependencyUpdateSchema, DepsRegen, DepsRegenBase, DepsRegenLive, DepsRegenOptions, DepsRegenShape, FileStatus, FileStatusSchema, GitError, GitErrorBase, GitHubApiError, GitHubApiErrorBase, GitHubCommitInfo, GitHubInfo, GitHubInfoSchema, GitHubLive, GitHubService, GitHubServiceBase, GitHubServiceShape, GlobSchema, HeadingHierarchyRule, InspectedConfig, InspectedConfigSchema, IssueLinkRefsPlugin, IssueNumberSchema, JsonPathSchema, LegacyVersionFileConfig, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, LintMessage, MarkdownLive, MarkdownParseError, MarkdownParseErrorBase, MarkdownService, MarkdownServiceBase, MarkdownServiceShape, ContentStructureRule$1 as MarkdownlintContentStructureRule, DependencyTableFormatRule$1 as MarkdownlintDependencyTableFormatRule, HeadingHierarchyRule$1 as MarkdownlintHeadingHierarchyRule, RequiredSectionsRule$1 as MarkdownlintRequiredSectionsRule, UncategorizedContentRule$1 as MarkdownlintUncategorizedContentRule, MergeSectionsPlugin, NonEmptyString, NormalizeFormatPlugin, PackageScope, PackageScopeSchema, PackagesRecordSchema, PendingChangeset, PendingChangesetSchema, PositiveInteger, PreviewRelease, PreviewReleaseSchema, RegenPlan, RegenResult, ReleasePlanError, ReleasePlanErrorBase, ReleasePlanner, ReleasePlannerBase, ReleasePlannerLive, ReleasePlannerShape, ReorderSectionsPlugin, RepoSchema, RequiredSectionsRule, ResolvedPackageScope, ResolvedPackageScopeSchema, ResolvedVersionFile, ResolvedVersionFileSchema, SectionCategory, SectionCategorySchema, SilkChangesetPreset, SilkChangesetTransformPreset, SilkChangesetsRules, UncategorizedContentRule, UrlOrMarkdownLinkSchema, UsernameSchema, VERSION_RE, VersionFileConfig, VersionFileConfigSchema, VersionFileError, VersionFileErrorBase, VersionFileUpdate, VersionFileUpdateRecordSchema, VersionFiles, VersionFilesSchema, VersionOrEmptySchema, VersionType, VersionTypeSchema, WorkspaceDependencyDiff,
|
|
5480
|
+
export { AggregateDependencyTablesPlugin, AppliedRelease, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysis, BranchAnalysisSchema, BranchAnalyzer, BranchAnalyzerBase, BranchAnalyzerLive, BranchAnalyzerShape, BranchFileEntry, BranchFileEntrySchema, BumpType, BumpTypeSchema, Categories, Changelog, ChangelogService, ChangelogServiceBase, ChangelogServiceShape, ChangelogTransformer, Changeset, ChangesetIOError, ChangesetIOErrorBase, ChangesetLinter, ChangesetOptions, ChangesetOptionsSchema, ChangesetPreview, ChangesetPreviewSchema, ChangesetSchema, ChangesetSummarySchema, ChangesetValidationError, ChangesetValidationErrorBase, Classification, ClassificationReason, ClassificationReasonSchema, ClassificationSchema, CommitHashSchema, ConfigInspector, ConfigInspectorBase, ConfigInspectorLive, ConfigInspectorShape, ConfigurationError, ConfigurationErrorBase, ContentStructureRule, ContributorFootnotesPlugin, DeduplicateItemsPlugin, DependencyAction, DependencyActionSchema, DependencyTable, DependencyTableFormatRule, DependencyTableRow, DependencyTableRowSchema, DependencyTableSchema, DependencyTableType, DependencyTableTypeSchema, DependencyType, DependencyTypeSchema, DependencyUpdate, DependencyUpdateSchema, DepsRegen, DepsRegenBase, DepsRegenDefault, DepsRegenLive, DepsRegenOptions, DepsRegenShape, FileStatus, FileStatusSchema, GitError, GitErrorBase, GitHubApiError, GitHubApiErrorBase, GitHubCommitInfo, GitHubInfo, GitHubInfoSchema, GitHubLive, GitHubService, GitHubServiceBase, GitHubServiceShape, GlobSchema, HeadingHierarchyRule, InspectedConfig, InspectedConfigSchema, IssueLinkRefsPlugin, IssueNumberSchema, JsonPathSchema, LegacyVersionFileConfig, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, LintMessage, MarkdownLive, MarkdownParseError, MarkdownParseErrorBase, MarkdownService, MarkdownServiceBase, MarkdownServiceShape, ContentStructureRule$1 as MarkdownlintContentStructureRule, DependencyTableFormatRule$1 as MarkdownlintDependencyTableFormatRule, HeadingHierarchyRule$1 as MarkdownlintHeadingHierarchyRule, RequiredSectionsRule$1 as MarkdownlintRequiredSectionsRule, UncategorizedContentRule$1 as MarkdownlintUncategorizedContentRule, MergeSectionsPlugin, NonEmptyString, NormalizeFormatPlugin, PackageScope, PackageScopeSchema, PackagesRecordSchema, PendingChangeset, PendingChangesetSchema, PositiveInteger, PreviewRelease, PreviewReleaseSchema, RegenPlan, RegenResult, ReleasePlanError, ReleasePlanErrorBase, ReleasePlanner, ReleasePlannerBase, ReleasePlannerLive, ReleasePlannerShape, ReorderSectionsPlugin, RepoSchema, RequiredSectionsRule, ResolvedPackageScope, ResolvedPackageScopeSchema, ResolvedVersionFile, ResolvedVersionFileSchema, SectionCategory, SectionCategorySchema, SilkChangesetPreset, SilkChangesetTransformPreset, SilkChangesetsRules, UncategorizedContentRule, UrlOrMarkdownLinkSchema, UsernameSchema, VERSION_RE, VersionFileConfig, VersionFileConfigSchema, VersionFileError, VersionFileErrorBase, VersionFileUpdate, VersionFileUpdateRecordSchema, VersionFiles, VersionFilesSchema, VersionOrEmptySchema, VersionType, VersionTypeSchema, WorkspaceDependencyDiff, WorkspaceVersion, changelogFunctions, computeWorkspaceDependencyDiffs, gitMergeBase, isPureDependencyChangeset, listPublishablePackageNames, makeBranchAnalyzerTest, makeConfigInspectorTest, makeGitHubTest, makeReleasePlannerTest, serializeDependencyTableToMarkdown };
|
|
5420
5481
|
}
|
|
5421
5482
|
//#endregion
|
|
5422
5483
|
//#region src/commitlint/config/schema.d.ts
|
|
@@ -9311,51 +9372,6 @@ declare class BiomeSchemaSync extends BiomeSchemaSync_base {}
|
|
|
9311
9372
|
*/
|
|
9312
9373
|
declare const BiomeSchemaSyncLive: Layer.Layer<BiomeSchemaSync, never, FileSystem.FileSystem>;
|
|
9313
9374
|
//#endregion
|
|
9314
|
-
//#region src/services/ChangesetConfig.d.ts
|
|
9315
|
-
/**
|
|
9316
|
-
* Changeset operating mode for a workspace root.
|
|
9317
|
-
* @public
|
|
9318
|
-
*/
|
|
9319
|
-
type ChangesetMode = "silk" | "vanilla" | "none";
|
|
9320
|
-
declare const ChangesetConfig_base: Context.TagClass<ChangesetConfig, "@savvy-web/silk-effects/ChangesetConfig", {
|
|
9321
|
-
readonly mode: (root: string) => Effect.Effect<ChangesetMode>;
|
|
9322
|
-
readonly versionPrivate: (root: string) => Effect.Effect<boolean>;
|
|
9323
|
-
readonly ignorePatterns: (root: string) => Effect.Effect<ReadonlyArray<string>>;
|
|
9324
|
-
readonly isIgnored: (name: string, root: string) => Effect.Effect<boolean>;
|
|
9325
|
-
readonly fixed: (root: string) => Effect.Effect<ReadonlyArray<ReadonlyArray<string>>>;
|
|
9326
|
-
}>;
|
|
9327
|
-
/**
|
|
9328
|
-
* Accessor service over a workspace root's `.changeset/config.json`.
|
|
9329
|
-
*
|
|
9330
|
-
* @remarks
|
|
9331
|
-
* Reads through {@link ChangesetConfigReader} (FileSystem-based) with a per-root cache.
|
|
9332
|
-
* Every accessor is total (error channel `never`): a missing or unreadable config collapses
|
|
9333
|
-
* to `mode: "none"` and empty/false defaults.
|
|
9334
|
-
*
|
|
9335
|
-
* @since 0.4.0
|
|
9336
|
-
* @public
|
|
9337
|
-
*/
|
|
9338
|
-
declare class ChangesetConfig extends ChangesetConfig_base {
|
|
9339
|
-
/**
|
|
9340
|
-
* The one ignore matcher: exact name match, or `@scope/*` wildcard.
|
|
9341
|
-
*
|
|
9342
|
-
* `"@scope/*"` matches `"@scope/anything"` (prefix kept includes the trailing slash),
|
|
9343
|
-
* but not the bare scope `"@scope"`.
|
|
9344
|
-
*/
|
|
9345
|
-
static matches(name: string, pattern: string): boolean;
|
|
9346
|
-
}
|
|
9347
|
-
/**
|
|
9348
|
-
* Live {@link ChangesetConfig} reading via {@link ChangesetConfigReader}, cached per root.
|
|
9349
|
-
*
|
|
9350
|
-
* @remarks
|
|
9351
|
-
* Requires `ChangesetConfigReader` (which requires `FileSystem`). Provide
|
|
9352
|
-
* `ChangesetConfigReaderLive` + a platform layer (`NodeContext.layer`).
|
|
9353
|
-
*
|
|
9354
|
-
* @since 0.4.0
|
|
9355
|
-
* @public
|
|
9356
|
-
*/
|
|
9357
|
-
declare const ChangesetConfigLive: Layer.Layer<ChangesetConfig, never, ChangesetConfigReader>;
|
|
9358
|
-
//#endregion
|
|
9359
9375
|
//#region src/services/ConfigDiscovery.d.ts
|
|
9360
9376
|
declare const ConfigDiscovery_base: Context.TagClass<ConfigDiscovery, "@savvy-web/silk-effects/ConfigDiscovery", {
|
|
9361
9377
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/silk-effects",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared Effect library for Silk Suite conventions",
|
|
6
6
|
"homepage": "https://github.com/savvy-web/systems/tree/main/packages/silk-effects",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"unified": "^11.0.5",
|
|
48
48
|
"unified-lint-rule": "^3.0.1",
|
|
49
49
|
"unist-util-visit": "^5.1.0",
|
|
50
|
-
"workspaces-effect": "^
|
|
50
|
+
"workspaces-effect": "^2.0.0",
|
|
51
51
|
"yaml": "^2.9.0",
|
|
52
52
|
"yaml-effect": "^0.7.0",
|
|
53
53
|
"yaml-lint": "^1.7.0"
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { GitError } from "../errors.js";
|
|
2
|
-
import { Context, Effect, Layer } from "effect";
|
|
3
|
-
import { execFileSync } from "node:child_process";
|
|
4
|
-
|
|
5
|
-
//#region src/changesets/services/workspace-snapshot.ts
|
|
6
|
-
/**
|
|
7
|
-
* Read workspace package snapshots at arbitrary git refs.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* `WorkspaceDiscovery` reads the **current** workspace state. To compute
|
|
11
|
-
* dependency diffs between two points in time, we also need to read
|
|
12
|
-
* `pnpm-workspace.yaml` and each `package.json` as they existed at a
|
|
13
|
-
* specific commit. This service shells out to `git show <ref>:<path>`
|
|
14
|
-
* for each file, returns a plain-object snapshot per workspace package,
|
|
15
|
-
* and caches per `(cwd, ref)` pair.
|
|
16
|
-
*
|
|
17
|
-
* The snapshot intentionally returns plain objects rather than
|
|
18
|
-
* `WorkspacePackage` instances — `WorkspacePackage` is a `Schema.Class`
|
|
19
|
-
* tightly coupled to the live filesystem, and snapshot consumers only
|
|
20
|
-
* need the declared dependency records to compute a diff.
|
|
21
|
-
*
|
|
22
|
-
* @see {@link WorkspaceSnapshotReader} for the service tag
|
|
23
|
-
* @see {@link WorkspaceSnapshotReaderLive} for the production layer
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
const _tag = Context.Tag("WorkspaceSnapshotReader");
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
const WorkspaceSnapshotReaderBase = _tag();
|
|
31
|
-
/**
|
|
32
|
-
* Effect service tag for {@link WorkspaceSnapshotReaderShape}.
|
|
33
|
-
*
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
var WorkspaceSnapshotReader = class extends WorkspaceSnapshotReaderBase {};
|
|
37
|
-
function runGitShow(cwd, ref, path) {
|
|
38
|
-
return Effect.try({
|
|
39
|
-
try: () => execFileSync("git", ["show", `${ref}:${path}`], {
|
|
40
|
-
cwd,
|
|
41
|
-
encoding: "utf8",
|
|
42
|
-
stdio: [
|
|
43
|
-
"ignore",
|
|
44
|
-
"pipe",
|
|
45
|
-
"pipe"
|
|
46
|
-
]
|
|
47
|
-
}),
|
|
48
|
-
catch: (error) => {
|
|
49
|
-
const stderr = error.stderr;
|
|
50
|
-
const text = typeof stderr === "string" ? stderr : stderr?.toString() ?? "";
|
|
51
|
-
if (/exists on disk, but not in|does not exist|unknown revision|bad object/.test(text)) return new GitError({
|
|
52
|
-
command: `git show ${ref}:${path}`,
|
|
53
|
-
cwd,
|
|
54
|
-
reason: "PATH_NOT_AT_REF"
|
|
55
|
-
});
|
|
56
|
-
return new GitError({
|
|
57
|
-
command: `git show ${ref}:${path}`,
|
|
58
|
-
cwd,
|
|
59
|
-
reason: text.trim() || (error.message ?? String(error))
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}).pipe(Effect.catchTag("GitError", (err) => err.reason === "PATH_NOT_AT_REF" ? Effect.succeed(null) : Effect.fail(err)));
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Parse a minimal `pnpm-workspace.yaml` (`packages:` list only). Tolerant
|
|
66
|
-
* of comments and varied indentation; rejects on missing `packages:` key.
|
|
67
|
-
*/
|
|
68
|
-
function parseWorkspaceGlobs(yamlText) {
|
|
69
|
-
const lines = yamlText.split(/\r?\n/);
|
|
70
|
-
const globs = [];
|
|
71
|
-
let inPackagesBlock = false;
|
|
72
|
-
for (const line of lines) {
|
|
73
|
-
if (/^\s*#/.test(line)) continue;
|
|
74
|
-
if (/^\s*packages\s*:\s*$/.test(line)) {
|
|
75
|
-
inPackagesBlock = true;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (inPackagesBlock) {
|
|
79
|
-
const match = line.match(/^\s+-\s+["']?(.+?)["']?\s*$/);
|
|
80
|
-
if (match) {
|
|
81
|
-
globs.push(match[1]);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (line.length > 0 && !line.startsWith(" ") && !line.startsWith(" ")) inPackagesBlock = false;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return globs;
|
|
88
|
-
}
|
|
89
|
-
function toSnapshot(pkg, relativePath) {
|
|
90
|
-
if (!pkg.name) return null;
|
|
91
|
-
return {
|
|
92
|
-
name: pkg.name,
|
|
93
|
-
relativePath,
|
|
94
|
-
version: pkg.version ?? "0.0.0",
|
|
95
|
-
dependencies: pkg.dependencies ?? {},
|
|
96
|
-
devDependencies: pkg.devDependencies ?? {},
|
|
97
|
-
peerDependencies: pkg.peerDependencies ?? {},
|
|
98
|
-
optionalDependencies: pkg.optionalDependencies ?? {}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Expand a workspace glob like `packages/*` or `apps/web` against the
|
|
103
|
-
* directories present at the given git ref. We can't `globSync` here
|
|
104
|
-
* (the directories may not be on disk at this ref); instead we use
|
|
105
|
-
* `git ls-tree` to enumerate paths.
|
|
106
|
-
*/
|
|
107
|
-
function expandGlobAtRef(cwd, ref, glob) {
|
|
108
|
-
return Effect.gen(function* () {
|
|
109
|
-
const cleanGlob = glob.replace(/\/\*\*$/, "/*");
|
|
110
|
-
if (!cleanGlob.includes("*") && !cleanGlob.includes("?")) return [cleanGlob];
|
|
111
|
-
const prefix = cleanGlob.includes("/") ? cleanGlob.slice(0, cleanGlob.lastIndexOf("/") + 1) : "";
|
|
112
|
-
const entries = (yield* Effect.try({
|
|
113
|
-
try: () => execFileSync("git", [
|
|
114
|
-
"ls-tree",
|
|
115
|
-
"--name-only",
|
|
116
|
-
ref,
|
|
117
|
-
prefix
|
|
118
|
-
], {
|
|
119
|
-
cwd,
|
|
120
|
-
encoding: "utf8",
|
|
121
|
-
stdio: [
|
|
122
|
-
"ignore",
|
|
123
|
-
"pipe",
|
|
124
|
-
"pipe"
|
|
125
|
-
]
|
|
126
|
-
}),
|
|
127
|
-
catch: (error) => {
|
|
128
|
-
const stderr = error.stderr;
|
|
129
|
-
const text = typeof stderr === "string" ? stderr : stderr?.toString() ?? "";
|
|
130
|
-
return new GitError({
|
|
131
|
-
command: `git ls-tree ${ref} ${prefix}`,
|
|
132
|
-
cwd,
|
|
133
|
-
reason: text.trim() || (error.message ?? String(error))
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
})).split(/\r?\n/).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
137
|
-
const regex = new RegExp(`^${cleanGlob.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]")}$`);
|
|
138
|
-
return entries.filter((e) => regex.test(e));
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
function makeShape() {
|
|
142
|
-
const cache = /* @__PURE__ */ new Map();
|
|
143
|
-
const snapshotAt = (cwd, ref) => Effect.gen(function* () {
|
|
144
|
-
const cacheKey = `${cwd}::${ref}`;
|
|
145
|
-
const cached = cache.get(cacheKey);
|
|
146
|
-
if (cached) return cached;
|
|
147
|
-
const wsYaml = yield* runGitShow(cwd, ref, "pnpm-workspace.yaml");
|
|
148
|
-
const globs = wsYaml ? parseWorkspaceGlobs(wsYaml) : [];
|
|
149
|
-
const dirs = [];
|
|
150
|
-
for (const glob of globs) {
|
|
151
|
-
const expanded = yield* expandGlobAtRef(cwd, ref, glob);
|
|
152
|
-
for (const d of expanded) if (!dirs.includes(d)) dirs.push(d);
|
|
153
|
-
}
|
|
154
|
-
if (!dirs.includes(".")) dirs.unshift(".");
|
|
155
|
-
const snapshots = [];
|
|
156
|
-
for (const dir of dirs) {
|
|
157
|
-
const pkgText = yield* runGitShow(cwd, ref, dir === "." ? "package.json" : `${dir}/package.json`);
|
|
158
|
-
if (!pkgText) continue;
|
|
159
|
-
let parsed;
|
|
160
|
-
try {
|
|
161
|
-
parsed = JSON.parse(pkgText);
|
|
162
|
-
} catch {
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
const snap = toSnapshot(parsed, dir);
|
|
166
|
-
if (snap) snapshots.push(snap);
|
|
167
|
-
}
|
|
168
|
-
cache.set(cacheKey, snapshots);
|
|
169
|
-
return snapshots;
|
|
170
|
-
});
|
|
171
|
-
return { snapshotAt };
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Production layer for {@link WorkspaceSnapshotReader}.
|
|
175
|
-
*
|
|
176
|
-
* @public
|
|
177
|
-
*/
|
|
178
|
-
const WorkspaceSnapshotReaderLive = Layer.succeed(WorkspaceSnapshotReader, makeShape());
|
|
179
|
-
|
|
180
|
-
//#endregion
|
|
181
|
-
export { WorkspaceSnapshotReader, WorkspaceSnapshotReaderBase, WorkspaceSnapshotReaderLive };
|