@effected/bundler 0.4.1 → 0.6.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/index.d.ts CHANGED
@@ -7,11 +7,12 @@
7
7
  * @public
8
8
  */
9
9
  import { BUNDLE_MANIFEST_FILENAME, BundleManifest, BundleManifest as BundleManifest$1, BundleManifestError, KNOWN_REGISTRY_TYPES, KnownRegistryType, MANIFEST_SPEC, ManifestSource, ManifestSource as ManifestSource$1, OpenGraphConfig, OpenGraphImage, OpenGraphImage as OpenGraphImage$1, ProjectIdentity, RegistryRef, RegistryRef as RegistryRef$1, SbomRef, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType } from "@effected/manifest";
10
- import { Context, Effect, FileSystem, Layer, Path, PlatformError, Schema } from "effect";
10
+ import { Cause, Context, Effect, FileSystem, Layer, Path, PlatformError, Schema } from "effect";
11
11
  import { Plugin } from "rolldown";
12
+ import { DescendError } from "@effected/walker";
13
+ import { CatalogAssemblyError, DependencyResolutionError, ManifestDecodeError, UnresolvedDependencyError } from "@effected/npm";
12
14
  import { WorkspaceDiscovery } from "@effected/workspaces";
13
15
  import { AppendError, JournalWatcher, JsonlEvent } from "@effected/jsonl";
14
- import { DescendError } from "@effected/walker";
15
16
  declare const ActionWorker_base: Schema.Class<ActionWorker, Schema.Struct<{
16
17
  /** The worker's source, relative to the package. */
17
18
  readonly source: Schema.String;
@@ -1659,7 +1660,7 @@ interface MetaResult {
1659
1660
  readonly apiJsonPath: string;
1660
1661
  readonly apiJsonFilename: string;
1661
1662
  }
1662
- declare const BundleManifestSourceError_base: 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 & {
1663
+ declare const BundleManifestSourceError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
1663
1664
  readonly _tag: "BundleManifestSourceError";
1664
1665
  } & Readonly<A>;
1665
1666
  /**
@@ -1696,13 +1697,13 @@ interface BundleManifestSources {
1696
1697
  }
1697
1698
  /**
1698
1699
  * Read the leaf (`<cwd>/bundle.json`) and project (`<workspaceRoot>/bundle.json`)
1699
- * source tiers. Absence is normal; a present file that does not decode throws
1700
+ * source tiers. Absence is normal; a present file that does not decode fails
1700
1701
  * {@link BundleManifestSourceError}. A package that IS the workspace root reads its file once, as the
1701
1702
  * leaf, and has no project tier.
1702
1703
  *
1703
1704
  * @public
1704
1705
  */
1705
- export declare function loadBundleManifestSources(cwd: string): Promise<BundleManifestSources>;
1706
+ export declare const loadBundleManifestSources: (cwd: string) => Effect.Effect<BundleManifestSources, BundleManifestSourceError | PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
1706
1707
  /**
1707
1708
  * Options for the meta-pass orchestrator.
1708
1709
  *
@@ -2357,9 +2358,12 @@ interface BuildTargetGroupsOptions {
2357
2358
  * node_modules dependency to its own sibling file (mirroring its `node_modules/...` path),
2358
2359
  * which `npm pack` then strips, breaking the "self-contained" promise `bundleNodeModules`
2359
2360
  * already makes. Scoped to that flag alone; every other build's JS pass is unaffected.
2361
+ *
2362
+ * The bundler's own reads and writes (the manifest, the tsconfigs, the stubs, `public/`) go through `FileSystem` and
2363
+ * `Path`; tsdown always works on the host disk. A tsdown rejection is a defect, carrying the thrown value.
2360
2364
  * @public
2361
2365
  */
2362
- export declare function buildTargetGroups(options: BuildTargetGroupsOptions): Promise<void>;
2366
+ export declare const buildTargetGroups: (options: BuildTargetGroupsOptions) => Effect.Effect<void, ConfigValidationError | PlatformError.PlatformError | DescendError, FileSystem.FileSystem | Path.Path>;
2363
2367
  /**
2364
2368
  * Which release versions a target receives: every version, only final versions, or only prereleases.
2365
2369
  *
@@ -2583,6 +2587,12 @@ interface ManifestLike {
2583
2587
  optionalDependencies?: Record<string, string>;
2584
2588
  [k: string]: unknown;
2585
2589
  }
2590
+ /**
2591
+ * The failures of {@link resolveManifest}.
2592
+ *
2593
+ * @public
2594
+ */
2595
+ type ResolveManifestError = ManifestDecodeError | CatalogAssemblyError | DependencyResolutionError | UnresolvedDependencyError;
2586
2596
  /**
2587
2597
  * Resolve every `catalog:`/`workspace:` specifier in a manifest to a concrete spec,
2588
2598
  * delegating to `@effected/workspaces`' one-shot `Workspaces.resolveManifest`. The
@@ -2591,13 +2601,13 @@ interface ManifestLike {
2591
2601
  * config-dependency hook-replay + lockfile), so no transient
2592
2602
  * `.pnpm-workspace-state-v1.json` is required.
2593
2603
  *
2594
- * Rejects with `ManifestDecodeError` when a dependency field is not a string-to-string
2604
+ * Fails with `ManifestDecodeError` when a dependency field is not a string-to-string
2595
2605
  * record, `UnresolvedDependencyError` on a specifier the workspace cannot answer, or
2596
2606
  * `CatalogAssemblyError`/`DependencyResolutionError` when catalog assembly or the
2597
2607
  * resolution mechanism itself fails.
2598
2608
  * @public
2599
2609
  */
2600
- export declare function resolveManifest(pkg: ManifestLike, cwd: string): Promise<ManifestLike>;
2610
+ export declare const resolveManifest: (pkg: ManifestLike, cwd: string) => Effect.Effect<ManifestLike, ResolveManifestError, FileSystem.FileSystem | Path.Path>;
2601
2611
  /**
2602
2612
  * Result of resolving next release versions for a workspace.
2603
2613
  *
@@ -2615,12 +2625,12 @@ interface NextVersions {
2615
2625
  * Walks up from `cwd` to the monorepo root via `@effected/workspaces`' `WorkspaceDiscovery`,
2616
2626
  * seeds the map with each package's CURRENT version, then overlays `newVersion` for
2617
2627
  * changeset-affected packages via `ReleasePlan.read`, including pre-release versions in pre
2618
- * mode and fixed or linked groups. Never rejects: any failure (not a workspace, missing
2628
+ * mode and fixed or linked groups. Never fails: any failure (not a workspace, missing
2619
2629
  * `.changeset/config.json`, an invalid config or `pre.json`, parse error) degrades to current
2620
2630
  * versions (or an empty map).
2621
2631
  * @public
2622
2632
  */
2623
- export declare function resolveNextVersions(cwd: string): Promise<NextVersions>;
2633
+ export declare const resolveNextVersions: (cwd: string) => Effect.Effect<NextVersions, never, FileSystem.FileSystem | Path.Path>;
2624
2634
  declare const EffectedConfigError_base: Schema.Class<EffectedConfigError, Schema.TaggedStruct<"EffectedConfigError", {
2625
2635
  /** The file at fault. */
2626
2636
  readonly path: Schema.String;
@@ -2692,6 +2702,40 @@ export declare class EffectedConfigFile {
2692
2702
  readonly root?: string;
2693
2703
  }) => Effect.Effect<ResolvedEffectedConfig, EffectedConfigError, FileSystem.FileSystem | Path.Path | WorkspaceDiscovery>;
2694
2704
  }
2705
+ /**
2706
+ * Where the `effected.toml` JSON Schema is published, as data.
2707
+ *
2708
+ * @remarks
2709
+ * One place for the identity, so the document the repository builds and the
2710
+ * `#:schema` directive a scaffold writes can never name different URLs. `host`
2711
+ * is the input to `@effected/schemastore`'s `HostedSchema.github`, whose
2712
+ * derived `$id` is `url`. `directive` is the first line of an `effected.toml`
2713
+ * that points tombi, taplo and other TOML editors at the schema; tombi wants a
2714
+ * blank line after it.
2715
+ *
2716
+ * @example
2717
+ * ```ts
2718
+ * import { EffectedConfigSchema } from "@effected/bundler";
2719
+ *
2720
+ * const toml = `${EffectedConfigSchema.directive}\n\n[action.entries]\nmain = "src/main.ts"\n`;
2721
+ * ```
2722
+ *
2723
+ * @public
2724
+ */
2725
+ export declare const EffectedConfigSchema: {
2726
+ /** The `HostedSchema.github` input that publishes the document. */
2727
+ readonly host: {
2728
+ readonly repo: "spencerbeggs/effected";
2729
+ readonly path: "schemas";
2730
+ readonly name: "config";
2731
+ readonly versions: readonly ["1.0"];
2732
+ readonly appendVersion: false;
2733
+ };
2734
+ /** The document's canonical URL, its `$id`. */
2735
+ readonly url: "https://raw.githubusercontent.com/spencerbeggs/effected/main/schemas/1.0/config.json";
2736
+ /** The `#:schema` directive line naming {@link EffectedConfigSchema.url}. */
2737
+ readonly directive: "#:schema https://raw.githubusercontent.com/spencerbeggs/effected/main/schemas/1.0/config.json";
2738
+ };
2695
2739
  /**
2696
2740
  * Merges a package's raw `effected.toml` document over the workspace root's.
2697
2741
  *
@@ -2851,7 +2895,7 @@ interface ResolvedTsconfig {
2851
2895
  *
2852
2896
  * @remarks
2853
2897
  * Resolves the package's own `<cwd>/tsconfig.json` (which extends the shared
2854
- * `ecma.json` base) through `@effected/tsconfig-json`'s `TsconfigLoaderSync`, so the
2898
+ * `ecma.json` base) through `@effected/tsconfig-json`'s `TsconfigLoader`, so the
2855
2899
  * result carries the package's real effective options — target, module, lib, strict,
2856
2900
  * jsx — with `${configDir}` already substituted to absolute paths. Only the dts-pass
2857
2901
  * overlay (composite/incremental/tsBuildInfoFile forced off, declarationMap forced on)
@@ -2863,13 +2907,13 @@ interface ResolvedTsconfig {
2863
2907
  *
2864
2908
  * @public
2865
2909
  */
2866
- export declare function buildResolvedTsconfig(options: ResolvedTsconfigOptions): ResolvedTsconfig;
2910
+ export declare const buildResolvedTsconfig: (options: ResolvedTsconfigOptions) => Effect.Effect<ResolvedTsconfig, Error, FileSystem.FileSystem | Path.Path>;
2867
2911
  /**
2868
2912
  * Write the resolved tsconfig to a temp file and return its absolute path.
2869
2913
  *
2870
2914
  * @public
2871
2915
  */
2872
- export declare function writeResolvedTsconfig(options: ResolvedTsconfigOptions): string;
2916
+ export declare const writeResolvedTsconfig: (options: ResolvedTsconfigOptions) => Effect.Effect<string, Error | PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
2873
2917
  /**
2874
2918
  * What a dts-emit tsconfig adds for one partition.
2875
2919
  *
@@ -2907,7 +2951,7 @@ interface DtsEmitTsconfigOptions {
2907
2951
  * manifest says, never through a typecheck-only condition or path alias that would pull source files into the
2908
2952
  * emitted declarations. The one exception is `options.paths`, the bundled workspace siblings resolved to their built
2909
2953
  * declarations, which is the only `paths` map this file ever carries. The only reader of this file is the tsgo
2910
- * declaration generator; nothing in the bundler reads it back through the kit's `TsconfigLoaderSync`, which rejects
2954
+ * declaration generator; nothing in the bundler reads it back through the kit's `TsconfigLoader`, which rejects
2911
2955
  * `null` compiler options.
2912
2956
  *
2913
2957
  * Best-effort: if the base tsconfig cannot be read or parsed (e.g. a synthetic test path that was
@@ -2916,7 +2960,7 @@ interface DtsEmitTsconfigOptions {
2916
2960
  *
2917
2961
  * @public
2918
2962
  */
2919
- export declare function writeDtsEmitTsconfig(resolvedTsconfigPath: string, options?: DtsEmitTsconfigOptions): string;
2963
+ export declare const writeDtsEmitTsconfig: (resolvedTsconfigPath: string, options?: DtsEmitTsconfigOptions) => Effect.Effect<string, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
2920
2964
  /** @public */
2921
2965
  interface PackageJsonLike {
2922
2966
  readonly exports?: unknown;
@@ -3010,17 +3054,15 @@ export declare function assertNoEntryCollisions(jsEntryNames: ReadonlyArray<stri
3010
3054
  export declare function deriveExportPaths(entries: Record<string, string>, exportsMap: Record<string, string> | undefined): Record<string, string>;
3011
3055
  /** @public */
3012
3056
  interface PackageJsonEntriesOptions extends ExtractOptions {
3013
- /** In-memory package.json. If omitted, reads `<cwd>/package.json`. */
3014
- readonly pkg?: PackageJsonLike;
3015
- /** Working directory for reading package.json. Defaults to process.cwd(). */
3016
- readonly cwd?: string;
3057
+ /** The package.json to derive entries from, already read. */
3058
+ readonly pkg: PackageJsonLike;
3017
3059
  }
3018
3060
  /**
3019
3061
  * Derive a tsdown `entry` record (name to source path) from a package.json.
3020
3062
  *
3021
3063
  * @public
3022
3064
  */
3023
- export declare function packageJsonEntries(options?: PackageJsonEntriesOptions): Record<string, string>;
3065
+ export declare function packageJsonEntries(options: PackageJsonEntriesOptions): Record<string, string>;
3024
3066
  /**
3025
3067
  * The exact filename `@tsdown/exe` emits for a SEA target, mirroring tsdown's
3026
3068
  * `resolveOutputFileName`: base fileName + `-<platform>-<arch>` + `.exe` on win.
@@ -3279,6 +3321,11 @@ interface BuildEmittedManifestOptions {
3279
3321
  readonly exeRewrite?: ExeRewrite | undefined;
3280
3322
  /** Whether the dts pass ran; `false` omits `types` conditions from the emitted manifest (issue #198). Defaults to `true`. */
3281
3323
  readonly emitDts?: boolean | undefined;
3324
+ /**
3325
+ * Whether the JS pass inlined a package by `bundle` in every partition. Such a package is removed from the emitted
3326
+ * `dependencies` and `optionalDependencies`, since the published files already hold its code.
3327
+ */
3328
+ readonly bundled?: ((name: string) => boolean) | undefined;
3282
3329
  }
3283
3330
  /**
3284
3331
  * Whether any of `pkg`'s four dependency fields carries at least one `catalog:`/`workspace:`
@@ -3293,7 +3340,7 @@ export declare function manifestNeedsCatalogResolution(pkg: Json): boolean;
3293
3340
  *
3294
3341
  * @public
3295
3342
  */
3296
- export declare function buildEmittedManifest(options: BuildEmittedManifestOptions): Promise<Json>;
3343
+ export declare const buildEmittedManifest: (options: BuildEmittedManifestOptions) => Effect.Effect<Json, ConfigValidationError | ResolveManifestError, FileSystem.FileSystem | Path.Path>;
3297
3344
  /** @public */
3298
3345
  interface EmitManifestOptions {
3299
3346
  readonly targetGroup: TargetGroupRef;
@@ -3312,13 +3359,22 @@ interface EmitManifestOptions {
3312
3359
  readonly exeRewrite?: ExeRewrite | undefined;
3313
3360
  /** Whether the dts pass ran; `false` omits `types` conditions from the emitted manifest (issue #198). Defaults to `true`. */
3314
3361
  readonly emitDts?: boolean | undefined;
3362
+ /**
3363
+ * Whether the JS pass inlined a package by `bundle` in every partition. Such a package is removed from the emitted
3364
+ * `dependencies` and `optionalDependencies`, since the published files already hold its code.
3365
+ */
3366
+ readonly bundled?: ((name: string) => boolean) | undefined;
3315
3367
  }
3316
3368
  /**
3317
3369
  * Rolldown plugin: emit the transformed package.json + LICENSE/README into the output pkg/ root.
3318
3370
  *
3371
+ * @remarks
3372
+ * rolldown calls `generateBundle` as a plain async hook, so the plugin captures the `FileSystem` and `Path` it is
3373
+ * built under and runs its reads with them.
3374
+ *
3319
3375
  * @public
3320
3376
  */
3321
- export declare function emitManifest(options: EmitManifestOptions): Plugin;
3377
+ export declare const emitManifest: (options: EmitManifestOptions) => Effect.Effect<Plugin, never, FileSystem.FileSystem | Path.Path>;
3322
3378
  declare const OgGenerateError_base: 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 & {
3323
3379
  readonly _tag: "OgGenerateError";
3324
3380
  } & Readonly<A>;
@@ -3385,7 +3441,7 @@ interface WriteGeneratedOgImageOptions {
3385
3441
  *
3386
3442
  * @public
3387
3443
  */
3388
- export declare function writeGeneratedOgImage(options: WriteGeneratedOgImageOptions): Promise<OpenGraphImage$1>;
3444
+ export declare const writeGeneratedOgImage: (options: WriteGeneratedOgImageOptions) => Effect.Effect<OpenGraphImage$1, OgGenerateError, FileSystem.FileSystem | Path.Path>;
3389
3445
  /**
3390
3446
  * Rewrite a meta `package.json` so the package's own `version` and any workspace-sibling
3391
3447
  * dependency version reflect their NEXT release version from `versions`. Pure: returns a new
@@ -3428,7 +3484,7 @@ interface PortableTsconfig {
3428
3484
  * @remarks
3429
3485
  * Resolves the package's own `<cwd>/tsconfig.json` (which extends the shared
3430
3486
  * `@effected/plugin/tsconfig/ecma.json` base) via `@effected/tsconfig-json`'s
3431
- * synchronous `TsconfigLoaderSync` (tsc-parity `extends` resolution) so the
3487
+ * `TsconfigLoader` (tsc-parity `extends` resolution) so the
3432
3488
  * result carries the full effective options (target/module/strict/jsx/lib),
3433
3489
  * then projects them through the kit's `PortableTsconfig.make` allow-list
3434
3490
  * filter to a portable, compilerOptions-only shape with no absolute paths or
@@ -3445,7 +3501,7 @@ interface PortableTsconfig {
3445
3501
  *
3446
3502
  * @public
3447
3503
  */
3448
- export declare function resolvePortableTsconfig(cwd: string, fallbackConfigPath?: string): PortableTsconfig;
3504
+ export declare const resolvePortableTsconfig: (cwd: string, fallbackConfigPath?: string) => Effect.Effect<PortableTsconfig, Error, FileSystem.FileSystem | Path.Path>;
3449
3505
  /**
3450
3506
  * Rolldown plugin: append the CJS default-interop footer to ENTRY chunks of the
3451
3507
  * `cjs` format that export a default alongside named exports.
@@ -3527,6 +3583,12 @@ export declare function nodeBuiltinDefaultInterop(): Plugin;
3527
3583
  * @public
3528
3584
  */
3529
3585
  export declare const removeDeclarationMaps: (pkgDir: string) => Effect.Effect<ReadonlyArray<string>, DescendError | PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
3586
+ /**
3587
+ * The failures of {@link copyPublicDir}: a collision, a walk failure, or an IO failure the guard does not own.
3588
+ *
3589
+ * @public
3590
+ */
3591
+ type CopyPublicDirError = ConfigValidationError | DescendError | PlatformError.PlatformError;
3530
3592
  /**
3531
3593
  * Copy the CONTENTS of `sourceDir` into `outDir`, additively.
3532
3594
  *
@@ -3543,7 +3605,7 @@ export declare const removeDeclarationMaps: (pkgDir: string) => Effect.Effect<Re
3543
3605
  * {@link ConfigValidationError} rather than clobbering it or surfacing a raw fs error.
3544
3606
  * @public
3545
3607
  */
3546
- export declare function copyPublicDir(sourceDir: string, outDir: string): void;
3608
+ export declare const copyPublicDir: (sourceDir: string, outDir: string) => Effect.Effect<void, CopyPublicDirError, FileSystem.FileSystem | Path.Path>;
3547
3609
  /** @public */
3548
3610
  interface CopyAmbientDtsOptions {
3549
3611
  /** The ambient exports to copy (from `extractAmbientDts`). */
@@ -3562,7 +3624,7 @@ interface CopyAmbientDtsOptions {
3562
3624
  * Throws {@link ConfigValidationError} on a missing source or any relative specifier.
3563
3625
  * @public
3564
3626
  */
3565
- export declare function copyAmbientDts(options: CopyAmbientDtsOptions): void;
3627
+ export declare const copyAmbientDts: (options: CopyAmbientDtsOptions) => Effect.Effect<void, ConfigValidationError | PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
3566
3628
  /**
3567
3629
  * Render a build report as GitHub Actions workflow-command annotations, one `::error` or `::warning`
3568
3630
  * line per diagnostic. Suppressed diagnostics are never annotated. Pure.
@@ -3648,5 +3710,5 @@ export declare function resolveTargets(options: {
3648
3710
  * @public
3649
3711
  */
3650
3712
  export declare function releaseWarnings(resolution: TargetResolution): ReadonlyArray<string>;
3651
- export { type ActionBuilderError, type ActionBuilderOptions, type ActionValidationRunOptions, type AmbientDtsEntry, BUNDLE_MANIFEST_FILENAME, type BuildEmittedManifestOptions, type BuildFormat$1 as BuildFormatOption, type BuildGroupSpec, type BuildIssues, type BuildPlatform$1 as BuildPlatformOption, type BuildTargetGroupsOptions, BundleManifest, BundleManifestError, type BundleManifestSources, type BundleMetaOptions, type BundlerBuildOptions, type BundlerPackageJson, type BundlerSeams, type ComposeManifestInput, type CopyAmbientDtsOptions, type CssOptions, type DeriveOptions, type DerivedDeclarationsPassOptions, type DerivedDtsPassOptions, type DerivedTsdownOptions, type DiagnosticInput, type DtsEmitTsconfigOptions, type DtsExportClass, type DtsPassDtsOptions, type DualExports, type EmitManifestOptions, type EntryOverride$1 as EntryOverrideOptions, type ExeBuild, type ExeConfig$1 as ExeOptions, type ExeRewrite, type ExeSeaConfig$1 as ExeSeaOptions, type ExeTarget, type ExeTargetInput, type ExtractAmbientOptions, type ExtractOptions, type ExtractResult, type GenerateMetaOptions, type Json, KNOWN_REGISTRY_TYPES, type KnownRegistryType, type LooseFileSpec as LooseFileOptions, LooseFileSpec$1 as LooseFileSpec, type LooseFiles, MANIFEST_SPEC, type ManifestLike, type ManifestRepository, ManifestSource, type ManifestTarget, type MetaOptions, type MetaResult, type TsdocTagDefinition as MetaTsdocTagDefinition, type WarningSuppressionRule as MetaWarningSuppressionRule, type ModuleExportNames, type NextVersions, type NormalizedExe, type NormalizedLooseFile, type NormalizedMeta, type OgImageCacheOptions, type OgImageGenerator, type OgImageInfo, OpenGraphConfig, OpenGraphImage, type PackageJsonEntriesOptions, type PackageJsonLike, type PassKind, type PkgOsCpu, type PlainDiagnostic, type PortableTsconfig, ProjectIdentity, type PublishTargetObject, type PublishTargetValue, type PublishTargets, type ReexportBarrelAnalysis, RegistryRef, type ReleaseChannel, type ResolvedCompilerOptions, type ResolvedGroup, type JsxConfig$1 as ResolvedJsxConfig, type ResolvedTarget, type ResolvedTsconfig, type ResolvedTsconfigOptions, type RunExeBuildOptions, type RunMetaPassOptions, SbomRef, type TargetGroupId, type TargetGroupRef, type TargetResolution, type Timer, type TransformManifestOptions, type TsconfigJsx, type TsdocOptions, TsdocTagDefinition$1 as TsdocTagDefinition, type TsdownBuild, type TsdownLogger, type ValidationInput, WarningSuppressionRule$1 as WarningSuppressionRule, type WriteGeneratedOgImageOptions, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType };
3713
+ export { type ActionBuilderError, type ActionBuilderOptions, type ActionValidationRunOptions, type AmbientDtsEntry, BUNDLE_MANIFEST_FILENAME, type BuildEmittedManifestOptions, type BuildFormat$1 as BuildFormatOption, type BuildGroupSpec, type BuildIssues, type BuildPlatform$1 as BuildPlatformOption, type BuildTargetGroupsOptions, BundleManifest, BundleManifestError, type BundleManifestSources, type BundleMetaOptions, type BundlerBuildOptions, type BundlerPackageJson, type BundlerSeams, type ComposeManifestInput, type CopyAmbientDtsOptions, type CopyPublicDirError, type CssOptions, type DeriveOptions, type DerivedDeclarationsPassOptions, type DerivedDtsPassOptions, type DerivedTsdownOptions, type DiagnosticInput, type DtsEmitTsconfigOptions, type DtsExportClass, type DtsPassDtsOptions, type DualExports, type EmitManifestOptions, type EntryOverride$1 as EntryOverrideOptions, type ExeBuild, type ExeConfig$1 as ExeOptions, type ExeRewrite, type ExeSeaConfig$1 as ExeSeaOptions, type ExeTarget, type ExeTargetInput, type ExtractAmbientOptions, type ExtractOptions, type ExtractResult, type GenerateMetaOptions, type Json, KNOWN_REGISTRY_TYPES, type KnownRegistryType, type LooseFileSpec as LooseFileOptions, LooseFileSpec$1 as LooseFileSpec, type LooseFiles, MANIFEST_SPEC, type ManifestLike, type ManifestRepository, ManifestSource, type ManifestTarget, type MetaOptions, type MetaResult, type TsdocTagDefinition as MetaTsdocTagDefinition, type WarningSuppressionRule as MetaWarningSuppressionRule, type ModuleExportNames, type NextVersions, type NormalizedExe, type NormalizedLooseFile, type NormalizedMeta, type OgImageCacheOptions, type OgImageGenerator, type OgImageInfo, OpenGraphConfig, OpenGraphImage, type PackageJsonEntriesOptions, type PackageJsonLike, type PassKind, type PkgOsCpu, type PlainDiagnostic, type PortableTsconfig, ProjectIdentity, type PublishTargetObject, type PublishTargetValue, type PublishTargets, type ReexportBarrelAnalysis, RegistryRef, type ReleaseChannel, type ResolveManifestError, type ResolvedCompilerOptions, type ResolvedGroup, type JsxConfig$1 as ResolvedJsxConfig, type ResolvedTarget, type ResolvedTsconfig, type ResolvedTsconfigOptions, type RunExeBuildOptions, type RunMetaPassOptions, SbomRef, type TargetGroupId, type TargetGroupRef, type TargetResolution, type Timer, type TransformManifestOptions, type TsconfigJsx, type TsdocOptions, TsdocTagDefinition$1 as TsdocTagDefinition, type TsdownBuild, type TsdownLogger, type ValidationInput, WarningSuppressionRule$1 as WarningSuppressionRule, type WriteGeneratedOgImageOptions, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType };
3652
3714
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -11,6 +11,7 @@ import { resolveNextVersions } from "./changesets/next-versions.js";
11
11
  import { ActionBuildOptions, ActionConfig, ActionEntries, ActionPersistLocalOptions, ActionValidationOptions, ActionWorker } from "./config/ActionConfig.js";
12
12
  import { BuildFormat, BuildPlatform, BundleConfig, BundleOpenGraphConfig, BundleOpenGraphImage, BundleRegistryRef, CopyEntry, EffectedConfig, EntryOverride, ExeConfig, ExeSeaConfig, ExeTargetConfig, JsxConfig, LooseFileSpec, ManifestConfig, MetaConfig, PackageBuildConfig, PackageConfig, TsdocConfig, TsdocTagDefinition, WarningSuppressionRule } from "./config/BuildConfig.js";
13
13
  import { EffectedConfigError, EffectedConfigFile, ResolvedConfig, ResolvedEffectedConfig } from "./config/EffectedConfigFile.js";
14
+ import { EffectedConfigSchema } from "./config/EffectedConfigSchema.js";
14
15
  import { merge } from "./config/merge.js";
15
16
  import { PluginLoadError, loadPlugins } from "./config/plugins.js";
16
17
  import { ConfigValidator } from "./config-validation/ConfigValidator.js";
@@ -54,4 +55,4 @@ import { RELEASE_CHANNELS, isTargetObject } from "./targets/config.js";
54
55
  import { releaseWarnings, resolveTargets } from "./targets/resolve-targets.js";
55
56
  import { BUNDLE_MANIFEST_FILENAME, BundleManifest, BundleManifestError, KNOWN_REGISTRY_TYPES, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, ProjectIdentity, RegistryRef, SbomRef, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType } from "@effected/manifest";
56
57
 
57
- export { ActionBuildOptions, ActionBuildResult, ActionBuilder, ActionBundle, ActionConfig, ActionEntries, ActionPersistLocalOptions, ActionValidation, ActionValidationOptions, ActionWorker, ActionYml, ActionYmlBranding, ActionYmlBrandingColor, ActionYmlBrandingIcon, ActionYmlInput, ActionYmlOutput, ActionYmlPathError, ActionYmlRuns, BUNDLE_MANIFEST_FILENAME, BuildCollector, BuildCollectorTag, BuildFailed, BuildFormat, BuildIssuesSchema, BuildJournal, BuildPlatform, BuildReport, BuildResult, BundleConfig, BundleFailed, BundleManifest, BundleManifestEmitError, BundleManifestError, BundleManifestSourceError, BundleOpenGraphConfig, BundleOpenGraphImage, BundleRegistryRef, BundleResult, BundleStats, Bundler, BundlerBuildResult, BundlerError, BundlerPhase, CleanError, ConfigValidationError, ConfigValidator, CopyEntry, DEFAULT_EXE_NODE_VERSION, DiagnosticEntry, EffectedConfig, EffectedConfigError, EffectedConfigFile, EmittedFile, EntryOverride, ExeConfig, ExeSeaConfig, ExeTargetConfig, IssueJournal, JsxConfig, KNOWN_REGISTRY_TYPES, LooseFileSpec, MANIFEST_SPEC, ManifestConfig, ManifestSource, MetaConfig, MetaGenerationError, OgGenerateError, OpenGraphConfig, OpenGraphImage, PackageBuildConfig, PackageConfig, PassReport, PersistLocal, PersistLocalError, PersistLocalResult, PlainDiagnosticSchema, PluginLoadError, ProjectIdentity, RELEASE_CHANNELS, RegistryRef, ReportTimings, ResolvedConfig, ResolvedEffectedConfig, SbomRef, TargetGroupReport, TsdocConfig, TsdocTagDefinition, ValidationFailed, ValidationIssue, ValidationResult, WarningSuppressionRule, WriteError, ambientOutName, analyzeReexportBarrel, assertNoEntryCollisions, buildEmittedManifest, buildMetricsPlugin, buildResolvedTsconfig, buildTargetGroups, cjsDefaultInterop, classifyDtsExport, collectExportNames, composeBundleManifest, computeExeFileName, copyAmbientDts, copyPublicDir, createEntryName, createTimer, createTsdownLogger, declarationExt, declarationsDirFor, decodeBundleManifest, decodeManifestSource, defaultManifestTransform, deriveDeclarationsPassOptions, deriveDtsPassOptions, deriveExportPaths, deriveTargetGroupOptions, dtsPassDtsOptions, emitManifest, encodeBundleManifest, extractAmbientDts, extractEntries, findRelativeSpecifiers, flattenIssues, formatTime, githubOwnerRepo, isKnownRegistryType, isTargetObject, loadBundleManifestSources, loadPlugins, manifestNeedsCatalogResolution, merge, mixedDtsExportError, nodeBuiltinDefaultInterop, normalizeBinPaths, normalizeExeOptions, normalizeLooseFiles, normalizeMetaOptions, ogImageInfoOf, outDirFor, packageJsonEntries, readTsconfigJsx, registriesFromTargets, releaseWarnings, removeDeclarationMaps, renderCiAnnotations, renderReexportStub, resolveJsxConfig, resolveManifest, resolveNextVersions, resolveOgCacheSalt, resolveOgGenerator, resolvePortableTsconfig, resolveTargets, rewriteMetaVersions, runExeBuild, serializeIssues, transformBin, transformExports, transformManifest, writeDtsEmitTsconfig, writeGeneratedOgImage, writeIssuesArtifact, writeResolvedTsconfig, writeTargetsBinding };
58
+ export { ActionBuildOptions, ActionBuildResult, ActionBuilder, ActionBundle, ActionConfig, ActionEntries, ActionPersistLocalOptions, ActionValidation, ActionValidationOptions, ActionWorker, ActionYml, ActionYmlBranding, ActionYmlBrandingColor, ActionYmlBrandingIcon, ActionYmlInput, ActionYmlOutput, ActionYmlPathError, ActionYmlRuns, BUNDLE_MANIFEST_FILENAME, BuildCollector, BuildCollectorTag, BuildFailed, BuildFormat, BuildIssuesSchema, BuildJournal, BuildPlatform, BuildReport, BuildResult, BundleConfig, BundleFailed, BundleManifest, BundleManifestEmitError, BundleManifestError, BundleManifestSourceError, BundleOpenGraphConfig, BundleOpenGraphImage, BundleRegistryRef, BundleResult, BundleStats, Bundler, BundlerBuildResult, BundlerError, BundlerPhase, CleanError, ConfigValidationError, ConfigValidator, CopyEntry, DEFAULT_EXE_NODE_VERSION, DiagnosticEntry, EffectedConfig, EffectedConfigError, EffectedConfigFile, EffectedConfigSchema, EmittedFile, EntryOverride, ExeConfig, ExeSeaConfig, ExeTargetConfig, IssueJournal, JsxConfig, KNOWN_REGISTRY_TYPES, LooseFileSpec, MANIFEST_SPEC, ManifestConfig, ManifestSource, MetaConfig, MetaGenerationError, OgGenerateError, OpenGraphConfig, OpenGraphImage, PackageBuildConfig, PackageConfig, PassReport, PersistLocal, PersistLocalError, PersistLocalResult, PlainDiagnosticSchema, PluginLoadError, ProjectIdentity, RELEASE_CHANNELS, RegistryRef, ReportTimings, ResolvedConfig, ResolvedEffectedConfig, SbomRef, TargetGroupReport, TsdocConfig, TsdocTagDefinition, ValidationFailed, ValidationIssue, ValidationResult, WarningSuppressionRule, WriteError, ambientOutName, analyzeReexportBarrel, assertNoEntryCollisions, buildEmittedManifest, buildMetricsPlugin, buildResolvedTsconfig, buildTargetGroups, cjsDefaultInterop, classifyDtsExport, collectExportNames, composeBundleManifest, computeExeFileName, copyAmbientDts, copyPublicDir, createEntryName, createTimer, createTsdownLogger, declarationExt, declarationsDirFor, decodeBundleManifest, decodeManifestSource, defaultManifestTransform, deriveDeclarationsPassOptions, deriveDtsPassOptions, deriveExportPaths, deriveTargetGroupOptions, dtsPassDtsOptions, emitManifest, encodeBundleManifest, extractAmbientDts, extractEntries, findRelativeSpecifiers, flattenIssues, formatTime, githubOwnerRepo, isKnownRegistryType, isTargetObject, loadBundleManifestSources, loadPlugins, manifestNeedsCatalogResolution, merge, mixedDtsExportError, nodeBuiltinDefaultInterop, normalizeBinPaths, normalizeExeOptions, normalizeLooseFiles, normalizeMetaOptions, ogImageInfoOf, outDirFor, packageJsonEntries, readTsconfigJsx, registriesFromTargets, releaseWarnings, removeDeclarationMaps, renderCiAnnotations, renderReexportStub, resolveJsxConfig, resolveManifest, resolveNextVersions, resolveOgCacheSalt, resolveOgGenerator, resolvePortableTsconfig, resolveTargets, rewriteMetaVersions, runExeBuild, serializeIssues, transformBin, transformExports, transformManifest, writeDtsEmitTsconfig, writeGeneratedOgImage, writeIssuesArtifact, writeResolvedTsconfig, writeTargetsBinding };
@@ -0,0 +1,14 @@
1
+ import { Effect, FileSystem } from "effect";
2
+
3
+ // src/internal/exists.ts
4
+ /**
5
+ * Whether a path exists, with `existsSync`'s semantics: every error reads as absent. `FileSystem.exists` answers
6
+ * `false` only for `NotFound` and fails on the rest, so a parent segment that is a file (`ENOTDIR`, a `BadResource`)
7
+ * or a denied `access` (`EACCES`) would surface where the ported code read "not there". The one place that rule
8
+ * lives; a site that wants the stricter answer calls `FileSystem.exists` itself.
9
+ *
10
+ * @internal
11
+ */
12
+ const existsLikeNode = (path) => Effect.flatMap(FileSystem.FileSystem, (fs) => fs.exists(path)).pipe(Effect.orElseSucceed(() => false));
13
+
14
+ export { existsLikeNode };
@@ -0,0 +1,15 @@
1
+ import { Effect } from "effect";
2
+ import { realpathSync } from "node:fs";
3
+
4
+ // src/internal/native-realpath.ts
5
+ /**
6
+ * The host's realpath(3) of `path`, failing with whatever `realpathSync.native` throws.
7
+ *
8
+ * @internal
9
+ */
10
+ const nativeRealPath = (path) => Effect.try({
11
+ try: () => realpathSync.native(path),
12
+ catch: (cause) => cause
13
+ });
14
+
15
+ export { nativeRealPath };
@@ -1,9 +1,9 @@
1
1
  import { resolveManifest } from "../catalog/resolve-catalogs.js";
2
+ import { pruneBundled } from "../passes/bundled-deps.js";
2
3
  import { stripBuiltCondition } from "./built-condition.js";
3
4
  import { applyManifestSet, validateManifestSet } from "./manifest-set.js";
4
5
  import { defaultManifestTransform, transformManifest } from "./transform.js";
5
- import { join } from "node:path";
6
- import { readFile } from "node:fs/promises";
6
+ import { Effect, FileSystem, Path } from "effect";
7
7
  import { DependencySpecifier } from "@effected/npm";
8
8
 
9
9
  // src/manifest/emit-manifest.ts
@@ -32,13 +32,17 @@ function manifestNeedsCatalogResolution(pkg) {
32
32
  *
33
33
  * @public
34
34
  */
35
- async function buildEmittedManifest(options) {
35
+ const buildEmittedManifest = Effect.fnUntraced(function* (options) {
36
36
  const { cwd, targetGroup, devManifest, drop, set } = options;
37
- if (set !== void 0) validateManifestSet(set, drop ?? []);
37
+ if (set !== void 0) yield* Effect.try({
38
+ try: () => validateManifestSet(set, drop ?? []),
39
+ catch: (error) => error
40
+ });
38
41
  const pkg = stripBuiltCondition(options.pkg);
39
42
  const shouldResolve = (targetGroup.isProd || devManifest === "resolve") && manifestNeedsCatalogResolution(pkg);
40
43
  let base = pkg;
41
- if (shouldResolve) base = await resolveManifest(pkg, cwd);
44
+ if (shouldResolve) base = yield* resolveManifest(pkg, cwd);
45
+ if (options.bundled !== void 0) base = pruneBundled(base, options.bundled);
42
46
  base = {
43
47
  ...base,
44
48
  name: targetGroup.name
@@ -50,44 +54,65 @@ async function buildEmittedManifest(options) {
50
54
  exeRewrite: options.exeRewrite,
51
55
  emitDts: options.emitDts ?? true
52
56
  });
53
- }
57
+ });
54
58
  /**
55
59
  * Rolldown plugin: emit the transformed package.json + LICENSE/README into the output pkg/ root.
56
60
  *
61
+ * @remarks
62
+ * rolldown calls `generateBundle` as a plain async hook, so the plugin captures the `FileSystem` and `Path` it is
63
+ * built under and runs its reads with them.
64
+ *
57
65
  * @public
58
66
  */
59
- function emitManifest(options) {
67
+ const emitManifest = (options) => Effect.map(Effect.context(), (services) => emitManifestWith(options, services));
68
+ const emitManifestWith = (options, services) => {
69
+ const run = Effect.runPromiseWith(services);
60
70
  const sourceDir = options.sourceDir;
61
71
  return {
62
72
  name: "savvy:emit-manifest",
63
73
  async generateBundle() {
64
- const manifest = await buildEmittedManifest({
65
- pkg: JSON.parse(await readFile(join(sourceDir, "package.json"), "utf-8")),
66
- cwd: sourceDir,
67
- targetGroup: options.targetGroup,
68
- devManifest: options.devManifest ?? "preserve",
69
- drop: options.drop,
70
- set: options.set,
71
- dual: options.dual,
72
- subdirExports: options.subdirExports,
73
- exeRewrite: options.exeRewrite,
74
- emitDts: options.emitDts
75
- });
74
+ const { manifest, extras } = await run(Effect.gen(function* () {
75
+ const fs = yield* FileSystem.FileSystem;
76
+ const { join } = yield* Path.Path;
77
+ const pkg = JSON.parse(yield* fs.readFileString(join(sourceDir, "package.json")));
78
+ const manifest = yield* buildEmittedManifest({
79
+ pkg,
80
+ cwd: sourceDir,
81
+ targetGroup: options.targetGroup,
82
+ devManifest: options.devManifest ?? "preserve",
83
+ drop: options.drop,
84
+ set: options.set,
85
+ dual: options.dual,
86
+ subdirExports: options.subdirExports,
87
+ exeRewrite: options.exeRewrite,
88
+ emitDts: options.emitDts,
89
+ bundled: options.bundled
90
+ });
91
+ const extras = [];
92
+ for (const name of ["LICENSE", "README.md"]) {
93
+ const content = yield* fs.readFileString(join(sourceDir, name)).pipe(Effect.option);
94
+ if (content._tag === "Some") extras.push({
95
+ name,
96
+ content: content.value
97
+ });
98
+ }
99
+ return {
100
+ manifest,
101
+ extras
102
+ };
103
+ }));
76
104
  this.emitFile({
77
105
  type: "asset",
78
106
  fileName: "package.json",
79
107
  source: `${JSON.stringify(manifest, null, " ")}\n`
80
108
  });
81
- for (const name of ["LICENSE", "README.md"]) try {
82
- const content = await readFile(join(sourceDir, name), "utf-8");
83
- this.emitFile({
84
- type: "asset",
85
- fileName: name,
86
- source: content
87
- });
88
- } catch {}
109
+ for (const { name, content } of extras) this.emitFile({
110
+ type: "asset",
111
+ fileName: name,
112
+ source: content
113
+ });
89
114
  }
90
115
  };
91
- }
116
+ };
92
117
 
93
118
  export { buildEmittedManifest, emitManifest, manifestNeedsCatalogResolution };
@@ -1,11 +1,12 @@
1
1
  import { MetaGenerationError } from "../errors.js";
2
- import { tsconfigSyncOptions } from "../tsconfig/sync-options.js";
2
+ import { existsLikeNode } from "../internal/exists.js";
3
3
  import { createMessageSuppressor } from "./message-suppressor.js";
4
- import { existsSync, realpathSync, writeFileSync } from "node:fs";
4
+ import { Effect, FileSystem, Path } from "effect";
5
+ import { realpathSync } from "node:fs";
5
6
  import { tmpdir } from "node:os";
6
7
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
7
8
  import { createHash } from "node:crypto";
8
- import { TsconfigLoaderSync } from "@effected/tsconfig-json";
9
+ import { TsconfigLoader } from "@effected/tsconfig-json";
9
10
  import { Extractor, ExtractorConfig, ExtractorLogLevel } from "@microsoft/api-extractor";
10
11
  import { TSDocConfigFile } from "@microsoft/tsdoc-config";
11
12
 
@@ -36,26 +37,28 @@ const CI_FATAL_MESSAGE_IDS = /* @__PURE__ */ new Set(["ae-forgotten-export"]);
36
37
  * calls within a process overwrite the same file; cross-process temp files are left for the OS to
37
38
  * reap, consistent with the other tmpdir tsconfig writers.
38
39
  */
39
- function writeApiExtractorTsconfig(options) {
40
- const absBase = isAbsolute(options.tsconfigPath) ? options.tsconfigPath : resolve(options.tsconfigPath);
41
- if (!existsSync(absBase)) return options.tsconfigPath;
42
- const entryDts = isAbsolute(options.entryDtsPath) ? options.entryDtsPath : resolve(options.cwd, options.entryDtsPath);
40
+ const writeApiExtractorTsconfig = Effect.fnUntraced(function* (options) {
41
+ const fs = yield* FileSystem.FileSystem;
42
+ const path = yield* Path.Path;
43
+ const absBase = path.isAbsolute(options.tsconfigPath) ? options.tsconfigPath : path.resolve(options.tsconfigPath);
44
+ if (!(yield* existsLikeNode(absBase))) return options.tsconfigPath;
45
+ const entryDts = path.isAbsolute(options.entryDtsPath) ? options.entryDtsPath : path.resolve(options.cwd, options.entryDtsPath);
43
46
  const ownPaths = options.paths ?? {};
44
47
  const hasPaths = Object.keys(ownPaths).length > 0;
45
48
  const cfg = {
46
49
  extends: absBase,
47
50
  files: [entryDts],
48
- include: [join(options.cwd, "types/*.d.ts")],
51
+ include: [path.join(options.cwd, "types/*.d.ts")],
49
52
  ...hasPaths ? { compilerOptions: { paths: {
50
- ...readBasePaths(absBase),
53
+ ...yield* readBasePaths(absBase),
51
54
  ...ownPaths
52
55
  } } } : {}
53
56
  };
54
57
  const hash = createHash("sha256").update(`${absBase}\0${entryDts}${hasPaths ? `\0${JSON.stringify(ownPaths)}` : ""}`).digest("hex").slice(0, 16);
55
- const path = join(tmpdir(), `tsconfig-api-extractor-${process.pid}-${hash}.json`);
56
- writeFileSync(path, `${JSON.stringify(cfg, null, " ")}\n`, "utf-8");
57
- return path;
58
- }
58
+ const out = path.join(tmpdir(), `tsconfig-api-extractor-${process.pid}-${hash}.json`);
59
+ yield* fs.writeFileString(out, `${JSON.stringify(cfg, null, " ")}\n`);
60
+ return out;
61
+ });
59
62
  /**
60
63
  * The base tsconfig's effective `compilerOptions.paths`, with every relative target made absolute.
61
64
  *
@@ -68,18 +71,15 @@ function writeApiExtractorTsconfig(options) {
68
71
  * so `paths` inherited from further up the chain are kept too. Best-effort: a base that cannot be
69
72
  * resolved contributes no paths.
70
73
  */
71
- function readBasePaths(absBase) {
72
- let resolved;
73
- try {
74
- resolved = TsconfigLoaderSync.resolve(absBase, tsconfigSyncOptions);
75
- } catch {
76
- return {};
77
- }
78
- const paths = resolved.compilerOptions.paths;
74
+ const readBasePaths = (absBase) => Effect.gen(function* () {
75
+ const path = yield* Path.Path;
76
+ const resolved = yield* TsconfigLoader.resolve(absBase).pipe(Effect.option);
77
+ if (resolved._tag === "None") return {};
78
+ const paths = resolved.value.compilerOptions.paths;
79
79
  if (paths === void 0) return {};
80
- const anchor = resolved.compilerOptions.baseUrl ?? resolved.pathsBase ?? dirname(absBase);
81
- return Object.fromEntries(Object.entries(paths).map(([key, targets]) => [key, targets.map((target) => isAbsolute(target) ? target : resolve(anchor, target))]));
82
- }
80
+ const anchor = resolved.value.compilerOptions.baseUrl ?? resolved.value.pathsBase ?? path.dirname(absBase);
81
+ return Object.fromEntries(Object.entries(paths).map(([key, targets]) => [key, targets.map((target) => path.isAbsolute(target) ? target : path.resolve(anchor, target))]));
82
+ });
83
83
  /**
84
84
  * Map an API Extractor message to a collector DiagnosticInput, or undefined if not warn/error.
85
85
  *
@@ -148,8 +148,23 @@ const isTsSource = (path) => /\.[cm]?tsx?$/.test(path) && !ExtractorConfig.hasDt
148
148
  function ownSourceInputFiles(program, cwd) {
149
149
  return program.getSourceFiles().map(({ fileName }) => resolve(cwd, fileName)).filter((path) => isTsSource(path) && isOwnPath(path, cwd));
150
150
  }
151
- /** Run API Extractor over a single entry's .d.ts, writing the .api.json (and optionally tsdoc-metadata.json). Throws on failure. */
152
- function runApiExtractor(options) {
151
+ /**
152
+ * Run API Extractor over a single entry's .d.ts, writing the .api.json (and optionally tsdoc-metadata.json).
153
+ *
154
+ * @remarks
155
+ * The derived tsconfig is written through `FileSystem`; API Extractor itself is synchronous and reads the host disk.
156
+ * Anything it throws, and the {@link MetaGenerationError} of a failed run, fails the effect with the thrown value.
157
+ */
158
+ const runApiExtractor = (options) => Effect.flatMap(writeApiExtractorTsconfig({
159
+ cwd: options.cwd,
160
+ tsconfigPath: options.tsconfigPath,
161
+ entryDtsPath: options.entryDtsPath,
162
+ paths: options.selfReferencePaths
163
+ }), (tsconfigFilePath) => Effect.try({
164
+ try: () => invokeApiExtractor(options, tsconfigFilePath),
165
+ catch: (e) => e
166
+ }));
167
+ function invokeApiExtractor(options, tsconfigFilePath) {
153
168
  const suppressor = createMessageSuppressor(options.suppressWarnings);
154
169
  const tsdocConfigFile = TSDocConfigFile.loadForFolder(dirname(options.tsdocConfigPath));
155
170
  const namedOwnInputs = /* @__PURE__ */ new Set();
@@ -158,12 +173,7 @@ function runApiExtractor(options) {
158
173
  projectFolder: options.cwd,
159
174
  mainEntryPointFilePath: options.entryDtsPath,
160
175
  enumMemberOrder: "preserve",
161
- compiler: { tsconfigFilePath: writeApiExtractorTsconfig({
162
- cwd: options.cwd,
163
- tsconfigPath: options.tsconfigPath,
164
- entryDtsPath: options.entryDtsPath,
165
- paths: options.selfReferencePaths
166
- }) },
176
+ compiler: { tsconfigFilePath },
167
177
  docModel: options.emitDocModel === false ? { enabled: false } : {
168
178
  enabled: true,
169
179
  apiJsonFilePath: options.apiJsonPath,