@savvy-web/tsdown-plugins 0.8.0 → 0.9.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 -1
- package/build/build-target-groups.js +1 -0
- package/build/cjs-default-interop.js +1 -0
- package/build/loose-files.js +1 -0
- package/build/node-builtin-default-interop.js +15 -9
- package/build/strip-maps.js +1 -0
- package/build/sync-public.js +1 -0
- package/build/target-groups.js +5 -1
- package/catalog/resolve-catalogs.js +1 -0
- package/changesets/next-versions.js +1 -0
- package/config-validation/ConfigValidator.js +5 -1
- package/config-validation/ConfigValidatorLive.js +5 -1
- package/dts/resolved-tsconfig.js +10 -2
- package/entry/extract.js +1 -0
- package/entry/package-json-entries.js +5 -1
- package/errors.js +10 -2
- package/exe/build.js +5 -1
- package/exe/config.js +6 -1
- package/exe/filename.js +1 -0
- package/index.d.ts +502 -571
- package/index.js +3 -2
- package/jsx/config.js +2 -0
- package/manifest/emit-manifest.js +10 -2
- package/manifest/transform.js +18 -4
- package/meta/api-extractor.js +21 -2
- package/meta/config.js +5 -1
- package/meta/generate.js +5 -2
- package/meta/optimistic.js +1 -0
- package/meta/run-pass.js +75 -0
- package/meta/tsconfig-resolver.js +6 -6
- package/package.json +1 -1
- package/report/collector.js +16 -1
- package/report/formatters/ci-annotations.js +1 -0
- package/report/formatters/diagnostics.js +23 -0
- package/report/formatters/json.js +1 -0
- package/report/formatters/markdown.js +19 -9
- package/report/formatters/silent.js +1 -0
- package/report/formatters/terminal.js +10 -1
- package/report/issues-artifact.js +88 -0
- package/report/layers/EnvironmentDetectorLive.js +1 -0
- package/report/layers/ExecutorResolverLive.js +1 -0
- package/report/layers/FormatSelectorLive.js +1 -0
- package/report/layers/OutputRendererLive.js +1 -0
- package/report/metrics-plugin.js +1 -0
- package/report/pipeline.js +2 -0
- package/report/schema.js +24 -3
- package/report/services/EnvironmentDetector.js +1 -0
- package/report/services/ExecutorResolver.js +1 -0
- package/report/services/FormatSelector.js +1 -0
- package/report/services/OutputRenderer.js +1 -0
- package/report/timer.js +6 -1
- package/report/tsdown-logger.js +1 -0
- package/targets/binding.js +5 -1
- package/targets/config.js +5 -1
- package/targets/resolve-targets.js +5 -1
- package/tsdoc-metadata.json +11 -0
- package/report/schema-export.js +0 -18
|
@@ -2,6 +2,7 @@ import { FormatSelector } from "../services/FormatSelector.js";
|
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/report/layers/FormatSelectorLive.ts
|
|
5
|
+
/** @public */
|
|
5
6
|
const FormatSelectorLive = Layer.succeed(FormatSelector, { select: (executor, explicit, env) => Effect.succeed(explicit ?? (env === "ci-github" && executor === "ci" ? "ci-annotations" : executor === "agent" ? "markdown" : executor === "ci" ? "json" : "terminal")) });
|
|
6
7
|
|
|
7
8
|
//#endregion
|
|
@@ -14,6 +14,7 @@ const formatters = /* @__PURE__ */ new Map([
|
|
|
14
14
|
["ci-annotations", CiAnnotationsFormatter],
|
|
15
15
|
["silent", SilentFormatter]
|
|
16
16
|
]);
|
|
17
|
+
/** @public */
|
|
17
18
|
const OutputRendererLive = Layer.succeed(OutputRenderer, { render: (reports, format, ctx) => Effect.sync(() => {
|
|
18
19
|
const f = formatters.get(format);
|
|
19
20
|
return f ? f.render(reports, ctx) : [];
|
package/report/metrics-plugin.js
CHANGED
|
@@ -16,6 +16,7 @@ function byteLength(content) {
|
|
|
16
16
|
* defensive onLog for rolldown-level diagnostics that bypass tsdown's logger. Append it to each
|
|
17
17
|
* build pass's `plugins` array. `bytes` is taken from the in-memory chunk/asset content (no fs);
|
|
18
18
|
* `gzip` is computed only when `verbose`.
|
|
19
|
+
* @public
|
|
19
20
|
*/
|
|
20
21
|
function buildMetricsPlugin(collector, groupId, pass, verbose) {
|
|
21
22
|
return {
|
package/report/pipeline.js
CHANGED
|
@@ -9,7 +9,9 @@ import { OutputRendererLive } from "./layers/OutputRendererLive.js";
|
|
|
9
9
|
import { Effect, Layer } from "effect";
|
|
10
10
|
|
|
11
11
|
//#region src/report/pipeline.ts
|
|
12
|
+
/** @public */
|
|
12
13
|
const ReportPipelineLive = Layer.mergeAll(EnvironmentDetectorLive, ExecutorResolverLive, FormatSelectorLive, OutputRendererLive);
|
|
14
|
+
/** @public */
|
|
13
15
|
const renderReport = (reports, options) => Effect.gen(function* () {
|
|
14
16
|
const detector = yield* EnvironmentDetector;
|
|
15
17
|
const executorResolver = yield* ExecutorResolver;
|
package/report/schema.js
CHANGED
|
@@ -1,36 +1,57 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
//#region src/report/schema.ts
|
|
4
|
+
/** @public */
|
|
4
5
|
var ReportTimings = class extends Schema.Class("ReportTimings")({ totalMs: Schema.Number }) {};
|
|
5
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* A captured warning or error, from tsdown's logger, rolldown's onLog, or API Extractor.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
6
11
|
var DiagnosticEntry = class extends Schema.Class("DiagnosticEntry")({
|
|
7
12
|
source: Schema.Literal("tsdown", "rolldown", "api-extractor"),
|
|
8
13
|
level: Schema.Literal("warn", "error"),
|
|
9
14
|
text: Schema.String,
|
|
15
|
+
/** API Extractor messageId (e.g. "ae-forgotten-export"); used to group suppressed messages by type. */
|
|
16
|
+
code: Schema.optional(Schema.String),
|
|
17
|
+
/** True when shown as `warn` locally but a hard error in CI (drives the "[fails CI]" nudge). */
|
|
18
|
+
ciFatal: Schema.optional(Schema.Boolean),
|
|
10
19
|
file: Schema.optional(Schema.String),
|
|
11
20
|
line: Schema.optional(Schema.Number),
|
|
12
21
|
column: Schema.optional(Schema.Number)
|
|
13
22
|
}) {};
|
|
14
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* One emitted output file with its in-memory byte size (gzip only when --verbose).
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
15
28
|
var EmittedFile = class extends Schema.Class("EmittedFile")({
|
|
16
29
|
path: Schema.String,
|
|
17
30
|
bytes: Schema.Number,
|
|
18
31
|
gzip: Schema.optional(Schema.Number)
|
|
19
32
|
}) {};
|
|
20
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* One build pass within a target group (js / dts / loose / exe / meta).
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
21
38
|
var PassReport = class extends Schema.Class("PassReport")({
|
|
22
39
|
id: Schema.Literal("js", "dts", "loose", "exe", "meta"),
|
|
23
40
|
files: Schema.Array(EmittedFile),
|
|
24
41
|
ms: Schema.Number
|
|
25
42
|
}) {};
|
|
43
|
+
/** @public */
|
|
26
44
|
var TargetGroupReport = class extends Schema.Class("TargetGroupReport")({
|
|
27
45
|
id: Schema.String,
|
|
28
46
|
entries: Schema.Array(Schema.String),
|
|
29
47
|
passes: Schema.Array(PassReport),
|
|
30
48
|
warnings: Schema.Array(DiagnosticEntry),
|
|
31
49
|
errors: Schema.Array(DiagnosticEntry),
|
|
50
|
+
/** Messages matched by `suppressWarnings`, kept for accounting and `--verbose` expansion. */
|
|
51
|
+
suppressed: Schema.Array(DiagnosticEntry),
|
|
32
52
|
timings: ReportTimings
|
|
33
53
|
}) {};
|
|
54
|
+
/** @public */
|
|
34
55
|
var BuildReport = class extends Schema.Class("BuildReport")({
|
|
35
56
|
package: Schema.String,
|
|
36
57
|
targetGroups: Schema.Array(TargetGroupReport)
|
package/report/timer.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
//#region src/report/timer.ts
|
|
2
|
+
/** @public */
|
|
2
3
|
function formatTime(ms) {
|
|
3
4
|
return ms < 1e3 ? `${Math.round(ms)}ms` : `${(ms / 1e3).toFixed(2)}s`;
|
|
4
5
|
}
|
|
5
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Create a wall-clock timer. (Date.now is fine in runtime build code.)
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
6
11
|
function createTimer(now = Date.now) {
|
|
7
12
|
const start = now();
|
|
8
13
|
return {
|
package/report/tsdown-logger.js
CHANGED
|
@@ -6,6 +6,7 @@ const join = (args) => args.map((a) => String(a)).join(" ").replace(ANSI, "").tr
|
|
|
6
6
|
* console. Paired with `logLevel: "silent"` in the same build config: silent suppresses tsdown's
|
|
7
7
|
* own console output while this logger still receives every message (verified against tsdown 0.22.3).
|
|
8
8
|
* info/success are dropped — file metrics come from the writeBundle plugin and timing from our timer.
|
|
9
|
+
* @public
|
|
9
10
|
*/
|
|
10
11
|
function createTsdownLogger(collector, groupId) {
|
|
11
12
|
const seenOnce = /* @__PURE__ */ new Set();
|
package/targets/binding.js
CHANGED
|
@@ -2,7 +2,11 @@ import { join } from "node:path";
|
|
|
2
2
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
|
|
4
4
|
//#region src/targets/binding.ts
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Write the target-to-group binding to dist/prod/targets.json for the release action to consume. Returns the path.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
6
10
|
function writeTargetsBinding(cwd, resolution) {
|
|
7
11
|
const dir = join(cwd, "dist", "prod");
|
|
8
12
|
mkdirSync(dir, { recursive: true });
|
package/targets/config.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
//#region src/targets/config.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* True when a target value is the object form (carries registry/name/from).
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
3
7
|
function isTargetObject(value) {
|
|
4
8
|
return typeof value === "object" && value !== null;
|
|
5
9
|
}
|
|
@@ -7,7 +7,11 @@ const DEFAULT_REGISTRIES = {
|
|
|
7
7
|
npm: "https://registry.npmjs.org",
|
|
8
8
|
github: "https://npm.pkg.github.com"
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a `publishConfig.targets` map into the distinct groups to build and every target bound to one. Pure; throws ConfigValidationError on structurally-invalid config.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
11
15
|
function resolveTargets(options) {
|
|
12
16
|
const { targets, baseName } = options;
|
|
13
17
|
const ids = Object.keys(targets);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.58.9"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/report/schema-export.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BuildReport } from "./schema.js";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import { JsonSchemaExporter } from "json-schema-effect";
|
|
4
|
-
|
|
5
|
-
//#region src/report/schema-export.ts
|
|
6
|
-
const SCHEMA_ID = "https://savvyweb.systems/schemas/build-report.schema.json";
|
|
7
|
-
/** Generate the SchemaStore-compatible JSON Schema document for BuildReport. */
|
|
8
|
-
const generateBuildReportSchema = () => Effect.gen(function* () {
|
|
9
|
-
return yield* (yield* JsonSchemaExporter).generate({
|
|
10
|
-
name: "build-report",
|
|
11
|
-
schema: BuildReport,
|
|
12
|
-
rootDefName: "BuildReport",
|
|
13
|
-
$id: SCHEMA_ID
|
|
14
|
-
});
|
|
15
|
-
}).pipe(Effect.provide(JsonSchemaExporter.Live));
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { generateBuildReportSchema };
|