@savvy-web/tsdown-plugins 1.1.13 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/catalog/resolve-catalogs.js +18 -11
- package/changesets/next-versions.js +19 -15
- package/config-validation/ConfigValidator.js +1 -1
- package/index.d.ts +84 -142
- package/index.js +2 -2
- package/jsx/config.js +28 -11
- package/manifest/emit-manifest.js +2 -1
- package/manifest/transform.js +8 -1
- package/meta/tsconfig-resolver.js +32 -17
- package/package.json +9 -14
- package/report/collector.js +1 -1
- package/report/schema.js +13 -3
- package/report/services/EnvironmentDetector.js +1 -1
- package/report/services/ExecutorResolver.js +1 -1
- package/report/services/FormatSelector.js +1 -1
- package/report/services/OutputRenderer.js +1 -1
- package/tsdoc-metadata.json +1 -1
package/README.md
CHANGED
|
@@ -42,9 +42,9 @@ export default defineConfig({
|
|
|
42
42
|
- **Entry detection** — `packageJsonEntries` and `extractEntries` derive build entries from a package's `exports` and `bin`, matching the rules used across the Silk Suite builders.
|
|
43
43
|
- **Manifest transforms** — `transformManifest`, `transformExports`, `transformBin` and `normalizeBinPaths` rewrite a source `package.json` into a publishable one; `emitManifest` is the rolldown plugin that writes it. A dual-format build emits both `import` and `require` export conditions, and a `"./package.json": "./package.json"` entry is added to the exports map so consumers can `import "<pkg>/package.json"`.
|
|
44
44
|
- **Ambient `.d.ts` exports** — `extractAmbientDts` and `classifyDtsExport` pick the types-only, hand-authored declaration exports out of a package's `exports` map; `transformExports` rewrites each to a key-derived `{ types }` pointer and `copyAmbientDts` copies the source declaration verbatim into every target dir, preserving its extension. `findRelativeSpecifiers` rejects a non-self-contained declaration and `mixedDtsExportError` rejects an export that mixes a hand-authored `types` with a runtime source.
|
|
45
|
-
- **Catalog resolution** — `resolveManifest` resolves `catalog:` and `workspace:` specifiers against the workspace, delegating to `workspaces-
|
|
45
|
+
- **Catalog resolution** — `resolveManifest` resolves `catalog:` and `workspace:` specifiers against the workspace, delegating to [`@effected/workspaces`](https://www.npmjs.com/package/@effected/workspaces). It rejects with a typed error rather than a defect: `ManifestDecodeError` when a dependency field is not a string-to-string record, `UnresolvedDependencyError` on a specifier the workspace cannot answer, and `CatalogAssemblyError`/`DependencyResolutionError` when catalog assembly or the resolution mechanism itself fails. All four are exported.
|
|
46
46
|
- **Multi-target resolution** — `resolveTargets` turns a `publishConfig.targets` map into the distinct byte-variant groups to build and the registry bindings for each; `writeTargetsBinding` persists that resolution as `dist/prod/targets.json` for the release step.
|
|
47
|
-
- **JSX resolution** — `resolveJsxConfig` and `readTsconfigJsx` derive the effective JSX transform from a package's tsconfig, with an explicit override winning.
|
|
47
|
+
- **JSX resolution** — `resolveJsxConfig` and `readTsconfigJsx` derive the effective JSX transform from a package's tsconfig, with an explicit override winning. The tsconfig is read through a loader that honors JSONC syntax and `extends` chains, so a `jsx` setting inherited from a base config resolves.
|
|
48
48
|
- **Executable binaries** — `normalizeExeOptions` fills the SEA defaults and infers targets from the package's `os`/`cpu`; `runExeBuild` drives `@tsdown/exe` to compile the binaries.
|
|
49
49
|
- **Config validation** — the `ConfigValidator` Effect service (with `ConfigValidatorLive`) fast-fails on a bad `publishConfig.targets`, `exe` or `meta` config, raising the typed `ConfigValidationError`.
|
|
50
50
|
- **dts tsconfig port** — `buildResolvedTsconfig` and `writeResolvedTsconfig` write a temp tsconfig with absolute paths so type declarations emit cleanly under pnpm symlinks.
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Manifest } from "@effected/npm";
|
|
2
|
+
import { NodeFileSystem, NodePath } from "@effect/platform-node";
|
|
3
|
+
import { Workspaces } from "@effected/workspaces";
|
|
4
|
+
import { Effect, Layer } from "effect";
|
|
4
5
|
|
|
5
6
|
//#region src/catalog/resolve-catalogs.ts
|
|
7
|
+
/** Bound once: the platform layer is stateless and layers memoize by reference. */
|
|
8
|
+
const platform = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
|
|
6
9
|
/**
|
|
7
10
|
* Resolve every `catalog:`/`workspace:` specifier in a manifest to a concrete spec,
|
|
8
|
-
* delegating to workspaces
|
|
9
|
-
* workspace root from `process.cwd()`
|
|
10
|
-
* and assembles catalogs durably (inline +
|
|
11
|
-
* so no transient
|
|
11
|
+
* delegating to `@effected/workspaces`' one-shot `Workspaces.resolveManifest`. The
|
|
12
|
+
* resolver re-discovers the workspace root from `process.cwd()` on every call (run
|
|
13
|
+
* this from inside the target workspace) and assembles catalogs durably (inline +
|
|
14
|
+
* config-dependency hook-replay + lockfile), so no transient
|
|
15
|
+
* `.pnpm-workspace-state-v1.json` is required.
|
|
12
16
|
*
|
|
13
|
-
* Rejects with `
|
|
14
|
-
* `
|
|
17
|
+
* Rejects with `ManifestDecodeError` when a dependency field is not a string-to-string
|
|
18
|
+
* record, `UnresolvedDependencyError` on a specifier the workspace cannot answer, or
|
|
19
|
+
* `CatalogAssemblyError`/`DependencyResolutionError` when catalog assembly or the
|
|
20
|
+
* resolution mechanism itself fails.
|
|
15
21
|
* @public
|
|
16
22
|
*/
|
|
17
23
|
function resolveManifest(pkg) {
|
|
18
24
|
const program = Effect.gen(function* () {
|
|
19
|
-
|
|
25
|
+
const manifest = yield* Manifest.decode(pkg);
|
|
26
|
+
return (manifest.needsResolution ? yield* Workspaces.resolveManifest(manifest) : manifest).toRecord();
|
|
20
27
|
});
|
|
21
|
-
return Effect.runPromise(program.pipe(Effect.provide(
|
|
28
|
+
return Effect.runPromise(program.pipe(Effect.provide(platform)));
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
//#endregion
|
|
@@ -1,34 +1,38 @@
|
|
|
1
|
+
import { NodeFileSystem, NodePath } from "@effect/platform-node";
|
|
2
|
+
import { WorkspaceDiscovery, Workspaces } from "@effected/workspaces";
|
|
3
|
+
import { Effect, Layer } from "effect";
|
|
1
4
|
import { getReleasePlan } from "@changesets/get-release-plan";
|
|
2
|
-
import { getPackages } from "@manypkg/get-packages";
|
|
3
5
|
|
|
4
6
|
//#region src/changesets/next-versions.ts
|
|
7
|
+
/** Bound once: the platform layer is stateless and layers memoize by reference. */
|
|
8
|
+
const platform = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
|
|
5
9
|
/**
|
|
6
10
|
* Resolve the next release version of every workspace package from pending changesets.
|
|
7
11
|
*
|
|
8
|
-
* Walks up from `cwd` to the monorepo root via `@
|
|
9
|
-
* each package's CURRENT version, then overlays `newVersion` for
|
|
10
|
-
* via `@changesets/get-release-plan`. Never rejects: any failure
|
|
11
|
-
* `.changeset/config.json`, parse error) degrades to current
|
|
12
|
+
* Walks up from `cwd` to the monorepo root via `@effected/workspaces`' `WorkspaceDiscovery`,
|
|
13
|
+
* seeds the map with each package's CURRENT version, then overlays `newVersion` for
|
|
14
|
+
* changeset-affected packages via `@changesets/get-release-plan`. Never rejects: any failure
|
|
15
|
+
* (not a workspace, missing `.changeset/config.json`, parse error) degrades to current
|
|
16
|
+
* versions (or an empty map).
|
|
12
17
|
* @public
|
|
13
18
|
*/
|
|
14
19
|
async function resolveNextVersions(cwd) {
|
|
15
20
|
try {
|
|
16
|
-
const packages = await
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
+
const packages = await Effect.runPromise(Effect.gen(function* () {
|
|
22
|
+
return yield* (yield* WorkspaceDiscovery).listPackages();
|
|
23
|
+
}).pipe(Effect.provide(Workspaces.layer({ cwd }).pipe(Layer.provide(platform)))));
|
|
24
|
+
const rootDir = packages[0]?.isRootWorkspace ? packages[0].path : cwd;
|
|
21
25
|
const versions = /* @__PURE__ */ new Map();
|
|
22
|
-
for (const p of packages
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
for (const p of packages) {
|
|
27
|
+
if (p.isRootWorkspace) continue;
|
|
28
|
+
versions.set(p.name, p.version);
|
|
25
29
|
}
|
|
26
30
|
try {
|
|
27
|
-
const plan = await getReleasePlan(
|
|
31
|
+
const plan = await getReleasePlan(rootDir);
|
|
28
32
|
for (const r of plan.releases) versions.set(r.name, r.newVersion);
|
|
29
33
|
} catch {}
|
|
30
34
|
return {
|
|
31
|
-
root:
|
|
35
|
+
root: rootDir,
|
|
32
36
|
versions
|
|
33
37
|
};
|
|
34
38
|
} catch {
|
|
@@ -6,7 +6,7 @@ import { Context } from "effect";
|
|
|
6
6
|
*
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
-
var ConfigValidator = class extends Context.
|
|
9
|
+
var ConfigValidator = class extends Context.Service()("@savvy-web/tsdown-plugins/ConfigValidator") {};
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
12
12
|
export { ConfigValidator };
|
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* flattened output location, so the ambient-copy step rejects it.
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
-
import { CatalogAssemblyError,
|
|
9
|
+
import { CatalogAssemblyError, DependencyResolutionError, ManifestDecodeError, UnresolvedDependencyError } from "@effected/npm";
|
|
10
10
|
import { Plugin } from "rolldown";
|
|
11
11
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
12
12
|
import { JsxEmit, ModuleDetectionKind, ModuleKind, ModuleResolutionKind, NewLineKind, ParsedCommandLine, ScriptTarget } from "typescript";
|
|
@@ -169,148 +169,67 @@ interface EmitManifestOptions {
|
|
|
169
169
|
declare function emitManifest(options: EmitManifestOptions): Plugin;
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region src/report/schema.d.ts
|
|
172
|
-
declare const ReportTimings_base: Schema.Class<ReportTimings, {
|
|
173
|
-
totalMs:
|
|
174
|
-
}
|
|
175
|
-
totalMs: typeof Schema.Number;
|
|
176
|
-
}>, never, {
|
|
177
|
-
readonly totalMs: number;
|
|
178
|
-
}, {}, {}>;
|
|
172
|
+
declare const ReportTimings_base: Schema.Class<ReportTimings, Schema.Struct<{
|
|
173
|
+
readonly totalMs: Schema.Number;
|
|
174
|
+
}>, {}>;
|
|
179
175
|
/** @public */
|
|
180
176
|
declare class ReportTimings extends ReportTimings_base {}
|
|
181
|
-
declare const DiagnosticEntry_base: Schema.Class<DiagnosticEntry, {
|
|
182
|
-
source: Schema.
|
|
183
|
-
level: Schema.
|
|
184
|
-
text:
|
|
177
|
+
declare const DiagnosticEntry_base: Schema.Class<DiagnosticEntry, Schema.Struct<{
|
|
178
|
+
readonly source: Schema.Literals<readonly ["tsdown", "rolldown", "api-extractor"]>;
|
|
179
|
+
readonly level: Schema.Literals<readonly ["warn", "error"]>;
|
|
180
|
+
readonly text: Schema.String;
|
|
185
181
|
/** API Extractor messageId (e.g. "ae-forgotten-export"); used to group suppressed messages by type. */
|
|
186
|
-
code: Schema.optional<
|
|
182
|
+
readonly code: Schema.optional<Schema.String>;
|
|
187
183
|
/** True when shown as `warn` locally but a hard error in CI (drives the "[fails CI]" nudge). */
|
|
188
|
-
ciFatal: Schema.optional<
|
|
189
|
-
file: Schema.optional<
|
|
190
|
-
line: Schema.optional<
|
|
191
|
-
column: Schema.optional<
|
|
192
|
-
}
|
|
193
|
-
source: Schema.Literal<["tsdown", "rolldown", "api-extractor"]>;
|
|
194
|
-
level: Schema.Literal<["warn", "error"]>;
|
|
195
|
-
text: typeof Schema.String;
|
|
196
|
-
/** API Extractor messageId (e.g. "ae-forgotten-export"); used to group suppressed messages by type. */
|
|
197
|
-
code: Schema.optional<typeof Schema.String>;
|
|
198
|
-
/** True when shown as `warn` locally but a hard error in CI (drives the "[fails CI]" nudge). */
|
|
199
|
-
ciFatal: Schema.optional<typeof Schema.Boolean>;
|
|
200
|
-
file: Schema.optional<typeof Schema.String>;
|
|
201
|
-
line: Schema.optional<typeof Schema.Number>;
|
|
202
|
-
column: Schema.optional<typeof Schema.Number>;
|
|
203
|
-
}>, never, {
|
|
204
|
-
readonly ciFatal?: boolean | undefined;
|
|
205
|
-
} & {
|
|
206
|
-
readonly code?: string | undefined;
|
|
207
|
-
} & {
|
|
208
|
-
readonly column?: number | undefined;
|
|
209
|
-
} & {
|
|
210
|
-
readonly file?: string | undefined;
|
|
211
|
-
} & {
|
|
212
|
-
readonly line?: number | undefined;
|
|
213
|
-
} & {
|
|
214
|
-
readonly level: "error" | "warn";
|
|
215
|
-
} & {
|
|
216
|
-
readonly source: "api-extractor" | "rolldown" | "tsdown";
|
|
217
|
-
} & {
|
|
218
|
-
readonly text: string;
|
|
219
|
-
}, {}, {}>;
|
|
184
|
+
readonly ciFatal: Schema.optional<Schema.Boolean>;
|
|
185
|
+
readonly file: Schema.optional<Schema.String>;
|
|
186
|
+
readonly line: Schema.optional<Schema.Number>;
|
|
187
|
+
readonly column: Schema.optional<Schema.Number>;
|
|
188
|
+
}>, {}>;
|
|
220
189
|
/**
|
|
221
190
|
* A captured warning or error, from tsdown's logger, rolldown's onLog, or API Extractor.
|
|
222
191
|
*
|
|
223
192
|
* @public
|
|
224
193
|
*/
|
|
225
194
|
declare class DiagnosticEntry extends DiagnosticEntry_base {}
|
|
226
|
-
declare const EmittedFile_base: Schema.Class<EmittedFile, {
|
|
227
|
-
path:
|
|
228
|
-
bytes:
|
|
229
|
-
gzip: Schema.optional<
|
|
230
|
-
}
|
|
231
|
-
path: typeof Schema.String;
|
|
232
|
-
bytes: typeof Schema.Number;
|
|
233
|
-
gzip: Schema.optional<typeof Schema.Number>;
|
|
234
|
-
}>, never, {
|
|
235
|
-
readonly gzip?: number | undefined;
|
|
236
|
-
} & {
|
|
237
|
-
readonly bytes: number;
|
|
238
|
-
} & {
|
|
239
|
-
readonly path: string;
|
|
240
|
-
}, {}, {}>;
|
|
195
|
+
declare const EmittedFile_base: Schema.Class<EmittedFile, Schema.Struct<{
|
|
196
|
+
readonly path: Schema.String;
|
|
197
|
+
readonly bytes: Schema.Number;
|
|
198
|
+
readonly gzip: Schema.optional<Schema.Number>;
|
|
199
|
+
}>, {}>;
|
|
241
200
|
/**
|
|
242
201
|
* One emitted output file with its in-memory byte size (gzip only when --verbose).
|
|
243
202
|
*
|
|
244
203
|
* @public
|
|
245
204
|
*/
|
|
246
205
|
declare class EmittedFile extends EmittedFile_base {}
|
|
247
|
-
declare const PassReport_base: Schema.Class<PassReport, {
|
|
248
|
-
id: Schema.
|
|
249
|
-
files: Schema
|
|
250
|
-
ms:
|
|
251
|
-
}
|
|
252
|
-
id: Schema.Literal<["js", "dts", "loose", "exe", "meta"]>;
|
|
253
|
-
files: Schema.Array$<typeof EmittedFile>;
|
|
254
|
-
ms: typeof Schema.Number;
|
|
255
|
-
}>, never, {
|
|
256
|
-
readonly files: readonly EmittedFile[];
|
|
257
|
-
} & {
|
|
258
|
-
readonly id: "dts" | "exe" | "js" | "loose" | "meta";
|
|
259
|
-
} & {
|
|
260
|
-
readonly ms: number;
|
|
261
|
-
}, {}, {}>;
|
|
206
|
+
declare const PassReport_base: Schema.Class<PassReport, Schema.Struct<{
|
|
207
|
+
readonly id: Schema.Literals<readonly ["js", "dts", "loose", "exe", "meta"]>;
|
|
208
|
+
readonly files: Schema.$Array<typeof EmittedFile>;
|
|
209
|
+
readonly ms: Schema.Number;
|
|
210
|
+
}>, {}>;
|
|
262
211
|
/**
|
|
263
212
|
* One build pass within a target group (js / dts / loose / exe / meta).
|
|
264
213
|
*
|
|
265
214
|
* @public
|
|
266
215
|
*/
|
|
267
216
|
declare class PassReport extends PassReport_base {}
|
|
268
|
-
declare const TargetGroupReport_base: Schema.Class<TargetGroupReport, {
|
|
269
|
-
id:
|
|
270
|
-
entries: Schema
|
|
271
|
-
passes: Schema
|
|
272
|
-
warnings: Schema
|
|
273
|
-
errors: Schema
|
|
217
|
+
declare const TargetGroupReport_base: Schema.Class<TargetGroupReport, Schema.Struct<{
|
|
218
|
+
readonly id: Schema.String;
|
|
219
|
+
readonly entries: Schema.$Array<Schema.String>;
|
|
220
|
+
readonly passes: Schema.$Array<typeof PassReport>;
|
|
221
|
+
readonly warnings: Schema.$Array<typeof DiagnosticEntry>;
|
|
222
|
+
readonly errors: Schema.$Array<typeof DiagnosticEntry>;
|
|
274
223
|
/** Messages matched by `suppressWarnings`, kept for accounting and `--verbose` expansion. */
|
|
275
|
-
suppressed: Schema
|
|
276
|
-
timings: typeof ReportTimings;
|
|
277
|
-
}
|
|
278
|
-
id: typeof Schema.String;
|
|
279
|
-
entries: Schema.Array$<typeof Schema.String>;
|
|
280
|
-
passes: Schema.Array$<typeof PassReport>;
|
|
281
|
-
warnings: Schema.Array$<typeof DiagnosticEntry>;
|
|
282
|
-
errors: Schema.Array$<typeof DiagnosticEntry>;
|
|
283
|
-
/** Messages matched by `suppressWarnings`, kept for accounting and `--verbose` expansion. */
|
|
284
|
-
suppressed: Schema.Array$<typeof DiagnosticEntry>;
|
|
285
|
-
timings: typeof ReportTimings;
|
|
286
|
-
}>, never, {
|
|
287
|
-
readonly entries: readonly string[];
|
|
288
|
-
} & {
|
|
289
|
-
readonly errors: readonly DiagnosticEntry[];
|
|
290
|
-
} & {
|
|
291
|
-
readonly id: string;
|
|
292
|
-
} & {
|
|
293
|
-
readonly passes: readonly PassReport[];
|
|
294
|
-
} & {
|
|
295
|
-
readonly suppressed: readonly DiagnosticEntry[];
|
|
296
|
-
} & {
|
|
297
|
-
readonly timings: ReportTimings;
|
|
298
|
-
} & {
|
|
299
|
-
readonly warnings: readonly DiagnosticEntry[];
|
|
300
|
-
}, {}, {}>;
|
|
224
|
+
readonly suppressed: Schema.$Array<typeof DiagnosticEntry>;
|
|
225
|
+
readonly timings: typeof ReportTimings;
|
|
226
|
+
}>, {}>;
|
|
301
227
|
/** @public */
|
|
302
228
|
declare class TargetGroupReport extends TargetGroupReport_base {}
|
|
303
|
-
declare const BuildReport_base: Schema.Class<BuildReport, {
|
|
304
|
-
package:
|
|
305
|
-
targetGroups: Schema
|
|
306
|
-
}
|
|
307
|
-
package: typeof Schema.String;
|
|
308
|
-
targetGroups: Schema.Array$<typeof TargetGroupReport>;
|
|
309
|
-
}>, never, {
|
|
310
|
-
readonly package: string;
|
|
311
|
-
} & {
|
|
312
|
-
readonly targetGroups: readonly TargetGroupReport[];
|
|
313
|
-
}, {}, {}>;
|
|
229
|
+
declare const BuildReport_base: Schema.Class<BuildReport, Schema.Struct<{
|
|
230
|
+
readonly package: Schema.String;
|
|
231
|
+
readonly targetGroups: Schema.$Array<typeof TargetGroupReport>;
|
|
232
|
+
}>, {}>;
|
|
314
233
|
/** @public */
|
|
315
234
|
declare class BuildReport extends BuildReport_base {}
|
|
316
235
|
//#endregion
|
|
@@ -346,7 +265,7 @@ declare class BuildCollector {
|
|
|
346
265
|
recordSuppressed(groupId: string, entry: DiagnosticInput): void;
|
|
347
266
|
snapshot(packageName: string): ReadonlyArray<BuildReport>;
|
|
348
267
|
}
|
|
349
|
-
declare const BuildCollectorTag_base: Context.
|
|
268
|
+
declare const BuildCollectorTag_base: Context.ServiceClass<BuildCollectorTag, "@savvy-web/tsdown-plugins/BuildCollector", BuildCollector>;
|
|
350
269
|
/** @public */
|
|
351
270
|
declare class BuildCollectorTag extends BuildCollectorTag_base {}
|
|
352
271
|
//#endregion
|
|
@@ -978,18 +897,36 @@ interface CopyAmbientDtsOptions {
|
|
|
978
897
|
declare function copyAmbientDts(options: CopyAmbientDtsOptions): void;
|
|
979
898
|
//#endregion
|
|
980
899
|
//#region src/catalog/resolve-catalogs.d.ts
|
|
900
|
+
/**
|
|
901
|
+
* Minimal shape of a `package.json` manifest needed to resolve catalog and
|
|
902
|
+
* workspace specifiers.
|
|
903
|
+
*
|
|
904
|
+
* @public
|
|
905
|
+
*/
|
|
906
|
+
interface ManifestLike {
|
|
907
|
+
readonly name: string;
|
|
908
|
+
readonly version: string;
|
|
909
|
+
dependencies?: Record<string, string>;
|
|
910
|
+
devDependencies?: Record<string, string>;
|
|
911
|
+
peerDependencies?: Record<string, string>;
|
|
912
|
+
optionalDependencies?: Record<string, string>;
|
|
913
|
+
[k: string]: unknown;
|
|
914
|
+
}
|
|
981
915
|
/**
|
|
982
916
|
* Resolve every `catalog:`/`workspace:` specifier in a manifest to a concrete spec,
|
|
983
|
-
* delegating to workspaces
|
|
984
|
-
* workspace root from `process.cwd()`
|
|
985
|
-
* and assembles catalogs durably (inline +
|
|
986
|
-
* so no transient
|
|
917
|
+
* delegating to `@effected/workspaces`' one-shot `Workspaces.resolveManifest`. The
|
|
918
|
+
* resolver re-discovers the workspace root from `process.cwd()` on every call (run
|
|
919
|
+
* this from inside the target workspace) and assembles catalogs durably (inline +
|
|
920
|
+
* config-dependency hook-replay + lockfile), so no transient
|
|
921
|
+
* `.pnpm-workspace-state-v1.json` is required.
|
|
987
922
|
*
|
|
988
|
-
* Rejects with `
|
|
989
|
-
* `
|
|
923
|
+
* Rejects with `ManifestDecodeError` when a dependency field is not a string-to-string
|
|
924
|
+
* record, `UnresolvedDependencyError` on a specifier the workspace cannot answer, or
|
|
925
|
+
* `CatalogAssemblyError`/`DependencyResolutionError` when catalog assembly or the
|
|
926
|
+
* resolution mechanism itself fails.
|
|
990
927
|
* @public
|
|
991
928
|
*/
|
|
992
|
-
declare function resolveManifest(pkg: ManifestLike
|
|
929
|
+
declare function resolveManifest(pkg: ManifestLike): Promise<ManifestLike>;
|
|
993
930
|
//#endregion
|
|
994
931
|
//#region src/changesets/next-versions.d.ts
|
|
995
932
|
/**
|
|
@@ -1006,10 +943,11 @@ interface NextVersions {
|
|
|
1006
943
|
/**
|
|
1007
944
|
* Resolve the next release version of every workspace package from pending changesets.
|
|
1008
945
|
*
|
|
1009
|
-
* Walks up from `cwd` to the monorepo root via `@
|
|
1010
|
-
* each package's CURRENT version, then overlays `newVersion` for
|
|
1011
|
-
* via `@changesets/get-release-plan`. Never rejects: any failure
|
|
1012
|
-
* `.changeset/config.json`, parse error) degrades to current
|
|
946
|
+
* Walks up from `cwd` to the monorepo root via `@effected/workspaces`' `WorkspaceDiscovery`,
|
|
947
|
+
* seeds the map with each package's CURRENT version, then overlays `newVersion` for
|
|
948
|
+
* changeset-affected packages via `@changesets/get-release-plan`. Never rejects: any failure
|
|
949
|
+
* (not a workspace, missing `.changeset/config.json`, parse error) degrades to current
|
|
950
|
+
* versions (or an empty map).
|
|
1013
951
|
* @public
|
|
1014
952
|
*/
|
|
1015
953
|
declare function resolveNextVersions(cwd: string): Promise<NextVersions>;
|
|
@@ -1258,7 +1196,7 @@ interface ValidationInput {
|
|
|
1258
1196
|
/** Standalone bundled output files; validated structurally (extension/format) before any build. */
|
|
1259
1197
|
readonly looseFiles?: LooseFiles | undefined;
|
|
1260
1198
|
}
|
|
1261
|
-
declare const ConfigValidator_base: Context.
|
|
1199
|
+
declare const ConfigValidator_base: Context.ServiceClass<ConfigValidator, "@savvy-web/tsdown-plugins/ConfigValidator", {
|
|
1262
1200
|
readonly validate: (input: ValidationInput) => Effect.Effect<void, ConfigValidationError>;
|
|
1263
1201
|
}>;
|
|
1264
1202
|
/**
|
|
@@ -1473,13 +1411,15 @@ interface TsconfigJsx {
|
|
|
1473
1411
|
}
|
|
1474
1412
|
/**
|
|
1475
1413
|
* Resolve the effective JSX config: an explicit override wins; otherwise infer from the tsconfig
|
|
1476
|
-
* values. Returns undefined when
|
|
1414
|
+
* values via `@effected/tsconfig-json`'s `JsxConfig.fromCompilerOptions`. Returns undefined when
|
|
1415
|
+
* no JSX transform is needed (preserve/none).
|
|
1477
1416
|
* @public
|
|
1478
1417
|
*/
|
|
1479
1418
|
declare function resolveJsxConfig(tsconfig: TsconfigJsx, override: JsxConfig | undefined): JsxConfig | undefined;
|
|
1480
1419
|
/**
|
|
1481
1420
|
* Read the jsx-relevant compilerOptions from a package's own tsconfig.json (best-effort;
|
|
1482
|
-
* returns empty on absence or parse error).
|
|
1421
|
+
* returns empty on absence or parse error). Resolved through `@effected/tsconfig-json`'s
|
|
1422
|
+
* sync loader, so JSONC syntax and `extends` chains are honored.
|
|
1483
1423
|
* @public
|
|
1484
1424
|
*/
|
|
1485
1425
|
declare function readTsconfigJsx(cwd: string): TsconfigJsx;
|
|
@@ -1690,10 +1630,12 @@ declare class TsconfigResolver {
|
|
|
1690
1630
|
*
|
|
1691
1631
|
* @remarks
|
|
1692
1632
|
* Resolves the package's own `<cwd>/tsconfig.json` (which extends the shared
|
|
1693
|
-
* `@savvy-web/bundler/ecma.json` base) via
|
|
1694
|
-
*
|
|
1695
|
-
*
|
|
1696
|
-
*
|
|
1633
|
+
* `@savvy-web/bundler/ecma.json` base) via `@effected/tsconfig-json`'s
|
|
1634
|
+
* synchronous `TsconfigLoaderSync` (tsc-parity `extends` resolution) so the
|
|
1635
|
+
* result carries the full effective options (target/module/strict/jsx/lib),
|
|
1636
|
+
* then projects them through the kit's `PortableTsconfig.make` allow-list
|
|
1637
|
+
* filter to a portable, compilerOptions-only shape with no absolute paths or
|
|
1638
|
+
* emit/file-selection options.
|
|
1697
1639
|
*
|
|
1698
1640
|
* When the package has no own `tsconfig.json` (e.g. a minimal test fixture),
|
|
1699
1641
|
* falls back to `fallbackConfigPath` — the build's already-resolved dts tsconfig,
|
|
@@ -1805,7 +1747,7 @@ declare function writeIssuesArtifact(opts: {
|
|
|
1805
1747
|
//#region src/report/services/EnvironmentDetector.d.ts
|
|
1806
1748
|
/** @public */
|
|
1807
1749
|
type Environment = "agent-shell" | "terminal" | "ci-github" | "ci-generic";
|
|
1808
|
-
declare const EnvironmentDetector_base: Context.
|
|
1750
|
+
declare const EnvironmentDetector_base: Context.ServiceClass<EnvironmentDetector, "@savvy-web/tsdown-plugins/EnvironmentDetector", {
|
|
1809
1751
|
readonly detect: () => Effect.Effect<Environment>;
|
|
1810
1752
|
}>;
|
|
1811
1753
|
/** @public */
|
|
@@ -1818,7 +1760,7 @@ declare const EnvironmentDetectorLive: Layer.Layer<EnvironmentDetector, never, n
|
|
|
1818
1760
|
//#region src/report/services/ExecutorResolver.d.ts
|
|
1819
1761
|
/** @public */
|
|
1820
1762
|
type Executor = "human" | "agent" | "ci";
|
|
1821
|
-
declare const ExecutorResolver_base: Context.
|
|
1763
|
+
declare const ExecutorResolver_base: Context.ServiceClass<ExecutorResolver, "@savvy-web/tsdown-plugins/ExecutorResolver", {
|
|
1822
1764
|
readonly resolve: (env: Environment) => Effect.Effect<Executor>;
|
|
1823
1765
|
}>;
|
|
1824
1766
|
/** @public */
|
|
@@ -1831,7 +1773,7 @@ declare const ExecutorResolverLive: Layer.Layer<ExecutorResolver, never, never>;
|
|
|
1831
1773
|
//#region src/report/services/FormatSelector.d.ts
|
|
1832
1774
|
/** @public */
|
|
1833
1775
|
type OutputFormat = "terminal" | "json" | "markdown" | "ci-annotations" | "silent";
|
|
1834
|
-
declare const FormatSelector_base: Context.
|
|
1776
|
+
declare const FormatSelector_base: Context.ServiceClass<FormatSelector, "@savvy-web/tsdown-plugins/FormatSelector", {
|
|
1835
1777
|
readonly select: (executor: Executor, explicit?: OutputFormat, env?: Environment) => Effect.Effect<OutputFormat>;
|
|
1836
1778
|
}>;
|
|
1837
1779
|
/** @public */
|
|
@@ -1842,7 +1784,7 @@ declare class FormatSelector extends FormatSelector_base {}
|
|
|
1842
1784
|
declare const FormatSelectorLive: Layer.Layer<FormatSelector, never, never>;
|
|
1843
1785
|
//#endregion
|
|
1844
1786
|
//#region src/report/services/OutputRenderer.d.ts
|
|
1845
|
-
declare const OutputRenderer_base: Context.
|
|
1787
|
+
declare const OutputRenderer_base: Context.ServiceClass<OutputRenderer, "@savvy-web/tsdown-plugins/OutputRenderer", {
|
|
1846
1788
|
readonly render: (reports: ReadonlyArray<BuildReport>, format: OutputFormat, ctx: FormatterContext) => Effect.Effect<ReadonlyArray<RenderedOutput>>;
|
|
1847
1789
|
}>;
|
|
1848
1790
|
/** @public */
|
|
@@ -1935,5 +1877,5 @@ declare function resolveTargets(options: {
|
|
|
1935
1877
|
baseName: string;
|
|
1936
1878
|
}): TargetResolution;
|
|
1937
1879
|
//#endregion
|
|
1938
|
-
export { type AmbientDtsEntry, BuildCollector, BuildCollectorTag, type BuildEmittedManifestOptions, type BuildFormat, type BuildGroupSpec, type BuildIssues, type BuildPlatform, type BuildReport, BuildReport as BuildReportSchema, type BuildTargetGroupsOptions, CatalogAssemblyError,
|
|
1880
|
+
export { type AmbientDtsEntry, BuildCollector, BuildCollectorTag, type BuildEmittedManifestOptions, type BuildFormat, type BuildGroupSpec, type BuildIssues, type BuildPlatform, type BuildReport, BuildReport as BuildReportSchema, type BuildTargetGroupsOptions, CatalogAssemblyError, CiAnnotationsFormatter, ConfigValidationError, ConfigValidator, ConfigValidatorLive, type CopyAmbientDtsOptions, type CssOptions, DEFAULT_EXE_NODE_VERSION, DependencyResolutionError, type DeriveOptions, type DerivedTsdownOptions, type DiagnosticEntry, type DiagnosticInput, type DtsExportClass, type DualExports, type EmitManifestOptions, type EmittedFile, type EntryOverride, type Environment, EnvironmentDetector, EnvironmentDetectorLive, type ExeBuild, type ExeConfig, type ExeRewrite, type ExeSeaConfig, type ExeTarget, type ExeTargetInput, type Executor, ExecutorResolver, ExecutorResolverLive, type ExtractAmbientOptions, type ExtractOptions, type ExtractResult, FormatSelector, FormatSelectorLive, type Formatter, type FormatterContext, type GenerateMetaOptions, type Json, JsonFormatter, type JsxConfig, type LooseFileSpec, type LooseFiles, ManifestDecodeError, type ManifestLike, MarkdownFormatter, MetaGenerationError, type MetaOptions, type MetaResult, type ModuleExportNames, type NextVersions, type NormalizedExe, type NormalizedLooseFile, type NormalizedMeta, type OutputFormat, OutputRenderer, OutputRendererLive, type PackageJsonEntriesOptions, type PackageJsonLike, type PassKind, type PassReport, type PkgOsCpu, type PlainDiagnostic, type PortableTsconfig, type PublishTargetObject, type PublishTargetValue, type PublishTargets, type ReexportBarrelAnalysis, type RenderReportOptions, type RenderedOutput, ReportPipelineLive, ReportTimings, type ResolvedCompilerOptions, type ResolvedGroup, type ResolvedTarget, type ResolvedTsconfig, type ResolvedTsconfigOptions, type RunExeBuildOptions, type RunMetaPassOptions, SilentFormatter, type TargetGroupId, type TargetGroupRef, type TargetGroupReport, TargetGroupReport as TargetGroupReportSchema, type TargetResolution, TerminalFormatter, type Timer, type TransformManifestOptions, type TsconfigJsx, TsconfigResolver, type TsdocOptions, type TsdocTagDefinition, type TsdownBuild, type TsdownLogger, UnresolvedDependencyError, type ValidationInput, type WarningSuppressionRule, ambientOutName, analyzeReexportBarrel, applySubdirMetaEntries, assertNoEntryCollisions, buildEmittedManifest, buildMetricsPlugin, buildResolvedTsconfig, buildTargetGroups, cjsDefaultInterop, classifyDtsExport, collectExportNames, computeExeFileName, copyAmbientDts, copyPublicDir, createEntryName, createTimer, createTsdownLogger, declarationExt, defaultManifestTransform, deriveExportPaths, deriveTargetGroupOptions, emitManifest, extractAmbientDts, extractEntries, findRelativeSpecifiers, flattenIssues, formatTime, generateMeta, isTargetObject, mixedDtsExportError, nodeBuiltinDefaultInterop, normalizeBinPaths, normalizeExeOptions, normalizeLooseFiles, normalizeMetaOptions, packageJsonEntries, readTsconfigJsx, removeDeclarationMaps, renderReexportStub, renderReport, resolveJsxConfig, resolveManifest, resolveNextVersions, resolvePortableTsconfig, resolveTargets, rewriteMetaVersions, runExeBuild, runMetaPass, serializeIssues, transformBin, transformExports, transformManifest, writeDtsEmitTsconfig, writeIssuesArtifact, writeResolvedTsconfig, writeTargetsBinding };
|
|
1939
1881
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -50,6 +50,6 @@ import { OutputRenderer } from "./report/services/OutputRenderer.js";
|
|
|
50
50
|
import { OutputRendererLive } from "./report/layers/OutputRendererLive.js";
|
|
51
51
|
import { ReportPipelineLive, renderReport } from "./report/pipeline.js";
|
|
52
52
|
import { writeTargetsBinding } from "./targets/binding.js";
|
|
53
|
-
import { CatalogAssemblyError,
|
|
53
|
+
import { CatalogAssemblyError, DependencyResolutionError, ManifestDecodeError, UnresolvedDependencyError } from "@effected/npm";
|
|
54
54
|
|
|
55
|
-
export { BuildCollector, BuildCollectorTag, BuildReport as BuildReportSchema, CatalogAssemblyError,
|
|
55
|
+
export { BuildCollector, BuildCollectorTag, BuildReport as BuildReportSchema, CatalogAssemblyError, CiAnnotationsFormatter, ConfigValidationError, ConfigValidator, ConfigValidatorLive, DEFAULT_EXE_NODE_VERSION, DependencyResolutionError, EnvironmentDetector, EnvironmentDetectorLive, ExecutorResolver, ExecutorResolverLive, FormatSelector, FormatSelectorLive, JsonFormatter, ManifestDecodeError, MarkdownFormatter, MetaGenerationError, OutputRenderer, OutputRendererLive, ReportPipelineLive, ReportTimings, SilentFormatter, TargetGroupReport as TargetGroupReportSchema, TerminalFormatter, TsconfigResolver, UnresolvedDependencyError, ambientOutName, analyzeReexportBarrel, applySubdirMetaEntries, assertNoEntryCollisions, buildEmittedManifest, buildMetricsPlugin, buildResolvedTsconfig, buildTargetGroups, cjsDefaultInterop, classifyDtsExport, collectExportNames, computeExeFileName, copyAmbientDts, copyPublicDir, createEntryName, createTimer, createTsdownLogger, declarationExt, defaultManifestTransform, deriveExportPaths, deriveTargetGroupOptions, emitManifest, extractAmbientDts, extractEntries, findRelativeSpecifiers, flattenIssues, formatTime, generateMeta, isTargetObject, mixedDtsExportError, nodeBuiltinDefaultInterop, normalizeBinPaths, normalizeExeOptions, normalizeLooseFiles, normalizeMetaOptions, packageJsonEntries, readTsconfigJsx, removeDeclarationMaps, renderReexportStub, renderReport, resolveJsxConfig, resolveManifest, resolveNextVersions, resolvePortableTsconfig, resolveTargets, rewriteMetaVersions, runExeBuild, runMetaPass, serializeIssues, transformBin, transformExports, transformManifest, writeDtsEmitTsconfig, writeIssuesArtifact, writeResolvedTsconfig, writeTargetsBinding };
|
package/jsx/config.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import
|
|
2
|
+
import * as nodePath from "node:path";
|
|
3
|
+
import { Option } from "effect";
|
|
4
|
+
import { JsxConfig, TsconfigLoaderSync } from "@effected/tsconfig-json";
|
|
3
5
|
|
|
4
6
|
//#region src/jsx/config.ts
|
|
5
7
|
/**
|
|
6
8
|
* Resolve the effective JSX config: an explicit override wins; otherwise infer from the tsconfig
|
|
7
|
-
* values. Returns undefined when
|
|
9
|
+
* values via `@effected/tsconfig-json`'s `JsxConfig.fromCompilerOptions`. Returns undefined when
|
|
10
|
+
* no JSX transform is needed (preserve/none).
|
|
8
11
|
* @public
|
|
9
12
|
*/
|
|
10
13
|
function resolveJsxConfig(tsconfig, override) {
|
|
@@ -12,23 +15,37 @@ function resolveJsxConfig(tsconfig, override) {
|
|
|
12
15
|
runtime: "automatic",
|
|
13
16
|
importSource: override.importSource ?? "react"
|
|
14
17
|
} : override;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const inferred = JsxConfig.fromCompilerOptions({
|
|
19
|
+
...tsconfig.jsx !== void 0 ? { jsx: tsconfig.jsx } : {},
|
|
20
|
+
...tsconfig.jsxImportSource !== void 0 ? { jsxImportSource: tsconfig.jsxImportSource } : {}
|
|
21
|
+
});
|
|
22
|
+
return Option.match(inferred, {
|
|
23
|
+
onNone: () => void 0,
|
|
24
|
+
onSome: (cfg) => ({
|
|
25
|
+
runtime: cfg.runtime,
|
|
26
|
+
...cfg.importSource !== void 0 ? { importSource: cfg.importSource } : {}
|
|
27
|
+
})
|
|
28
|
+
});
|
|
21
29
|
}
|
|
30
|
+
/** The consumer-supplied sync operations for the tsconfig loader. @internal */
|
|
31
|
+
const syncOptions = {
|
|
32
|
+
fileSystem: {
|
|
33
|
+
exists: existsSync,
|
|
34
|
+
readFile: (p) => readFileSync(p, "utf8")
|
|
35
|
+
},
|
|
36
|
+
path: nodePath
|
|
37
|
+
};
|
|
22
38
|
/**
|
|
23
39
|
* Read the jsx-relevant compilerOptions from a package's own tsconfig.json (best-effort;
|
|
24
|
-
* returns empty on absence or parse error).
|
|
40
|
+
* returns empty on absence or parse error). Resolved through `@effected/tsconfig-json`'s
|
|
41
|
+
* sync loader, so JSONC syntax and `extends` chains are honored.
|
|
25
42
|
* @public
|
|
26
43
|
*/
|
|
27
44
|
function readTsconfigJsx(cwd) {
|
|
28
|
-
const path = join(cwd, "tsconfig.json");
|
|
45
|
+
const path = nodePath.join(cwd, "tsconfig.json");
|
|
29
46
|
if (!existsSync(path)) return {};
|
|
30
47
|
try {
|
|
31
|
-
const co =
|
|
48
|
+
const co = TsconfigLoaderSync.compilerOptions(path, syncOptions);
|
|
32
49
|
return {
|
|
33
50
|
...co.jsx !== void 0 ? { jsx: co.jsx } : {},
|
|
34
51
|
...co.jsxImportSource !== void 0 ? { jsxImportSource: co.jsxImportSource } : {}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolveManifest } from "../catalog/resolve-catalogs.js";
|
|
2
2
|
import { transformManifest } from "./transform.js";
|
|
3
|
+
import { DependencySpecifier } from "@effected/npm";
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
import { readFile } from "node:fs/promises";
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ const DEPENDENCY_FIELDS = [
|
|
|
10
11
|
"peerDependencies",
|
|
11
12
|
"optionalDependencies"
|
|
12
13
|
];
|
|
13
|
-
const isCatalogOrWorkspaceSpec = (spec) => typeof spec === "string" && (
|
|
14
|
+
const isCatalogOrWorkspaceSpec = (spec) => typeof spec === "string" && (DependencySpecifier.isCatalog(spec) || DependencySpecifier.isWorkspace(spec));
|
|
14
15
|
/**
|
|
15
16
|
* Whether any of `pkg`'s four dependency fields carries at least one `catalog:`/`workspace:`
|
|
16
17
|
* specifier. `resolveManifest` returns a manifest with none of these unchanged, so callers can
|
package/manifest/transform.js
CHANGED
|
@@ -82,11 +82,18 @@ const isTs = (p) => !isDeclarationFile(p) && (p.endsWith(".ts") || p.endsWith(".
|
|
|
82
82
|
* gates the `types` condition: when `false` (the build's dts pass was skipped, see issue #198),
|
|
83
83
|
* omitting `types` avoids pointing the published manifest at a declaration file that was never
|
|
84
84
|
* written. Defaults to `true` (current behavior, byte-identical).
|
|
85
|
+
*
|
|
86
|
+
* The trailing `default` condition mirrors the ESM artifact so `require(esm)` resolves on the
|
|
87
|
+
* Node range every published package supports (engines >=24.11.0): Node's require() matches
|
|
88
|
+
* `node`/`require`/`default` but never `import`, so an import-only map dies with
|
|
89
|
+
* ERR_PACKAGE_PATH_NOT_EXPORTED even where require(esm) works. Dual-format entries keep their
|
|
90
|
+
* dedicated CJS artifact under `require`, which wins over `default` by condition order.
|
|
85
91
|
*/
|
|
86
92
|
const tsConditions = (exportKey, dual, subdirExports, emitDts = true) => ({
|
|
87
93
|
...emitDts ? { types: toBuiltDts(exportKey, subdirExports) } : {},
|
|
88
94
|
import: toBuiltJs(exportKey, subdirExports),
|
|
89
|
-
...dual ? { require: toBuiltCjs(exportKey, subdirExports) } : {}
|
|
95
|
+
...dual ? { require: toBuiltCjs(exportKey, subdirExports) } : {},
|
|
96
|
+
default: toBuiltJs(exportKey, subdirExports)
|
|
90
97
|
});
|
|
91
98
|
/**
|
|
92
99
|
* A `./public/<path>` export value points into the staged `public/` dir, whose CONTENTS `copyPublicDir`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import
|
|
3
|
-
import { JsxEmit, ModuleDetectionKind, ModuleKind, ModuleResolutionKind, NewLineKind, ScriptTarget
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import * as nodePath from "node:path";
|
|
3
|
+
import { JsxEmit, ModuleDetectionKind, ModuleKind, ModuleResolutionKind, NewLineKind, ScriptTarget } from "typescript";
|
|
4
|
+
import { PortableTsconfig, TsconfigLoaderSync } from "@effected/tsconfig-json";
|
|
4
5
|
|
|
5
6
|
//#region src/meta/tsconfig-resolver.ts
|
|
6
7
|
/**
|
|
@@ -215,15 +216,31 @@ var TsconfigResolver = class TsconfigResolver {
|
|
|
215
216
|
}
|
|
216
217
|
};
|
|
217
218
|
/**
|
|
219
|
+
* The consumer-supplied sync operations backing {@link resolvePortableTsconfig}:
|
|
220
|
+
* Node's `existsSync`/`readFileSync` satisfy the loader's `SyncFileSystem`, and
|
|
221
|
+
* `node:path` satisfies `SyncPath` verbatim.
|
|
222
|
+
*
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
const syncOptions = {
|
|
226
|
+
fileSystem: {
|
|
227
|
+
exists: existsSync,
|
|
228
|
+
readFile: (p) => readFileSync(p, "utf8")
|
|
229
|
+
},
|
|
230
|
+
path: nodePath
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
218
233
|
* Resolves the package's effective compiler options (following `extends`) into a
|
|
219
234
|
* portable, JSON-serializable tsconfig for the meta release bundle.
|
|
220
235
|
*
|
|
221
236
|
* @remarks
|
|
222
237
|
* Resolves the package's own `<cwd>/tsconfig.json` (which extends the shared
|
|
223
|
-
* `@savvy-web/bundler/ecma.json` base) via
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
238
|
+
* `@savvy-web/bundler/ecma.json` base) via `@effected/tsconfig-json`'s
|
|
239
|
+
* synchronous `TsconfigLoaderSync` (tsc-parity `extends` resolution) so the
|
|
240
|
+
* result carries the full effective options (target/module/strict/jsx/lib),
|
|
241
|
+
* then projects them through the kit's `PortableTsconfig.make` allow-list
|
|
242
|
+
* filter to a portable, compilerOptions-only shape with no absolute paths or
|
|
243
|
+
* emit/file-selection options.
|
|
227
244
|
*
|
|
228
245
|
* When the package has no own `tsconfig.json` (e.g. a minimal test fixture),
|
|
229
246
|
* falls back to `fallbackConfigPath` — the build's already-resolved dts tsconfig,
|
|
@@ -237,7 +254,7 @@ var TsconfigResolver = class TsconfigResolver {
|
|
|
237
254
|
* @public
|
|
238
255
|
*/
|
|
239
256
|
function resolvePortableTsconfig(cwd, fallbackConfigPath) {
|
|
240
|
-
const ownConfig = join(cwd, "tsconfig.json");
|
|
257
|
+
const ownConfig = nodePath.join(cwd, "tsconfig.json");
|
|
241
258
|
const configPath = existsSync(ownConfig) ? ownConfig : fallbackConfigPath !== void 0 && existsSync(fallbackConfigPath) ? fallbackConfigPath : void 0;
|
|
242
259
|
if (configPath === void 0) return {
|
|
243
260
|
$schema: TSCONFIG_SCHEMA_URL,
|
|
@@ -246,15 +263,13 @@ function resolvePortableTsconfig(cwd, fallbackConfigPath) {
|
|
|
246
263
|
noEmit: true
|
|
247
264
|
}
|
|
248
265
|
};
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
if (parsed === void 0) throw new Error(`Failed to parse tsconfig at ${configPath}`);
|
|
257
|
-
return new TsconfigResolver().resolve(parsed);
|
|
266
|
+
try {
|
|
267
|
+
const resolved = TsconfigLoaderSync.resolve(configPath, syncOptions);
|
|
268
|
+
return PortableTsconfig.make(resolved);
|
|
269
|
+
} catch (error) {
|
|
270
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
271
|
+
throw new Error(`Cannot resolve portable tsconfig at ${configPath}: ${message}`, { cause: error });
|
|
272
|
+
}
|
|
258
273
|
}
|
|
259
274
|
|
|
260
275
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/tsdown-plugins",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Interface-only tsdown/rolldown plugin pack powering @savvy-web/bundler",
|
|
6
6
|
"homepage": "https://github.com/savvy-web/systems/tree/main/packages/tsdown-plugins",
|
|
@@ -23,30 +23,25 @@
|
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./index.d.ts",
|
|
26
|
-
"import": "./index.js"
|
|
26
|
+
"import": "./index.js",
|
|
27
|
+
"default": "./index.js"
|
|
27
28
|
},
|
|
28
29
|
"./package.json": "./package.json"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@changesets/get-release-plan": "^5.0.0-next.7",
|
|
32
|
-
"@effect/
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@effect/rpc": "^0.75.1",
|
|
37
|
-
"@effect/sql": "^0.51.1",
|
|
38
|
-
"@effect/workflow": "^0.18.2",
|
|
39
|
-
"@manypkg/get-packages": "^3.1.0",
|
|
33
|
+
"@effect/platform-node": "4.0.0-beta.98",
|
|
34
|
+
"@effected/npm": "^0.2.0",
|
|
35
|
+
"@effected/tsconfig-json": "^0.2.0",
|
|
36
|
+
"@effected/workspaces": "^0.3.0",
|
|
40
37
|
"@microsoft/api-extractor": "^7.58.9",
|
|
41
38
|
"@microsoft/tsdoc": "^0.16.0",
|
|
42
39
|
"@microsoft/tsdoc-config": "^0.18.1",
|
|
43
|
-
"effect": "
|
|
44
|
-
"json-schema-effect": "^0.3.0",
|
|
40
|
+
"effect": "4.0.0-beta.98",
|
|
45
41
|
"picocolors": "^1.1.1",
|
|
46
42
|
"sort-package-json": "^4.0.0",
|
|
47
43
|
"std-env": "^4.2.0",
|
|
48
44
|
"tsdown": "^0.22.7",
|
|
49
|
-
"typescript": "^6.0.3"
|
|
50
|
-
"workspaces-effect": "^2.1.0"
|
|
45
|
+
"typescript": "^6.0.3"
|
|
51
46
|
}
|
|
52
47
|
}
|
package/report/collector.js
CHANGED
|
@@ -135,7 +135,7 @@ function toEntry(input) {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
/** @public */
|
|
138
|
-
var BuildCollectorTag = class extends Context.
|
|
138
|
+
var BuildCollectorTag = class extends Context.Service()("@savvy-web/tsdown-plugins/BuildCollector") {};
|
|
139
139
|
|
|
140
140
|
//#endregion
|
|
141
141
|
export { BuildCollector, BuildCollectorTag };
|
package/report/schema.js
CHANGED
|
@@ -9,8 +9,12 @@ var ReportTimings = class extends Schema.Class("ReportTimings")({ totalMs: Schem
|
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
11
|
var DiagnosticEntry = class extends Schema.Class("DiagnosticEntry")({
|
|
12
|
-
source: Schema.
|
|
13
|
-
|
|
12
|
+
source: Schema.Literals([
|
|
13
|
+
"tsdown",
|
|
14
|
+
"rolldown",
|
|
15
|
+
"api-extractor"
|
|
16
|
+
]),
|
|
17
|
+
level: Schema.Literals(["warn", "error"]),
|
|
14
18
|
text: Schema.String,
|
|
15
19
|
/** API Extractor messageId (e.g. "ae-forgotten-export"); used to group suppressed messages by type. */
|
|
16
20
|
code: Schema.optional(Schema.String),
|
|
@@ -36,7 +40,13 @@ var EmittedFile = class extends Schema.Class("EmittedFile")({
|
|
|
36
40
|
* @public
|
|
37
41
|
*/
|
|
38
42
|
var PassReport = class extends Schema.Class("PassReport")({
|
|
39
|
-
id: Schema.
|
|
43
|
+
id: Schema.Literals([
|
|
44
|
+
"js",
|
|
45
|
+
"dts",
|
|
46
|
+
"loose",
|
|
47
|
+
"exe",
|
|
48
|
+
"meta"
|
|
49
|
+
]),
|
|
40
50
|
files: Schema.Array(EmittedFile),
|
|
41
51
|
ms: Schema.Number
|
|
42
52
|
}) {};
|
|
@@ -2,7 +2,7 @@ import { Context } from "effect";
|
|
|
2
2
|
|
|
3
3
|
//#region src/report/services/EnvironmentDetector.ts
|
|
4
4
|
/** @public */
|
|
5
|
-
var EnvironmentDetector = class extends Context.
|
|
5
|
+
var EnvironmentDetector = class extends Context.Service()("@savvy-web/tsdown-plugins/EnvironmentDetector") {};
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
export { EnvironmentDetector };
|
|
@@ -2,7 +2,7 @@ import { Context } from "effect";
|
|
|
2
2
|
|
|
3
3
|
//#region src/report/services/ExecutorResolver.ts
|
|
4
4
|
/** @public */
|
|
5
|
-
var ExecutorResolver = class extends Context.
|
|
5
|
+
var ExecutorResolver = class extends Context.Service()("@savvy-web/tsdown-plugins/ExecutorResolver") {};
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
export { ExecutorResolver };
|
|
@@ -2,7 +2,7 @@ import { Context } from "effect";
|
|
|
2
2
|
|
|
3
3
|
//#region src/report/services/FormatSelector.ts
|
|
4
4
|
/** @public */
|
|
5
|
-
var FormatSelector = class extends Context.
|
|
5
|
+
var FormatSelector = class extends Context.Service()("@savvy-web/tsdown-plugins/FormatSelector") {};
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
export { FormatSelector };
|
|
@@ -2,7 +2,7 @@ import { Context } from "effect";
|
|
|
2
2
|
|
|
3
3
|
//#region src/report/services/OutputRenderer.ts
|
|
4
4
|
/** @public */
|
|
5
|
-
var OutputRenderer = class extends Context.
|
|
5
|
+
var OutputRenderer = class extends Context.Service()("@savvy-web/tsdown-plugins/OutputRenderer") {};
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
export { OutputRenderer };
|