@effected/workspaces 0.48.1 → 0.49.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/ChangeDetector.js +2 -2
- package/ConfigDependencyHooks.js +38 -9
- package/ConfigDependencySpec.js +2 -2
- package/DependencyGraph.js +1 -1
- package/DuplicateCheck.js +1 -1
- package/ImportGraph.js +2 -2
- package/LayerPolicy.js +3 -3
- package/LockfileReader.js +3 -3
- package/PackageManagerName.js +2 -2
- package/PackedInstall.js +5 -5
- package/PeerCheck.js +2 -2
- package/SourceBoundary.js +2 -2
- package/VersioningStrategy.js +1 -1
- package/WorkspaceCatalogs.js +10 -8
- package/WorkspaceDiscovery.js +3 -3
- package/WorkspaceLayering.js +3 -3
- package/WorkspacePackage.js +2 -2
- package/WorkspaceRoot.js +2 -2
- package/WorkspaceSnapshots.js +6 -6
- package/WorkspaceStateSnapshot.js +2 -2
- package/Workspaces.js +12 -5
- package/WorkspacesSync.js +4 -4
- package/index.d.ts +72 -8
- package/internal/configDependencyFetch.js +18 -11
- package/internal/configDependencyResolution.js +6 -6
- package/internal/configDependencyShared.js +4 -4
- package/internal/enumerate.js +1 -1
- package/internal/membership.js +3 -3
- package/internal/packageManagerDecision.js +1 -1
- package/internal/packedInstallPlan.js +2 -2
- package/internal/patterns.js +1 -1
- package/internal/workspaceYaml.js +2 -2
- package/package.json +2 -2
package/ChangeDetector.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DependencyGraph } from "./DependencyGraph.js";
|
|
2
|
-
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
3
1
|
import { Git } from "@effected/git";
|
|
4
2
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
import { DependencyGraph } from "./DependencyGraph.js";
|
|
4
|
+
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
5
5
|
|
|
6
6
|
// src/ChangeDetector.ts
|
|
7
7
|
/**
|
package/ConfigDependencyHooks.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { normalize } from "./internal/catalogs.js";
|
|
2
|
-
import { makeFetchConfigDependency } from "./internal/configDependencyFetch.js";
|
|
3
|
-
import { lookupPnpmfiles, resolvePnpmfiles } from "./internal/configDependencyResolution.js";
|
|
4
|
-
import { Context, Duration, Effect, Layer, Predicate, Schema } from "effect";
|
|
5
|
-
import { CatalogAssemblyError } from "@effected/npm";
|
|
6
1
|
import { pathToFileURL } from "node:url";
|
|
7
2
|
import { Run } from "@effected/commands";
|
|
3
|
+
import { CatalogAssemblyError } from "@effected/npm";
|
|
8
4
|
import { PeerDependencyRules } from "@effected/pnpm";
|
|
5
|
+
import { Context, Duration, Effect, Layer, Predicate, Schema } from "effect";
|
|
9
6
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
7
|
+
import { normalize } from "./internal/catalogs.js";
|
|
8
|
+
import { makeFetchConfigDependency } from "./internal/configDependencyFetch.js";
|
|
9
|
+
import { lookupPnpmfiles, resolvePnpmfiles } from "./internal/configDependencyResolution.js";
|
|
10
10
|
|
|
11
11
|
// src/ConfigDependencyHooks.ts
|
|
12
12
|
/** Internal alias, kept short at the many call sites in this module. */
|
|
@@ -434,7 +434,7 @@ var ConfigDependencyHooks = class ConfigDependencyHooks extends Context.Service(
|
|
|
434
434
|
return yield* replayInProcess(pnpmfiles, seed, rules);
|
|
435
435
|
}) });
|
|
436
436
|
/**
|
|
437
|
-
* The subprocess layer: replays each config dependency's pnpmfile in a `node`
|
|
437
|
+
* The subprocess layer, configured: replays each config dependency's pnpmfile in a `node`
|
|
438
438
|
* child process instead of an in-process dynamic `import()`, with identical
|
|
439
439
|
* typed semantics to {@link ConfigDependencyHooks.layerLive} — the two are
|
|
440
440
|
* drop-in interchangeable.
|
|
@@ -511,11 +511,29 @@ var ConfigDependencyHooks = class ConfigDependencyHooks extends Context.Service(
|
|
|
511
511
|
* the consumer provides it once at the edge (`@effect/platform-node`'s
|
|
512
512
|
* `NodeServices.layer`), the same discharge `@effected/git` uses. Wired by
|
|
513
513
|
* `WorkspaceCatalogs.layerWithConfigDependenciesSubprocess` /
|
|
514
|
-
* `Workspaces.layerWithConfigDependenciesSubprocess
|
|
514
|
+
* `Workspaces.layerWithConfigDependenciesSubprocess`, which take the same
|
|
515
|
+
* options. {@link ConfigDependencyHooks.layerSubprocess} is this layer with
|
|
516
|
+
* every default.
|
|
517
|
+
*
|
|
518
|
+
* **Bind the result to a `const`.** A parameterized factory mints a fresh
|
|
519
|
+
* reference per call and layers memoize by reference.
|
|
520
|
+
*
|
|
521
|
+
* @param options - How the fetch rung spawns pnpm; see
|
|
522
|
+
* {@link ConfigDependencyHooksSubprocessOptions}.
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
* ```ts
|
|
526
|
+
* import { ConfigDependencyHooks } from "@effected/workspaces";
|
|
527
|
+
*
|
|
528
|
+
* // Fetch with one pinned pnpm and a registry token only that spawn sees.
|
|
529
|
+
* const Hooks = ConfigDependencyHooks.layerSubprocessWith({
|
|
530
|
+
* pnpm: { command: "/opt/pnpm/bin/pnpm", env: { NPM_TOKEN: "token" } },
|
|
531
|
+
* });
|
|
532
|
+
* ```
|
|
515
533
|
*/
|
|
516
|
-
static
|
|
534
|
+
static layerSubprocessWith = (options = {}) => Layer.effect(ConfigDependencyHooks, Effect.gen(function* () {
|
|
517
535
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
518
|
-
const fetch = makeFetchConfigDependency(spawner);
|
|
536
|
+
const fetch = makeFetchConfigDependency(spawner, options.pnpm);
|
|
519
537
|
return { inject: (root, configDependencies, seed, rules, context) => Effect.gen(function* () {
|
|
520
538
|
if (Object.keys(configDependencies).length === 0) return untouched(seed, rules);
|
|
521
539
|
const pnpmfiles = yield* resolvePnpmfiles(root, configDependencies, {
|
|
@@ -545,6 +563,17 @@ var ConfigDependencyHooks = class ConfigDependencyHooks extends Context.Service(
|
|
|
545
563
|
return injectionOf(configOf(payload.config, seedToConfig(seed, rules)), pnpmfiles);
|
|
546
564
|
}) };
|
|
547
565
|
}));
|
|
566
|
+
/**
|
|
567
|
+
* {@link ConfigDependencyHooks.layerSubprocessWith} with every default: the
|
|
568
|
+
* fetch rung runs `pnpm` from the inherited `PATH`, under the inherited
|
|
569
|
+
* environment.
|
|
570
|
+
*
|
|
571
|
+
* @remarks
|
|
572
|
+
* One shared reference, so every composite wiring it memoizes to one
|
|
573
|
+
* layer. Requires core's `ChildProcessSpawner`, as `layerSubprocessWith`
|
|
574
|
+
* does.
|
|
575
|
+
*/
|
|
576
|
+
static layerSubprocess = ConfigDependencyHooks.layerSubprocessWith();
|
|
548
577
|
};
|
|
549
578
|
|
|
550
579
|
export { ConfigDependencyHooks };
|
package/ConfigDependencySpec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { splitConfigDependencySpec } from "./internal/configDependencySpecGrammar.js";
|
|
2
|
-
import { Effect, Exit, Option, Result, Schema, SchemaIssue, SchemaTransformation } from "effect";
|
|
3
1
|
import { SriIntegrityHash } from "@effected/npm";
|
|
4
2
|
import { SemVer } from "@effected/semver";
|
|
3
|
+
import { Effect, Exit, Option, Result, Schema, SchemaIssue, SchemaTransformation } from "effect";
|
|
4
|
+
import { splitConfigDependencySpec } from "./internal/configDependencySpecGrammar.js";
|
|
5
5
|
|
|
6
6
|
// src/ConfigDependencySpec.ts
|
|
7
7
|
/**
|
package/DependencyGraph.js
CHANGED
package/DuplicateCheck.js
CHANGED
package/ImportGraph.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { GlobSet } from "@effected/glob";
|
|
2
|
+
import { Effect, FileSystem, Option, Path, Schema } from "effect";
|
|
1
3
|
import { isTypePositionImport } from "./internal/importPosition.js";
|
|
2
4
|
import { isIdentifierChar, lex, locate, specifierLiterals, wordEndingAt } from "./internal/sourceText.js";
|
|
3
5
|
import { DEFAULT_EXTENSIONS, walkSources } from "./internal/sourceWalk.js";
|
|
4
6
|
import { SourceBoundary } from "./SourceBoundary.js";
|
|
5
7
|
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
6
|
-
import { Effect, FileSystem, Option, Path, Schema } from "effect";
|
|
7
|
-
import { GlobSet } from "@effected/glob";
|
|
8
8
|
|
|
9
9
|
// src/ImportGraph.ts
|
|
10
10
|
/**
|
package/LayerPolicy.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { GlobSet } from "@effected/glob";
|
|
2
|
+
import { DependencyField } from "@effected/npm";
|
|
3
|
+
import { Effect, FileSystem, Result, Schema } from "effect";
|
|
1
4
|
import { causeMessage } from "./internal/causeMessage.js";
|
|
2
5
|
import { ALL_DEPENDENCY_FIELDS } from "./internal/dependencyFields.js";
|
|
3
|
-
import { Effect, FileSystem, Result, Schema } from "effect";
|
|
4
|
-
import { DependencyField } from "@effected/npm";
|
|
5
|
-
import { GlobSet } from "@effected/glob";
|
|
6
6
|
|
|
7
7
|
// src/LayerPolicy.ts
|
|
8
8
|
const REQUIRED_EDGE = /^\S+ -> \S+$/u;
|
package/LockfileReader.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { Lockfile, LockfileFormat, LockfileIntegrity, filenameFor } from "@effected/lockfiles";
|
|
2
|
+
import { PackageJsonFormat } from "@effected/package-json";
|
|
3
|
+
import { Context, Duration, Effect, Exit, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
|
|
1
4
|
import { findLayerRoot } from "./internal/layerRoot.js";
|
|
2
5
|
import { PackageManagerDetector } from "./PackageManagerName.js";
|
|
3
6
|
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
4
7
|
import { WorkspaceRoot } from "./WorkspaceRoot.js";
|
|
5
|
-
import { Context, Duration, Effect, Exit, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
|
|
6
|
-
import { PackageJsonFormat } from "@effected/package-json";
|
|
7
|
-
import { Lockfile, LockfileFormat, LockfileIntegrity, filenameFor } from "@effected/lockfiles";
|
|
8
8
|
|
|
9
9
|
// src/LockfileReader.ts
|
|
10
10
|
/**
|
package/PackageManagerName.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { PackageJsonFormat } from "@effected/package-json";
|
|
2
|
+
import { Context, Effect, FileSystem, Layer, Option, Path, Predicate, Result, Schema } from "effect";
|
|
1
3
|
import { MARKER_FILES, decidePackageManager } from "./internal/packageManagerDecision.js";
|
|
2
4
|
import { WorkspaceManifestError } from "./WorkspacePackage.js";
|
|
3
|
-
import { Context, Effect, FileSystem, Layer, Option, Path, Predicate, Result, Schema } from "effect";
|
|
4
|
-
import { PackageJsonFormat } from "@effected/package-json";
|
|
5
5
|
|
|
6
6
|
// src/PackageManagerName.ts
|
|
7
7
|
/**
|
package/PackedInstall.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PackageManagerName } from "./PackageManagerName.js";
|
|
3
|
-
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
4
|
-
import { Config, Duration, Effect, FileSystem, Option, Path, Redacted, Result, Schema, Stream } from "effect";
|
|
1
|
+
import { Run } from "@effected/commands";
|
|
5
2
|
import { PackageJsonFormat } from "@effected/package-json";
|
|
6
3
|
import { Yaml } from "@effected/yaml";
|
|
7
|
-
import {
|
|
4
|
+
import { Config, Duration, Effect, FileSystem, Option, Path, Redacted, Result, Schema, Stream } from "effect";
|
|
8
5
|
import { ChildProcess } from "effect/process";
|
|
6
|
+
import { binConflict, binTargetOf, closureOf, consumerFiles, fileOverridesOf, installArgs, overridePath, readPackedManifest, scrubEnv, versionOf } from "./internal/packedInstallPlan.js";
|
|
7
|
+
import { PackageManagerName } from "./PackageManagerName.js";
|
|
8
|
+
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
9
9
|
|
|
10
10
|
// src/PackedInstall.ts
|
|
11
11
|
/**
|
package/PeerCheck.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { indexInstances, rootInstances } from "./internal/roots.js";
|
|
2
|
-
import { Option, Result, Schema } from "effect";
|
|
3
1
|
import { PnpmMatcher } from "@effected/pnpm";
|
|
4
2
|
import { Range, SemVer } from "@effected/semver";
|
|
3
|
+
import { Option, Result, Schema } from "effect";
|
|
4
|
+
import { indexInstances, rootInstances } from "./internal/roots.js";
|
|
5
5
|
|
|
6
6
|
// src/PeerCheck.ts
|
|
7
7
|
/**
|
package/SourceBoundary.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { GlobSet } from "@effected/glob";
|
|
2
|
+
import { Effect, FileSystem, Schema } from "effect";
|
|
1
3
|
import { isIdentifierChar, lex, locate, references, specifierLiterals } from "./internal/sourceText.js";
|
|
2
4
|
import { DEFAULT_EXTENSIONS, walkSources } from "./internal/sourceWalk.js";
|
|
3
|
-
import { Effect, FileSystem, Schema } from "effect";
|
|
4
|
-
import { GlobSet } from "@effected/glob";
|
|
5
5
|
|
|
6
6
|
// src/SourceBoundary.ts
|
|
7
7
|
/**
|
package/VersioningStrategy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
1
2
|
import { PublishabilityDetector } from "./Publishability.js";
|
|
2
3
|
import { ReleaseTag } from "./ReleaseTag.js";
|
|
3
4
|
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
4
|
-
import { Effect, Schema } from "effect";
|
|
5
5
|
|
|
6
6
|
// src/VersioningStrategy.ts
|
|
7
7
|
/**
|
package/WorkspaceCatalogs.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { filenameFor } from "@effected/lockfiles";
|
|
2
|
+
import { CatalogAssemblyError, CatalogResolver, DependencyResolutionError } from "@effected/npm";
|
|
3
|
+
import { PackageJsonFormat } from "@effected/package-json";
|
|
4
|
+
import { PartialReleaseAgeGate, PeerDependencyRules, ReleaseAgeGate } from "@effected/pnpm";
|
|
5
|
+
import { Yaml } from "@effected/yaml";
|
|
6
|
+
import { Context, Duration, Effect, Exit, FileSystem, Layer, Option, Path, PlatformError, Predicate, Schema } from "effect";
|
|
1
7
|
import { ConfigDependencyHooks } from "./ConfigDependencyHooks.js";
|
|
2
8
|
import { inlineCatalogs, merge, normalize, rangeOf } from "./internal/catalogs.js";
|
|
3
9
|
import { isStringRecord } from "./internal/guards.js";
|
|
@@ -6,12 +12,6 @@ import { findLayerRoot } from "./internal/layerRoot.js";
|
|
|
6
12
|
import { configDependenciesOf, inlinePeerDependencyRules } from "./internal/workspaceYaml.js";
|
|
7
13
|
import { LockfileReader } from "./LockfileReader.js";
|
|
8
14
|
import { WorkspaceRoot } from "./WorkspaceRoot.js";
|
|
9
|
-
import { Context, Duration, Effect, Exit, FileSystem, Layer, Option, Path, PlatformError, Predicate, Schema } from "effect";
|
|
10
|
-
import { CatalogAssemblyError, CatalogResolver, DependencyResolutionError } from "@effected/npm";
|
|
11
|
-
import { PackageJsonFormat } from "@effected/package-json";
|
|
12
|
-
import { Yaml } from "@effected/yaml";
|
|
13
|
-
import { filenameFor } from "@effected/lockfiles";
|
|
14
|
-
import { PartialReleaseAgeGate, PeerDependencyRules, ReleaseAgeGate } from "@effected/pnpm";
|
|
15
15
|
|
|
16
16
|
// src/WorkspaceCatalogs.ts
|
|
17
17
|
/**
|
|
@@ -484,10 +484,12 @@ var WorkspaceCatalogs = class WorkspaceCatalogs extends Context.Service()("@effe
|
|
|
484
484
|
* that cannot resolve at runtime — every bundled GitHub Action hits this).
|
|
485
485
|
* The cost is one extra requirement: core's `ChildProcessSpawner`, provided
|
|
486
486
|
* once at the edge (`@effect/platform-node`'s `NodeServices.layer`) — the
|
|
487
|
-
* same sanctioned R-widening as `Workspaces.layerWithGit`.
|
|
487
|
+
* same sanctioned R-widening as `Workspaces.layerWithGit`. `pnpm` chooses
|
|
488
|
+
* how the fetch rung spawns pnpm, as for
|
|
489
|
+
* {@link ConfigDependencyHooks.layerSubprocessWith}. Parameterized, so
|
|
488
490
|
* bind it to a `const` and reuse it.
|
|
489
491
|
*/
|
|
490
|
-
static layerWithConfigDependenciesSubprocess = (options) => WorkspaceCatalogs.layerWithHooks(ConfigDependencyHooks.layerSubprocess, options);
|
|
492
|
+
static layerWithConfigDependenciesSubprocess = (options) => WorkspaceCatalogs.layerWithHooks(options?.pnpm === void 0 ? ConfigDependencyHooks.layerSubprocess : ConfigDependencyHooks.layerSubprocessWith({ pnpm: options.pnpm }), options);
|
|
491
493
|
/**
|
|
492
494
|
* A test double satisfying the full {@link WorkspaceCatalogsShape} with no
|
|
493
495
|
* filesystem, lockfile read, or hook replay.
|
package/WorkspaceDiscovery.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { DependencyResolutionError, WorkspaceResolver } from "@effected/npm";
|
|
2
|
+
import { PackageJsonFormat } from "@effected/package-json";
|
|
3
|
+
import { Context, Duration, Effect, Exit, FileSystem, Layer, Option, Path, Schema } from "effect";
|
|
1
4
|
import { enumerate } from "./internal/enumerate.js";
|
|
2
5
|
import { isStringRecord } from "./internal/guards.js";
|
|
3
6
|
import { findLayerRoot } from "./internal/layerRoot.js";
|
|
@@ -6,9 +9,6 @@ import { MARKER_FILES } from "./internal/packageManagerDecision.js";
|
|
|
6
9
|
import { readPatternSource } from "./internal/patterns.js";
|
|
7
10
|
import { WorkspacePackage } from "./WorkspacePackage.js";
|
|
8
11
|
import { WorkspaceRoot } from "./WorkspaceRoot.js";
|
|
9
|
-
import { Context, Duration, Effect, Exit, FileSystem, Layer, Option, Path, Schema } from "effect";
|
|
10
|
-
import { DependencyResolutionError, WorkspaceResolver } from "@effected/npm";
|
|
11
|
-
import { PackageJsonFormat } from "@effected/package-json";
|
|
12
12
|
|
|
13
13
|
// src/WorkspaceDiscovery.ts
|
|
14
14
|
/**
|
package/WorkspaceLayering.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { GlobSet } from "@effected/glob";
|
|
2
|
+
import { DependencyField } from "@effected/npm";
|
|
3
|
+
import { Effect, Graph, Option, Schema } from "effect";
|
|
1
4
|
import { ALL_DEPENDENCY_FIELDS } from "./internal/dependencyFields.js";
|
|
2
5
|
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
3
|
-
import { Effect, Graph, Option, Schema } from "effect";
|
|
4
|
-
import { DependencyField } from "@effected/npm";
|
|
5
|
-
import { GlobSet } from "@effected/glob";
|
|
6
6
|
|
|
7
7
|
// src/WorkspaceLayering.ts
|
|
8
8
|
/**
|
package/WorkspacePackage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Effect, FileSystem, Option, Schema } from "effect";
|
|
2
|
-
import { Package, PackageJsonFormat } from "@effected/package-json";
|
|
3
1
|
import { GlobPattern } from "@effected/glob";
|
|
4
2
|
import { WorkspaceManifest } from "@effected/lockfiles";
|
|
3
|
+
import { Package, PackageJsonFormat } from "@effected/package-json";
|
|
4
|
+
import { Effect, FileSystem, Option, Schema } from "effect";
|
|
5
5
|
|
|
6
6
|
// src/WorkspacePackage.ts
|
|
7
7
|
const EMPTY = Object.freeze(Object.create(null));
|
package/WorkspaceRoot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WorkspaceRootMatch, probedMarkers } from "./WorkspaceMarker.js";
|
|
2
|
-
import { Context, Effect, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
|
|
3
1
|
import { PackageJsonFormat } from "@effected/package-json";
|
|
4
2
|
import { Walker } from "@effected/walker";
|
|
3
|
+
import { Context, Effect, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
|
|
4
|
+
import { WorkspaceRootMatch, probedMarkers } from "./WorkspaceMarker.js";
|
|
5
5
|
|
|
6
6
|
// src/WorkspaceRoot.ts
|
|
7
7
|
/** How the not-found message names the `package.json` marker: only one with a `workspaces` field counts. */
|
package/WorkspaceSnapshots.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { Git } from "@effected/git";
|
|
2
|
+
import { Lockfile, filenameFor } from "@effected/lockfiles";
|
|
3
|
+
import { CatalogAssemblyError } from "@effected/npm";
|
|
4
|
+
import { PackageJsonFormat } from "@effected/package-json";
|
|
5
|
+
import { Yaml } from "@effected/yaml";
|
|
6
|
+
import { Context, Duration, Effect, Exit, Layer, Option, Predicate, Result } from "effect";
|
|
1
7
|
import { ConfigDependencyHooks } from "./ConfigDependencyHooks.js";
|
|
2
8
|
import { isStringRecord } from "./internal/guards.js";
|
|
3
9
|
import { importerVersionsOf } from "./internal/importerVersions.js";
|
|
@@ -8,12 +14,6 @@ import { CatalogSet, WorkspaceCatalogs, injectFromDocument } from "./WorkspaceCa
|
|
|
8
14
|
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
9
15
|
import { WorkspaceRoot } from "./WorkspaceRoot.js";
|
|
10
16
|
import { PackageStateSnapshot, WorkspaceStateSnapshot } from "./WorkspaceStateSnapshot.js";
|
|
11
|
-
import { Git } from "@effected/git";
|
|
12
|
-
import { Context, Duration, Effect, Exit, Layer, Option, Predicate, Result } from "effect";
|
|
13
|
-
import { CatalogAssemblyError } from "@effected/npm";
|
|
14
|
-
import { PackageJsonFormat } from "@effected/package-json";
|
|
15
|
-
import { Yaml } from "@effected/yaml";
|
|
16
|
-
import { Lockfile, filenameFor } from "@effected/lockfiles";
|
|
17
17
|
|
|
18
18
|
// src/WorkspaceSnapshots.ts
|
|
19
19
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CatalogResolver, DependencyResolutionError, DependencySpecifier, WorkspaceResolver } from "@effected/npm";
|
|
2
|
+
import { Effect, Exit, Layer, Option, Schema, SchemaTransformation } from "effect";
|
|
1
3
|
import { unanimousVersionOf } from "./internal/importerVersions.js";
|
|
2
4
|
import { CatalogSet } from "./WorkspaceCatalogs.js";
|
|
3
|
-
import { Effect, Exit, Layer, Option, Schema, SchemaTransformation } from "effect";
|
|
4
|
-
import { CatalogResolver, DependencyResolutionError, DependencySpecifier, WorkspaceResolver } from "@effected/npm";
|
|
5
5
|
|
|
6
6
|
// src/WorkspaceStateSnapshot.ts
|
|
7
7
|
/** `record[key]` when `key` is the record's own property; never an inherited member. */
|
package/Workspaces.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { LocalExec, LocalExecError } from "@effected/commands";
|
|
2
|
+
import { Git } from "@effected/git";
|
|
3
|
+
import { Effect, Layer, Option } from "effect";
|
|
1
4
|
import { ChangeDetector } from "./ChangeDetector.js";
|
|
2
5
|
import { ConfigDependencyHooks } from "./ConfigDependencyHooks.js";
|
|
3
6
|
import { layerFindOptions } from "./internal/layerRoot.js";
|
|
@@ -7,11 +10,9 @@ import { WorkspaceCatalogs } from "./WorkspaceCatalogs.js";
|
|
|
7
10
|
import { WorkspaceDiscovery } from "./WorkspaceDiscovery.js";
|
|
8
11
|
import { WorkspaceRoot } from "./WorkspaceRoot.js";
|
|
9
12
|
import { WorkspaceSnapshots } from "./WorkspaceSnapshots.js";
|
|
10
|
-
import { Git } from "@effected/git";
|
|
11
|
-
import { Effect, Layer, Option } from "effect";
|
|
12
|
-
import { LocalExec, LocalExecError } from "@effected/commands";
|
|
13
13
|
|
|
14
14
|
// src/Workspaces.ts
|
|
15
|
+
const subprocessHooks = (options) => options?.pnpm === void 0 ? ConfigDependencyHooks.layerSubprocess : ConfigDependencyHooks.layerSubprocessWith({ pnpm: options.pnpm });
|
|
15
16
|
const compose = (options, hooks) => {
|
|
16
17
|
const roots = WorkspaceRoot.layer;
|
|
17
18
|
const detector = PackageManagerDetector.layer;
|
|
@@ -100,10 +101,13 @@ var Workspaces = class Workspaces {
|
|
|
100
101
|
* this is a separate composite rather than a flag: a consumer that keeps the
|
|
101
102
|
* in-process replay should not have to be able to spawn a subprocess.
|
|
102
103
|
*
|
|
104
|
+
* `pnpm` chooses how the fetch rung spawns pnpm, as for
|
|
105
|
+
* {@link ConfigDependencyHooks.layerSubprocessWith}.
|
|
106
|
+
*
|
|
103
107
|
* **Bind the result to a `const`.**
|
|
104
108
|
*/
|
|
105
109
|
static layerWithConfigDependenciesSubprocess(options) {
|
|
106
|
-
return compose(options,
|
|
110
|
+
return compose(options, subprocessHooks(options));
|
|
107
111
|
}
|
|
108
112
|
/**
|
|
109
113
|
* The git-free composite plus {@link ChangeDetector} and
|
|
@@ -173,6 +177,9 @@ var Workspaces = class Workspaces {
|
|
|
173
177
|
* is no R-widening to weigh here and a bundled consumer pays nothing to be
|
|
174
178
|
* correct. Prefer this variant whenever the program ships as a bundle.
|
|
175
179
|
*
|
|
180
|
+
* `pnpm` chooses how the fetch rung spawns pnpm, as for
|
|
181
|
+
* {@link ConfigDependencyHooks.layerSubprocessWith}.
|
|
182
|
+
*
|
|
176
183
|
* **Bind the result to a `const`.**
|
|
177
184
|
*
|
|
178
185
|
* @example
|
|
@@ -184,7 +191,7 @@ var Workspaces = class Workspaces {
|
|
|
184
191
|
* ```
|
|
185
192
|
*/
|
|
186
193
|
static layerWithGitAndConfigDependenciesSubprocess(options) {
|
|
187
|
-
return Workspaces.layerWithGitAndHooks(
|
|
194
|
+
return Workspaces.layerWithGitAndHooks(subprocessHooks(options), options);
|
|
188
195
|
}
|
|
189
196
|
/**
|
|
190
197
|
* The git composite over a **caller-supplied** hooks layer — the same graph
|
package/WorkspacesSync.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { LocalExec, LocalExecError } from "@effected/commands";
|
|
2
|
+
import { PackageJsonFormat } from "@effected/package-json";
|
|
3
|
+
import { Yaml } from "@effected/yaml";
|
|
4
|
+
import { Effect, Exit, Option, Result, Schema } from "effect";
|
|
1
5
|
import { isStringRecord } from "./internal/guards.js";
|
|
2
6
|
import { membershipOf, rulesFor } from "./internal/membership.js";
|
|
3
7
|
import { decidePackageManager } from "./internal/packageManagerDecision.js";
|
|
@@ -7,10 +11,6 @@ import { PackageManagerDetectionError, PackageManagerEvidence, verdictResult } f
|
|
|
7
11
|
import { WorkspaceDiscoveryError, WorkspacePatternError } from "./WorkspaceDiscovery.js";
|
|
8
12
|
import { WorkspaceRootMatch, probedMarkers } from "./WorkspaceMarker.js";
|
|
9
13
|
import { PublishConfig, WorkspaceManifestError, WorkspacePackage } from "./WorkspacePackage.js";
|
|
10
|
-
import { Effect, Exit, Option, Result, Schema } from "effect";
|
|
11
|
-
import { PackageJsonFormat } from "@effected/package-json";
|
|
12
|
-
import { Yaml } from "@effected/yaml";
|
|
13
|
-
import { LocalExec, LocalExecError } from "@effected/commands";
|
|
14
14
|
|
|
15
15
|
// src/WorkspacesSync.ts
|
|
16
16
|
/**
|
package/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* @packageDocumentation
|
|
29
29
|
*/
|
|
30
30
|
import { Git, GitCommandError, NotARepositoryError, UnknownRefError } from "@effected/git";
|
|
31
|
-
import { Context, Effect, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
|
|
31
|
+
import { Context, Effect, FileSystem, Layer, Option, Path, Redacted, Result, Schema } from "effect";
|
|
32
32
|
import { CatalogAssemblyError, CatalogResolver, DependencyResolutionError, Manifest, UnresolvedDependencyError, WorkspaceResolver } from "@effected/npm";
|
|
33
33
|
import { GlobPattern } from "@effected/glob";
|
|
34
34
|
import { Lockfile, LockfileFramingError, LockfileIntegrity, LockfileParseError, ResolvedPackage, WorkspaceManifest } from "@effected/lockfiles";
|
|
@@ -1205,6 +1205,33 @@ interface ConfigDependencyHooksShape {
|
|
|
1205
1205
|
*/
|
|
1206
1206
|
readonly inject: (root: string, configDependencies: Readonly<Record<string, string>>, seed: Readonly<Record<string, Readonly<Record<string, string>>>>, rules?: PeerDependencyRules, context?: HookReplayContext) => Effect.Effect<HookInjection, CatalogAssemblyError>;
|
|
1207
1207
|
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Options for {@link ConfigDependencyHooks.layerSubprocessWith}.
|
|
1210
|
+
*
|
|
1211
|
+
* @public
|
|
1212
|
+
*/
|
|
1213
|
+
interface ConfigDependencyHooksSubprocessOptions {
|
|
1214
|
+
/**
|
|
1215
|
+
* How the fetch rung spawns pnpm, the one `pnpm install --frozen-lockfile`
|
|
1216
|
+
* it runs to put a declared version this checkout never installed into the
|
|
1217
|
+
* store.
|
|
1218
|
+
*
|
|
1219
|
+
* @remarks
|
|
1220
|
+
* `command` names the executable, spawned without a shell: a bare name
|
|
1221
|
+
* resolves against the child's `PATH`, so an absolute path pins exactly one
|
|
1222
|
+
* binary. `env` is layered over the inherited environment, never in place of
|
|
1223
|
+
* it, and only on this spawn; the `node` replay child never sees it.
|
|
1224
|
+
* `Redacted` values reach pnpm unchanged and are never shown in errors.
|
|
1225
|
+
* Neither changes how the fetch is verified.
|
|
1226
|
+
*
|
|
1227
|
+
* @defaultValue `pnpm` from the inherited `PATH`, under the inherited
|
|
1228
|
+
* environment.
|
|
1229
|
+
*/
|
|
1230
|
+
readonly pnpm?: {
|
|
1231
|
+
readonly command?: string | undefined;
|
|
1232
|
+
readonly env?: Readonly<Record<string, string | Redacted.Redacted<string>>> | undefined;
|
|
1233
|
+
} | undefined;
|
|
1234
|
+
}
|
|
1208
1235
|
declare const ConfigDependencyHooks_base: Context.ServiceClass<ConfigDependencyHooks, "@effected/workspaces/ConfigDependencyHooks", ConfigDependencyHooksShape>;
|
|
1209
1236
|
/**
|
|
1210
1237
|
* Replays a workspace's `configDependencies` `updateConfig` hooks over the inline
|
|
@@ -1310,7 +1337,7 @@ export declare class ConfigDependencyHooks extends ConfigDependencyHooks_base {
|
|
|
1310
1337
|
*/
|
|
1311
1338
|
static readonly layerFrom: (entries: Readonly<Record<string, string>>) => Layer.Layer<ConfigDependencyHooks>;
|
|
1312
1339
|
/**
|
|
1313
|
-
* The subprocess layer: replays each config dependency's pnpmfile in a `node`
|
|
1340
|
+
* The subprocess layer, configured: replays each config dependency's pnpmfile in a `node`
|
|
1314
1341
|
* child process instead of an in-process dynamic `import()`, with identical
|
|
1315
1342
|
* typed semantics to {@link ConfigDependencyHooks.layerLive} — the two are
|
|
1316
1343
|
* drop-in interchangeable.
|
|
@@ -1387,7 +1414,36 @@ export declare class ConfigDependencyHooks extends ConfigDependencyHooks_base {
|
|
|
1387
1414
|
* the consumer provides it once at the edge (`@effect/platform-node`'s
|
|
1388
1415
|
* `NodeServices.layer`), the same discharge `@effected/git` uses. Wired by
|
|
1389
1416
|
* `WorkspaceCatalogs.layerWithConfigDependenciesSubprocess` /
|
|
1390
|
-
* `Workspaces.layerWithConfigDependenciesSubprocess
|
|
1417
|
+
* `Workspaces.layerWithConfigDependenciesSubprocess`, which take the same
|
|
1418
|
+
* options. {@link ConfigDependencyHooks.layerSubprocess} is this layer with
|
|
1419
|
+
* every default.
|
|
1420
|
+
*
|
|
1421
|
+
* **Bind the result to a `const`.** A parameterized factory mints a fresh
|
|
1422
|
+
* reference per call and layers memoize by reference.
|
|
1423
|
+
*
|
|
1424
|
+
* @param options - How the fetch rung spawns pnpm; see
|
|
1425
|
+
* {@link ConfigDependencyHooksSubprocessOptions}.
|
|
1426
|
+
*
|
|
1427
|
+
* @example
|
|
1428
|
+
* ```ts
|
|
1429
|
+
* import { ConfigDependencyHooks } from "@effected/workspaces";
|
|
1430
|
+
*
|
|
1431
|
+
* // Fetch with one pinned pnpm and a registry token only that spawn sees.
|
|
1432
|
+
* const Hooks = ConfigDependencyHooks.layerSubprocessWith({
|
|
1433
|
+
* pnpm: { command: "/opt/pnpm/bin/pnpm", env: { NPM_TOKEN: "token" } },
|
|
1434
|
+
* });
|
|
1435
|
+
* ```
|
|
1436
|
+
*/
|
|
1437
|
+
static readonly layerSubprocessWith: (options?: ConfigDependencyHooksSubprocessOptions) => Layer.Layer<ConfigDependencyHooks, never, ChildProcessSpawner.ChildProcessSpawner>;
|
|
1438
|
+
/**
|
|
1439
|
+
* {@link ConfigDependencyHooks.layerSubprocessWith} with every default: the
|
|
1440
|
+
* fetch rung runs `pnpm` from the inherited `PATH`, under the inherited
|
|
1441
|
+
* environment.
|
|
1442
|
+
*
|
|
1443
|
+
* @remarks
|
|
1444
|
+
* One shared reference, so every composite wiring it memoizes to one
|
|
1445
|
+
* layer. Requires core's `ChildProcessSpawner`, as `layerSubprocessWith`
|
|
1446
|
+
* does.
|
|
1391
1447
|
*/
|
|
1392
1448
|
static readonly layerSubprocess: Layer.Layer<ConfigDependencyHooks, never, ChildProcessSpawner.ChildProcessSpawner>;
|
|
1393
1449
|
}
|
|
@@ -2672,10 +2728,12 @@ export declare class WorkspaceCatalogs extends WorkspaceCatalogs_base {
|
|
|
2672
2728
|
* that cannot resolve at runtime — every bundled GitHub Action hits this).
|
|
2673
2729
|
* The cost is one extra requirement: core's `ChildProcessSpawner`, provided
|
|
2674
2730
|
* once at the edge (`@effect/platform-node`'s `NodeServices.layer`) — the
|
|
2675
|
-
* same sanctioned R-widening as `Workspaces.layerWithGit`.
|
|
2731
|
+
* same sanctioned R-widening as `Workspaces.layerWithGit`. `pnpm` chooses
|
|
2732
|
+
* how the fetch rung spawns pnpm, as for
|
|
2733
|
+
* {@link ConfigDependencyHooks.layerSubprocessWith}. Parameterized, so
|
|
2676
2734
|
* bind it to a `const` and reuse it.
|
|
2677
2735
|
*/
|
|
2678
|
-
static readonly layerWithConfigDependenciesSubprocess: (options?: WorkspaceCatalogsOptions) => Layer.Layer<WorkspaceCatalogs, never, WorkspaceRoot | LockfileReader | FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
2736
|
+
static readonly layerWithConfigDependenciesSubprocess: (options?: WorkspaceCatalogsOptions & ConfigDependencyHooksSubprocessOptions) => Layer.Layer<WorkspaceCatalogs, never, WorkspaceRoot | LockfileReader | FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
2679
2737
|
/**
|
|
2680
2738
|
* A test double satisfying the full {@link WorkspaceCatalogsShape} with no
|
|
2681
2739
|
* filesystem, lockfile read, or hook replay.
|
|
@@ -4357,9 +4415,12 @@ export declare class Workspaces {
|
|
|
4357
4415
|
* this is a separate composite rather than a flag: a consumer that keeps the
|
|
4358
4416
|
* in-process replay should not have to be able to spawn a subprocess.
|
|
4359
4417
|
*
|
|
4418
|
+
* `pnpm` chooses how the fetch rung spawns pnpm, as for
|
|
4419
|
+
* {@link ConfigDependencyHooks.layerSubprocessWith}.
|
|
4420
|
+
*
|
|
4360
4421
|
* **Bind the result to a `const`.**
|
|
4361
4422
|
*/
|
|
4362
|
-
static layerWithConfigDependenciesSubprocess(options?: WorkspacesOptions): Layer.Layer<WorkspacesServices, never, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
4423
|
+
static layerWithConfigDependenciesSubprocess(options?: WorkspacesOptions & ConfigDependencyHooksSubprocessOptions): Layer.Layer<WorkspacesServices, never, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
4363
4424
|
/**
|
|
4364
4425
|
* The git-free composite plus {@link ChangeDetector} and
|
|
4365
4426
|
* {@link WorkspaceSnapshots}, over `@effected/git`'s `Git` service.
|
|
@@ -4424,6 +4485,9 @@ export declare class Workspaces {
|
|
|
4424
4485
|
* is no R-widening to weigh here and a bundled consumer pays nothing to be
|
|
4425
4486
|
* correct. Prefer this variant whenever the program ships as a bundle.
|
|
4426
4487
|
*
|
|
4488
|
+
* `pnpm` chooses how the fetch rung spawns pnpm, as for
|
|
4489
|
+
* {@link ConfigDependencyHooks.layerSubprocessWith}.
|
|
4490
|
+
*
|
|
4427
4491
|
* **Bind the result to a `const`.**
|
|
4428
4492
|
*
|
|
4429
4493
|
* @example
|
|
@@ -4434,7 +4498,7 @@ export declare class Workspaces {
|
|
|
4434
4498
|
* const KitLayer = Workspaces.layerWithGitAndConfigDependenciesSubprocess();
|
|
4435
4499
|
* ```
|
|
4436
4500
|
*/
|
|
4437
|
-
static layerWithGitAndConfigDependenciesSubprocess(options?: WorkspacesGitOptions): Layer.Layer<WorkspacesServices | ChangeDetector | WorkspaceSnapshots | Git, never, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
4501
|
+
static layerWithGitAndConfigDependenciesSubprocess(options?: WorkspacesGitOptions & ConfigDependencyHooksSubprocessOptions): Layer.Layer<WorkspacesServices | ChangeDetector | WorkspaceSnapshots | Git, never, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
4438
4502
|
/**
|
|
4439
4503
|
* The git composite over a **caller-supplied** hooks layer — the same graph
|
|
4440
4504
|
* as {@link Workspaces.layerWithGit} and its two config-dependency
|
|
@@ -5150,5 +5214,5 @@ export declare const detectPackageManagerSync: (root: string, options: Workspace
|
|
|
5150
5214
|
* @public
|
|
5151
5215
|
*/
|
|
5152
5216
|
export declare const localExecContextSync: (cwd: string, options: FindWorkspaceRootSyncOptions) => Result.Result<Option.Option<ExecContext>, LocalExecError>;
|
|
5153
|
-
export type { CatalogAssemblyFailure, ChangeDetectionFailure, ChangeDetectorShape, ClassifyOptions, ConfigDependencyHooksShape, DependencyDiff, DuplicateCheckOptions, FindWorkspaceRootOptions, FindWorkspaceRootSyncOptions, GetWorkspacePackagesSyncOptions, HookInjection, HookReplay, HookReplayContext, HookReplaySource, ImporterVersions, LockfileReadFailure, LockfileReaderOptions, LockfileReaderShape, PackageManagerDetectionFailure, PackageManagerDetectorShape, PackageRelease, PeerCheckOptions, PublishabilityDetectorShape, SyncDirectoryEntry, SyncFileSystem, SyncPath, TagClassification, TagFormatOptions, TrackingTagOptions, UnverifiedReason, VersioningDetectOptions, WorkspaceCatalogsOptions, WorkspaceCatalogsShape, WorkspaceDiscoveryFailure, WorkspaceDiscoveryOptions, WorkspaceDiscoveryShape, WorkspaceDiscoverySkip, WorkspaceDiscoverySkipKind, WorkspaceLookupFailure, WorkspaceRootShape, WorkspaceSnapshotAtFailure, WorkspaceSnapshotWorktreeFailure, WorkspaceSnapshotsOptions, WorkspaceSnapshotsShape, WorkspacesGitOptions, WorkspacesOptions, WorkspacesServices, WorkspacesSyncOptions };
|
|
5217
|
+
export type { CatalogAssemblyFailure, ChangeDetectionFailure, ChangeDetectorShape, ClassifyOptions, ConfigDependencyHooksShape, ConfigDependencyHooksSubprocessOptions, DependencyDiff, DuplicateCheckOptions, FindWorkspaceRootOptions, FindWorkspaceRootSyncOptions, GetWorkspacePackagesSyncOptions, HookInjection, HookReplay, HookReplayContext, HookReplaySource, ImporterVersions, LockfileReadFailure, LockfileReaderOptions, LockfileReaderShape, PackageManagerDetectionFailure, PackageManagerDetectorShape, PackageRelease, PeerCheckOptions, PublishabilityDetectorShape, SyncDirectoryEntry, SyncFileSystem, SyncPath, TagClassification, TagFormatOptions, TrackingTagOptions, UnverifiedReason, VersioningDetectOptions, WorkspaceCatalogsOptions, WorkspaceCatalogsShape, WorkspaceDiscoveryFailure, WorkspaceDiscoveryOptions, WorkspaceDiscoveryShape, WorkspaceDiscoverySkip, WorkspaceDiscoverySkipKind, WorkspaceLookupFailure, WorkspaceRootShape, WorkspaceSnapshotAtFailure, WorkspaceSnapshotWorktreeFailure, WorkspaceSnapshotsOptions, WorkspaceSnapshotsShape, WorkspacesGitOptions, WorkspacesOptions, WorkspacesServices, WorkspacesSyncOptions };
|
|
5154
5218
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { carries, manifestVersion, messageOf, sideLabel } from "./configDependencyShared.js";
|
|
2
|
-
import { splitConfigDependencySpec } from "./configDependencySpecGrammar.js";
|
|
3
|
-
import { Duration, Effect, Predicate } from "effect";
|
|
4
|
-
import { IntegrityHash } from "@effected/npm";
|
|
5
|
-
import { Yaml } from "@effected/yaml";
|
|
6
|
-
import { Run } from "@effected/commands";
|
|
7
|
-
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
8
1
|
import { copyFile, mkdtemp, readFile, realpath, rm, writeFile } from "node:fs/promises";
|
|
9
2
|
import { tmpdir } from "node:os";
|
|
10
3
|
import { basename, dirname, join } from "node:path";
|
|
4
|
+
import { Run } from "@effected/commands";
|
|
5
|
+
import { IntegrityHash } from "@effected/npm";
|
|
6
|
+
import { Yaml } from "@effected/yaml";
|
|
7
|
+
import { Duration, Effect, Predicate } from "effect";
|
|
8
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
9
|
+
import { carries, manifestVersion, messageOf, sideLabel } from "./configDependencyShared.js";
|
|
10
|
+
import { splitConfigDependencySpec } from "./configDependencySpecGrammar.js";
|
|
11
11
|
|
|
12
12
|
// src/internal/configDependencyFetch.ts
|
|
13
13
|
const fetchFailure = (reason, message, cause) => cause === void 0 ? {
|
|
@@ -137,9 +137,9 @@ const fetchArgs = (scratch, stores) => {
|
|
|
137
137
|
const isStoreEntry = (resolved, name, version) => resolved.split(/[/\\]/).join("/").includes(`/links/${name}/${version}/`);
|
|
138
138
|
/**
|
|
139
139
|
* Build the fetch rung over a spawner. Wired only by
|
|
140
|
-
* `ConfigDependencyHooks.layerSubprocess
|
|
140
|
+
* `ConfigDependencyHooks.layerSubprocessWith` (and so `layerSubprocess`).
|
|
141
141
|
*/
|
|
142
|
-
const makeFetchConfigDependency = (spawner) => (request) => Effect.scoped(Effect.gen(function* () {
|
|
142
|
+
const makeFetchConfigDependency = (spawner, pnpm = {}) => (request) => Effect.scoped(Effect.gen(function* () {
|
|
143
143
|
const { name, version } = request;
|
|
144
144
|
const key = `${name}@${version}`;
|
|
145
145
|
const failed = (message, cause) => fetchFailure("fetchFailed", message, cause);
|
|
@@ -165,8 +165,15 @@ const makeFetchConfigDependency = (spawner) => (request) => Effect.scoped(Effect
|
|
|
165
165
|
if (!isNotFound(error)) throw error;
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
|
-
const
|
|
169
|
-
|
|
168
|
+
const executable = pnpm.command ?? "pnpm";
|
|
169
|
+
const command = ChildProcess.make(executable, fetchArgs(scratch, request.stores), {
|
|
170
|
+
cwd: scratch,
|
|
171
|
+
...pnpm.env === void 0 ? {} : {
|
|
172
|
+
env: { ...pnpm.env },
|
|
173
|
+
extendEnv: true
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
yield* Run.text(command, { timeout: FETCH_TIMEOUT }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), Effect.mapError((cause) => failed(`fetching ${key} with \`${executable} ${fetchArgs("<scratch>", request.stores).join(" ")}\` failed: ${messageOf(cause)}`, cause)));
|
|
170
177
|
if ((yield* io("reading back the scratch lockfile", () => readFile(join(scratch, "pnpm-lock.yaml"), "utf8"))) !== lockfile) return yield* Effect.fail(failed(`fetching ${key}: pnpm rewrote the integrity-pinned scratch lockfile instead of installing from it, so the installed copy was not verified against the recorded integrity and is not used.`));
|
|
171
178
|
const linked = join(scratch, "node_modules", ".pnpm-config", name);
|
|
172
179
|
const resolved = yield* io(`resolving ${linked}`, () => realpath(linked));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { carries, hooksError, ioOrNone, manifestVersion, sideLabel } from "./configDependencyShared.js";
|
|
2
|
-
import { splitConfigDependencySpec } from "./configDependencySpecGrammar.js";
|
|
3
|
-
import { Array, Config, Duration, Effect, Exit, Option, Predicate, Result } from "effect";
|
|
4
|
-
import { PackageManagerCache } from "@effected/npm";
|
|
5
|
-
import { Yaml } from "@effected/yaml";
|
|
6
|
-
import { PnpmEnvLockfile } from "@effected/lockfiles";
|
|
7
1
|
import { readFile, readdir, realpath } from "node:fs/promises";
|
|
8
2
|
import { homedir } from "node:os";
|
|
9
3
|
import { basename, dirname, join } from "node:path";
|
|
4
|
+
import { PnpmEnvLockfile } from "@effected/lockfiles";
|
|
5
|
+
import { PackageManagerCache } from "@effected/npm";
|
|
6
|
+
import { Yaml } from "@effected/yaml";
|
|
7
|
+
import { Array, Config, Duration, Effect, Exit, Option, Predicate, Result } from "effect";
|
|
8
|
+
import { carries, hooksError, ioOrNone, manifestVersion, sideLabel } from "./configDependencyShared.js";
|
|
9
|
+
import { splitConfigDependencySpec } from "./configDependencySpecGrammar.js";
|
|
10
10
|
|
|
11
11
|
// src/internal/configDependencyResolution.ts
|
|
12
12
|
/** The pnpmfile filenames a config dependency may ship, in the order pnpm tries them. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { causeMessage } from "./causeMessage.js";
|
|
2
|
-
import { Effect, Option, Predicate, Result } from "effect";
|
|
3
|
-
import { CatalogAssemblyError } from "@effected/npm";
|
|
4
|
-
import { PackageJsonFormat } from "@effected/package-json";
|
|
5
1
|
import { readFile } from "node:fs/promises";
|
|
6
2
|
import { join } from "node:path";
|
|
3
|
+
import { CatalogAssemblyError } from "@effected/npm";
|
|
4
|
+
import { PackageJsonFormat } from "@effected/package-json";
|
|
5
|
+
import { Effect, Option, Predicate, Result } from "effect";
|
|
6
|
+
import { causeMessage } from "./causeMessage.js";
|
|
7
7
|
|
|
8
8
|
// src/internal/configDependencyShared.ts
|
|
9
9
|
/** The typed `hooks`-source failure every rung of the ladder reports through. */
|
package/internal/enumerate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Traversal, badMaxDepthMessage, isPruned, isValidMaxDepth, joinRelative } from "./traverse.js";
|
|
2
1
|
import { Effect, FileSystem, Path } from "effect";
|
|
2
|
+
import { Traversal, badMaxDepthMessage, isPruned, isValidMaxDepth, joinRelative } from "./traverse.js";
|
|
3
3
|
|
|
4
4
|
// src/internal/enumerate.ts
|
|
5
5
|
/** Strip a trailing slash from `GlobPattern.enumerationPrefix` to get a relative directory. */
|
package/internal/membership.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { decidePackageManager } from "./packageManagerDecision.js";
|
|
2
|
-
import { Option, Result } from "effect";
|
|
3
|
-
import { NpmWorkspacePatterns } from "@effected/npm";
|
|
4
1
|
import { GlobSet } from "@effected/glob";
|
|
2
|
+
import { NpmWorkspacePatterns } from "@effected/npm";
|
|
3
|
+
import { Option, Result } from "effect";
|
|
4
|
+
import { decidePackageManager } from "./packageManagerDecision.js";
|
|
5
5
|
|
|
6
6
|
// src/internal/membership.ts
|
|
7
7
|
/** The rules for a root that is not npm's. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Option, Predicate, Schema } from "effect";
|
|
2
1
|
import { PackageManager } from "@effected/package-json";
|
|
2
|
+
import { Option, Predicate, Schema } from "effect";
|
|
3
3
|
|
|
4
4
|
// src/internal/packageManagerDecision.ts
|
|
5
5
|
/** The marker FILES the decision may ask about, in the order it asks. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RUNTIME_DEPENDENCY_FIELDS } from "./dependencyFields.js";
|
|
2
|
-
import { Predicate, Result } from "effect";
|
|
3
1
|
import { PackageJsonFormat } from "@effected/package-json";
|
|
2
|
+
import { Predicate, Result } from "effect";
|
|
3
|
+
import { RUNTIME_DEPENDENCY_FIELDS } from "./dependencyFields.js";
|
|
4
4
|
|
|
5
5
|
// src/internal/packedInstallPlan.ts
|
|
6
6
|
/** Variables that carry the PARENT run's context into a child package manager. */
|
package/internal/patterns.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Effect, FileSystem, Option, Path, Result } from "effect";
|
|
2
1
|
import { PackageJsonFormat } from "@effected/package-json";
|
|
3
2
|
import { Yaml } from "@effected/yaml";
|
|
3
|
+
import { Effect, FileSystem, Option, Path, Result } from "effect";
|
|
4
4
|
|
|
5
5
|
// src/internal/patterns.ts
|
|
6
6
|
/** The string entries of `value` when it is an array, else `undefined`. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { stringsOf } from "./patterns.js";
|
|
2
|
-
import { Predicate } from "effect";
|
|
3
1
|
import { PeerDependencyRules } from "@effected/pnpm";
|
|
2
|
+
import { Predicate } from "effect";
|
|
3
|
+
import { stringsOf } from "./patterns.js";
|
|
4
4
|
|
|
5
5
|
// src/internal/workspaceYaml.ts
|
|
6
6
|
/** The `configDependencies` map (name → version+integrity) of a parsed pnpm-workspace document. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/workspaces",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Monorepo workspace tooling as Effect services — root discovery, package enumeration, the dependency graph, package-manager detection, pnpm catalog resolution, lockfile IO and git-based change detection.",
|
|
6
6
|
"keywords": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@effected/bun": "^0.1.0",
|
|
55
55
|
"@effected/commands": "^0.22.0",
|
|
56
|
-
"@effected/git": "^0.
|
|
56
|
+
"@effected/git": "^0.34.0",
|
|
57
57
|
"@effected/glob": "^0.23.0",
|
|
58
58
|
"@effected/jsonc": "^0.25.0",
|
|
59
59
|
"@effected/lockfiles": "^0.27.0",
|