@effected/workspaces 0.42.0 → 0.44.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/SourceBoundary.js CHANGED
@@ -25,7 +25,8 @@ var Offence = class extends Schema.Class("Offence")({
25
25
  "console-stdout",
26
26
  "forbidImports",
27
27
  "forbidTokens",
28
- "forbidImportedNames"
28
+ "forbidImportedNames",
29
+ "promiseInExclusive"
29
30
  ]),
30
31
  /**
31
32
  * What matched: the identifier, the call, the import specifier, the token,
@@ -283,6 +284,37 @@ const tokenOccurrences = (code, token) => {
283
284
  };
284
285
  const forbids = (entry, specifier) => entry.endsWith("*") ? specifier.startsWith(entry.slice(0, -1)) : specifier === entry || specifier.startsWith(`${entry}/`);
285
286
  const isNodeModule = (specifier, module) => [module, `node:${module}`].some((name) => specifier === name || specifier.startsWith(`${name}/`));
287
+ const LANE_BINDING = /(?<![\p{ID_Continue}$.#])(?:const|let|var)\s+([\p{ID_Start}$_][\p{ID_Continue}$]*)\s*=\s*(?:(?:yield\s*\*|await)\s*)?Exclusive\s*\.\s*make(?![\p{ID_Continue}$])/gu;
288
+ const PROMISE_CALL = /(?<![\p{ID_Continue}$.#])Effect\s*\.\s*(promise|runPromiseExit|runPromise)\s*(?:<[^()]*>\s*)?\(/gu;
289
+ /** Where `code` calls `<lane>.run(`, as the offsets just inside the opening paren and of the matching close (end of text when unbalanced). */
290
+ const runSpans = (code, lane) => {
291
+ const call = new RegExp(`(?<![\\p{ID_Continue}$.#])${lane.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}\\s*(?:\\?\\.|\\.)\\s*run\\s*\\(`, "gu");
292
+ return [...code.matchAll(call)].map((match) => {
293
+ const from = (match.index ?? 0) + match[0].length;
294
+ let depth = 1;
295
+ let to = from;
296
+ for (; to < code.length && depth > 0; to++) if (code[to] === "(") depth++;
297
+ else if (code[to] === ")") depth--;
298
+ return {
299
+ from,
300
+ to
301
+ };
302
+ });
303
+ };
304
+ /** Every `Effect.promise(` or `Effect.runPromise(` lexically inside a `<lane>.run(` call, for each lane the file binds from `Exclusive.make` or `lanes` names. */
305
+ const promisesInLanes = (code, lanes) => {
306
+ const names = /* @__PURE__ */ new Set([...[...code.matchAll(LANE_BINDING)].map((match) => match[1] ?? ""), ...lanes]);
307
+ names.delete("");
308
+ const found = /* @__PURE__ */ new Map();
309
+ for (const lane of names) for (const { from, to } of runSpans(code, lane)) for (const call of code.slice(from, to).matchAll(PROMISE_CALL)) {
310
+ const offset = from + (call.index ?? 0);
311
+ if (!found.has(offset)) found.set(offset, `${lane}.run: Effect.${call[1]}`);
312
+ }
313
+ return [...found].map(([offset, detail]) => ({
314
+ offset,
315
+ detail
316
+ }));
317
+ };
286
318
  const FIXTURES = [
287
319
  {
288
320
  name: "process: destructuring",
@@ -635,6 +667,72 @@ const FIXTURES = [
635
667
  } },
636
668
  flagged: false
637
669
  },
670
+ {
671
+ name: "promiseInExclusive: Effect.promise in a lane body",
672
+ source: "const lane = yield* Exclusive.make;\nlane.run(Effect.promise(() => f()), { timeout: \"1s\" });",
673
+ rule: { promiseInExclusive: {} },
674
+ flagged: true
675
+ },
676
+ {
677
+ name: "promiseInExclusive: Effect.promise nested in Effect.gen in a lane body",
678
+ source: "const lane = yield* Exclusive.make;\nlane.run(Effect.gen(function* () { yield* Effect.promise(() => f()); }), { timeout: 1 });",
679
+ rule: { promiseInExclusive: {} },
680
+ flagged: true
681
+ },
682
+ {
683
+ name: "promiseInExclusive: Effect.runPromise in a lane body",
684
+ source: "const lane = yield* Exclusive.make;\nlane.run(Effect.sync(() => Effect.runPromise(g)), { timeout: 1 });",
685
+ rule: { promiseInExclusive: {} },
686
+ flagged: true
687
+ },
688
+ {
689
+ name: "promiseInExclusive: Effect.promise with a type argument in a lane body",
690
+ source: "const lane = yield* Exclusive.make;\nlane.run(Effect.promise<void>(() => f()), { timeout: 1 });",
691
+ rule: { promiseInExclusive: {} },
692
+ flagged: true
693
+ },
694
+ {
695
+ name: "promiseInExclusive: Effect.runPromiseExit in a lane body",
696
+ source: "const lane = yield* Exclusive.make;\nlane.run(Effect.sync(() => Effect.runPromiseExit(g)), { timeout: 1 });",
697
+ rule: { promiseInExclusive: {} },
698
+ flagged: true
699
+ },
700
+ {
701
+ name: "promiseInExclusive: a lane passed in and named in lanes",
702
+ source: "lane.run(Effect.promise(() => f()), { timeout: 1 });",
703
+ rule: { promiseInExclusive: { lanes: ["lane"] } },
704
+ flagged: true
705
+ },
706
+ {
707
+ name: "promiseInExclusive: Exclusive.promise in a lane body",
708
+ source: "const lane = yield* Exclusive.make;\nlane.run(Exclusive.promise(lane, (s) => f(s)), { timeout: 1 });",
709
+ rule: { promiseInExclusive: {} },
710
+ flagged: false
711
+ },
712
+ {
713
+ name: "promiseInExclusive: Effect.promise after the run call closes",
714
+ source: "const lane = yield* Exclusive.make;\nlane.run(body, { timeout: 1 });\nconst p = Effect.promise(() => f());",
715
+ rule: { promiseInExclusive: {} },
716
+ flagged: false
717
+ },
718
+ {
719
+ name: "promiseInExclusive: the call named in a string",
720
+ source: "const lane = yield* Exclusive.make;\nlane.run(Effect.succeed(\"Effect.promise(x)\"), { timeout: 1 });",
721
+ rule: { promiseInExclusive: {} },
722
+ flagged: false
723
+ },
724
+ {
725
+ name: "promiseInExclusive: the call named in a comment",
726
+ source: "const lane = yield* Exclusive.make;\nlane.run(body /* Effect.promise(x) */, { timeout: 1 });",
727
+ rule: { promiseInExclusive: {} },
728
+ flagged: false
729
+ },
730
+ {
731
+ name: "promiseInExclusive: a receiver nothing binds from Exclusive.make",
732
+ source: "other.run(Effect.promise(() => f()), { timeout: 1 });",
733
+ rule: { promiseInExclusive: {} },
734
+ flagged: false
735
+ },
638
736
  {
639
737
  name: "forbidTokens: a private field",
640
738
  source: "const v = this.#process.env.__PACKAGE_VERSION__;",
@@ -715,8 +813,27 @@ var SourceBoundary = class SourceBoundary {
715
813
  static stripComments = (text) => lex(text).withoutComments;
716
814
  /** Whether `text` reads the global `process` in code (see {@link BoundaryRule}). */
717
815
  static referencesProcess = (text, options) => processReads(lex(text).code, [...EXEMPT, ...options?.ignoreTokens ?? []]).length > 0;
718
- /** Every module specifier `text` imports: static, side-effect, re-export, type-only, `import(...)` with a literal, and `require(...)`. */
816
+ /**
817
+ * Every module specifier `text` imports: static, side-effect, re-export, type-only, `import(...)` with a literal, and `require(...)`.
818
+ *
819
+ * @remarks
820
+ * One entry per occurrence, in source order: a module imported twice appears twice. Wrap the result in
821
+ * `new Set(...)` for the set of modules.
822
+ */
719
823
  static importSpecifiers = (text) => specifierLiterals(lex(text)).map((literal) => literal.value);
824
+ /**
825
+ * The rule for platform-free code: every Node built-in, bare or `node:`-prefixed, and `@effect/platform*`.
826
+ *
827
+ * @remarks
828
+ * Pass `builtinModules` from `node:module` as `builtins`; no list ships here because it would drift with Node
829
+ * releases. A bare-name list also forbids npm packages that share a built-in's name (`events`, `buffer`,
830
+ * `punycode`).
831
+ */
832
+ static platformFree = (builtins) => ({ forbidImports: [
833
+ "node:*",
834
+ "@effect/platform*",
835
+ ...builtins
836
+ ] });
720
837
  /** Whether `text` imports the Node built-in `module`, in either its `node:` or bare form. */
721
838
  static importsNode = (text, module) => SourceBoundary.importSpecifiers(text).some((specifier) => isNodeModule(specifier, module));
722
839
  /**
@@ -775,6 +892,11 @@ var SourceBoundary = class SourceBoundary {
775
892
  rule: "forbidImportedNames",
776
893
  detail
777
894
  });
895
+ else if ("promiseInExclusive" in rule) for (const { offset, detail } of promisesInLanes(lexed.code, rule.promiseInExclusive.lanes ?? [])) found.push({
896
+ offset,
897
+ rule: "promiseInExclusive",
898
+ detail
899
+ });
778
900
  else if ("forbidTokens" in rule) for (const token of new Set(rule.forbidTokens)) for (const offset of tokenOccurrences(lexed.code, token)) found.push({
779
901
  offset,
780
902
  rule: "forbidTokens",
package/index.d.ts CHANGED
@@ -3062,6 +3062,326 @@ export declare class PeerCheck extends PeerCheck_base {
3062
3062
  */
3063
3063
  static run(lockfile: Lockfile, options?: PeerCheckOptions): PeerCheck;
3064
3064
  }
3065
+ declare const PnpmSettingsError_base: Schema.Class<PnpmSettingsError, Schema.TaggedStruct<"PnpmSettingsError", {
3066
+ /** Why the file could not be used. */
3067
+ readonly reason: Schema.Literals<readonly ["read", "parse", "shape", "membership"]>;
3068
+ /** The file involved, when the source named one. */
3069
+ readonly path: Schema.optionalKey<Schema.String>;
3070
+ /** The underlying failure, for `"read"`, `"parse"` and `"membership"`. */
3071
+ readonly cause: Schema.optionalKey<Schema.Defect>;
3072
+ }>, import("effect/Cause").YieldableError>;
3073
+ /**
3074
+ * A pnpm settings file could not be used.
3075
+ *
3076
+ * @remarks
3077
+ * `reason` routes: `"read"` — the file exists but could not be read (the
3078
+ * platform failure is the `cause`); `"parse"` — the file is not valid YAML (the
3079
+ * `YamlParseError` is the `cause`); `"shape"` — the file is valid YAML but its
3080
+ * document is not a mapping (a list or a scalar), which pnpm refuses too;
3081
+ * `"membership"` — the workspace's `packages:` patterns each compile alone but
3082
+ * fail as a set (they share one compile budget; the `GlobError` is the
3083
+ * `cause`), so whether the directory is a member cannot be decided and the
3084
+ * load fails rather than reading the workspace file as not applying. A
3085
+ * file that does not exist is not an error: pnpm skips it, and so does
3086
+ * {@link PnpmSettings.load}. An empty file is an empty mapping.
3087
+ *
3088
+ * @public
3089
+ */
3090
+ export declare class PnpmSettingsError extends PnpmSettingsError_base {
3091
+ get message(): string;
3092
+ }
3093
+ /**
3094
+ * Where a setting's value came from, highest precedence first: a
3095
+ * `pnpm_config_*` / `PNPM_CONFIG_*` environment variable, the workspace's
3096
+ * `pnpm-workspace.yaml`, or pnpm's global `config.yaml`.
3097
+ *
3098
+ * @public
3099
+ */
3100
+ type PnpmSettingOrigin = "environment" | "workspace" | "global";
3101
+ /**
3102
+ * One YAML settings file for {@link PnpmSettings.fromSourcesResult}: its text
3103
+ * and, for errors and `PnpmSettings.files`, where it came from.
3104
+ *
3105
+ * @public
3106
+ */
3107
+ interface PnpmSettingsSource {
3108
+ /** The YAML text. */
3109
+ readonly text: string;
3110
+ /** Where it was read from. */
3111
+ readonly path?: string | undefined;
3112
+ }
3113
+ /**
3114
+ * The inputs {@link PnpmSettings.fromSourcesResult} merges.
3115
+ *
3116
+ * @public
3117
+ */
3118
+ interface PnpmSettingsSources {
3119
+ /** The workspace root's `pnpm-workspace.yaml`. */
3120
+ readonly workspace?: PnpmSettingsSource | undefined;
3121
+ /** pnpm's global `config.yaml`. */
3122
+ readonly global?: PnpmSettingsSource | undefined;
3123
+ /** The environment, read for `pnpm_config_*` and `PNPM_CONFIG_*` variables. */
3124
+ readonly env?: Readonly<Record<string, string | undefined>> | undefined;
3125
+ }
3126
+ /**
3127
+ * Options for {@link PnpmSettings.load}.
3128
+ *
3129
+ * @public
3130
+ */
3131
+ interface PnpmSettingsLoadOptions {
3132
+ /**
3133
+ * Where pnpm would run. The workspace file is the nearest
3134
+ * `pnpm-workspace.yaml` at or above its real path, when this directory
3135
+ * belongs to that workspace, unless the environment names a workspace
3136
+ * directory (`PNPM_CONFIG_WORKSPACE_DIR`, then `NPM_CONFIG_WORKSPACE_DIR`,
3137
+ * each in either case). See {@link PnpmSettings.load} for the membership
3138
+ * rule.
3139
+ */
3140
+ readonly cwd: string;
3141
+ /**
3142
+ * The environment, as a plain record (pass `process.env` at the edge). Read
3143
+ * for `pnpm_config_*` settings, the workspace-directory override,
3144
+ * `XDG_CONFIG_HOME`, `LOCALAPPDATA` and `HOME`.
3145
+ */
3146
+ readonly env: Readonly<Record<string, string | undefined>>;
3147
+ /**
3148
+ * The platform pnpm runs on (pass `process.platform` at the edge). It picks
3149
+ * pnpm's default global config directory when `XDG_CONFIG_HOME` is unset:
3150
+ * `~/Library/Preferences/pnpm` on `"darwin"`, `%LOCALAPPDATA%\pnpm\config`
3151
+ * on `"win32"`, `~/.config/pnpm` elsewhere.
3152
+ */
3153
+ readonly platform: string;
3154
+ /**
3155
+ * The home directory. Defaults to `env.HOME`, then `env.USERPROFILE`; with
3156
+ * neither, and no `XDG_CONFIG_HOME` (or `LOCALAPPDATA` on win32), no global
3157
+ * config file is read.
3158
+ */
3159
+ readonly home?: string | undefined;
3160
+ /**
3161
+ * pnpm's global config directory, holding `config.yaml`. Overrides the
3162
+ * directory derived from the environment and platform.
3163
+ */
3164
+ readonly globalConfigDir?: string | undefined;
3165
+ }
3166
+ declare const PnpmSettings_base: Schema.Class<PnpmSettings, Schema.Struct<{
3167
+ /** The environment's pnpm settings, keyed by camelCase name, as written. */
3168
+ readonly environment: Schema.$Record<Schema.String, Schema.String>;
3169
+ /** The top-level settings of the workspace's `pnpm-workspace.yaml`. */
3170
+ readonly workspace: Schema.$Record<Schema.String, Schema.Unknown>;
3171
+ /** The top-level settings of pnpm's global `config.yaml`. */
3172
+ readonly global: Schema.$Record<Schema.String, Schema.Unknown>;
3173
+ /** The settings files that were read, lowest precedence first. */
3174
+ readonly files: Schema.$Array<Schema.String>;
3175
+ }>, {}>;
3176
+ /**
3177
+ * pnpm's effective settings: the values `pnpm config get <key>` reports for a
3178
+ * pnpm setting, merged from the sources pnpm reads with pnpm's precedence.
3179
+ *
3180
+ * @remarks
3181
+ * Build one with {@link PnpmSettings.load} (finds and reads the files through
3182
+ * `FileSystem`) or {@link PnpmSettings.fromSourcesResult} (from text you
3183
+ * already hold), then read a setting by name:
3184
+ *
3185
+ * ```ts
3186
+ * settings.minimumReleaseAge; // Option<number>
3187
+ * settings.minimumReleaseAgeExclude; // ReadonlyArray<string>
3188
+ * settings.getBoolean("minimumReleaseAgeStrict");
3189
+ * ```
3190
+ *
3191
+ * **Precedence, highest first**: a `pnpm_config_<name>` or
3192
+ * `PNPM_CONFIG_<NAME>` environment variable, the workspace root's
3193
+ * `pnpm-workspace.yaml`, then pnpm's global `config.yaml`. A higher source
3194
+ * replaces a lower one's value whole; lists are not merged. This is the order
3195
+ * pnpm 11 and pnpm 12 apply to settings such as `minimumReleaseAge` and
3196
+ * `minimumReleaseAgeExclude`.
3197
+ *
3198
+ * **What pnpm does not read for a pnpm setting, this does not read either.**
3199
+ * `.npmrc` files (project, user and global), `npm_config_*` variables and
3200
+ * the old global `rc` file carry no pnpm setting for pnpm 11 and 12: pnpm
3201
+ * takes only registry and auth keys from `.npmrc`. A registry or a credential
3202
+ * is `@effected/npm`'s `NpmConfig`, not this. Command-line `--config.*`
3203
+ * flags, pnpm's built-in defaults (`minimumReleaseAge` reads as unset here,
3204
+ * as `pnpm config get` reports it, though pnpm applies a default when it
3205
+ * installs), and the per-setting source restrictions pnpm applies to a few
3206
+ * machine-level settings (a `pnpm-workspace.yaml` cannot set `globalDir`, for
3207
+ * example) are not modelled.
3208
+ *
3209
+ * **Keys.** Every accessor takes the camelCase name pnpm writes in YAML
3210
+ * (`minimumReleaseAge`) or the kebab-case one an npmrc would use
3211
+ * (`minimum-release-age`); both name the same setting. An environment
3212
+ * variable names a setting in snake case: `pnpm_config_minimum_release_age`
3213
+ * all lowercase, or `PNPM_CONFIG_MINIMUM_RELEASE_AGE` all uppercase. A mixed
3214
+ * spelling is not a pnpm setting and is ignored, and an empty value is unset.
3215
+ * When both spellings are set, the uppercase one wins, as in pnpm 12.
3216
+ *
3217
+ * **Typed reads.** An environment value is text, read as the type the
3218
+ * accessor asks for: a number as a canonical decimal, a boolean as `true` or
3219
+ * `false`, a list as a JSON array of strings. An environment value that does
3220
+ * not read as that type is skipped, and the next source answers, as pnpm 12
3221
+ * skips it. In a file, pnpm 12 coerces boolean words (`yes`, `on`, `"true"`)
3222
+ * and digit strings (`"15"`), and so does this. A file value that still does
3223
+ * not read as the type answers `None` instead of falling through, because
3224
+ * pnpm 12 refuses to load a file with a mistyped setting; {@link
3225
+ * PnpmSettings.get} shows the raw value. A `null` in a file is unset.
3226
+ *
3227
+ * @example
3228
+ * ```ts
3229
+ * import { PnpmSettings } from "@effected/workspaces";
3230
+ * import { Effect, Option } from "effect";
3231
+ *
3232
+ * const cutoffMinutes = Effect.gen(function* () {
3233
+ * const settings = yield* PnpmSettings.load({
3234
+ * cwd: process.cwd(),
3235
+ * env: process.env,
3236
+ * platform: process.platform,
3237
+ * });
3238
+ * // Unset means pnpm's own default, 1440 minutes, not an open gate.
3239
+ * return Option.getOrElse(settings.minimumReleaseAge, () => 1440);
3240
+ * });
3241
+ * ```
3242
+ *
3243
+ * @public
3244
+ */
3245
+ export declare class PnpmSettings extends PnpmSettings_base {
3246
+ /**
3247
+ * A setting's raw value from the highest source that sets it, or `None`.
3248
+ *
3249
+ * @remarks
3250
+ * An environment value is the string as written; a file value is the
3251
+ * decoded YAML (a number, a list, a mapping). Use the typed accessors to
3252
+ * read it as a type.
3253
+ *
3254
+ * @param key - The setting, camelCase or kebab-case.
3255
+ */
3256
+ get(key: string): Option.Option<unknown>;
3257
+ /**
3258
+ * Which source {@link PnpmSettings.get} answers a setting from, or `None`
3259
+ * when no source sets it.
3260
+ *
3261
+ * @param key - The setting, camelCase or kebab-case.
3262
+ */
3263
+ origin(key: string): Option.Option<PnpmSettingOrigin>;
3264
+ /**
3265
+ * A string setting: an environment value as written, or a string in a file.
3266
+ *
3267
+ * @param key - The setting, camelCase or kebab-case.
3268
+ */
3269
+ getString(key: string): Option.Option<string>;
3270
+ /**
3271
+ * A numeric setting: a finite number, or a canonical decimal string, in any
3272
+ * source.
3273
+ *
3274
+ * @remarks
3275
+ * A canonical decimal is an optional `-`, digits with no leading zero, and
3276
+ * an optional fraction: `05`, `+5`, `0x10`, `1e2` and `1_000` are not
3277
+ * numbers here, as pnpm 12 does not read them from the environment. An
3278
+ * integer setting such as {@link PnpmSettings.minimumReleaseAge} is
3279
+ * stricter still.
3280
+ *
3281
+ * @param key - The setting, camelCase or kebab-case.
3282
+ */
3283
+ getNumber(key: string): Option.Option<number>;
3284
+ /**
3285
+ * A boolean setting: `true` or `false` in the environment, a YAML boolean
3286
+ * or a boolean word in a file.
3287
+ *
3288
+ * @remarks
3289
+ * In a file, the strings `true`, `yes`, `y` and `on` read as `true` and
3290
+ * `false`, `no`, `n` and `off` as `false`, trimmed and in any case, as
3291
+ * pnpm 12 coerces them. A number (`1`, `0`) or any other string answers
3292
+ * `None`; pnpm 12 refuses it as an invalid boolean. The environment is
3293
+ * stricter: only `true` or `false`, trimmed and lowercase.
3294
+ *
3295
+ * @param key - The setting, camelCase or kebab-case.
3296
+ */
3297
+ getBoolean(key: string): Option.Option<boolean>;
3298
+ /**
3299
+ * A list setting: a JSON array of strings in the environment, a YAML list
3300
+ * of strings in a file.
3301
+ *
3302
+ * @remarks
3303
+ * A comma-separated environment value is not a list: pnpm 12 ignores it,
3304
+ * and this skips it to the next source.
3305
+ *
3306
+ * @param key - The setting, camelCase or kebab-case.
3307
+ */
3308
+ getStringArray(key: string): Option.Option<ReadonlyArray<string>>;
3309
+ /**
3310
+ * `minimumReleaseAge`: the minutes a version must have been published before
3311
+ * pnpm installs it, or `None` when no source sets it. `None` is not an
3312
+ * open gate: pnpm then applies its built-in default of 1440 minutes.
3313
+ *
3314
+ * @remarks
3315
+ * Only a non-negative safe integer counts, as pnpm 12 reads the setting
3316
+ * (an unsigned 64-bit integer, here bounded by `Number.MAX_SAFE_INTEGER`).
3317
+ * Text, in the environment or a quoted file value, must be canonical digits
3318
+ * once trimmed: `" 30 "` reads as 30, while `05`, `+5`, `-0`, `5.0`, `0x10`
3319
+ * and `1e2` do not read at all. Such an environment value is skipped to the
3320
+ * next source; such a file value answers `None`. A YAML number is read as
3321
+ * decoded, so an unquoted `5.0` or `1e2` in a file reads as 5 or 100 where
3322
+ * pnpm 12 refuses the file.
3323
+ */
3324
+ get minimumReleaseAge(): Option.Option<number>;
3325
+ /**
3326
+ * `minimumReleaseAgeExclude`: the package patterns exempt from
3327
+ * {@link PnpmSettings.minimumReleaseAge}, empty when no source sets them.
3328
+ *
3329
+ * @remarks
3330
+ * An explicitly empty list in a higher source shadows a lower source's
3331
+ * entries, as in pnpm.
3332
+ */
3333
+ get minimumReleaseAgeExclude(): ReadonlyArray<string>;
3334
+ /**
3335
+ * The typed read every accessor shares: an environment value that does not
3336
+ * parse falls through; the first file that sets the key decides.
3337
+ */
3338
+ private read;
3339
+ /**
3340
+ * Merges pnpm's settings sources, with no IO.
3341
+ *
3342
+ * @remarks
3343
+ * Parses each YAML file, keeps the environment's `pnpm_config_*` and
3344
+ * `PNPM_CONFIG_*` variables, and records the named files in
3345
+ * `PnpmSettings.files`. Fails `"parse"` for a file that is not YAML
3346
+ * and `"shape"` for one whose document is not a mapping.
3347
+ *
3348
+ * @param sources - The workspace file, the global file and the environment.
3349
+ */
3350
+ static fromSourcesResult(sources: PnpmSettingsSources): Result.Result<PnpmSettings, PnpmSettingsError>;
3351
+ /**
3352
+ * Loads the settings pnpm would use when run in `options.cwd`.
3353
+ *
3354
+ * @remarks
3355
+ * The workspace file is found as pnpm finds it. When a
3356
+ * `PNPM_CONFIG_WORKSPACE_DIR` / `NPM_CONFIG_WORKSPACE_DIR` variable names a
3357
+ * directory (resolved against `cwd`), its `pnpm-workspace.yaml` is the
3358
+ * file, unconditionally. Otherwise `cwd` is resolved through
3359
+ * `FileSystem.realPath` (the lexical path when that fails, as in pnpm), and
3360
+ * the nearest `pnpm-workspace.yaml` at or above it is taken. A misnamed
3361
+ * manifest (`pnpm-workspace.yml`, `.pnpm-workspace.yaml`) is not a
3362
+ * workspace manifest and the ascent passes it, as pnpm 12 does; pnpm 11
3363
+ * refuses to run below one. That workspace applies only when `cwd` belongs
3364
+ * to it: `cwd`
3365
+ * is its root, `cwd` holds no project manifest (`package.json`,
3366
+ * `package.json5` or `package.yaml`), or `cwd` matches the manifest's
3367
+ * `packages:` patterns. A manifest with no `packages:` key has the root as
3368
+ * its only member, so a nested project with its own `package.json` (an
3369
+ * example app, a fixture) reads no workspace file, exactly as pnpm skips
3370
+ * it. A directory under `node_modules` or `bower_components` is never a
3371
+ * member.
3372
+ *
3373
+ * The global file is `config.yaml` in pnpm's global config directory:
3374
+ * {@link PnpmSettingsLoadOptions.globalConfigDir}, else
3375
+ * `$XDG_CONFIG_HOME/pnpm`, else the platform default (see
3376
+ * {@link PnpmSettingsLoadOptions.platform}). A file that does not exist is
3377
+ * skipped; one that cannot be read fails `"read"` (so does a project
3378
+ * manifest probe that fails other than not-found), and one that does not
3379
+ * parse fails as {@link PnpmSettings.fromSourcesResult} does.
3380
+ *
3381
+ * @param options - See {@link PnpmSettingsLoadOptions}.
3382
+ */
3383
+ static readonly load: (options: PnpmSettingsLoadOptions) => Effect.Effect<PnpmSettings, PnpmSettingsError, FileSystem.FileSystem | Path.Path>;
3384
+ }
3065
3385
  declare const PublishTarget_base: Schema.Class<PublishTarget, Schema.Struct<{
3066
3386
  /** The package name being published. */
3067
3387
  readonly name: Schema.NonEmptyString;
@@ -5074,5 +5394,5 @@ export declare const detectPackageManagerSync: (root: string, options: Workspace
5074
5394
  * @public
5075
5395
  */
5076
5396
  export declare const localExecContextSync: (cwd: string, options: FindWorkspaceRootSyncOptions) => Result.Result<Option.Option<ExecContext>, LocalExecError>;
5077
- export type { CatalogAssemblyFailure, ChangeDetectionFailure, ChangeDetectorShape, ClassifyOptions, ConfigDependencyHooksShape, DependencyDiff, DuplicateCheckOptions, FindWorkspaceRootOptions, FindWorkspaceRootSyncOptions, GetWorkspacePackagesSyncOptions, HookInjection, HookReplay, HookReplayContext, HookReplaySource, ImporterVersions, LockfileReadFailure, LockfileReaderOptions, LockfileReaderShape, PackageManagerDetectionFailure, PackageManagerDetectorShape, PackageRelease, PeerCheckOptions, PeerDependencyRules, 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 };
5397
+ export type { CatalogAssemblyFailure, ChangeDetectionFailure, ChangeDetectorShape, ClassifyOptions, ConfigDependencyHooksShape, DependencyDiff, DuplicateCheckOptions, FindWorkspaceRootOptions, FindWorkspaceRootSyncOptions, GetWorkspacePackagesSyncOptions, HookInjection, HookReplay, HookReplayContext, HookReplaySource, ImporterVersions, LockfileReadFailure, LockfileReaderOptions, LockfileReaderShape, PackageManagerDetectionFailure, PackageManagerDetectorShape, PackageRelease, PeerCheckOptions, PeerDependencyRules, PnpmSettingOrigin, PnpmSettingsLoadOptions, PnpmSettingsSource, PnpmSettingsSources, 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 };
5078
5398
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -6,6 +6,7 @@ import { Dependent, DuplicateCheck, DuplicateInstance, DuplicatedPackage, Duplic
6
6
  import { LockfileReadError, LockfileReader } from "./LockfileReader.js";
7
7
  import { DetectedPackageManager, PackageManagerDetectionError, PackageManagerDetector, PackageManagerEvidence, PackageManagerName } from "./PackageManagerName.js";
8
8
  import { PeerCheck, PeerParent, UnsatisfiedPeer } from "./PeerCheck.js";
9
+ import { PnpmSettings, PnpmSettingsError } from "./PnpmSettings.js";
9
10
  import { PublishTarget, PublishabilityDetector } from "./Publishability.js";
10
11
  import { ReleaseTag, TagStyle, TrackingTag, classifyTag } from "./ReleaseTag.js";
11
12
  import { VersioningStrategy, VersioningStrategyType } from "./VersioningStrategy.js";
@@ -19,4 +20,4 @@ import { PackageStateSnapshot, WorkspaceStateSnapshot } from "./WorkspaceStateSn
19
20
  import { Workspaces } from "./Workspaces.js";
20
21
  import { detectPackageManagerSync, findWorkspaceRootSync, getWorkspacePackagesSync, localExecContextSync, locateWorkspaceRootSync } from "./WorkspacesSync.js";
21
22
 
22
- export { CatalogSet, ChangeDetectionError, ChangeDetectionOptions, ChangeDetector, ConfigDependencyHooks, ConfigDependencySpec, CyclicDependencyError, DependencyGraph, Dependent, DetectedPackageManager, DuplicateCheck, DuplicateInstance, DuplicatedPackage, DuplicatedVersion, InvalidConfigDependencySpecError, LockfileReadError, LockfileReader, NoPeerDependencyRules, PackageManagerDetectionError, PackageManagerDetector, PackageManagerEvidence, PackageManagerName, PackageNotFoundError, PackageStateSnapshot, PeerCheck, PeerParent, PublishConfig, PublishTarget, PublishabilityDetector, ReleaseTag, TagStyle, TrackingTag, UnsatisfiedPeer, VersioningStrategy, VersioningStrategyType, WORKSPACE_MARKERS, WorkspaceCatalogs, WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspaceInfo, WorkspaceManifestError, WorkspaceMarker, WorkspacePackage, WorkspacePatternError, WorkspaceRoot, WorkspaceRootMatch, WorkspaceRootNotFoundError, WorkspaceSnapshots, WorkspaceStateSnapshot, Workspaces, classifyTag, detectPackageManagerSync, findWorkspaceRootSync, getWorkspacePackagesSync, localExecContextSync, locateWorkspaceRootSync };
23
+ export { CatalogSet, ChangeDetectionError, ChangeDetectionOptions, ChangeDetector, ConfigDependencyHooks, ConfigDependencySpec, CyclicDependencyError, DependencyGraph, Dependent, DetectedPackageManager, DuplicateCheck, DuplicateInstance, DuplicatedPackage, DuplicatedVersion, InvalidConfigDependencySpecError, LockfileReadError, LockfileReader, NoPeerDependencyRules, PackageManagerDetectionError, PackageManagerDetector, PackageManagerEvidence, PackageManagerName, PackageNotFoundError, PackageStateSnapshot, PeerCheck, PeerParent, PnpmSettings, PnpmSettingsError, PublishConfig, PublishTarget, PublishabilityDetector, ReleaseTag, TagStyle, TrackingTag, UnsatisfiedPeer, VersioningStrategy, VersioningStrategyType, WORKSPACE_MARKERS, WorkspaceCatalogs, WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspaceInfo, WorkspaceManifestError, WorkspaceMarker, WorkspacePackage, WorkspacePatternError, WorkspaceRoot, WorkspaceRootMatch, WorkspaceRootNotFoundError, WorkspaceSnapshots, WorkspaceStateSnapshot, Workspaces, classifyTag, detectPackageManagerSync, findWorkspaceRootSync, getWorkspacePackagesSync, localExecContextSync, locateWorkspaceRootSync };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/workspaces",
3
- "version": "0.42.0",
3
+ "version": "0.44.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,14 +53,14 @@
53
53
  "dependencies": {
54
54
  "@effected/commands": "^0.20.0",
55
55
  "@effected/git": "^0.30.0",
56
- "@effected/glob": "^0.18.0",
57
- "@effected/jsonc": "^0.23.0",
58
- "@effected/lockfiles": "^0.22.0",
59
- "@effected/npm": "^0.30.0",
60
- "@effected/package-json": "^0.29.0",
61
- "@effected/semver": "^0.21.0",
62
- "@effected/walker": "^0.25.0",
63
- "@effected/yaml": "^0.28.0",
56
+ "@effected/glob": "^0.20.0",
57
+ "@effected/jsonc": "^0.24.0",
58
+ "@effected/lockfiles": "^0.23.0",
59
+ "@effected/npm": "^0.31.0",
60
+ "@effected/package-json": "^0.31.0",
61
+ "@effected/semver": "^0.22.0",
62
+ "@effected/walker": "^0.26.0",
63
+ "@effected/yaml": "^0.29.0",
64
64
  "@pnpm/catalogs.config": "^1100.0.5",
65
65
  "@pnpm/catalogs.protocol-parser": "^1100.0.0",
66
66
  "@pnpm/catalogs.resolver": "^1100.0.0",