@effected/bundler 0.0.0-stage → 0.2.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/Bundler.js +498 -0
- package/BundlerError.js +39 -0
- package/LICENSE +21 -0
- package/README.md +84 -2
- package/action/ActionBuilder.js +108 -0
- package/action/ActionBundle.js +272 -0
- package/action/ActionErrors.js +83 -0
- package/action/ActionValidation.js +195 -0
- package/action/ActionYml.js +366 -0
- package/action/PersistLocal.js +186 -0
- package/action/entries.js +23 -0
- package/action/ignore-stub-plugin.js +25 -0
- package/action/import-check.js +134 -0
- package/assets/Inter-SemiBold.ttf +0 -0
- package/assets/LICENSE-Inter.txt +92 -0
- package/catalog/resolve-catalogs.js +32 -0
- package/changesets/next-versions.js +50 -0
- package/config/ActionConfig.js +102 -0
- package/config/BuildConfig.js +438 -0
- package/config/EffectedConfigFile.js +171 -0
- package/config/merge.js +20 -0
- package/config/plugins.js +84 -0
- package/config-validation/ConfigValidator.js +73 -0
- package/dts/bundled-siblings.js +108 -0
- package/dts/parse.js +28 -0
- package/dts/reexport-stub.js +94 -0
- package/dts/relative-imports.js +33 -0
- package/dts/resolved-tsconfig.js +238 -0
- package/entries/ambient-dts.js +108 -0
- package/entries/export-paths.js +16 -0
- package/entries/extract.js +79 -0
- package/entries/package-json-entries.js +19 -0
- package/errors.js +37 -0
- package/exe/build.js +55 -0
- package/exe/config.js +54 -0
- package/exe/filename.js +13 -0
- package/index.d.ts +3619 -0
- package/index.js +57 -0
- package/internal/causeMessage.js +57 -0
- package/journal/BuildJournal.js +107 -0
- package/jsx/config.js +44 -0
- package/manifest/built-condition.js +120 -0
- package/manifest/emit-manifest.js +93 -0
- package/manifest/export-patterns.js +56 -0
- package/manifest/manifest-set.js +101 -0
- package/manifest/transform.js +324 -0
- package/meta/api-extractor.js +241 -0
- package/meta/bundle-config.js +22 -0
- package/meta/bundle-manifest.js +134 -0
- package/meta/bundle-source.js +106 -0
- package/meta/config.js +24 -0
- package/meta/generate.js +249 -0
- package/meta/merge-models.js +43 -0
- package/meta/message-suppressor.js +43 -0
- package/meta/og-image.js +137 -0
- package/meta/og-satori.js +140 -0
- package/meta/optimistic.js +32 -0
- package/meta/run-pass.js +124 -0
- package/meta/scrub-declaration-maps.js +63 -0
- package/meta/tsconfig-resolver.js +55 -0
- package/meta/tsdoc-config.js +47 -0
- package/package.json +86 -5
- package/passes/build-target-groups.js +347 -0
- package/passes/cjs-default-interop.js +98 -0
- package/passes/loose-files.js +57 -0
- package/passes/node-builtin-default-interop.js +79 -0
- package/passes/strip-maps.js +40 -0
- package/passes/sync-public.js +100 -0
- package/passes/target-groups.js +112 -0
- package/report/ci-annotations.js +36 -0
- package/report/collector.js +140 -0
- package/report/issues-artifact.js +149 -0
- package/report/metrics-plugin.js +76 -0
- package/report/schema.js +77 -0
- package/report/timer.js +19 -0
- package/report/tsdown-logger.js +58 -0
- package/targets/binding.js +19 -0
- package/targets/config.js +21 -0
- package/targets/resolve-targets.js +165 -0
- package/tsconfig/sync-options.js +20 -0
- package/tsdoc-metadata.json +11 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,3619 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find every relative module specifier in a declaration source: static `import`/`export … from`,
|
|
3
|
+
* `import("…")` type nodes, and `/// <reference path="…" />`. Pure parsing — no I/O.
|
|
4
|
+
*
|
|
5
|
+
* A non-empty result means the file is NOT self-contained and would break when copied verbatim to a
|
|
6
|
+
* flattened output location, so the ambient-copy step rejects it.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
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";
|
|
11
|
+
import { Plugin } from "rolldown";
|
|
12
|
+
import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
13
|
+
import { AppendError, JournalWatcher, JsonlEvent } from "@effected/jsonl";
|
|
14
|
+
import { DescendError } from "@effected/walker";
|
|
15
|
+
declare const ActionEntries_base: Schema.Class<ActionEntries, Schema.Struct<{
|
|
16
|
+
/** The main entry point's source. */
|
|
17
|
+
readonly main: Schema.withDecodingDefaultKey<Schema.String, never>;
|
|
18
|
+
/** The source of the entry that runs before `main`. */
|
|
19
|
+
readonly pre: Schema.optionalKey<Schema.String>;
|
|
20
|
+
/** The source of the entry that runs after `main`, for cleanup. */
|
|
21
|
+
readonly post: Schema.optionalKey<Schema.String>;
|
|
22
|
+
/** Extra bundles outside the lifecycle: a name to its source, each emitted as `dist/<name>.js`. */
|
|
23
|
+
readonly workers: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>;
|
|
24
|
+
}>, {}>;
|
|
25
|
+
/**
|
|
26
|
+
* The bundles a GitHub Action ships, the `[action.entries]` table.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* `main`, `pre` and `post` are the lifecycle entries `action.yml` runs. A worker is a bundle outside that
|
|
30
|
+
* lifecycle, which the action loads itself.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare class ActionEntries extends ActionEntries_base {}
|
|
35
|
+
declare const ActionBuildOptions_base: Schema.Class<ActionBuildOptions, Schema.Struct<{
|
|
36
|
+
/** Whether to minify the bundles. */
|
|
37
|
+
readonly minify: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
38
|
+
/** Whether to generate source maps. */
|
|
39
|
+
readonly sourceMap: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
40
|
+
/** Packages left out of the bundles and imported at runtime, in addition to `node:` builtins. */
|
|
41
|
+
readonly externals: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
42
|
+
/**
|
|
43
|
+
* Packages left out of the bundles and replaced with a stub that throws if it is ever loaded.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* For an optional transitive dependency the action never exercises, such as a native module.
|
|
47
|
+
*/
|
|
48
|
+
readonly ignore: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to import each bundle in a fresh Node after building it, which proves it loads.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* A bundle can build cleanly and not load, and this is the only check that finds out. Turn it off for an action
|
|
54
|
+
* with no `GITHUB_ACTIONS` guard around its program, because the import runs that program for real.
|
|
55
|
+
*/
|
|
56
|
+
readonly importCheck: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
57
|
+
}>, {}>;
|
|
58
|
+
/**
|
|
59
|
+
* How an action's bundles are built, the `[action.build]` table.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* There is no key for keeping a package's dynamic imports native, and writing one fails like any unknown key.
|
|
63
|
+
* Rolldown leaves a computed `import()` native on its own, so a workaround for a bundler that compiles one into a
|
|
64
|
+
* module that cannot find its target has no counterpart here.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export declare class ActionBuildOptions extends ActionBuildOptions_base {}
|
|
69
|
+
declare const ActionValidationOptions_base: Schema.Class<ActionValidationOptions, Schema.Struct<{
|
|
70
|
+
/** Whether `action.yml` must exist and be valid. */
|
|
71
|
+
readonly requireActionYml: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
72
|
+
/** The size past which a bundle is reported, such as `"5mb"` or `"500kb"`. */
|
|
73
|
+
readonly maxBundleSize: Schema.optionalKey<Schema.String>;
|
|
74
|
+
/** Whether a warning is an error. Absent means it is under CI and is not locally. */
|
|
75
|
+
readonly strict: Schema.optionalKey<Schema.Boolean>;
|
|
76
|
+
}>, {}>;
|
|
77
|
+
/**
|
|
78
|
+
* What an action build checks before it builds, the `[action.validation]` table.
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
export declare class ActionValidationOptions extends ActionValidationOptions_base {}
|
|
83
|
+
declare const ActionPersistLocalOptions_base: Schema.Class<ActionPersistLocalOptions, Schema.Struct<{
|
|
84
|
+
/** Whether to copy the build output locally. */
|
|
85
|
+
readonly enabled: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
86
|
+
/** The local action directory, relative to the package. */
|
|
87
|
+
readonly path: Schema.withDecodingDefaultKey<Schema.String, never>;
|
|
88
|
+
/** Whether to generate the act boilerplate, `.actrc` and `act-test.yml`, when those files do not exist. */
|
|
89
|
+
readonly actTemplate: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
90
|
+
}>, {}>;
|
|
91
|
+
/**
|
|
92
|
+
* The local copy of an action's build for testing with nektos/act, the `[action.persistLocal]` table.
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export declare class ActionPersistLocalOptions extends ActionPersistLocalOptions_base {}
|
|
97
|
+
declare const ActionConfig_base: Schema.Class<ActionConfig, Schema.Struct<{
|
|
98
|
+
/** The bundles to build. */
|
|
99
|
+
readonly entries: Schema.withDecodingDefaultKey<typeof ActionEntries, never>;
|
|
100
|
+
/** How to build them. */
|
|
101
|
+
readonly build: Schema.withDecodingDefaultKey<typeof ActionBuildOptions, never>;
|
|
102
|
+
/** What to check before building. */
|
|
103
|
+
readonly validation: Schema.withDecodingDefaultKey<typeof ActionValidationOptions, never>;
|
|
104
|
+
/** The local copy for testing with nektos/act. */
|
|
105
|
+
readonly persistLocal: Schema.withDecodingDefaultKey<typeof ActionPersistLocalOptions, never>;
|
|
106
|
+
}>, {}>;
|
|
107
|
+
/**
|
|
108
|
+
* A GitHub Action's build settings, the `[action]` table of `effected.toml`.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* Every field has a default, so an empty table is a complete config. An `effected.toml` with no `[action]` table
|
|
112
|
+
* at all is a library rather than an action, which is why `config.action` stays absent in that case.
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export declare class ActionConfig extends ActionConfig_base {}
|
|
117
|
+
declare const BundleFailed_base: Schema.Class<BundleFailed, Schema.TaggedStruct<"BundleFailed", {
|
|
118
|
+
/** The entry at fault, as its bundle name or source path. */
|
|
119
|
+
readonly entry: Schema.String;
|
|
120
|
+
/** What went wrong. */
|
|
121
|
+
readonly cause: Schema.Defect;
|
|
122
|
+
}>, import("effect/Cause").YieldableError>;
|
|
123
|
+
/**
|
|
124
|
+
* An entry could not go through the bundler, or could not be bundled at all.
|
|
125
|
+
*
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
export declare class BundleFailed extends BundleFailed_base {
|
|
129
|
+
get message(): string;
|
|
130
|
+
}
|
|
131
|
+
declare const CleanError_base: Schema.Class<CleanError, Schema.TaggedStruct<"CleanError", {
|
|
132
|
+
/** The directory. */
|
|
133
|
+
readonly directory: Schema.String;
|
|
134
|
+
/** What went wrong. */
|
|
135
|
+
readonly cause: Schema.Defect;
|
|
136
|
+
}>, import("effect/Cause").YieldableError>;
|
|
137
|
+
/**
|
|
138
|
+
* The output directory could not be cleaned.
|
|
139
|
+
*
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
export declare class CleanError extends CleanError_base {
|
|
143
|
+
get message(): string;
|
|
144
|
+
}
|
|
145
|
+
declare const WriteError_base: Schema.Class<WriteError, Schema.TaggedStruct<"WriteError", {
|
|
146
|
+
/** The file. */
|
|
147
|
+
readonly path: Schema.String;
|
|
148
|
+
/** What went wrong. */
|
|
149
|
+
readonly cause: Schema.Defect;
|
|
150
|
+
}>, import("effect/Cause").YieldableError>;
|
|
151
|
+
/**
|
|
152
|
+
* An output file could not be written.
|
|
153
|
+
*
|
|
154
|
+
* @public
|
|
155
|
+
*/
|
|
156
|
+
export declare class WriteError extends WriteError_base {
|
|
157
|
+
get message(): string;
|
|
158
|
+
}
|
|
159
|
+
declare const PersistLocalError_base: Schema.Class<PersistLocalError, Schema.TaggedStruct<"PersistLocalError", {
|
|
160
|
+
/** The path involved. */
|
|
161
|
+
readonly path: Schema.String;
|
|
162
|
+
/** What went wrong. */
|
|
163
|
+
readonly cause: Schema.Defect;
|
|
164
|
+
}>, import("effect/Cause").YieldableError>;
|
|
165
|
+
/**
|
|
166
|
+
* A file could not be copied to the local action directory.
|
|
167
|
+
*
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
export declare class PersistLocalError extends PersistLocalError_base {
|
|
171
|
+
get message(): string;
|
|
172
|
+
}
|
|
173
|
+
declare const ActionYmlPathError_base: Schema.Class<ActionYmlPathError, Schema.TaggedStruct<"ActionYmlPathError", {
|
|
174
|
+
/** The `runs` key: `main`, `pre` or `post`. */
|
|
175
|
+
readonly entryType: Schema.String;
|
|
176
|
+
/** The path as `action.yml` writes it. */
|
|
177
|
+
readonly specifiedPath: Schema.String;
|
|
178
|
+
/** Where that path resolves to. */
|
|
179
|
+
readonly expectedPath: Schema.String;
|
|
180
|
+
}>, import("effect/Cause").YieldableError>;
|
|
181
|
+
/**
|
|
182
|
+
* A `runs` path in `action.yml` names no file in the local action directory.
|
|
183
|
+
*
|
|
184
|
+
* @public
|
|
185
|
+
*/
|
|
186
|
+
export declare class ActionYmlPathError extends ActionYmlPathError_base {
|
|
187
|
+
get message(): string;
|
|
188
|
+
}
|
|
189
|
+
declare const BundleStats_base: Schema.Class<BundleStats, Schema.Struct<{
|
|
190
|
+
/** The entry: `main`, `pre`, `post` or a worker's name. */
|
|
191
|
+
readonly entry: Schema.String;
|
|
192
|
+
/** The bundle's size in bytes. */
|
|
193
|
+
readonly size: Schema.Number;
|
|
194
|
+
/** How long the entry took to bundle and check, in milliseconds. */
|
|
195
|
+
readonly duration: Schema.Number;
|
|
196
|
+
/** The output path, relative to the action. */
|
|
197
|
+
readonly outputPath: Schema.String;
|
|
198
|
+
}>, {}>;
|
|
199
|
+
/**
|
|
200
|
+
* What one bundle came to.
|
|
201
|
+
*
|
|
202
|
+
* @public
|
|
203
|
+
*/
|
|
204
|
+
export declare class BundleStats extends BundleStats_base {}
|
|
205
|
+
declare const BundleResult_base: Schema.Class<BundleResult, Schema.Struct<{
|
|
206
|
+
/** Whether the entry bundled and its bundle loaded. */
|
|
207
|
+
readonly success: Schema.Boolean;
|
|
208
|
+
/** The bundle's statistics, on success. */
|
|
209
|
+
readonly stats: Schema.optionalKey<typeof BundleStats>;
|
|
210
|
+
/** What went wrong, on failure. */
|
|
211
|
+
readonly error: Schema.optionalKey<Schema.String>;
|
|
212
|
+
/** The warnings rolldown logged for this entry, when it logged any. */
|
|
213
|
+
readonly warnings: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
214
|
+
}>, {}>;
|
|
215
|
+
/**
|
|
216
|
+
* How one entry's bundling went.
|
|
217
|
+
*
|
|
218
|
+
* @public
|
|
219
|
+
*/
|
|
220
|
+
export declare class BundleResult extends BundleResult_base {}
|
|
221
|
+
declare const BuildResult_base: Schema.Class<BuildResult, Schema.Struct<{
|
|
222
|
+
/** Whether every entry succeeded. */
|
|
223
|
+
readonly success: Schema.Boolean;
|
|
224
|
+
/** Each entry's result: `main`, `pre`, `post`, then the workers. */
|
|
225
|
+
readonly entries: Schema.$Array<typeof BundleResult>;
|
|
226
|
+
/** How long the build took, in milliseconds. */
|
|
227
|
+
readonly duration: Schema.Number;
|
|
228
|
+
/** A summary of what went wrong, on failure. */
|
|
229
|
+
readonly error: Schema.optionalKey<Schema.String>;
|
|
230
|
+
}>, {}>;
|
|
231
|
+
/**
|
|
232
|
+
* How a whole action bundle went.
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
*/
|
|
236
|
+
export declare class BuildResult extends BuildResult_base {}
|
|
237
|
+
/**
|
|
238
|
+
* Bundles a GitHub Action with rolldown.
|
|
239
|
+
*
|
|
240
|
+
* @public
|
|
241
|
+
*/
|
|
242
|
+
export declare class ActionBundle {
|
|
243
|
+
private constructor();
|
|
244
|
+
/**
|
|
245
|
+
* Bundles every entry of the action at `options.cwd` into its own `dist/<entry>.js`, and writes `dist/package.json`
|
|
246
|
+
* so Node reads them as ESM.
|
|
247
|
+
*
|
|
248
|
+
* @remarks
|
|
249
|
+
* Each bundle is self-contained apart from `node:` builtins and `build.externals`, and the output does not depend
|
|
250
|
+
* on when or where it is built.
|
|
251
|
+
*
|
|
252
|
+
* Each bundle is then imported in a fresh Node, because a bundle can build cleanly and not load. Set
|
|
253
|
+
* `build.importCheck = false` to skip that. The child has no `GITHUB_*` variable, token or `PATH`, and runs in a
|
|
254
|
+
* temporary directory, for at most a minute. An action's `GITHUB_ACTIONS` guard stays closed, but an action with no
|
|
255
|
+
* guard runs for real there. A failure asking for an input passes. A package listed in `build.externals` that is not
|
|
256
|
+
* installed passes with a warning on the entry, and the check learns nothing about the bundle past that import.
|
|
257
|
+
*
|
|
258
|
+
* An entry that fails to bundle or load is reported in the result with the others still built, and leaves no bundle
|
|
259
|
+
* in `dist`. A missing `main`, a `pre`, `post` or worker the config names with no file, and a bad worker name fail
|
|
260
|
+
* {@link BundleFailed} before `dist` is touched. Interrupting the build kills a running load check.
|
|
261
|
+
*
|
|
262
|
+
* Cleaning `dist`, writing `dist/package.json` and reading each bundle's size go through the provided `FileSystem`
|
|
263
|
+
* and `Path`, while rolldown and the load check work on the host disk, so provide the host's.
|
|
264
|
+
*
|
|
265
|
+
* @param options - `cwd` is the action's directory; `clean` removes `dist` first.
|
|
266
|
+
*/
|
|
267
|
+
static readonly build: (config: ActionConfig, options: {
|
|
268
|
+
readonly cwd: string;
|
|
269
|
+
readonly clean: boolean;
|
|
270
|
+
}) => Effect.Effect<BuildResult, BundleFailed | CleanError | WriteError, FileSystem.FileSystem | Path.Path>;
|
|
271
|
+
}
|
|
272
|
+
declare const ValidationIssue_base: Schema.Class<ValidationIssue, Schema.Struct<{
|
|
273
|
+
/** What kind of problem it is, such as `MAIN_ENTRY_MISSING`. */
|
|
274
|
+
readonly code: Schema.String;
|
|
275
|
+
/** What went wrong. */
|
|
276
|
+
readonly message: Schema.String;
|
|
277
|
+
/** The file at fault. */
|
|
278
|
+
readonly file: Schema.optionalKey<Schema.String>;
|
|
279
|
+
/** How to fix it. */
|
|
280
|
+
readonly suggestion: Schema.optionalKey<Schema.String>;
|
|
281
|
+
}>, {}>;
|
|
282
|
+
/**
|
|
283
|
+
* One problem a validation found.
|
|
284
|
+
*
|
|
285
|
+
* @public
|
|
286
|
+
*/
|
|
287
|
+
export declare class ValidationIssue extends ValidationIssue_base {}
|
|
288
|
+
declare const ValidationResult_base: Schema.Class<ValidationResult, Schema.Struct<{
|
|
289
|
+
/** Whether the build may go ahead: no errors, and in strict mode no warnings either. */
|
|
290
|
+
readonly valid: Schema.Boolean;
|
|
291
|
+
/** Problems that always stop a build. */
|
|
292
|
+
readonly errors: Schema.$Array<typeof ValidationIssue>;
|
|
293
|
+
/** Problems that stop a build only in strict mode. */
|
|
294
|
+
readonly warnings: Schema.$Array<typeof ValidationIssue>;
|
|
295
|
+
}>, {}>;
|
|
296
|
+
/**
|
|
297
|
+
* What a validation found.
|
|
298
|
+
*
|
|
299
|
+
* @public
|
|
300
|
+
*/
|
|
301
|
+
export declare class ValidationResult extends ValidationResult_base {}
|
|
302
|
+
/**
|
|
303
|
+
* How {@link ActionValidation.validate} decides strict mode.
|
|
304
|
+
*
|
|
305
|
+
* @public
|
|
306
|
+
*/
|
|
307
|
+
interface ActionValidationRunOptions {
|
|
308
|
+
/** Whether this run is under CI, which is what an unset `validation.strict` follows. */
|
|
309
|
+
readonly ci: boolean;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Checks an action's config, entry points and `action.yml`, and the size of what it built.
|
|
313
|
+
*
|
|
314
|
+
* @public
|
|
315
|
+
*/
|
|
316
|
+
export declare class ActionValidation {
|
|
317
|
+
private constructor();
|
|
318
|
+
/**
|
|
319
|
+
* Whether `env` describes a CI run, by `@effected/env`'s one rule: a known provider's marker, or a truthy `CI` or
|
|
320
|
+
* `CONTINUOUS_INTEGRATION`.
|
|
321
|
+
*/
|
|
322
|
+
static isCI(env: Readonly<Record<string, string | undefined>>): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Whether warnings stop this build: `validation.strict` when it is set, otherwise whether this is a CI run.
|
|
325
|
+
*/
|
|
326
|
+
static isStrict(config: ActionConfig, options: ActionValidationRunOptions): boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Validates the action at `cwd` before a build.
|
|
329
|
+
*
|
|
330
|
+
* @remarks
|
|
331
|
+
* Every finding comes back in the result, whatever its severity: the effect fails only when a file cannot be
|
|
332
|
+
* read. A missing `main`, a `pre`, `post` or worker the config names with no file, a bad worker name, an unreadable `maxBundleSize` and a broken
|
|
333
|
+
* `action.yml` are errors. A missing `action.yml` and missing recommended fields are warnings, and `valid` turns
|
|
334
|
+
* false on them in strict mode.
|
|
335
|
+
*
|
|
336
|
+
* @param cwd - The action's directory.
|
|
337
|
+
* @param options - `ci` says whether this run is under CI. Answer it once at `main`, with {@link ActionValidation.isCI}.
|
|
338
|
+
*/
|
|
339
|
+
static readonly validate: (config: ActionConfig, cwd: string, options: ActionValidationRunOptions) => Effect.Effect<ValidationResult, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
|
|
340
|
+
/**
|
|
341
|
+
* The bundles past `validation.maxBundleSize`, one warning each. Nothing when no limit is set or it cannot be read.
|
|
342
|
+
*/
|
|
343
|
+
static checkBundleSizes(config: ActionConfig, bundles: ReadonlyArray<{
|
|
344
|
+
readonly entry: string;
|
|
345
|
+
readonly size: number;
|
|
346
|
+
readonly outputPath: string;
|
|
347
|
+
}>): ReadonlyArray<ValidationIssue>;
|
|
348
|
+
/** A result from its findings: valid with no errors, and in strict mode no warnings either. */
|
|
349
|
+
static resultOf(errors: ReadonlyArray<ValidationIssue>, warnings: ReadonlyArray<ValidationIssue>, strict: boolean): ValidationResult;
|
|
350
|
+
}
|
|
351
|
+
declare const ValidationFailed_base: Schema.Class<ValidationFailed, Schema.TaggedStruct<"ValidationFailed", {
|
|
352
|
+
/** How many errors it found. */
|
|
353
|
+
readonly errorCount: Schema.Number;
|
|
354
|
+
/** How many warnings it found. */
|
|
355
|
+
readonly warningCount: Schema.Number;
|
|
356
|
+
/** A summary. */
|
|
357
|
+
readonly message: Schema.String;
|
|
358
|
+
/** Everything it found. */
|
|
359
|
+
readonly validation: typeof ValidationResult;
|
|
360
|
+
/** How bundling went, when validation stopped the build after it. */
|
|
361
|
+
readonly build: Schema.optionalKey<typeof BuildResult>;
|
|
362
|
+
}>, import("effect/Cause").YieldableError>;
|
|
363
|
+
/**
|
|
364
|
+
* Validation stopped an action build, before bundling or on a bundle's size afterwards.
|
|
365
|
+
*
|
|
366
|
+
* @public
|
|
367
|
+
*/
|
|
368
|
+
export declare class ValidationFailed extends ValidationFailed_base {}
|
|
369
|
+
declare const BuildFailed_base: Schema.Class<BuildFailed, Schema.TaggedStruct<"BuildFailed", {
|
|
370
|
+
/** A summary. */
|
|
371
|
+
readonly message: Schema.String;
|
|
372
|
+
/** How many entries failed. */
|
|
373
|
+
readonly failedEntries: Schema.Number;
|
|
374
|
+
/** Every entry's result. */
|
|
375
|
+
readonly build: typeof BuildResult;
|
|
376
|
+
/** What validation found before bundling. */
|
|
377
|
+
readonly validation: typeof ValidationResult;
|
|
378
|
+
}>, import("effect/Cause").YieldableError>;
|
|
379
|
+
/**
|
|
380
|
+
* An entry of an action failed to bundle or does not load.
|
|
381
|
+
*
|
|
382
|
+
* @public
|
|
383
|
+
*/
|
|
384
|
+
export declare class BuildFailed extends BuildFailed_base {}
|
|
385
|
+
/**
|
|
386
|
+
* What {@link ActionBuilder.build} can fail with.
|
|
387
|
+
*
|
|
388
|
+
* @public
|
|
389
|
+
*/
|
|
390
|
+
type ActionBuilderError = ValidationFailed | BuildFailed | BundleFailed | CleanError | WriteError | PersistLocalError | ActionYmlPathError | PlatformError.PlatformError;
|
|
391
|
+
/**
|
|
392
|
+
* What {@link ActionBuilder.build} takes.
|
|
393
|
+
*
|
|
394
|
+
* @public
|
|
395
|
+
*/
|
|
396
|
+
interface ActionBuilderOptions {
|
|
397
|
+
/** The action's directory. */
|
|
398
|
+
readonly cwd: string;
|
|
399
|
+
/** The decoded `[action]` table. */
|
|
400
|
+
readonly config: ActionConfig;
|
|
401
|
+
/** Whether to validate before bundling and check bundle sizes after it. */
|
|
402
|
+
readonly validate: boolean;
|
|
403
|
+
/** Whether to copy the build locally. `persistLocal.enabled = false` turns that off too. */
|
|
404
|
+
readonly persist: boolean;
|
|
405
|
+
/** Whether this run is under CI, which is what an unset `validation.strict` follows. */
|
|
406
|
+
readonly ci: boolean;
|
|
407
|
+
}
|
|
408
|
+
declare const ActionBuildResult_base: Schema.Class<ActionBuildResult, Schema.Struct<{
|
|
409
|
+
/** What validation found, including any bundle over its size limit. Empty and valid when validation was skipped. */
|
|
410
|
+
readonly validation: typeof ValidationResult;
|
|
411
|
+
/** How bundling went. */
|
|
412
|
+
readonly build: typeof BuildResult;
|
|
413
|
+
/** Whether the build was copied to the local action directory. */
|
|
414
|
+
readonly persisted: Schema.Boolean;
|
|
415
|
+
}>, {}>;
|
|
416
|
+
/**
|
|
417
|
+
* What a whole action build did.
|
|
418
|
+
*
|
|
419
|
+
* @public
|
|
420
|
+
*/
|
|
421
|
+
export declare class ActionBuildResult extends ActionBuildResult_base {}
|
|
422
|
+
/**
|
|
423
|
+
* Builds a GitHub Action.
|
|
424
|
+
*
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
export declare class ActionBuilder {
|
|
428
|
+
private constructor();
|
|
429
|
+
/**
|
|
430
|
+
* Validates the action, bundles it, checks the bundles' sizes and copies the build locally.
|
|
431
|
+
*
|
|
432
|
+
* @remarks
|
|
433
|
+
* It writes nothing to stdout; rendering belongs to the caller. A step that fails stops the ones after it, so an
|
|
434
|
+
* invalid action leaves `dist` as it was, and a failed build or size check persists nothing. In strict mode, set
|
|
435
|
+
* by `validation.strict` or else by running under CI, a warning fails like an error. With `validate` false, neither
|
|
436
|
+
* validation nor the size check runs. `build.importCheck` alone decides whether each bundle is imported to prove it
|
|
437
|
+
* loads, per {@link ActionBundle.build}.
|
|
438
|
+
*
|
|
439
|
+
* Validation and persisting go through the provided `FileSystem`, while bundling always works on the real disk,
|
|
440
|
+
* because rolldown does. A memory filesystem therefore suits {@link ActionValidation} and {@link PersistLocal} tests,
|
|
441
|
+
* not this method.
|
|
442
|
+
*/
|
|
443
|
+
static readonly build: (options: ActionBuilderOptions) => Effect.Effect<ActionBuildResult, ActionBuilderError, FileSystem.FileSystem | Path.Path>;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* The Feather icons GitHub accepts as an action's branding icon.
|
|
447
|
+
*
|
|
448
|
+
* @public
|
|
449
|
+
*/
|
|
450
|
+
export declare const ActionYmlBrandingIcon: Schema.Literals<readonly ["activity", "airplay", "alert-circle", "alert-octagon", "alert-triangle", "align-center", "align-justify", "align-left", "align-right", "anchor", "aperture", "archive", "arrow-down-circle", "arrow-down-left", "arrow-down-right", "arrow-down", "arrow-left-circle", "arrow-left", "arrow-right-circle", "arrow-right", "arrow-up-circle", "arrow-up-left", "arrow-up-right", "arrow-up", "at-sign", "award", "bar-chart-2", "bar-chart", "battery-charging", "battery", "bell-off", "bell", "bluetooth", "bold", "book-open", "book", "bookmark", "box", "briefcase", "calendar", "camera-off", "camera", "cast", "check-circle", "check-square", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "chevrons-down", "chevrons-left", "chevrons-right", "chevrons-up", "circle", "clipboard", "clock", "cloud-drizzle", "cloud-lightning", "cloud-off", "cloud-rain", "cloud-snow", "cloud", "code", "command", "compass", "copy", "corner-down-left", "corner-down-right", "corner-left-down", "corner-left-up", "corner-right-down", "corner-right-up", "corner-up-left", "corner-up-right", "cpu", "credit-card", "crop", "crosshair", "database", "delete", "disc", "dollar-sign", "download-cloud", "download", "droplet", "edit-2", "edit-3", "edit", "external-link", "eye-off", "eye", "fast-forward", "feather", "file-minus", "file-plus", "file-text", "file", "film", "filter", "flag", "folder-minus", "folder-plus", "folder", "gift", "git-branch", "git-commit", "git-merge", "git-pull-request", "globe", "grid", "hard-drive", "hash", "headphones", "heart", "help-circle", "home", "image", "inbox", "info", "italic", "layers", "layout", "life-buoy", "link-2", "link", "list", "loader", "lock", "log-in", "log-out", "mail", "map-pin", "map", "maximize-2", "maximize", "menu", "message-circle", "message-square", "mic-off", "mic", "minimize-2", "minimize", "minus-circle", "minus-square", "minus", "monitor", "moon", "more-horizontal", "more-vertical", "move", "music", "navigation-2", "navigation", "octagon", "package", "paperclip", "pause-circle", "pause", "percent", "phone-call", "phone-forwarded", "phone-incoming", "phone-missed", "phone-off", "phone-outgoing", "phone", "pie-chart", "play-circle", "play", "plus-circle", "plus-square", "plus", "pocket", "power", "printer", "radio", "refresh-ccw", "refresh-cw", "repeat", "rewind", "rotate-ccw", "rotate-cw", "rss", "save", "scissors", "search", "send", "server", "settings", "share-2", "share", "shield-off", "shield", "shopping-bag", "shopping-cart", "shuffle", "sidebar", "skip-back", "skip-forward", "slash", "sliders", "smartphone", "speaker", "square", "star", "stop-circle", "sun", "sunrise", "sunset", "table", "tablet", "tag", "target", "terminal", "thermometer", "thumbs-down", "thumbs-up", "toggle-left", "toggle-right", "trash-2", "trash", "trending-down", "trending-up", "triangle", "truck", "tv", "type", "umbrella", "underline", "unlock", "upload-cloud", "upload", "user-check", "user-minus", "user-plus", "user-x", "user", "users", "video-off", "video", "voicemail", "volume-1", "volume-2", "volume-x", "volume", "watch", "wifi-off", "wifi", "wind", "x-circle", "x-square", "x", "zap-off", "zap", "zoom-in", "zoom-out"]>;
|
|
451
|
+
/**
|
|
452
|
+
* The decoded type of {@link (ActionYmlBrandingIcon:variable)}.
|
|
453
|
+
*
|
|
454
|
+
* @public
|
|
455
|
+
*/
|
|
456
|
+
export type ActionYmlBrandingIcon = typeof ActionYmlBrandingIcon.Type;
|
|
457
|
+
/**
|
|
458
|
+
* The colors GitHub accepts as an action's branding color.
|
|
459
|
+
*
|
|
460
|
+
* @public
|
|
461
|
+
*/
|
|
462
|
+
export declare const ActionYmlBrandingColor: Schema.Literals<readonly ["white", "black", "yellow", "blue", "green", "orange", "red", "purple", "gray-dark"]>;
|
|
463
|
+
/**
|
|
464
|
+
* The decoded type of {@link (ActionYmlBrandingColor:variable)}.
|
|
465
|
+
*
|
|
466
|
+
* @public
|
|
467
|
+
*/
|
|
468
|
+
export type ActionYmlBrandingColor = typeof ActionYmlBrandingColor.Type;
|
|
469
|
+
declare const ActionYmlInput_base: Schema.Class<ActionYmlInput, Schema.Struct<{
|
|
470
|
+
/** What the input is for. */
|
|
471
|
+
readonly description: Schema.String;
|
|
472
|
+
/** Whether a workflow must supply the input. */
|
|
473
|
+
readonly required: Schema.optionalKey<Schema.Boolean>;
|
|
474
|
+
/** The value used when a workflow supplies none. A string only, so a YAML `default: true` is a schema error: quote it. */
|
|
475
|
+
readonly default: Schema.optionalKey<Schema.String>;
|
|
476
|
+
/** The warning shown when a workflow supplies the input. */
|
|
477
|
+
readonly deprecationMessage: Schema.optionalKey<Schema.String>;
|
|
478
|
+
}>, {}>;
|
|
479
|
+
/**
|
|
480
|
+
* One input an action declares.
|
|
481
|
+
*
|
|
482
|
+
* @public
|
|
483
|
+
*/
|
|
484
|
+
export declare class ActionYmlInput extends ActionYmlInput_base {}
|
|
485
|
+
declare const ActionYmlOutput_base: Schema.Class<ActionYmlOutput, Schema.Struct<{
|
|
486
|
+
/** What the output holds. */
|
|
487
|
+
readonly description: Schema.String;
|
|
488
|
+
}>, {}>;
|
|
489
|
+
/**
|
|
490
|
+
* One output an action declares.
|
|
491
|
+
*
|
|
492
|
+
* @public
|
|
493
|
+
*/
|
|
494
|
+
export declare class ActionYmlOutput extends ActionYmlOutput_base {}
|
|
495
|
+
declare const ActionYmlRuns_base: Schema.Class<ActionYmlRuns, Schema.Struct<{
|
|
496
|
+
/** The runtime. */
|
|
497
|
+
readonly using: Schema.Literal<"node24">;
|
|
498
|
+
/** The file that runs as the main step. */
|
|
499
|
+
readonly main: Schema.String;
|
|
500
|
+
/** The file that runs before `main`. */
|
|
501
|
+
readonly pre: Schema.optionalKey<Schema.String>;
|
|
502
|
+
/** The condition for running `pre`. */
|
|
503
|
+
readonly "pre-if": Schema.optionalKey<Schema.String>;
|
|
504
|
+
/** The file that runs after `main`. */
|
|
505
|
+
readonly post: Schema.optionalKey<Schema.String>;
|
|
506
|
+
/** The condition for running `post`. */
|
|
507
|
+
readonly "post-if": Schema.optionalKey<Schema.String>;
|
|
508
|
+
}>, {}>;
|
|
509
|
+
/**
|
|
510
|
+
* How an action runs, the `runs` key.
|
|
511
|
+
*
|
|
512
|
+
* @remarks
|
|
513
|
+
* The action builder emits Node 24 actions only, so `using` takes `node24` and nothing else.
|
|
514
|
+
*
|
|
515
|
+
* @public
|
|
516
|
+
*/
|
|
517
|
+
export declare class ActionYmlRuns extends ActionYmlRuns_base {}
|
|
518
|
+
declare const ActionYmlBranding_base: Schema.Class<ActionYmlBranding, Schema.Struct<{
|
|
519
|
+
/** The icon. */
|
|
520
|
+
readonly icon: Schema.optionalKey<Schema.Literals<readonly ["activity", "airplay", "alert-circle", "alert-octagon", "alert-triangle", "align-center", "align-justify", "align-left", "align-right", "anchor", "aperture", "archive", "arrow-down-circle", "arrow-down-left", "arrow-down-right", "arrow-down", "arrow-left-circle", "arrow-left", "arrow-right-circle", "arrow-right", "arrow-up-circle", "arrow-up-left", "arrow-up-right", "arrow-up", "at-sign", "award", "bar-chart-2", "bar-chart", "battery-charging", "battery", "bell-off", "bell", "bluetooth", "bold", "book-open", "book", "bookmark", "box", "briefcase", "calendar", "camera-off", "camera", "cast", "check-circle", "check-square", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "chevrons-down", "chevrons-left", "chevrons-right", "chevrons-up", "circle", "clipboard", "clock", "cloud-drizzle", "cloud-lightning", "cloud-off", "cloud-rain", "cloud-snow", "cloud", "code", "command", "compass", "copy", "corner-down-left", "corner-down-right", "corner-left-down", "corner-left-up", "corner-right-down", "corner-right-up", "corner-up-left", "corner-up-right", "cpu", "credit-card", "crop", "crosshair", "database", "delete", "disc", "dollar-sign", "download-cloud", "download", "droplet", "edit-2", "edit-3", "edit", "external-link", "eye-off", "eye", "fast-forward", "feather", "file-minus", "file-plus", "file-text", "file", "film", "filter", "flag", "folder-minus", "folder-plus", "folder", "gift", "git-branch", "git-commit", "git-merge", "git-pull-request", "globe", "grid", "hard-drive", "hash", "headphones", "heart", "help-circle", "home", "image", "inbox", "info", "italic", "layers", "layout", "life-buoy", "link-2", "link", "list", "loader", "lock", "log-in", "log-out", "mail", "map-pin", "map", "maximize-2", "maximize", "menu", "message-circle", "message-square", "mic-off", "mic", "minimize-2", "minimize", "minus-circle", "minus-square", "minus", "monitor", "moon", "more-horizontal", "more-vertical", "move", "music", "navigation-2", "navigation", "octagon", "package", "paperclip", "pause-circle", "pause", "percent", "phone-call", "phone-forwarded", "phone-incoming", "phone-missed", "phone-off", "phone-outgoing", "phone", "pie-chart", "play-circle", "play", "plus-circle", "plus-square", "plus", "pocket", "power", "printer", "radio", "refresh-ccw", "refresh-cw", "repeat", "rewind", "rotate-ccw", "rotate-cw", "rss", "save", "scissors", "search", "send", "server", "settings", "share-2", "share", "shield-off", "shield", "shopping-bag", "shopping-cart", "shuffle", "sidebar", "skip-back", "skip-forward", "slash", "sliders", "smartphone", "speaker", "square", "star", "stop-circle", "sun", "sunrise", "sunset", "table", "tablet", "tag", "target", "terminal", "thermometer", "thumbs-down", "thumbs-up", "toggle-left", "toggle-right", "trash-2", "trash", "trending-down", "trending-up", "triangle", "truck", "tv", "type", "umbrella", "underline", "unlock", "upload-cloud", "upload", "user-check", "user-minus", "user-plus", "user-x", "user", "users", "video-off", "video", "voicemail", "volume-1", "volume-2", "volume-x", "volume", "watch", "wifi-off", "wifi", "wind", "x-circle", "x-square", "x", "zap-off", "zap", "zoom-in", "zoom-out"]>>;
|
|
521
|
+
/** The background color. */
|
|
522
|
+
readonly color: Schema.optionalKey<Schema.Literals<readonly ["white", "black", "yellow", "blue", "green", "orange", "red", "purple", "gray-dark"]>>;
|
|
523
|
+
}>, {}>;
|
|
524
|
+
/**
|
|
525
|
+
* An action's Marketplace branding.
|
|
526
|
+
*
|
|
527
|
+
* @public
|
|
528
|
+
*/
|
|
529
|
+
export declare class ActionYmlBranding extends ActionYmlBranding_base {}
|
|
530
|
+
declare const ActionYml_base: Schema.Class<ActionYml, Schema.Struct<{
|
|
531
|
+
/** The action's name. */
|
|
532
|
+
readonly name: Schema.String;
|
|
533
|
+
/** What the action does. */
|
|
534
|
+
readonly description: Schema.String;
|
|
535
|
+
/** The action's author. */
|
|
536
|
+
readonly author: Schema.optionalKey<Schema.String>;
|
|
537
|
+
/** The inputs, by name. */
|
|
538
|
+
readonly inputs: Schema.optionalKey<Schema.$Record<Schema.String, typeof ActionYmlInput>>;
|
|
539
|
+
/** The outputs, by name. */
|
|
540
|
+
readonly outputs: Schema.optionalKey<Schema.$Record<Schema.String, typeof ActionYmlOutput>>;
|
|
541
|
+
/** How the action runs. */
|
|
542
|
+
readonly runs: typeof ActionYmlRuns;
|
|
543
|
+
/** The Marketplace branding. */
|
|
544
|
+
readonly branding: Schema.optionalKey<typeof ActionYmlBranding>;
|
|
545
|
+
}>, {}>;
|
|
546
|
+
/**
|
|
547
|
+
* A decoded `action.yml`, per GitHub's metadata syntax for actions.
|
|
548
|
+
*
|
|
549
|
+
* @remarks
|
|
550
|
+
* Keys it does not model are dropped rather than rejected. Parse the file with `Yaml.parse` from `@effected/yaml`,
|
|
551
|
+
* then decode the document with this schema.
|
|
552
|
+
*
|
|
553
|
+
* @public
|
|
554
|
+
*/
|
|
555
|
+
export declare class ActionYml extends ActionYml_base {}
|
|
556
|
+
declare const PersistLocalResult_base: Schema.Class<PersistLocalResult, Schema.Struct<{
|
|
557
|
+
/** Files copied because they were new or changed. */
|
|
558
|
+
readonly filesCopied: Schema.Number;
|
|
559
|
+
/** Files left alone because they matched. */
|
|
560
|
+
readonly filesSkipped: Schema.Number;
|
|
561
|
+
/** Whether an act template file was generated. */
|
|
562
|
+
readonly actTemplateGenerated: Schema.Boolean;
|
|
563
|
+
/** The local action directory. */
|
|
564
|
+
readonly outputPath: Schema.String;
|
|
565
|
+
}>, {}>;
|
|
566
|
+
/**
|
|
567
|
+
* What a persist did.
|
|
568
|
+
*
|
|
569
|
+
* @public
|
|
570
|
+
*/
|
|
571
|
+
export declare class PersistLocalResult extends PersistLocalResult_base {}
|
|
572
|
+
/**
|
|
573
|
+
* Copies an action's build to a local action directory, for testing with nektos/act.
|
|
574
|
+
*
|
|
575
|
+
* @public
|
|
576
|
+
*/
|
|
577
|
+
export declare class PersistLocal {
|
|
578
|
+
private constructor();
|
|
579
|
+
/**
|
|
580
|
+
* Makes `persistLocal.path` hold the action's `action.yml` and `dist/`, and generates the act template.
|
|
581
|
+
*
|
|
582
|
+
* @remarks
|
|
583
|
+
* It writes nothing when `persistLocal.enabled` is false. Files that match are left alone, and files the source no
|
|
584
|
+
* longer has are removed. A `.actrc` and `.github/workflows/act-test.yml` that already exist are kept. A `runs` path
|
|
585
|
+
* in `action.yml` that names no persisted file fails {@link ActionYmlPathError}.
|
|
586
|
+
*
|
|
587
|
+
* @param options - `cwd` is the action's directory.
|
|
588
|
+
*/
|
|
589
|
+
static readonly persist: (config: ActionConfig, options: {
|
|
590
|
+
readonly cwd: string;
|
|
591
|
+
}) => Effect.Effect<PersistLocalResult, PersistLocalError | ActionYmlPathError, FileSystem.FileSystem | Path.Path>;
|
|
592
|
+
}
|
|
593
|
+
declare const ReportTimings_base: Schema.Class<ReportTimings, Schema.Struct<{
|
|
594
|
+
readonly totalMs: Schema.Number;
|
|
595
|
+
}>, {}>;
|
|
596
|
+
/** @public */
|
|
597
|
+
export declare class ReportTimings extends ReportTimings_base {}
|
|
598
|
+
declare const DiagnosticEntry_base: Schema.Class<DiagnosticEntry, Schema.Struct<{
|
|
599
|
+
readonly source: Schema.Literals<readonly ["tsdown", "rolldown", "api-extractor", "meta", "config"]>;
|
|
600
|
+
readonly level: Schema.Literals<readonly ["warn", "error"]>;
|
|
601
|
+
readonly text: Schema.String;
|
|
602
|
+
/**
|
|
603
|
+
* Diagnostic identifier — an API Extractor messageId (e.g. "ae-forgotten-export") or a
|
|
604
|
+
* rolldown warning code (e.g. "MIXED_EXPORTS"); used to group suppressed messages by type.
|
|
605
|
+
*/
|
|
606
|
+
readonly code: Schema.optional<Schema.String>;
|
|
607
|
+
/** True when shown as `warn` locally but a hard error in CI (drives the "[fails CI]" nudge). */
|
|
608
|
+
readonly ciFatal: Schema.optional<Schema.Boolean>;
|
|
609
|
+
readonly file: Schema.optional<Schema.String>;
|
|
610
|
+
readonly line: Schema.optional<Schema.Number>;
|
|
611
|
+
readonly column: Schema.optional<Schema.Number>;
|
|
612
|
+
}>, {}>;
|
|
613
|
+
/**
|
|
614
|
+
* A captured warning or error, from tsdown's logger, rolldown's onLog, API Extractor, the meta
|
|
615
|
+
* pass's own sidecar work (`bundle.json` sources, Open Graph generation), or an advisory finding
|
|
616
|
+
* about the build config itself (`config`, e.g. a `publishConfig.targets` set no final release reaches).
|
|
617
|
+
*
|
|
618
|
+
* @public
|
|
619
|
+
*/
|
|
620
|
+
export declare class DiagnosticEntry extends DiagnosticEntry_base {}
|
|
621
|
+
declare const EmittedFile_base: Schema.Class<EmittedFile, Schema.Struct<{
|
|
622
|
+
readonly path: Schema.String;
|
|
623
|
+
readonly bytes: Schema.Number;
|
|
624
|
+
readonly gzip: Schema.optional<Schema.Number>;
|
|
625
|
+
}>, {}>;
|
|
626
|
+
/**
|
|
627
|
+
* One emitted output file with its in-memory byte size (gzip only when --verbose).
|
|
628
|
+
*
|
|
629
|
+
* @public
|
|
630
|
+
*/
|
|
631
|
+
export declare class EmittedFile extends EmittedFile_base {}
|
|
632
|
+
declare const PassReport_base: Schema.Class<PassReport, Schema.Struct<{
|
|
633
|
+
readonly id: Schema.Literals<readonly ["js", "dts", "loose", "exe", "meta"]>;
|
|
634
|
+
readonly files: Schema.$Array<typeof EmittedFile>;
|
|
635
|
+
readonly ms: Schema.Number;
|
|
636
|
+
}>, {}>;
|
|
637
|
+
/**
|
|
638
|
+
* One build pass within a target group (js / dts / loose / exe / meta).
|
|
639
|
+
*
|
|
640
|
+
* @public
|
|
641
|
+
*/
|
|
642
|
+
export declare class PassReport extends PassReport_base {}
|
|
643
|
+
declare const TargetGroupReport_base: Schema.Class<TargetGroupReport, Schema.Struct<{
|
|
644
|
+
readonly id: Schema.String;
|
|
645
|
+
readonly entries: Schema.$Array<Schema.String>;
|
|
646
|
+
readonly passes: Schema.$Array<typeof PassReport>;
|
|
647
|
+
readonly warnings: Schema.$Array<typeof DiagnosticEntry>;
|
|
648
|
+
readonly errors: Schema.$Array<typeof DiagnosticEntry>;
|
|
649
|
+
/** Messages matched by `suppressWarnings`, kept for accounting and `--verbose` expansion. */
|
|
650
|
+
readonly suppressed: Schema.$Array<typeof DiagnosticEntry>;
|
|
651
|
+
readonly timings: typeof ReportTimings;
|
|
652
|
+
}>, {}>;
|
|
653
|
+
/** @public */
|
|
654
|
+
export declare class TargetGroupReport extends TargetGroupReport_base {}
|
|
655
|
+
declare const BuildReport_base: Schema.Class<BuildReport, Schema.Struct<{
|
|
656
|
+
readonly package: Schema.String;
|
|
657
|
+
readonly targetGroups: Schema.$Array<typeof TargetGroupReport>;
|
|
658
|
+
}>, {}>;
|
|
659
|
+
/** @public */
|
|
660
|
+
export declare class BuildReport extends BuildReport_base {}
|
|
661
|
+
/**
|
|
662
|
+
* The part of a build a {@link BundlerError} failed in.
|
|
663
|
+
*
|
|
664
|
+
* @public
|
|
665
|
+
*/
|
|
666
|
+
export declare const BundlerPhase: Schema.Literals<readonly ["validate", "js", "dts", "meta", "exe", "manifest"]>;
|
|
667
|
+
/**
|
|
668
|
+
* The decoded type of {@link (BundlerPhase:variable)}.
|
|
669
|
+
*
|
|
670
|
+
* @public
|
|
671
|
+
*/
|
|
672
|
+
export type BundlerPhase = typeof BundlerPhase.Type;
|
|
673
|
+
declare const BundlerError_base: Schema.Class<BundlerError, Schema.TaggedStruct<"BundlerError", {
|
|
674
|
+
/** The part of the build that failed. */
|
|
675
|
+
readonly phase: Schema.Literals<readonly ["validate", "js", "dts", "meta", "exe", "manifest"]>;
|
|
676
|
+
/** What went wrong, read from the thrown value and its cause chain. */
|
|
677
|
+
readonly message: Schema.String;
|
|
678
|
+
/** The thrown value, carried structurally. */
|
|
679
|
+
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
680
|
+
/** Everything the build recorded before it failed. */
|
|
681
|
+
readonly report: typeof BuildReport;
|
|
682
|
+
}>, import("effect/Cause").YieldableError>;
|
|
683
|
+
/**
|
|
684
|
+
* A build ended before it finished.
|
|
685
|
+
*
|
|
686
|
+
* @remarks
|
|
687
|
+
* `report` is the collector's snapshot at the moment of failure, so a caller can still render the diagnostics
|
|
688
|
+
* the build gathered. `dist/prod/issues.json` was written with `buildOk: false` before this failure was raised,
|
|
689
|
+
* unless writing it failed too.
|
|
690
|
+
*
|
|
691
|
+
* @public
|
|
692
|
+
*/
|
|
693
|
+
export declare class BundlerError extends BundlerError_base {}
|
|
694
|
+
/**
|
|
695
|
+
* A module format the build can emit.
|
|
696
|
+
*
|
|
697
|
+
* @public
|
|
698
|
+
*/
|
|
699
|
+
export declare const BuildFormat: Schema.Literals<readonly ["esm", "cjs"]>;
|
|
700
|
+
/**
|
|
701
|
+
* The decoded type of {@link (BuildFormat:variable)}.
|
|
702
|
+
*
|
|
703
|
+
* @public
|
|
704
|
+
*/
|
|
705
|
+
export type BuildFormat = typeof BuildFormat.Type;
|
|
706
|
+
/**
|
|
707
|
+
* The platform a JS pass targets.
|
|
708
|
+
*
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
export declare const BuildPlatform: Schema.Literals<readonly ["node", "browser", "neutral"]>;
|
|
712
|
+
/**
|
|
713
|
+
* The decoded type of {@link (BuildPlatform:variable)}.
|
|
714
|
+
*
|
|
715
|
+
* @public
|
|
716
|
+
*/
|
|
717
|
+
export type BuildPlatform = typeof BuildPlatform.Type;
|
|
718
|
+
declare const EntryOverride_base: Schema.Class<EntryOverride, Schema.Struct<{
|
|
719
|
+
/** Export paths to pin to this partition, e.g. `"./changesets/markdownlint"`, or `"."` for the root. */
|
|
720
|
+
readonly entries: Schema.$Array<Schema.String>;
|
|
721
|
+
/** Output module formats for this partition. */
|
|
722
|
+
readonly format: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["esm", "cjs"]>>>;
|
|
723
|
+
/** Packages force-bundled into this partition's JS output. */
|
|
724
|
+
readonly bundle: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
725
|
+
/** Packages kept external in this partition. */
|
|
726
|
+
readonly externals: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
727
|
+
/** Whether this partition bundles its `node_modules` dependencies. */
|
|
728
|
+
readonly bundleNodeModules: Schema.optionalKey<Schema.Boolean>;
|
|
729
|
+
/** Packages whose declarations are inlined into this partition's `.d.ts`; a workspace sibling must be built first. */
|
|
730
|
+
readonly bundledPackages: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
731
|
+
/** Packages externalized in this partition's declaration pass only. */
|
|
732
|
+
readonly dtsExternals: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
733
|
+
/** The JS pass's platform for this partition, `"node"` when absent. Use `"browser"` for a browser runtime. */
|
|
734
|
+
readonly platform: Schema.optionalKey<Schema.Literals<readonly ["node", "browser", "neutral"]>>;
|
|
735
|
+
/** CSS handling forwarded to tsdown's `css` option on the JS pass; tsdown owns the shape. */
|
|
736
|
+
readonly css: Schema.optionalKey<Schema.Unknown>;
|
|
737
|
+
/**
|
|
738
|
+
* Builds this partition into a `pkg/<outSubdir>/` subdirectory as an isolated sub-package.
|
|
739
|
+
*
|
|
740
|
+
* @remarks
|
|
741
|
+
* The export's built path becomes `./<outSubdir>/index.{js,d.ts}`. Exactly one export path may be pinned
|
|
742
|
+
* per `outSubdir` override.
|
|
743
|
+
*/
|
|
744
|
+
readonly outSubdir: Schema.optionalKey<Schema.String>;
|
|
745
|
+
}>, {}>;
|
|
746
|
+
/**
|
|
747
|
+
* Format and bundling settings pinned to some of a package's export paths, layered onto the base build.
|
|
748
|
+
*
|
|
749
|
+
* @remarks
|
|
750
|
+
* Use one to keep a single entry CJS in an otherwise ESM-only package, or to build an entry as an isolated
|
|
751
|
+
* browser sub-package. Every setting except `entries` is absent unless written, and absent means the base
|
|
752
|
+
* build's value.
|
|
753
|
+
*
|
|
754
|
+
* @public
|
|
755
|
+
*/
|
|
756
|
+
export declare class EntryOverride extends EntryOverride_base {}
|
|
757
|
+
declare const LooseFileSpec_base: Schema.Class<LooseFileSpec$1, Schema.Struct<{
|
|
758
|
+
/** Source module to bundle into the file. */
|
|
759
|
+
readonly source: Schema.String;
|
|
760
|
+
/** Module format. Required only for an ambiguous `.js` key; inferred from `.mjs` and `.cjs`. */
|
|
761
|
+
readonly format: Schema.optionalKey<Schema.Literals<readonly ["esm", "cjs"]>>;
|
|
762
|
+
}>, {}>;
|
|
763
|
+
/**
|
|
764
|
+
* One standalone output file's source and format.
|
|
765
|
+
*
|
|
766
|
+
* @public
|
|
767
|
+
*/
|
|
768
|
+
declare class LooseFileSpec$1 extends LooseFileSpec_base {}
|
|
769
|
+
declare const CopyEntry_base: Schema.Class<CopyEntry, Schema.Struct<{
|
|
770
|
+
/**
|
|
771
|
+
* Source paths or globs, relative to the package directory. A directory is copied whole and keeps its own basename
|
|
772
|
+
* under `to`, so `{ from: "../../schemas", to: "schemas" }` emits `pkg/schemas/schemas/...`; use the bare string
|
|
773
|
+
* `"../../schemas"` to ship `schemas/` at the package root.
|
|
774
|
+
*/
|
|
775
|
+
readonly from: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>;
|
|
776
|
+
/** The destination directory, relative to the group's `pkg/` root, which is the default. It may not leave `pkg/`. */
|
|
777
|
+
readonly to: Schema.optionalKey<Schema.String>;
|
|
778
|
+
/** Whether to drop each source's directory structure. tsdown defaults this to `true`. */
|
|
779
|
+
readonly flatten: Schema.optionalKey<Schema.Boolean>;
|
|
780
|
+
}>, {}>;
|
|
781
|
+
/**
|
|
782
|
+
* One non-module asset to copy into each publish group's `pkg/` directory, in the shape of tsdown's `copy` option.
|
|
783
|
+
*
|
|
784
|
+
* @public
|
|
785
|
+
*/
|
|
786
|
+
export declare class CopyEntry extends CopyEntry_base {}
|
|
787
|
+
declare const JsxConfig_base: Schema.Class<JsxConfig, Schema.Struct<{
|
|
788
|
+
/** `"automatic"` auto-imports the JSX factories; `"classic"` compiles to `React.createElement`. */
|
|
789
|
+
readonly runtime: Schema.optionalKey<Schema.Literals<readonly ["automatic", "classic"]>>;
|
|
790
|
+
/** The JSX import source for the automatic runtime, e.g. `"react"` or `"preact"`. */
|
|
791
|
+
readonly importSource: Schema.optionalKey<Schema.String>;
|
|
792
|
+
}>, {}>;
|
|
793
|
+
/**
|
|
794
|
+
* JSX transform settings.
|
|
795
|
+
*
|
|
796
|
+
* @public
|
|
797
|
+
*/
|
|
798
|
+
export declare class JsxConfig extends JsxConfig_base {}
|
|
799
|
+
declare const ManifestConfig_base: Schema.Class<ManifestConfig, Schema.Struct<{
|
|
800
|
+
/** Top-level manifest keys to drop from the emitted `package.json`, beyond the ones always stripped. */
|
|
801
|
+
readonly drop: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
802
|
+
/**
|
|
803
|
+
* Top-level string keys written over the emitted `package.json`, after `drop`.
|
|
804
|
+
*
|
|
805
|
+
* @remarks
|
|
806
|
+
* `name` renames the package everywhere the build names it: every publish group without its own name override,
|
|
807
|
+
* `targets.json` and the API model, so two workspace packages can emit as one published name. Keys the build or the
|
|
808
|
+
* release owns, such as `version`, `private`, `exports` and the dependency maps, fail validation, as does a key also
|
|
809
|
+
* listed in `drop`.
|
|
810
|
+
*/
|
|
811
|
+
readonly set: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>;
|
|
812
|
+
}>, {}>;
|
|
813
|
+
/**
|
|
814
|
+
* What the build changes in the emitted `package.json`.
|
|
815
|
+
*
|
|
816
|
+
* @public
|
|
817
|
+
*/
|
|
818
|
+
export declare class ManifestConfig extends ManifestConfig_base {}
|
|
819
|
+
declare const WarningSuppressionRule_base: Schema.Class<WarningSuppressionRule$1, Schema.Struct<{
|
|
820
|
+
/** The exact API Extractor message id. */
|
|
821
|
+
readonly messageId: Schema.optionalKey<Schema.String>;
|
|
822
|
+
/** A regex or substring matched against the message text. */
|
|
823
|
+
readonly pattern: Schema.optionalKey<Schema.String>;
|
|
824
|
+
}>, {}>;
|
|
825
|
+
/**
|
|
826
|
+
* An API Extractor message-suppression rule.
|
|
827
|
+
*
|
|
828
|
+
* @remarks
|
|
829
|
+
* `messageId` matches exactly and `pattern`, a regex or substring, matches the message text. A rule with
|
|
830
|
+
* both needs both to match.
|
|
831
|
+
*
|
|
832
|
+
* @public
|
|
833
|
+
*/
|
|
834
|
+
declare class WarningSuppressionRule$1 extends WarningSuppressionRule_base {}
|
|
835
|
+
declare const TsdocTagDefinition_base: Schema.Class<TsdocTagDefinition$1, Schema.Struct<{
|
|
836
|
+
/** The tag's name, with its leading `@`. */
|
|
837
|
+
readonly tagName: Schema.String;
|
|
838
|
+
/** The tag's syntax. */
|
|
839
|
+
readonly syntaxKind: Schema.Literals<readonly ["block", "inline", "modifier"]>;
|
|
840
|
+
/** Whether a declaration may carry the tag more than once. */
|
|
841
|
+
readonly allowMultiple: Schema.optionalKey<Schema.Boolean>;
|
|
842
|
+
}>, {}>;
|
|
843
|
+
/**
|
|
844
|
+
* A single TSDoc tag definition, as API Extractor's TSDoc config takes it.
|
|
845
|
+
*
|
|
846
|
+
* @public
|
|
847
|
+
*/
|
|
848
|
+
declare class TsdocTagDefinition$1 extends TsdocTagDefinition_base {}
|
|
849
|
+
declare const TsdocConfig_base: Schema.Class<TsdocConfig, Schema.Struct<{
|
|
850
|
+
/**
|
|
851
|
+
* API Extractor messages to suppress.
|
|
852
|
+
*
|
|
853
|
+
* @remarks
|
|
854
|
+
* Defaults to the `_base` forgotten-export every `Schema.Class` synthesizes. A list replaces the default
|
|
855
|
+
* rather than adding to it, so an empty list suppresses nothing.
|
|
856
|
+
*/
|
|
857
|
+
readonly suppressWarnings: Schema.withDecodingDefaultKey<Schema.$Array<typeof WarningSuppressionRule$1>, never>;
|
|
858
|
+
/** Custom TSDoc tags to register. */
|
|
859
|
+
readonly tagDefinitions: Schema.withDecodingDefaultKey<Schema.$Array<typeof TsdocTagDefinition$1>, never>;
|
|
860
|
+
}>, {}>;
|
|
861
|
+
/**
|
|
862
|
+
* TSDoc and documentation-warning settings.
|
|
863
|
+
*
|
|
864
|
+
* @public
|
|
865
|
+
*/
|
|
866
|
+
export declare class TsdocConfig extends TsdocConfig_base {}
|
|
867
|
+
declare const MetaConfig_base: Schema.Class<MetaConfig, Schema.Struct<{
|
|
868
|
+
/**
|
|
869
|
+
* Directories, relative to the package directory, that the canonical group's API model is copied into.
|
|
870
|
+
*
|
|
871
|
+
* @remarks
|
|
872
|
+
* For a docs site reading the model from its own tree. Each one receives the `.api.json`, the meta `package.json`
|
|
873
|
+
* and `tsconfig.json`, and `bundle.json` when one was emitted.
|
|
874
|
+
*/
|
|
875
|
+
readonly localPaths: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
876
|
+
/**
|
|
877
|
+
* Forward-looks the meta bundle's own version and its workspace siblings' dependency versions to their
|
|
878
|
+
* next release versions from pending changesets.
|
|
879
|
+
*
|
|
880
|
+
* @remarks
|
|
881
|
+
* `"auto"` is `false` under CI and `true` locally, so a local bundle matches the CI release build.
|
|
882
|
+
*/
|
|
883
|
+
readonly optimistic: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Literal<"auto">, Schema.Boolean]>, never>;
|
|
884
|
+
/** TSDoc and documentation-warning settings. */
|
|
885
|
+
readonly tsdoc: Schema.withDecodingDefaultKey<typeof TsdocConfig, never>;
|
|
886
|
+
}>, {}>;
|
|
887
|
+
/**
|
|
888
|
+
* API model generation settings, the `[package.build.meta]` table.
|
|
889
|
+
*
|
|
890
|
+
* @public
|
|
891
|
+
*/
|
|
892
|
+
export declare class MetaConfig extends MetaConfig_base {}
|
|
893
|
+
declare const ExeTargetConfig_base: Schema.Class<ExeTargetConfig, Schema.Struct<{
|
|
894
|
+
/** The platform, using tsdown's `win` token rather than `win32`. */
|
|
895
|
+
readonly platform: Schema.Literals<readonly ["darwin", "linux", "win"]>;
|
|
896
|
+
/** The CPU architecture. */
|
|
897
|
+
readonly arch: Schema.Literals<readonly ["arm64", "x64"]>;
|
|
898
|
+
}>, {}>;
|
|
899
|
+
/**
|
|
900
|
+
* A single-executable (SEA) target platform and architecture.
|
|
901
|
+
*
|
|
902
|
+
* @public
|
|
903
|
+
*/
|
|
904
|
+
export declare class ExeTargetConfig extends ExeTargetConfig_base {}
|
|
905
|
+
declare const ExeSeaConfig_base: Schema.Class<ExeSeaConfig, Schema.Struct<{
|
|
906
|
+
/** Whether to silence Node's experimental SEA warning. */
|
|
907
|
+
readonly disableExperimentalSEAWarning: Schema.optionalKey<Schema.Boolean>;
|
|
908
|
+
/** Whether to embed V8's code cache. */
|
|
909
|
+
readonly useCodeCache: Schema.optionalKey<Schema.Boolean>;
|
|
910
|
+
/** Whether to embed a V8 startup snapshot. */
|
|
911
|
+
readonly useSnapshot: Schema.optionalKey<Schema.Boolean>;
|
|
912
|
+
}>, {}>;
|
|
913
|
+
/**
|
|
914
|
+
* Single-executable `seaConfig` overrides, merged over the defaults.
|
|
915
|
+
*
|
|
916
|
+
* @public
|
|
917
|
+
*/
|
|
918
|
+
export declare class ExeSeaConfig extends ExeSeaConfig_base {}
|
|
919
|
+
declare const ExeConfig_base: Schema.Class<ExeConfig, Schema.Struct<{
|
|
920
|
+
/** Output binary basename, with no extension or suffix. */
|
|
921
|
+
readonly fileName: Schema.String;
|
|
922
|
+
/** The bin entry; `./src/bin.ts` when absent. */
|
|
923
|
+
readonly entry: Schema.optionalKey<Schema.String>;
|
|
924
|
+
/** The Node runtime to embed. */
|
|
925
|
+
readonly nodeVersion: Schema.optionalKey<Schema.String>;
|
|
926
|
+
/** `seaConfig` overrides merged over the defaults. */
|
|
927
|
+
readonly seaConfig: Schema.optionalKey<typeof ExeSeaConfig>;
|
|
928
|
+
/** Explicit targets; inferred from the package's `os` and `cpu` when absent. */
|
|
929
|
+
readonly targets: Schema.optionalKey<Schema.$Array<typeof ExeTargetConfig>>;
|
|
930
|
+
}>, {}>;
|
|
931
|
+
/**
|
|
932
|
+
* One single-executable (SEA) binary to compile.
|
|
933
|
+
*
|
|
934
|
+
* @public
|
|
935
|
+
*/
|
|
936
|
+
export declare class ExeConfig extends ExeConfig_base {}
|
|
937
|
+
declare const PackageBuildConfig_base: Schema.Class<PackageBuildConfig, Schema.Struct<{
|
|
938
|
+
/** Output module formats. ESM-only by default; add `"cjs"` for a dual-format build. */
|
|
939
|
+
readonly format: Schema.withDecodingDefaultKey<Schema.$Array<Schema.Literals<readonly ["esm", "cjs"]>>, never>;
|
|
940
|
+
/** Packages kept external. */
|
|
941
|
+
readonly externals: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
942
|
+
/**
|
|
943
|
+
* Packages force-bundled into the JS output, even ones declared in `package.json` that would otherwise be
|
|
944
|
+
* external.
|
|
945
|
+
*
|
|
946
|
+
* @remarks
|
|
947
|
+
* The inverse of `externals`. Declarations are not inlined by this; use `bundledPackages` to roll a
|
|
948
|
+
* package's types into the emitted `.d.ts` too.
|
|
949
|
+
*/
|
|
950
|
+
readonly bundle: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
951
|
+
/**
|
|
952
|
+
* External packages whose declarations are inlined into the bundled `.d.ts`; all others stay external.
|
|
953
|
+
*
|
|
954
|
+
* @remarks
|
|
955
|
+
* A workspace sibling inlines from its built declarations, so it has to be built first; the build fails naming it
|
|
956
|
+
* when they are absent.
|
|
957
|
+
*/
|
|
958
|
+
readonly bundledPackages: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
959
|
+
/**
|
|
960
|
+
* Packages externalized in the declaration pass only: imported from the emitted `.d.ts` rather than
|
|
961
|
+
* inlined, while the JS pass still bundles them per `bundleNodeModules`.
|
|
962
|
+
*
|
|
963
|
+
* @remarks
|
|
964
|
+
* For a dependency whose types cannot be safely inlined, such as `effect`'s cross-module `declare module`
|
|
965
|
+
* augmentations. Declare these as package dependencies so consumers can resolve the emitted imports.
|
|
966
|
+
*/
|
|
967
|
+
readonly dtsExternals: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
968
|
+
/**
|
|
969
|
+
* Bundles `node_modules` and workspace dependencies that are not externalized into the JS output and the
|
|
970
|
+
* bundled declarations alike.
|
|
971
|
+
*/
|
|
972
|
+
readonly bundleNodeModules: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
973
|
+
/**
|
|
974
|
+
* Minifies the output.
|
|
975
|
+
*
|
|
976
|
+
* @remarks
|
|
977
|
+
* Off by default: minified Node libraries trip security scanners and degrade stack traces.
|
|
978
|
+
*/
|
|
979
|
+
readonly minify: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
980
|
+
/**
|
|
981
|
+
* Runs the bundled `.d.ts` pass and, with it, the meta pass that reads those declarations.
|
|
982
|
+
*
|
|
983
|
+
* @remarks
|
|
984
|
+
* `false` is for JS-only artifacts that never consume declarations. It differs from `meta = false`, which
|
|
985
|
+
* disables only the API model and still runs the declaration pass.
|
|
986
|
+
*/
|
|
987
|
+
readonly emitDts: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
988
|
+
/**
|
|
989
|
+
* Compile-time global replacements forwarded to the build's `define`.
|
|
990
|
+
*
|
|
991
|
+
* @remarks
|
|
992
|
+
* Values are inserted verbatim, so a string literal must carry its own quotes.
|
|
993
|
+
*/
|
|
994
|
+
readonly define: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>;
|
|
995
|
+
/** Modules whose default export is a rolldown plugin or a factory of one, as package-relative paths. */
|
|
996
|
+
readonly plugins: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
997
|
+
/** Per-entry format and bundling overrides, layered onto the base build. */
|
|
998
|
+
readonly overrides: Schema.withDecodingDefaultKey<Schema.$Array<typeof EntryOverride>, never>;
|
|
999
|
+
/**
|
|
1000
|
+
* Standalone bundled output files emitted at literal paths, outside the exports, declaration and meta graph.
|
|
1001
|
+
*
|
|
1002
|
+
* @remarks
|
|
1003
|
+
* Keys are literal output filenames; values are a source path or a {@link LooseFileSpec}. Pair with
|
|
1004
|
+
* `bundleNodeModules` to make each file self-contained.
|
|
1005
|
+
*/
|
|
1006
|
+
readonly looseFiles: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, typeof LooseFileSpec$1]>>, never>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Non-module assets copied into each group's `pkg/` directory by the JS pass.
|
|
1009
|
+
*
|
|
1010
|
+
* @remarks
|
|
1011
|
+
* tsdown's `copy` option as data: a string is a path or glob relative to the package directory, copied into the
|
|
1012
|
+
* `pkg/` root, and {@link CopyEntry} adds a destination. A directory keeps its basename, so `"../../schemas"` ships
|
|
1013
|
+
* `pkg/schemas/...`. A `public/` directory is already copied verbatim with no
|
|
1014
|
+
* config; this is the explicit way, for files that live elsewhere. A package that compiles only a binary runs no JS
|
|
1015
|
+
* pass, so setting this there fails validation.
|
|
1016
|
+
*/
|
|
1017
|
+
readonly copy: Schema.withDecodingDefaultKey<Schema.$Array<Schema.Union<readonly [Schema.String, typeof CopyEntry]>>, never>;
|
|
1018
|
+
/** JSX transform settings; inferred from the package's tsconfig when absent. */
|
|
1019
|
+
readonly jsx: Schema.optionalKey<typeof JsxConfig>;
|
|
1020
|
+
/** What the build changes in the emitted `package.json`. */
|
|
1021
|
+
readonly manifest: Schema.withDecodingDefaultKey<typeof ManifestConfig, never>;
|
|
1022
|
+
/** API model generation: its settings, or `false` to opt out. Generated with defaults when absent. */
|
|
1023
|
+
readonly meta: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Literal<false>, typeof MetaConfig]>, never>;
|
|
1024
|
+
/** Single-executable binaries to compile: one, or a list. */
|
|
1025
|
+
readonly exe: Schema.optionalKey<Schema.Union<readonly [typeof ExeConfig, Schema.$Array<typeof ExeConfig>]>>;
|
|
1026
|
+
}>, {}>;
|
|
1027
|
+
/**
|
|
1028
|
+
* The build settings of one package, the `[package.build]` table.
|
|
1029
|
+
*
|
|
1030
|
+
* @remarks
|
|
1031
|
+
* Every field has a default or is absent, so an empty table is a complete config.
|
|
1032
|
+
*
|
|
1033
|
+
* @public
|
|
1034
|
+
*/
|
|
1035
|
+
export declare class PackageBuildConfig extends PackageBuildConfig_base {}
|
|
1036
|
+
declare const BundleOpenGraphImage_base: Schema.Class<BundleOpenGraphImage, Schema.Struct<{
|
|
1037
|
+
/** Bundle-relative asset path. Mutually exclusive with `url`. */
|
|
1038
|
+
readonly path: Schema.optionalKey<Schema.String>;
|
|
1039
|
+
/** Absolute external URL, used verbatim. Mutually exclusive with `path`. */
|
|
1040
|
+
readonly url: Schema.optionalKey<Schema.String>;
|
|
1041
|
+
/** MIME type; inferred from the extension when absent. */
|
|
1042
|
+
readonly type: Schema.optionalKey<Schema.String>;
|
|
1043
|
+
/** Pixel width. */
|
|
1044
|
+
readonly width: Schema.optionalKey<Schema.Int>;
|
|
1045
|
+
/** Pixel height. */
|
|
1046
|
+
readonly height: Schema.optionalKey<Schema.Int>;
|
|
1047
|
+
/** Alt text; inferred when absent. */
|
|
1048
|
+
readonly alt: Schema.optionalKey<Schema.String>;
|
|
1049
|
+
}>, {}>;
|
|
1050
|
+
/**
|
|
1051
|
+
* One Open Graph image a package's API docs declare.
|
|
1052
|
+
*
|
|
1053
|
+
* @remarks
|
|
1054
|
+
* Exactly one of `path` and `url` must be present.
|
|
1055
|
+
*
|
|
1056
|
+
* @public
|
|
1057
|
+
*/
|
|
1058
|
+
export declare class BundleOpenGraphImage extends BundleOpenGraphImage_base {}
|
|
1059
|
+
declare const BundleRegistryRef_base: Schema.Class<BundleRegistryRef, Schema.Struct<{
|
|
1060
|
+
/** The protocol family, e.g. `"npm"` or `"jsr"`. Unknown values are accepted. */
|
|
1061
|
+
readonly type: Schema.String;
|
|
1062
|
+
/** The human instance label, e.g. `"npm"`. */
|
|
1063
|
+
readonly name: Schema.String;
|
|
1064
|
+
/** The package's URL on that registry instance. */
|
|
1065
|
+
readonly url: Schema.String;
|
|
1066
|
+
}>, {}>;
|
|
1067
|
+
/**
|
|
1068
|
+
* One registry a documented package is published to.
|
|
1069
|
+
*
|
|
1070
|
+
* @public
|
|
1071
|
+
*/
|
|
1072
|
+
export declare class BundleRegistryRef extends BundleRegistryRef_base {}
|
|
1073
|
+
declare const BundleOpenGraphConfig_base: Schema.Class<BundleOpenGraphConfig, Schema.Struct<{
|
|
1074
|
+
/** Static images, by path or url. Listed after a generated image. */
|
|
1075
|
+
readonly images: Schema.optionalKey<Schema.$Array<typeof BundleOpenGraphImage>>;
|
|
1076
|
+
/** Embed accent color, a CSS color string. */
|
|
1077
|
+
readonly themeColor: Schema.optionalKey<Schema.String>;
|
|
1078
|
+
/** Renders an image at build time, listed first. `"satori"` is the only renderer. */
|
|
1079
|
+
readonly generate: Schema.optionalKey<Schema.Literal<"satori">>;
|
|
1080
|
+
/**
|
|
1081
|
+
* The cross-build image cache's salt.
|
|
1082
|
+
*
|
|
1083
|
+
* @remarks
|
|
1084
|
+
* A string caches under it, so change it whenever the renderer's output changes for the same input.
|
|
1085
|
+
* `false` always regenerates. Absent, the renderer's own salt is used.
|
|
1086
|
+
*/
|
|
1087
|
+
readonly cacheSalt: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Literal<false>]>>;
|
|
1088
|
+
}>, {}>;
|
|
1089
|
+
/**
|
|
1090
|
+
* The Open Graph settings of a package's API docs.
|
|
1091
|
+
*
|
|
1092
|
+
* @public
|
|
1093
|
+
*/
|
|
1094
|
+
export declare class BundleOpenGraphConfig extends BundleOpenGraphConfig_base {}
|
|
1095
|
+
declare const BundleConfig_base: Schema.Class<BundleConfig, Schema.Struct<{
|
|
1096
|
+
/** The display name. */
|
|
1097
|
+
readonly name: Schema.optionalKey<Schema.String>;
|
|
1098
|
+
/** A one-line tagline. */
|
|
1099
|
+
readonly tagline: Schema.optionalKey<Schema.String>;
|
|
1100
|
+
/** A description. */
|
|
1101
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
1102
|
+
/** The Open Graph settings. */
|
|
1103
|
+
readonly openGraph: Schema.optionalKey<typeof BundleOpenGraphConfig>;
|
|
1104
|
+
/** Registries; `false` disables the default derived from `targets.json`. */
|
|
1105
|
+
readonly registries: Schema.optionalKey<Schema.Union<readonly [Schema.$Array<typeof BundleRegistryRef>, Schema.Literal<false>]>>;
|
|
1106
|
+
}>, {}>;
|
|
1107
|
+
/**
|
|
1108
|
+
* The config tier of a package's emitted `bundle.json`, the `[package.bundle]` table.
|
|
1109
|
+
*
|
|
1110
|
+
* @public
|
|
1111
|
+
*/
|
|
1112
|
+
export declare class BundleConfig extends BundleConfig_base {}
|
|
1113
|
+
declare const PackageConfig_base: Schema.Class<PackageConfig, Schema.Struct<{
|
|
1114
|
+
/** The build settings. */
|
|
1115
|
+
readonly build: Schema.withDecodingDefaultKey<typeof PackageBuildConfig, never>;
|
|
1116
|
+
/** The `bundle.json` config tier. */
|
|
1117
|
+
readonly bundle: Schema.optionalKey<typeof BundleConfig>;
|
|
1118
|
+
}>, {}>;
|
|
1119
|
+
/**
|
|
1120
|
+
* The `[package]` table of `effected.toml`.
|
|
1121
|
+
*
|
|
1122
|
+
* @public
|
|
1123
|
+
*/
|
|
1124
|
+
export declare class PackageConfig extends PackageConfig_base {}
|
|
1125
|
+
declare const EffectedConfig_base: Schema.Class<EffectedConfig, Schema.Struct<{
|
|
1126
|
+
/** The package tables. */
|
|
1127
|
+
readonly package: Schema.optionalKey<typeof PackageConfig>;
|
|
1128
|
+
/** The GitHub Action table. Absent for a library. */
|
|
1129
|
+
readonly action: Schema.optionalKey<typeof ActionConfig>;
|
|
1130
|
+
}>, {}>;
|
|
1131
|
+
/**
|
|
1132
|
+
* A decoded `effected.toml`.
|
|
1133
|
+
*
|
|
1134
|
+
* @remarks
|
|
1135
|
+
* Decode it with `onExcessProperty: "error"`: a struct's decode drops
|
|
1136
|
+
* unknown keys by default, and a typo in a human-written config must fail naming its path rather than
|
|
1137
|
+
* silently taking the default.
|
|
1138
|
+
*
|
|
1139
|
+
* @public
|
|
1140
|
+
*/
|
|
1141
|
+
export declare class EffectedConfig extends EffectedConfig_base {}
|
|
1142
|
+
declare const ConfigValidationError_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 & {
|
|
1143
|
+
readonly _tag: "ConfigValidationError";
|
|
1144
|
+
} & Readonly<A>;
|
|
1145
|
+
/**
|
|
1146
|
+
* A build config is structurally invalid; raised before any build work.
|
|
1147
|
+
*
|
|
1148
|
+
* @public
|
|
1149
|
+
*/
|
|
1150
|
+
export declare class ConfigValidationError extends ConfigValidationError_base<{
|
|
1151
|
+
readonly path: string;
|
|
1152
|
+
readonly reason: string;
|
|
1153
|
+
}> {
|
|
1154
|
+
get message(): string;
|
|
1155
|
+
}
|
|
1156
|
+
declare const MetaGenerationError_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 & {
|
|
1157
|
+
readonly _tag: "MetaGenerationError";
|
|
1158
|
+
} & Readonly<A>;
|
|
1159
|
+
/**
|
|
1160
|
+
* API Extractor meta generation failed for an entry.
|
|
1161
|
+
*
|
|
1162
|
+
* @public
|
|
1163
|
+
*/
|
|
1164
|
+
export declare class MetaGenerationError extends MetaGenerationError_base<{
|
|
1165
|
+
readonly entry: string;
|
|
1166
|
+
readonly reason: string;
|
|
1167
|
+
}> {
|
|
1168
|
+
get message(): string;
|
|
1169
|
+
}
|
|
1170
|
+
declare const BundleManifestEmitError_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 & {
|
|
1171
|
+
readonly _tag: "BundleManifestEmitError";
|
|
1172
|
+
} & Readonly<A>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Writing the `bundle.json` sidecar failed: the composed manifest did not encode, or the file could not be
|
|
1175
|
+
* written (a read-only or full disk). Recorded in `issues.json` as a `meta` error.
|
|
1176
|
+
*
|
|
1177
|
+
* @public
|
|
1178
|
+
*/
|
|
1179
|
+
export declare class BundleManifestEmitError extends BundleManifestEmitError_base<{
|
|
1180
|
+
readonly packageName: string;
|
|
1181
|
+
readonly path: string;
|
|
1182
|
+
readonly cause: unknown;
|
|
1183
|
+
}> {
|
|
1184
|
+
get message(): string;
|
|
1185
|
+
}
|
|
1186
|
+
/** @public */
|
|
1187
|
+
type PassKind = PassReport["id"];
|
|
1188
|
+
/** @public */
|
|
1189
|
+
interface DiagnosticInput {
|
|
1190
|
+
readonly source: DiagnosticEntry["source"];
|
|
1191
|
+
readonly level: DiagnosticEntry["level"];
|
|
1192
|
+
readonly text: string;
|
|
1193
|
+
readonly code?: string;
|
|
1194
|
+
readonly ciFatal?: boolean;
|
|
1195
|
+
readonly file?: string;
|
|
1196
|
+
readonly line?: number;
|
|
1197
|
+
readonly column?: number;
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Stateful build-event accumulator. The write surface is synchronous so it can be called directly
|
|
1201
|
+
* from tsdown's customLogger and API Extractor's messageCallback (both invoked synchronously).
|
|
1202
|
+
* `snapshot` builds the immutable BuildReport the Effect render pipeline consumes.
|
|
1203
|
+
* @public
|
|
1204
|
+
*/
|
|
1205
|
+
export declare class BuildCollector {
|
|
1206
|
+
private readonly groups;
|
|
1207
|
+
private group;
|
|
1208
|
+
private pass;
|
|
1209
|
+
registerGroup(groupId: string, entries: ReadonlyArray<string>): void;
|
|
1210
|
+
recordEmitted(groupId: string, pass: PassKind, file: EmittedFile): void;
|
|
1211
|
+
recordPassTiming(groupId: string, pass: PassKind, ms: number): void;
|
|
1212
|
+
recordWarning(groupId: string, entry: DiagnosticInput): void;
|
|
1213
|
+
recordError(groupId: string, entry: DiagnosticInput): void;
|
|
1214
|
+
recordSuppressed(groupId: string, entry: DiagnosticInput): void;
|
|
1215
|
+
snapshot(packageName: string): ReadonlyArray<BuildReport>;
|
|
1216
|
+
}
|
|
1217
|
+
declare const BuildCollectorTag_base: Context.ServiceClass<BuildCollectorTag, "@effected/bundler/BuildCollector", BuildCollector>;
|
|
1218
|
+
/** @public */
|
|
1219
|
+
export declare class BuildCollectorTag extends BuildCollectorTag_base {}
|
|
1220
|
+
/**
|
|
1221
|
+
* Default Node runtime embedded in the SEA (parity with the vitest-agent reference).
|
|
1222
|
+
*
|
|
1223
|
+
* @public
|
|
1224
|
+
*/
|
|
1225
|
+
export declare const DEFAULT_EXE_NODE_VERSION = "25.9.0";
|
|
1226
|
+
/**
|
|
1227
|
+
* A resolved per-platform SEA target. `platform` uses the tsdown/\@tsdown/exe token (win, not win32).
|
|
1228
|
+
*
|
|
1229
|
+
* @public
|
|
1230
|
+
*/
|
|
1231
|
+
interface ExeTarget {
|
|
1232
|
+
readonly platform: "darwin" | "linux" | "win";
|
|
1233
|
+
readonly arch: "arm64" | "x64";
|
|
1234
|
+
readonly nodeVersion: string;
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* A target before nodeVersion defaulting (platform/arch only).
|
|
1238
|
+
*
|
|
1239
|
+
* @public
|
|
1240
|
+
*/
|
|
1241
|
+
interface ExeTargetInput {
|
|
1242
|
+
readonly platform: "darwin" | "linux" | "win";
|
|
1243
|
+
readonly arch: "arm64" | "x64";
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* SEA seaConfig overrides (subset; the rest are defaulted).
|
|
1247
|
+
*
|
|
1248
|
+
* @public
|
|
1249
|
+
*/
|
|
1250
|
+
interface ExeSeaConfig$1 {
|
|
1251
|
+
readonly disableExperimentalSEAWarning?: boolean | undefined;
|
|
1252
|
+
readonly useCodeCache?: boolean | undefined;
|
|
1253
|
+
readonly useSnapshot?: boolean | undefined;
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* One SEA binary to compile.
|
|
1257
|
+
*
|
|
1258
|
+
* @public
|
|
1259
|
+
*/
|
|
1260
|
+
interface ExeConfig$1 {
|
|
1261
|
+
/** Output binary basename (no extension/suffix). */
|
|
1262
|
+
readonly fileName: string;
|
|
1263
|
+
/** Bin entry; defaults to ./src/bin.ts. */
|
|
1264
|
+
readonly entry?: string | undefined;
|
|
1265
|
+
/** Node runtime to embed; defaults to DEFAULT_EXE_NODE_VERSION. */
|
|
1266
|
+
readonly nodeVersion?: string | undefined;
|
|
1267
|
+
/** seaConfig overrides merged over the defaults. */
|
|
1268
|
+
readonly seaConfig?: ExeSeaConfig$1 | undefined;
|
|
1269
|
+
/** Explicit targets; default inferred from the package os/cpu. */
|
|
1270
|
+
readonly targets?: ReadonlyArray<ExeTargetInput> | undefined;
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Fully-resolved SEA binary spec (no optionals).
|
|
1274
|
+
*
|
|
1275
|
+
* @public
|
|
1276
|
+
*/
|
|
1277
|
+
interface NormalizedExe {
|
|
1278
|
+
readonly fileName: string;
|
|
1279
|
+
readonly entry: string;
|
|
1280
|
+
readonly targets: ReadonlyArray<ExeTarget>;
|
|
1281
|
+
readonly seaConfig: {
|
|
1282
|
+
readonly disableExperimentalSEAWarning: boolean;
|
|
1283
|
+
readonly useCodeCache: boolean;
|
|
1284
|
+
readonly useSnapshot: boolean;
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* The package's own os/cpu fields, used to infer a single platform target.
|
|
1289
|
+
*
|
|
1290
|
+
* @public
|
|
1291
|
+
*/
|
|
1292
|
+
interface PkgOsCpu {
|
|
1293
|
+
readonly os: ReadonlyArray<string>;
|
|
1294
|
+
readonly cpu: ReadonlyArray<string>;
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Normalize `exe` (object or array) into one fully-resolved spec per binary.
|
|
1298
|
+
*
|
|
1299
|
+
* Pure function; structural validation (missing fileName, empty targets) lives in the
|
|
1300
|
+
* config-validation layer.
|
|
1301
|
+
* @public
|
|
1302
|
+
*/
|
|
1303
|
+
export declare function normalizeExeOptions(exe: ExeConfig$1 | ReadonlyArray<ExeConfig$1>, pkg: PkgOsCpu): ReadonlyArray<NormalizedExe>;
|
|
1304
|
+
/**
|
|
1305
|
+
* A minimal structural type for tsdown's build, looser than `TsdownBuild` because this path passes an object literal.
|
|
1306
|
+
*
|
|
1307
|
+
* @public
|
|
1308
|
+
*/
|
|
1309
|
+
type ExeBuild = (config: unknown) => Promise<unknown>;
|
|
1310
|
+
/**
|
|
1311
|
+
* Options for compiling SEA binaries.
|
|
1312
|
+
*
|
|
1313
|
+
* @public
|
|
1314
|
+
*/
|
|
1315
|
+
interface RunExeBuildOptions {
|
|
1316
|
+
readonly cwd: string;
|
|
1317
|
+
/** Directory the binaries are emitted into (e.g. dist/prod/npm/pkg/bin). */
|
|
1318
|
+
readonly outDir: string;
|
|
1319
|
+
/** One fully-resolved spec per binary. */
|
|
1320
|
+
readonly specs: ReadonlyArray<NormalizedExe>;
|
|
1321
|
+
/** Injectable tsdown build (defaults to tsdown's build function). */
|
|
1322
|
+
readonly build?: ExeBuild | undefined;
|
|
1323
|
+
/** When set with groupId, muzzle tsdown and record an "exe" pass into this collector. */
|
|
1324
|
+
readonly collector?: BuildCollector | undefined;
|
|
1325
|
+
/** Target-group id the exe pass belongs to (required to record into the collector). */
|
|
1326
|
+
readonly groupId?: string | undefined;
|
|
1327
|
+
/** Compute gzip sizes (verbose render). */
|
|
1328
|
+
readonly verbose?: boolean | undefined;
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Compile each SEA binary via tsdown's exe mode. One tsdown build per spec.
|
|
1332
|
+
*
|
|
1333
|
+
* @public
|
|
1334
|
+
*/
|
|
1335
|
+
export declare function runExeBuild(options: RunExeBuildOptions): Promise<void>;
|
|
1336
|
+
/**
|
|
1337
|
+
* Resolved JSX transform settings. The shape mirrors the subset of rolldown's JsxOptions, but the
|
|
1338
|
+
* bundler consumes it to populate the generated dts tsconfig's `jsx`/`jsxImportSource`, not by
|
|
1339
|
+
* forwarding it into rolldown's input options.
|
|
1340
|
+
*
|
|
1341
|
+
* @public
|
|
1342
|
+
*/
|
|
1343
|
+
interface JsxConfig$1 {
|
|
1344
|
+
/** "automatic" auto-imports the JSX factories (react-jsx); "classic" does not (React.createElement). */
|
|
1345
|
+
readonly runtime?: "classic" | "automatic" | undefined;
|
|
1346
|
+
/** The JSX import source for the automatic runtime (e.g. "react", "preact"). */
|
|
1347
|
+
readonly importSource?: string | undefined;
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* The jsx-relevant slice of a tsconfig's compilerOptions.
|
|
1351
|
+
*
|
|
1352
|
+
* @public
|
|
1353
|
+
*/
|
|
1354
|
+
interface TsconfigJsx {
|
|
1355
|
+
readonly jsx?: string | undefined;
|
|
1356
|
+
readonly jsxImportSource?: string | undefined;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Resolve the effective JSX config: an explicit override wins; otherwise infer from the tsconfig
|
|
1360
|
+
* values via `@effected/tsconfig-json`'s `JsxConfig.fromCompilerOptions`. Returns undefined when
|
|
1361
|
+
* no JSX transform is needed (preserve/none).
|
|
1362
|
+
* @public
|
|
1363
|
+
*/
|
|
1364
|
+
export declare function resolveJsxConfig(tsconfig: TsconfigJsx, override: JsxConfig$1 | undefined): JsxConfig$1 | undefined;
|
|
1365
|
+
/**
|
|
1366
|
+
* Read the jsx-relevant compilerOptions from a package's own tsconfig.json (best-effort;
|
|
1367
|
+
* answers empty on absence or on a read or parse failure; a loader defect is not swallowed). Resolved through `@effected/tsconfig-json`'s
|
|
1368
|
+
* loader, so JSONC syntax and `extends` chains are honored.
|
|
1369
|
+
* @public
|
|
1370
|
+
*/
|
|
1371
|
+
export declare const readTsconfigJsx: (cwd: string) => Effect.Effect<TsconfigJsx, never, FileSystem.FileSystem | Path.Path>;
|
|
1372
|
+
/**
|
|
1373
|
+
* What an Open Graph image generator receives: the merged identity of the
|
|
1374
|
+
* package being built, after the config, leaf and project tiers resolved.
|
|
1375
|
+
*
|
|
1376
|
+
* @public
|
|
1377
|
+
*/
|
|
1378
|
+
interface OgImageInfo {
|
|
1379
|
+
/** Display name — the merged `name`, falling back to the npm name. */
|
|
1380
|
+
readonly name: string;
|
|
1381
|
+
/** The npm package name. */
|
|
1382
|
+
readonly packageName: string;
|
|
1383
|
+
/** The emitted version (the optimistic next version when enabled). */
|
|
1384
|
+
readonly version: string;
|
|
1385
|
+
readonly tagline?: string | undefined;
|
|
1386
|
+
readonly description?: string | undefined;
|
|
1387
|
+
/** The inherited project tier, when the workspace root declares one. */
|
|
1388
|
+
readonly project?: {
|
|
1389
|
+
readonly name?: string | undefined;
|
|
1390
|
+
readonly tagline?: string | undefined;
|
|
1391
|
+
} | undefined;
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* An `openGraph.generate` renderer. A renderer whose output is fully determined by its input can
|
|
1395
|
+
* carry its own `cacheSalt`, naming everything else that shapes the bytes (its version, its
|
|
1396
|
+
* options); that turns on the cross-build cache without any config. `ogImage.satori()` does.
|
|
1397
|
+
*
|
|
1398
|
+
* @public
|
|
1399
|
+
*/
|
|
1400
|
+
interface OgImageGenerator {
|
|
1401
|
+
(info: OgImageInfo): Promise<Uint8Array>;
|
|
1402
|
+
readonly cacheSalt?: string | undefined;
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* The `meta.bundle` block: the CONFIG tier of the emitted `bundle.json`,
|
|
1406
|
+
* ranked over the package's `bundle.json` (leaf) and the workspace root's
|
|
1407
|
+
* (project).
|
|
1408
|
+
*
|
|
1409
|
+
* @public
|
|
1410
|
+
*/
|
|
1411
|
+
interface BundleMetaOptions {
|
|
1412
|
+
readonly name?: string | undefined;
|
|
1413
|
+
readonly tagline?: string | undefined;
|
|
1414
|
+
readonly description?: string | undefined;
|
|
1415
|
+
readonly openGraph?: {
|
|
1416
|
+
/** Static images, path (bundle-relative) or url. Listed after a generated image. */
|
|
1417
|
+
readonly images?: ReadonlyArray<OpenGraphImage$1> | undefined;
|
|
1418
|
+
readonly themeColor?: string | undefined;
|
|
1419
|
+
/** Render an image at build time; the bytes are written to `meta/og/<unscoped>.<png|jpg|webp>` and listed first. */
|
|
1420
|
+
readonly generate?: OgImageGenerator | undefined;
|
|
1421
|
+
/**
|
|
1422
|
+
* The cross-build image cache, keyed on the {@link OgImageInfo} plus this salt. A string
|
|
1423
|
+
* caches under it: change it whenever the generator's output changes for the same input,
|
|
1424
|
+
* since the cache cannot see code. `false` always regenerates. Omitted, the generator's own
|
|
1425
|
+
* {@link OgImageGenerator.cacheSalt} is used when it has one, otherwise it always regenerates.
|
|
1426
|
+
*/
|
|
1427
|
+
readonly cacheSalt?: string | false | undefined;
|
|
1428
|
+
} | undefined;
|
|
1429
|
+
/** Registries; `false` disables the default derived from `targets.json`. */
|
|
1430
|
+
readonly registries?: ReadonlyArray<RegistryRef$1> | false | undefined;
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* A `targets.json` target as the manifest composer sees it: the human label and the registry endpoint.
|
|
1434
|
+
*
|
|
1435
|
+
* @public
|
|
1436
|
+
*/
|
|
1437
|
+
interface ManifestTarget {
|
|
1438
|
+
readonly name: string;
|
|
1439
|
+
readonly registry: string;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Everything {@link composeBundleManifest} needs: the three authoring tiers plus the build facts
|
|
1443
|
+
* that derive the rest.
|
|
1444
|
+
*
|
|
1445
|
+
* @public
|
|
1446
|
+
*/
|
|
1447
|
+
interface ComposeManifestInput {
|
|
1448
|
+
readonly config: BundleMetaOptions | undefined;
|
|
1449
|
+
readonly leaf: ManifestSource$1 | undefined;
|
|
1450
|
+
readonly project: ManifestSource$1 | undefined;
|
|
1451
|
+
readonly packageName: string;
|
|
1452
|
+
readonly isPrivate: boolean;
|
|
1453
|
+
/** `targets.json` targets for the group being emitted. */
|
|
1454
|
+
readonly targets: ReadonlyArray<ManifestTarget>;
|
|
1455
|
+
/** The image `og-image.ts` wrote, already sized. */
|
|
1456
|
+
readonly generatedImage: OpenGraphImage$1 | undefined;
|
|
1457
|
+
/** The emitted manifest's `repository` field; a GitHub Packages target derives its page URL from it. */
|
|
1458
|
+
readonly repository?: ManifestRepository | undefined;
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* The `repository` field of the emitted `package.json`, as far as the manifest composer reads it.
|
|
1462
|
+
*
|
|
1463
|
+
* @public
|
|
1464
|
+
*/
|
|
1465
|
+
interface ManifestRepository {
|
|
1466
|
+
readonly url: string;
|
|
1467
|
+
readonly directory?: string | undefined;
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* `owner/repo` from any of the GitHub URL spellings a `repository.url` carries (https, `git+https`,
|
|
1471
|
+
* `git@`, `ssh://`, `git://`, the `github:` shorthand), or `undefined` for anything else.
|
|
1472
|
+
*
|
|
1473
|
+
* @public
|
|
1474
|
+
*/
|
|
1475
|
+
export declare function githubOwnerRepo(url: string): {
|
|
1476
|
+
readonly owner: string;
|
|
1477
|
+
readonly repo: string;
|
|
1478
|
+
} | undefined;
|
|
1479
|
+
/**
|
|
1480
|
+
* Derive the registries block from the build's targets. Only for a public
|
|
1481
|
+
* package: a private one is published nowhere.
|
|
1482
|
+
*
|
|
1483
|
+
* @public
|
|
1484
|
+
*/
|
|
1485
|
+
export declare function registriesFromTargets(input: Pick<ComposeManifestInput, "targets" | "packageName" | "isPrivate" | "repository">): ReadonlyArray<RegistryRef$1>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Flatten the three authoring tiers into the emitted manifest. Pure.
|
|
1488
|
+
*
|
|
1489
|
+
* @remarks
|
|
1490
|
+
* Config beats leaf beats project per FIELD; the project tier is emitted
|
|
1491
|
+
* nested, never flattened, because the consumer's provenance ranking depends
|
|
1492
|
+
* on telling the tiers apart. Returns `undefined` when there is nothing to
|
|
1493
|
+
* say, so a package with no metadata emits no file. An `sbom` pointer is
|
|
1494
|
+
* never written here — the release action upserts it at publish.
|
|
1495
|
+
*
|
|
1496
|
+
* @public
|
|
1497
|
+
*/
|
|
1498
|
+
export declare function composeBundleManifest(input: ComposeManifestInput): BundleManifest$1 | undefined;
|
|
1499
|
+
/**
|
|
1500
|
+
* What the generator sees. Built from the same tiers as the manifest.
|
|
1501
|
+
*
|
|
1502
|
+
* @public
|
|
1503
|
+
*/
|
|
1504
|
+
export declare function ogImageInfoOf(input: ComposeManifestInput & {
|
|
1505
|
+
readonly version: string;
|
|
1506
|
+
}): OgImageInfo;
|
|
1507
|
+
/**
|
|
1508
|
+
* A single TSDoc tag definition (parity with api-extractor's TSDoc config).
|
|
1509
|
+
*
|
|
1510
|
+
* @public
|
|
1511
|
+
*/
|
|
1512
|
+
interface TsdocTagDefinition {
|
|
1513
|
+
readonly tagName: string;
|
|
1514
|
+
readonly syntaxKind: "block" | "inline" | "modifier";
|
|
1515
|
+
readonly allowMultiple?: boolean | undefined;
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* An api-extractor message-suppression rule. messageId is exact-matched; pattern (regex or substring) is matched against the text. A rule with both needs both to match.
|
|
1519
|
+
*
|
|
1520
|
+
* @public
|
|
1521
|
+
*/
|
|
1522
|
+
interface WarningSuppressionRule {
|
|
1523
|
+
readonly messageId?: string | undefined;
|
|
1524
|
+
readonly pattern?: string | undefined;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* TSDoc / doc-warning configuration. suppressWarnings is doc functionality, so it lives here.
|
|
1528
|
+
*
|
|
1529
|
+
* @public
|
|
1530
|
+
*/
|
|
1531
|
+
interface TsdocOptions {
|
|
1532
|
+
readonly suppressWarnings?: ReadonlyArray<WarningSuppressionRule> | undefined;
|
|
1533
|
+
readonly tagDefinitions?: ReadonlyArray<TsdocTagDefinition> | undefined;
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* The `meta` field on defineBuild. Absent means no api-model generation.
|
|
1537
|
+
*
|
|
1538
|
+
* @public
|
|
1539
|
+
*/
|
|
1540
|
+
interface MetaOptions {
|
|
1541
|
+
/** Directories to copy the canonical group's api-model into after `savvy build --target prod`. */
|
|
1542
|
+
readonly localPaths?: ReadonlyArray<string> | undefined;
|
|
1543
|
+
/**
|
|
1544
|
+
* Forward-look the meta bundle's own `version` and workspace-sibling dep versions to their
|
|
1545
|
+
* NEXT release version from pending changesets. `"auto"` (default) is `false` under CI
|
|
1546
|
+
* (`CI`/`GITHUB_ACTIONS` set) and `true` locally, so a local bundle matches the CI release build.
|
|
1547
|
+
*/
|
|
1548
|
+
readonly optimistic?: "auto" | boolean | undefined;
|
|
1549
|
+
readonly tsdoc?: TsdocOptions | undefined;
|
|
1550
|
+
/**
|
|
1551
|
+
* The CONFIG tier of the emitted `bundle.json` sidecar (ranked over the package's and the
|
|
1552
|
+
* workspace root's `bundle.json` source files) and the optional build-time Open Graph image.
|
|
1553
|
+
* The project tier is found through workspace discovery, which requires the workspace root's
|
|
1554
|
+
* `package.json` to declare a `version`; without one, discovery fails silently and no `project`
|
|
1555
|
+
* tier is emitted.
|
|
1556
|
+
*/
|
|
1557
|
+
readonly bundle?: BundleMetaOptions | undefined;
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Fully-resolved meta options (no optionals).
|
|
1561
|
+
*
|
|
1562
|
+
* @public
|
|
1563
|
+
*/
|
|
1564
|
+
interface NormalizedMeta {
|
|
1565
|
+
readonly localPaths: ReadonlyArray<string>;
|
|
1566
|
+
readonly optimistic: boolean;
|
|
1567
|
+
readonly tsdoc: {
|
|
1568
|
+
readonly suppressWarnings: ReadonlyArray<WarningSuppressionRule>;
|
|
1569
|
+
readonly tagDefinitions: ReadonlyArray<TsdocTagDefinition>;
|
|
1570
|
+
};
|
|
1571
|
+
/** Passed through verbatim; `undefined` means no config tier (the source tiers still apply). */
|
|
1572
|
+
readonly bundle: BundleMetaOptions | undefined;
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Fill defaults so downstream code never branches on undefined.
|
|
1576
|
+
*
|
|
1577
|
+
* @public
|
|
1578
|
+
*/
|
|
1579
|
+
export declare function normalizeMetaOptions(meta: MetaOptions, env?: {
|
|
1580
|
+
CI?: string | undefined;
|
|
1581
|
+
GITHUB_ACTIONS?: string | undefined;
|
|
1582
|
+
}): NormalizedMeta;
|
|
1583
|
+
/** @public */
|
|
1584
|
+
interface GenerateMetaOptions {
|
|
1585
|
+
readonly cwd: string;
|
|
1586
|
+
readonly packageName: string;
|
|
1587
|
+
/** Resolved tsconfig (from writeResolvedTsconfig) for the api-extractor compiler. */
|
|
1588
|
+
readonly tsconfigPath: string;
|
|
1589
|
+
/** Directory holding the tsdown-emitted per-file .d.ts (e.g. dist/prod/npm/pkg). */
|
|
1590
|
+
readonly dtsDir: string;
|
|
1591
|
+
/**
|
|
1592
|
+
* Per-module declarations dir used ONLY for a second, diagnostics-only API Extractor run that
|
|
1593
|
+
* resolves accurate per-file source locations. The shipped api-model is still produced from
|
|
1594
|
+
* `dtsDir` (the bundled dts), so it is unchanged. When omitted or equal to `dtsDir`, a single
|
|
1595
|
+
* run over `dtsDir` produces both model and diagnostics (legacy behavior).
|
|
1596
|
+
*/
|
|
1597
|
+
readonly aeInputDir?: string | undefined;
|
|
1598
|
+
/** Map of entry name to the .d.ts basename (without extension) inside dtsDir. */
|
|
1599
|
+
readonly entries: Record<string, string>;
|
|
1600
|
+
/** Map of entry name to its export path (".", "./sub"). */
|
|
1601
|
+
readonly exportPaths: Record<string, string>;
|
|
1602
|
+
/** Where to write the meta bundle (.api.json + package.json + tsconfig.json). */
|
|
1603
|
+
readonly outMetaDir: string;
|
|
1604
|
+
/** Directories (relative to cwd) to copy the meta bundle into. */
|
|
1605
|
+
readonly localPaths: ReadonlyArray<string>;
|
|
1606
|
+
readonly tsdoc: NormalizedMeta["tsdoc"];
|
|
1607
|
+
/**
|
|
1608
|
+
* Optional transform applied to the bundle `package.json` (read from `dtsDir`) before it is
|
|
1609
|
+
* written to `outMetaDir` and copied into `localPaths`. Used for the optimistic next-version
|
|
1610
|
+
* rewrite. When omitted, the package.json is copied verbatim.
|
|
1611
|
+
*/
|
|
1612
|
+
readonly manifestTransform?: ((pkg: Record<string, unknown>) => Record<string, unknown>) | undefined;
|
|
1613
|
+
/** When set, API Extractor warnings/errors are routed here (and suppressed from console). */
|
|
1614
|
+
readonly onMessage?: ((entry: DiagnosticInput) => void) | undefined;
|
|
1615
|
+
/** When true (CI), forgotten exports become a hard build error. */
|
|
1616
|
+
readonly ci?: boolean | undefined;
|
|
1617
|
+
/** When set, messages matched by `suppressWarnings` are routed here for accounting. */
|
|
1618
|
+
readonly onSuppressed?: ((entry: DiagnosticInput) => void) | undefined;
|
|
1619
|
+
/**
|
|
1620
|
+
* The `bundle.json` sidecar inputs: the config tier, the two source tiers, and the targets bound
|
|
1621
|
+
* to this group (registries derive from them). Omitted means no sidecar and no Open Graph image.
|
|
1622
|
+
*/
|
|
1623
|
+
readonly bundle?: {
|
|
1624
|
+
readonly config: BundleMetaOptions | undefined;
|
|
1625
|
+
readonly leaf: ManifestSource$1 | undefined;
|
|
1626
|
+
readonly project: ManifestSource$1 | undefined;
|
|
1627
|
+
readonly targets: ReadonlyArray<ManifestTarget>;
|
|
1628
|
+
} | undefined;
|
|
1629
|
+
}
|
|
1630
|
+
/** @public */
|
|
1631
|
+
interface MetaResult {
|
|
1632
|
+
readonly apiJsonPath: string;
|
|
1633
|
+
readonly apiJsonFilename: string;
|
|
1634
|
+
}
|
|
1635
|
+
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 & {
|
|
1636
|
+
readonly _tag: "BundleManifestSourceError";
|
|
1637
|
+
} & Readonly<A>;
|
|
1638
|
+
/**
|
|
1639
|
+
* A present `bundle.json` source file that could not be parsed or decoded. Absence is never
|
|
1640
|
+
* this error — a missing source tier is the normal case.
|
|
1641
|
+
*
|
|
1642
|
+
* @public
|
|
1643
|
+
*/
|
|
1644
|
+
export declare class BundleManifestSourceError extends BundleManifestSourceError_base<{
|
|
1645
|
+
readonly path: string;
|
|
1646
|
+
readonly cause: unknown;
|
|
1647
|
+
}> {
|
|
1648
|
+
get message(): string;
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* The two source tiers a build reads: the package's own file and the workspace root's.
|
|
1652
|
+
*
|
|
1653
|
+
* @public
|
|
1654
|
+
*/
|
|
1655
|
+
interface BundleManifestSources {
|
|
1656
|
+
readonly leaf: ManifestSource$1 | undefined;
|
|
1657
|
+
readonly project: ManifestSource$1 | undefined;
|
|
1658
|
+
/**
|
|
1659
|
+
* Why workspace discovery failed, when it did. The project tier is then unknown rather than
|
|
1660
|
+
* absent; `runMetaPass` records it as a `meta` warning so the degradation is visible in `issues.json`.
|
|
1661
|
+
*/
|
|
1662
|
+
readonly discoveryFailure?: string | undefined;
|
|
1663
|
+
/**
|
|
1664
|
+
* Source files under the retired name `tsdoctor.json`, at a tier with no `bundle.json`. They are never
|
|
1665
|
+
* read; `runMetaPass` records each as a `meta` warning so a missed rename is visible instead of the tier
|
|
1666
|
+
* silently disappearing. Absent when there are none.
|
|
1667
|
+
*/
|
|
1668
|
+
readonly retiredSources?: ReadonlyArray<string> | undefined;
|
|
1669
|
+
}
|
|
1670
|
+
/**
|
|
1671
|
+
* Read the leaf (`<cwd>/bundle.json`) and project (`<workspaceRoot>/bundle.json`)
|
|
1672
|
+
* source tiers. Absence is normal; a present file that does not decode throws
|
|
1673
|
+
* {@link BundleManifestSourceError}. A package that IS the workspace root reads its file once, as the
|
|
1674
|
+
* leaf, and has no project tier.
|
|
1675
|
+
*
|
|
1676
|
+
* @public
|
|
1677
|
+
*/
|
|
1678
|
+
export declare function loadBundleManifestSources(cwd: string): Promise<BundleManifestSources>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Options for the meta-pass orchestrator.
|
|
1681
|
+
*
|
|
1682
|
+
* @public
|
|
1683
|
+
*/
|
|
1684
|
+
interface RunMetaPassOptions {
|
|
1685
|
+
readonly cwd: string;
|
|
1686
|
+
readonly packageName: string;
|
|
1687
|
+
readonly tsconfigPath: string;
|
|
1688
|
+
readonly groups: ReadonlyArray<{
|
|
1689
|
+
id: string;
|
|
1690
|
+
name: string;
|
|
1691
|
+
}>;
|
|
1692
|
+
readonly entries: Record<string, string>;
|
|
1693
|
+
readonly exportsMap: Record<string, string> | undefined;
|
|
1694
|
+
readonly overrides?: ReadonlyArray<{
|
|
1695
|
+
entries: ReadonlyArray<string>;
|
|
1696
|
+
outSubdir?: string | undefined;
|
|
1697
|
+
}> | undefined;
|
|
1698
|
+
readonly meta: MetaOptions;
|
|
1699
|
+
readonly collector: BuildCollector;
|
|
1700
|
+
readonly ci: boolean;
|
|
1701
|
+
/** Injectable for tests; defaults to the real generateMeta. */
|
|
1702
|
+
readonly generateMeta?: (o: GenerateMetaOptions) => Promise<MetaResult>;
|
|
1703
|
+
/** Injectable for tests; defaults to the real resolveNextVersions. Only called when optimistic. */
|
|
1704
|
+
readonly resolveNextVersions?: (cwd: string) => Promise<{
|
|
1705
|
+
versions: ReadonlyMap<string, string>;
|
|
1706
|
+
}>;
|
|
1707
|
+
/**
|
|
1708
|
+
* The resolved `targets.json` targets; each group's `bundle.json` derives its registries from the
|
|
1709
|
+
* targets bound to that group. Omitted (an escape-hatch build with no resolution) means none.
|
|
1710
|
+
*/
|
|
1711
|
+
readonly targets?: ReadonlyArray<{
|
|
1712
|
+
group: string;
|
|
1713
|
+
id: string;
|
|
1714
|
+
registry: string;
|
|
1715
|
+
}> | undefined;
|
|
1716
|
+
/** Injectable for tests; defaults to the real loadBundleManifestSources. */
|
|
1717
|
+
readonly loadBundleManifestSources?: (cwd: string) => Promise<BundleManifestSources>;
|
|
1718
|
+
}
|
|
1719
|
+
/** @public */
|
|
1720
|
+
type Json = Record<string, unknown>;
|
|
1721
|
+
/**
|
|
1722
|
+
* Which exports get a CJS `require` condition. `true`/`false` apply uniformly to every
|
|
1723
|
+
* TS export; a Set marks ONLY the listed export keys (e.g. "./changesets/markdownlint")
|
|
1724
|
+
* as dual — used by per-entry format overrides.
|
|
1725
|
+
* @public
|
|
1726
|
+
*/
|
|
1727
|
+
type DualExports = boolean | ReadonlySet<string>;
|
|
1728
|
+
/**
|
|
1729
|
+
* The default `transform` applied to every package's manifest when its
|
|
1730
|
+
* build config does not provide one of its own. Strips the build/dev-only
|
|
1731
|
+
* fields in `NON_PUBLISHED_FIELDS` from the emitted package.json.
|
|
1732
|
+
*
|
|
1733
|
+
* This is the pattern nearly every package repeated by hand (inherited from
|
|
1734
|
+
* rslib-builder); `defineBuild` now applies it automatically so a package needs a
|
|
1735
|
+
* `transform` only when it has genuinely custom manifest work to do (e.g. silk
|
|
1736
|
+
* promoting workspace deps to peerDependencies). A custom transform REPLACES this
|
|
1737
|
+
* default — re-export it and call it from a custom transform to keep the stripping.
|
|
1738
|
+
*
|
|
1739
|
+
* `targetGroup` is accepted (so this is assignable wherever the full transform
|
|
1740
|
+
* signature is expected) but unused; the strip is identical for every group.
|
|
1741
|
+
*
|
|
1742
|
+
* `options.drop` names further top-level keys (for example `dependencies`) to delete after the
|
|
1743
|
+
* standard stripping.
|
|
1744
|
+
*
|
|
1745
|
+
* Pure: the supplied `pkg` is NOT mutated — a shallow copy with the fields removed
|
|
1746
|
+
* is returned, so external callers invoking this from a custom transform keep their
|
|
1747
|
+
* input intact.
|
|
1748
|
+
* @public
|
|
1749
|
+
*/
|
|
1750
|
+
export declare function defaultManifestTransform({ pkg }: {
|
|
1751
|
+
pkg: Json;
|
|
1752
|
+
}, options?: {
|
|
1753
|
+
readonly drop?: ReadonlyArray<string> | undefined;
|
|
1754
|
+
}): Json;
|
|
1755
|
+
/**
|
|
1756
|
+
* Describes a SEA binary the bundler compiled for this package. When present,
|
|
1757
|
+
* {@link transformManifest} rewrites every `exports`/`bin` value equal to `source`
|
|
1758
|
+
* to the emitted binary path and adds it to `files` so it ships in the tarball.
|
|
1759
|
+
* @public
|
|
1760
|
+
*/
|
|
1761
|
+
interface ExeRewrite {
|
|
1762
|
+
/** The exe entry source path (matches exports/bin values to rewrite). */
|
|
1763
|
+
readonly source: string;
|
|
1764
|
+
/** The emitted SEA filename (already suffixed, incl. .exe on win). */
|
|
1765
|
+
readonly fileName: string;
|
|
1766
|
+
/** Relative dir the binary is emitted into (e.g. "bin"). */
|
|
1767
|
+
readonly dir: string;
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Rewrite an exports map: TS string targets become a types/import conditions object.
|
|
1771
|
+
* Each TS condition also gets a `require` entry when `dual` is `true` (uniform) or when
|
|
1772
|
+
* the export key is in the `dual` Set (per-entry).
|
|
1773
|
+
*
|
|
1774
|
+
* The output path is derived from the export KEY via the shared entry-name function,
|
|
1775
|
+
* never from the source path, so the manifest target always matches the emitted file.
|
|
1776
|
+
*
|
|
1777
|
+
* Export keys in `subdirExports` are built into an isolated `<key>/index.*` subdir (e.g. an
|
|
1778
|
+
* RSPress `./runtime`), so their conditions gain an `/index` segment.
|
|
1779
|
+
*
|
|
1780
|
+
* `emitDts` gates the `types` condition on every GENERATED (non-ambient) TS export: pass `false`
|
|
1781
|
+
* when the build's dts pass was skipped (issue #198) so the manifest does not point at a `.d.ts`
|
|
1782
|
+
* that was never written. Defaults to `true`. Ambient `.d.ts` exports (hand-authored, copied
|
|
1783
|
+
* verbatim regardless of the dts pass) are unaffected — their `types` condition is always kept.
|
|
1784
|
+
*
|
|
1785
|
+
* A condition-object value whose flat `import`/`default`/`types` conditions all name one TS source
|
|
1786
|
+
* (`"./foo": { "import": "./src/foo.ts" }`) is rewritten like the bare string, named after the export
|
|
1787
|
+
* key as the entry pass names it. Any other condition object holding a TS source throws
|
|
1788
|
+
* {@link ConfigValidationError}, since its targets would never be built; one holding none passes
|
|
1789
|
+
* through as authored.
|
|
1790
|
+
*
|
|
1791
|
+
* A subpath target written as the built path, `./dist/foo.js`, is a build source too: the entry pass
|
|
1792
|
+
* builds it from `./src/foo.ts` and names the output after the export key, so it is rewritten exactly
|
|
1793
|
+
* as `./src/foo.ts` would be. A build source holding a `*` (`./dist/*.js`, `./src/*.ts`) throws
|
|
1794
|
+
* {@link ConfigValidationError}, since the build emits one entry per key from one literal source.
|
|
1795
|
+
* @public
|
|
1796
|
+
*/
|
|
1797
|
+
export declare function transformExports(exports: unknown, dual?: DualExports, subdirExports?: ReadonlySet<string>, emitDts?: boolean): unknown;
|
|
1798
|
+
/**
|
|
1799
|
+
* Rewrite bin: TS targets, and `./dist/*.js` targets the entry pass builds from `./src/*.ts`, to
|
|
1800
|
+
* bin/[command].js (string to bin/cli.js); strip leading ./ otherwise.
|
|
1801
|
+
*
|
|
1802
|
+
* @public
|
|
1803
|
+
*/
|
|
1804
|
+
export declare function transformBin(bin: unknown): unknown;
|
|
1805
|
+
/**
|
|
1806
|
+
* FINAL guard: strip leading ./ from bin paths (npm 11.x drops ./-prefixed bins).
|
|
1807
|
+
*
|
|
1808
|
+
* @public
|
|
1809
|
+
*/
|
|
1810
|
+
export declare function normalizeBinPaths(bin: unknown): unknown;
|
|
1811
|
+
/** @public */
|
|
1812
|
+
interface TransformManifestOptions {
|
|
1813
|
+
/** Run after the standard transforms, before the bin final-guard + sort. */
|
|
1814
|
+
readonly transform?: ((pkg: Json) => Json) | undefined;
|
|
1815
|
+
/** Which exports emit dual import/require conditions. boolean = uniform; Set = per-export-key. */
|
|
1816
|
+
readonly dual?: DualExports | undefined;
|
|
1817
|
+
/** Export keys built into a `<key>/index.*` subdir (e.g. an RSPress `./runtime`). */
|
|
1818
|
+
readonly subdirExports?: ReadonlySet<string> | undefined;
|
|
1819
|
+
/** When set, rewrite exports/bin values equal to `source` to the SEA path and add it to `files`. */
|
|
1820
|
+
readonly exeRewrite?: ExeRewrite | undefined;
|
|
1821
|
+
/**
|
|
1822
|
+
* Whether the build's dts pass ran. `false` omits the `types` condition from generated (non-
|
|
1823
|
+
* ambient) TS exports — the manifest must not point at a `.d.ts` that was never written
|
|
1824
|
+
* (issue #198). Defaults to `true`.
|
|
1825
|
+
*/
|
|
1826
|
+
readonly emitDts?: boolean | undefined;
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Apply the full standard manifest transform (excluding catalog resolution, done upstream).
|
|
1830
|
+
*
|
|
1831
|
+
* @public
|
|
1832
|
+
*/
|
|
1833
|
+
export declare function transformManifest(pkg: Json, options?: TransformManifestOptions): Json;
|
|
1834
|
+
/**
|
|
1835
|
+
* A build group id: "dev" or any prod byte-variant id (e.g. "npm", "github", a custom key).
|
|
1836
|
+
*
|
|
1837
|
+
* @public
|
|
1838
|
+
*/
|
|
1839
|
+
type TargetGroupId = string;
|
|
1840
|
+
/**
|
|
1841
|
+
* An output module format the build can emit.
|
|
1842
|
+
*
|
|
1843
|
+
* @public
|
|
1844
|
+
*/
|
|
1845
|
+
type BuildFormat$1 = "esm" | "cjs";
|
|
1846
|
+
/**
|
|
1847
|
+
* Bundling platform for the JS pass. Defaults to "node". Use "browser" for web runtime partitions.
|
|
1848
|
+
*
|
|
1849
|
+
* @public
|
|
1850
|
+
*/
|
|
1851
|
+
type BuildPlatform$1 = "node" | "browser" | "neutral";
|
|
1852
|
+
/**
|
|
1853
|
+
* A prod/dev group to build: its folder id and the resolved package name its manifest carries.
|
|
1854
|
+
*
|
|
1855
|
+
* @public
|
|
1856
|
+
*/
|
|
1857
|
+
interface BuildGroupSpec {
|
|
1858
|
+
readonly id: TargetGroupId;
|
|
1859
|
+
readonly name: string;
|
|
1860
|
+
}
|
|
1861
|
+
/** @public */
|
|
1862
|
+
interface DeriveOptions {
|
|
1863
|
+
readonly group: TargetGroupId;
|
|
1864
|
+
readonly cwd: string;
|
|
1865
|
+
readonly version: string;
|
|
1866
|
+
readonly entry: Record<string, string>;
|
|
1867
|
+
readonly tsconfigPath: string;
|
|
1868
|
+
readonly devManifest: "preserve" | "resolve";
|
|
1869
|
+
readonly externals?: ReadonlyArray<string>;
|
|
1870
|
+
/** JS-pass platform. Defaults to "node"; set "browser" for an RSPress runtime partition. */
|
|
1871
|
+
readonly platform?: BuildPlatform$1 | undefined;
|
|
1872
|
+
/** Output formats to emit. Defaults to esm-only when unset. */
|
|
1873
|
+
readonly format?: ReadonlyArray<BuildFormat$1> | undefined;
|
|
1874
|
+
/** Minify prod output (prod groups only; dev is never minified). Defaults to false. */
|
|
1875
|
+
readonly minify?: boolean | undefined;
|
|
1876
|
+
/**
|
|
1877
|
+
* Compile-time global replacements forwarded to the build `define`. Merged AFTER the
|
|
1878
|
+
* auto-injected `process.env.__PACKAGE_VERSION__` so a user key of the same name wins.
|
|
1879
|
+
* Values are inserted verbatim (string literals must already be quoted).
|
|
1880
|
+
*/
|
|
1881
|
+
readonly define?: Record<string, string> | undefined;
|
|
1882
|
+
/**
|
|
1883
|
+
* External packages whose declarations should be INLINED into the bundled dts
|
|
1884
|
+
* (the rslib `dtsBundledPackages` equivalent). Maps to tsdown's `deps.onlyBundle`
|
|
1885
|
+
* in the dts pass, so ONLY these node_modules packages are rolled into the
|
|
1886
|
+
* `.d.ts` and every other dependency stays an external `import`. dts-pass-only:
|
|
1887
|
+
* runtime JS bundling is unaffected.
|
|
1888
|
+
*/
|
|
1889
|
+
readonly bundledPackages?: ReadonlyArray<string> | undefined;
|
|
1890
|
+
/**
|
|
1891
|
+
* Force-bundle node_modules (and workspace) JS dependencies into the JS pass.
|
|
1892
|
+
* Consumed here ONLY to decide the JS pass's `unbundle` posture — see
|
|
1893
|
+
* {@link DerivedTsdownOptions.unbundle} — which is the whole of its effect: tsdown
|
|
1894
|
+
* already bundles anything the manifest does not declare as a production dependency,
|
|
1895
|
+
* so no `deps` flag is needed to force it.
|
|
1896
|
+
*/
|
|
1897
|
+
readonly bundleNodeModules?: boolean | undefined;
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* The JS pass: per-module JavaScript, no declarations.
|
|
1901
|
+
*
|
|
1902
|
+
* The build runs TWO tsdown passes per TargetGroup to the SAME outDir:
|
|
1903
|
+
* - pass 1 (this) emits per-module JS (`unbundle: true`) with `dts: false` and the
|
|
1904
|
+
* default `clean: true`, so it starts from a fresh outDir;
|
|
1905
|
+
* - pass 2 (`DerivedDtsPassOptions`) emits ONLY bundled declarations (`unbundle: false`,
|
|
1906
|
+
* `dts: { emitDtsOnly: true }`) with `clean: false`, so it must NOT wipe pass 1.
|
|
1907
|
+
*
|
|
1908
|
+
* We cannot do this in a single pass: tsdown's `unbundle` maps to rolldown
|
|
1909
|
+
* `output.preserveModules` for the WHOLE build, and the dts plugin shares it — so one pass
|
|
1910
|
+
* gives EITHER per-module JS + per-module dts OR bundled JS + bundled dts. Per-module dts
|
|
1911
|
+
* breaks type portability (TS2883) when a package exports only its root entry, and bundling
|
|
1912
|
+
* the JS re-bundles workspace consumers (e.g. silk re-bundling silk-effects crashes at
|
|
1913
|
+
* runtime). The split keeps per-module JS (no re-bundle hazard) AND bundled, self-contained
|
|
1914
|
+
* declarations (no TS2883).
|
|
1915
|
+
*
|
|
1916
|
+
* **`unbundle` flips to `false` when `bundleNodeModules` is set.** `bundleNodeModules: true`
|
|
1917
|
+
* exists to produce a genuinely self-contained artifact (its own TSDoc already promises this),
|
|
1918
|
+
* but `preserveModules` (the per-module JS pass) writes every inlined node_modules dependency
|
|
1919
|
+
* out to its OWN sibling file, mirroring its `node_modules/.pnpm/...` (or workspace) path
|
|
1920
|
+
* relative to the package root — for BOTH esm and cjs. `npm pack` unconditionally strips any
|
|
1921
|
+
* directory literally named `node_modules` from the published tarball, so an esm entry built
|
|
1922
|
+
* this way throws `Cannot find module '.../node_modules/.pnpm/.../foo.js'` once packed and
|
|
1923
|
+
* installed (the cjs sibling accidentally escapes this: tsdown's own dts pass, which always
|
|
1924
|
+
* runs `unbundle: false`, re-emits and overwrites a dual-format build's `.cjs` JS chunk as a
|
|
1925
|
+
* side effect of emitting `.d.cts` — see the dts-pass rebuild note in `buildTargetGroups` — so
|
|
1926
|
+
* only the esm artifact keeps the broken preserveModules layout). Turning `unbundle` off for
|
|
1927
|
+
* the JS pass whenever `bundleNodeModules` is requested makes BOTH formats bundle into one
|
|
1928
|
+
* self-contained file, matching what the flag already promises and what the cjs side already
|
|
1929
|
+
* does by accident. Scoped to `bundleNodeModules` alone: every other build keeps the default
|
|
1930
|
+
* per-module dev-friendly layout unchanged.
|
|
1931
|
+
* @public
|
|
1932
|
+
*/
|
|
1933
|
+
interface DerivedTsdownOptions {
|
|
1934
|
+
readonly outDir: string;
|
|
1935
|
+
readonly sourcemap: boolean;
|
|
1936
|
+
readonly minify: boolean;
|
|
1937
|
+
readonly format: ReadonlyArray<BuildFormat$1>;
|
|
1938
|
+
/** `false` only when `bundleNodeModules` is set — see the interface TSDoc above. */
|
|
1939
|
+
readonly unbundle: boolean;
|
|
1940
|
+
/** JS pass starts fresh; it owns the outDir before the dts pass appends to it. */
|
|
1941
|
+
readonly clean: true;
|
|
1942
|
+
readonly platform: BuildPlatform$1;
|
|
1943
|
+
/**
|
|
1944
|
+
* Controls output file extensions. Always false for this builder.
|
|
1945
|
+
*
|
|
1946
|
+
* tsdown 0.22.2 finding (verified by running a real esm+cjs build of a type:module package):
|
|
1947
|
+
* - With fixedExtension: false, tsdown emits ESM index.js plus CJS index.cjs for a
|
|
1948
|
+
* type:module package in the JS pass. There is no collision: tsdown derives the .js
|
|
1949
|
+
* extension for ESM and the .cjs extension for CJS automatically. An earlier M1.1 note
|
|
1950
|
+
* claimed the two formats collide on ambient .js under fixedExtension: false; that claim
|
|
1951
|
+
* was wrong and is corrected here.
|
|
1952
|
+
* - This .js plus .cjs scheme is the one we want. It matches the rslib parity target, where
|
|
1953
|
+
* silk's dual-format output uses import: .js, require: .cjs, and a single types: .d.ts, and
|
|
1954
|
+
* it matches the flat manifest the emit-manifest transform writes.
|
|
1955
|
+
* - Setting fixedExtension: true would instead yield .mjs plus .cjs (and .d.mts plus .d.cts),
|
|
1956
|
+
* which is NOT wanted, so dual-format needs no fixedExtension change and we leave it false.
|
|
1957
|
+
* - The matching `.d.ts` / `.d.cts` declarations are emitted by the SEPARATE dts pass (see
|
|
1958
|
+
* `DerivedDtsPassOptions`), which keeps `unbundle: false` so the declarations are rolled up.
|
|
1959
|
+
*/
|
|
1960
|
+
readonly fixedExtension: false;
|
|
1961
|
+
readonly entry: Record<string, string>;
|
|
1962
|
+
/** JS pass emits no declarations; the dts pass owns them. */
|
|
1963
|
+
readonly dts: false;
|
|
1964
|
+
readonly define: Record<string, string>;
|
|
1965
|
+
readonly isProd: boolean;
|
|
1966
|
+
/**
|
|
1967
|
+
* CJS named-export interop, the equivalent of rslib's cjsInterop: true. This is the real
|
|
1968
|
+
* tsdown option name, so it threads straight to the build with no rename.
|
|
1969
|
+
*
|
|
1970
|
+
* tsdown 0.22.2 finding (verified against the dist Options dts plus the build source):
|
|
1971
|
+
* - cjsDefault is a top-level boolean, default true. The build maps it to rolldown's
|
|
1972
|
+
* output.exports: cjsDefault ? "auto" : "named", and also silences the MIXED_EXPORT
|
|
1973
|
+
* warning. With "auto", a module whose only default-style export is a single default
|
|
1974
|
+
* becomes module.exports = value, while named exports stay attached, so a require() call
|
|
1975
|
+
* returns the value directly and named exports survive, the interop rslib gives with
|
|
1976
|
+
* cjsInterop: true.
|
|
1977
|
+
* - We only set it (to true) when cjs is in the format, so esm-only builds leave the tsdown
|
|
1978
|
+
* default untouched and stay byte-identical to before.
|
|
1979
|
+
*/
|
|
1980
|
+
readonly cjsDefault?: boolean | undefined;
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* The dts pass: bundled (rolled-up, self-contained) declarations only, no JS.
|
|
1984
|
+
*
|
|
1985
|
+
* Appended to the SAME outDir as the JS pass, so `clean` MUST be false (otherwise it wipes
|
|
1986
|
+
* the per-module JS the JS pass just wrote). `unbundle: false` makes rolldown roll the
|
|
1987
|
+
* declarations up per public entry, so a type re-exported through the root entry lands inline
|
|
1988
|
+
* in `index.d.ts` (fixing TS2883) instead of as a per-module sibling `.d.ts`.
|
|
1989
|
+
* `dts: { emitDtsOnly: true }` strips the JS chunks this pass would otherwise produce.
|
|
1990
|
+
*
|
|
1991
|
+
* Dual format: when `format` includes `cjs`, the dts pass still emits both `index.d.ts` (esm)
|
|
1992
|
+
* and `index.d.cts` (cjs) to the shared outDir.
|
|
1993
|
+
*
|
|
1994
|
+
* @public
|
|
1995
|
+
*/
|
|
1996
|
+
interface DerivedDtsPassOptions {
|
|
1997
|
+
readonly outDir: string;
|
|
1998
|
+
readonly sourcemap: false;
|
|
1999
|
+
readonly format: ReadonlyArray<BuildFormat$1>;
|
|
2000
|
+
readonly unbundle: false;
|
|
2001
|
+
readonly clean: false;
|
|
2002
|
+
readonly platform: "node";
|
|
2003
|
+
readonly fixedExtension: false;
|
|
2004
|
+
readonly entry: Record<string, string>;
|
|
2005
|
+
readonly dts: DtsPassDtsOptions;
|
|
2006
|
+
readonly define: Record<string, string>;
|
|
2007
|
+
readonly isProd: boolean;
|
|
2008
|
+
/** External packages to inline into the bundled dts (tsdown `deps.onlyBundle`). */
|
|
2009
|
+
readonly bundledPackages?: ReadonlyArray<string> | undefined;
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* The `dts` block both declaration passes hand to tsdown.
|
|
2013
|
+
*
|
|
2014
|
+
* The generator is pinned to `"tsgo"` — the TypeScript 7.1 declaration-emit API — and the
|
|
2015
|
+
* TypeScript module is named explicitly via `tsgo.moduleUrl`, resolved from THIS package's own
|
|
2016
|
+
* `typescript` dependency. rolldown-plugin-dts' auto-detection only inspects whatever
|
|
2017
|
+
* `typescript` it can reach from its own location, which in a consumer workspace may be a
|
|
2018
|
+
* hoisted copy with no API (TypeScript 7.0's main export is a version stub); naming the module
|
|
2019
|
+
* makes the pass resolve the same compiler in every install topology.
|
|
2020
|
+
*
|
|
2021
|
+
* @public
|
|
2022
|
+
*/
|
|
2023
|
+
interface DtsPassDtsOptions {
|
|
2024
|
+
readonly tsconfig: string;
|
|
2025
|
+
readonly emitDtsOnly: true;
|
|
2026
|
+
readonly generator: "tsgo";
|
|
2027
|
+
readonly tsgo: {
|
|
2028
|
+
readonly moduleUrl: string;
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Build the {@link DtsPassDtsOptions} for a resolved tsconfig path.
|
|
2033
|
+
*
|
|
2034
|
+
* @public
|
|
2035
|
+
*/
|
|
2036
|
+
export declare const dtsPassDtsOptions: (tsconfig: string) => DtsPassDtsOptions;
|
|
2037
|
+
/**
|
|
2038
|
+
* The output dir for a group: `dist/prod/\<group\>/pkg`, or `dist/dev/pkg` for the unused dev group.
|
|
2039
|
+
*
|
|
2040
|
+
* @public
|
|
2041
|
+
*/
|
|
2042
|
+
export declare const outDirFor: (cwd: string, group: TargetGroupId) => string;
|
|
2043
|
+
/**
|
|
2044
|
+
* Per-module declarations dir for a prod group: a sibling of `pkg/`, NOT published, used only as
|
|
2045
|
+
* API Extractor's diagnostics-run input so locations resolve to per-file source. Kept (not stripped)
|
|
2046
|
+
* as a cacheable, inspectable build artifact (issue #162).
|
|
2047
|
+
*
|
|
2048
|
+
* @public
|
|
2049
|
+
*/
|
|
2050
|
+
export declare const declarationsDirFor: (cwd: string, group: TargetGroupId) => string;
|
|
2051
|
+
/**
|
|
2052
|
+
* Derive the JS-pass tsdown options for one TargetGroup (per-module JS, no dts).
|
|
2053
|
+
*
|
|
2054
|
+
* @public
|
|
2055
|
+
*/
|
|
2056
|
+
export declare function deriveTargetGroupOptions(options: DeriveOptions): DerivedTsdownOptions;
|
|
2057
|
+
/**
|
|
2058
|
+
* Derive the dts-pass tsdown options for one TargetGroup (bundled declarations only).
|
|
2059
|
+
*
|
|
2060
|
+
* @public
|
|
2061
|
+
*/
|
|
2062
|
+
export declare function deriveDtsPassOptions(options: DeriveOptions): DerivedDtsPassOptions;
|
|
2063
|
+
/** @internal */
|
|
2064
|
+
interface DerivedDeclarationsPassOptions {
|
|
2065
|
+
readonly outDir: string;
|
|
2066
|
+
readonly sourcemap: false;
|
|
2067
|
+
readonly format: ReadonlyArray<BuildFormat$1>;
|
|
2068
|
+
readonly unbundle: true;
|
|
2069
|
+
readonly platform: "node";
|
|
2070
|
+
readonly fixedExtension: false;
|
|
2071
|
+
readonly entry: Record<string, string>;
|
|
2072
|
+
readonly dts: DtsPassDtsOptions;
|
|
2073
|
+
readonly define: Record<string, string>;
|
|
2074
|
+
readonly bundledPackages?: ReadonlyArray<string> | undefined;
|
|
2075
|
+
}
|
|
2076
|
+
/**
|
|
2077
|
+
* Derive the per-module declarations pass (API Extractor diagnostics input). Mirrors
|
|
2078
|
+
* {@link deriveDtsPassOptions} but `unbundle: true` (preserveModules → 1:1 source positions),
|
|
2079
|
+
* esm-only (AE reads the `.d.ts` entry only), into the `declarations/` sibling dir. Bin entries
|
|
2080
|
+
* are dropped (no exports).
|
|
2081
|
+
* @internal
|
|
2082
|
+
*/
|
|
2083
|
+
export declare function deriveDeclarationsPassOptions(options: DeriveOptions): DerivedDeclarationsPassOptions;
|
|
2084
|
+
/**
|
|
2085
|
+
* One standalone bundled output file, declared by its literal output filename.
|
|
2086
|
+
*
|
|
2087
|
+
* @public
|
|
2088
|
+
*/
|
|
2089
|
+
interface LooseFileSpec {
|
|
2090
|
+
/** Source module to bundle into the file. */
|
|
2091
|
+
readonly source: string;
|
|
2092
|
+
/** Module format. Required only for an ambiguous `.js` key; inferred from `.mjs`/`.cjs`. */
|
|
2093
|
+
readonly format?: BuildFormat$1 | undefined;
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Map of literal output filename to its source (bare string) or a `{ source, format }` spec.
|
|
2097
|
+
*
|
|
2098
|
+
* @public
|
|
2099
|
+
*/
|
|
2100
|
+
type LooseFiles = Record<string, string | LooseFileSpec>;
|
|
2101
|
+
/**
|
|
2102
|
+
* A loose file resolved to a concrete build descriptor.
|
|
2103
|
+
*
|
|
2104
|
+
* @public
|
|
2105
|
+
*/
|
|
2106
|
+
interface NormalizedLooseFile {
|
|
2107
|
+
/** Literal output filename written into the package dir, e.g. `pnpmfile.mjs`. */
|
|
2108
|
+
readonly outFile: string;
|
|
2109
|
+
/** tsdown entry name (outFile without its extension), e.g. `pnpmfile`. */
|
|
2110
|
+
readonly entryName: string;
|
|
2111
|
+
/** Source module to bundle. */
|
|
2112
|
+
readonly source: string;
|
|
2113
|
+
/** Resolved module format. */
|
|
2114
|
+
readonly format: BuildFormat$1;
|
|
2115
|
+
/**
|
|
2116
|
+
* Whether tsdown should use fixed extensions. `.mjs`/`.cjs` need `true` (tsdown derives
|
|
2117
|
+
* `.mjs` for esm and `.cjs` for cjs); a `.js` + esm output needs `false` (tsdown derives `.js`).
|
|
2118
|
+
*/
|
|
2119
|
+
readonly fixedExtension: boolean;
|
|
2120
|
+
}
|
|
2121
|
+
/**
|
|
2122
|
+
* Resolve a `looseFiles` map into normalized build descriptors. Pure (no filesystem):
|
|
2123
|
+
* a missing `source` is surfaced later by tsdown's entry resolution. Throws
|
|
2124
|
+
* {@link ConfigValidationError} on any structural problem so the bundler's ConfigValidator
|
|
2125
|
+
* surfaces it as a typed, fast-fail config error.
|
|
2126
|
+
* @public
|
|
2127
|
+
*/
|
|
2128
|
+
export declare function normalizeLooseFiles(files: LooseFiles): ReadonlyArray<NormalizedLooseFile>;
|
|
2129
|
+
/**
|
|
2130
|
+
* Signature compatible with tsdown's `build(inlineConfig)`.
|
|
2131
|
+
*
|
|
2132
|
+
* @public
|
|
2133
|
+
*/
|
|
2134
|
+
type TsdownBuild = (config: Record<string, unknown>) => Promise<unknown>;
|
|
2135
|
+
/**
|
|
2136
|
+
* CSS handling for a partition's JS pass, forwarded VERBATIM to tsdown's `css` option (consumed
|
|
2137
|
+
* by `@tsdown/css`). Structurally typed so tsdown-plugins takes no dependency on `@tsdown/css`.
|
|
2138
|
+
* The package whose runtime is built must install `@tsdown/css`; tsdown loads it lazily.
|
|
2139
|
+
* @public
|
|
2140
|
+
*/
|
|
2141
|
+
interface CssOptions {
|
|
2142
|
+
readonly modules?: boolean | {
|
|
2143
|
+
readonly localsConvention?: string;
|
|
2144
|
+
readonly namedExport?: boolean;
|
|
2145
|
+
readonly [k: string]: unknown;
|
|
2146
|
+
};
|
|
2147
|
+
readonly [k: string]: unknown;
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* One entry partition built with its own format + bundling posture, layered into the
|
|
2151
|
+
* SAME outDir as the base build (clean:false). Each partition is built from ITS OWN values
|
|
2152
|
+
* only — an option this override omits is simply absent for this partition, not inherited
|
|
2153
|
+
* from the base build (partition 0 in `buildTargetGroups`). Callers that want a base-build
|
|
2154
|
+
* value to also apply to an override must pass it again explicitly. An override can
|
|
2155
|
+
* therefore depend on NOT inheriting the base build's externals. `entry` is a subset of the package's
|
|
2156
|
+
* entries (`entryName -> source path`).
|
|
2157
|
+
* @public
|
|
2158
|
+
*/
|
|
2159
|
+
interface EntryOverride$1 {
|
|
2160
|
+
readonly entry: Record<string, string>;
|
|
2161
|
+
readonly format?: ReadonlyArray<BuildFormat$1> | undefined;
|
|
2162
|
+
readonly externals?: ReadonlyArray<string> | undefined;
|
|
2163
|
+
readonly bundle?: ReadonlyArray<string> | undefined;
|
|
2164
|
+
readonly bundleNodeModules?: boolean | undefined;
|
|
2165
|
+
readonly bundledPackages?: ReadonlyArray<string> | undefined;
|
|
2166
|
+
readonly dtsExternals?: ReadonlyArray<string> | undefined;
|
|
2167
|
+
/** JS-pass platform for this partition. Defaults to the base "node". Use "browser" for a web runtime. */
|
|
2168
|
+
readonly platform?: BuildPlatform$1 | undefined;
|
|
2169
|
+
/** CSS handling forwarded to tsdown's `css` option (JS pass only). Enables `@tsdown/css`. */
|
|
2170
|
+
readonly css?: CssOptions | undefined;
|
|
2171
|
+
/**
|
|
2172
|
+
* Build this partition into `<groupOutDir>/<outSubdir>/` instead of the shared group root.
|
|
2173
|
+
* Isolates a sub-package (e.g. an RSPress `./runtime`) so its bundleless per-file output cannot
|
|
2174
|
+
* collide with the base partition's output and its barrel path is deterministic. The partition's
|
|
2175
|
+
* entry should be `{ index: <barrel source> }` so it emits `<outSubdir>/index.js` + `<outSubdir>/index.d.ts`.
|
|
2176
|
+
*/
|
|
2177
|
+
readonly outSubdir?: string | undefined;
|
|
2178
|
+
}
|
|
2179
|
+
/** @public */
|
|
2180
|
+
interface BuildTargetGroupsOptions {
|
|
2181
|
+
readonly cwd: string;
|
|
2182
|
+
readonly version: string;
|
|
2183
|
+
readonly entry: Record<string, string>;
|
|
2184
|
+
readonly tsconfigPath: string;
|
|
2185
|
+
readonly groups: ReadonlyArray<BuildGroupSpec>;
|
|
2186
|
+
readonly devManifest: "preserve" | "resolve";
|
|
2187
|
+
readonly externals?: ReadonlyArray<string>;
|
|
2188
|
+
/**
|
|
2189
|
+
* Packages externalized in the dts pass ONLY — emitted as `import ... from "..."`
|
|
2190
|
+
* references in the `.d.ts` rather than inlined — while the JS pass still bundles
|
|
2191
|
+
* them per `bundleNodeModules`. The dts pass `neverBundle` becomes the union of
|
|
2192
|
+
* `externals` and `dtsExternals`. Use when a dependency's types cannot be safely
|
|
2193
|
+
* inlined into a single bundled declaration file (e.g. effect's cross-module
|
|
2194
|
+
* `declare module` augmentations, which inline into conflicting interface
|
|
2195
|
+
* extensions in consumers). The JS pass is unaffected.
|
|
2196
|
+
*/
|
|
2197
|
+
readonly dtsExternals?: ReadonlyArray<string> | undefined;
|
|
2198
|
+
/**
|
|
2199
|
+
* External packages whose declarations are inlined into the bundled dts
|
|
2200
|
+
* (rslib `dtsBundledPackages` equivalent). Forwarded to the dts pass as
|
|
2201
|
+
* `deps.dts.alwaysBundle` alongside `deps.neverBundle: true`; unlike
|
|
2202
|
+
* `deps.onlyBundle` this does not enable tsdown's strict-mode check that
|
|
2203
|
+
* errors on every unlisted transitive dependency. The JS pass is unaffected.
|
|
2204
|
+
*/
|
|
2205
|
+
readonly bundledPackages?: ReadonlyArray<string> | undefined;
|
|
2206
|
+
/**
|
|
2207
|
+
* Force-bundle node_modules (and workspace) JS dependencies that are not
|
|
2208
|
+
* externalized, restoring the rslib bundle-everything-except-externals
|
|
2209
|
+
* behavior. Acts through the JS pass's `unbundle: false` posture, NOT through a
|
|
2210
|
+
* `deps` flag: bundling node_modules is already tsdown's default for anything the
|
|
2211
|
+
* manifest does not declare as a production dependency. The dts pass mirrors it by
|
|
2212
|
+
* likewise leaving that default in place, so the bundled declarations are also
|
|
2213
|
+
* self-contained. Defaults to false (current behavior).
|
|
2214
|
+
*/
|
|
2215
|
+
readonly bundleNodeModules?: boolean | undefined;
|
|
2216
|
+
/**
|
|
2217
|
+
* Force-bundle (inline) these packages into the JS output (tsdown `deps.alwaysBundle`),
|
|
2218
|
+
* even declared deps that would otherwise be auto-externalized. The inverse of
|
|
2219
|
+
* `externals`. Forwarded to the JS pass AND, identically, to the dts pass and the
|
|
2220
|
+
* prod-only per-module declarations pass — the dts pass RE-EMITS the dual-format `.cjs`
|
|
2221
|
+
* chunk (see `buildTargetGroups`'s class doc), so a force-bundled dependency must stay
|
|
2222
|
+
* inlined there too, or the re-emitted `.cjs` re-externalizes it.
|
|
2223
|
+
*/
|
|
2224
|
+
readonly bundle?: ReadonlyArray<string> | undefined;
|
|
2225
|
+
/** Output formats to emit. Defaults to esm-only when unset. */
|
|
2226
|
+
readonly format?: ReadonlyArray<BuildFormat$1> | undefined;
|
|
2227
|
+
/**
|
|
2228
|
+
* Minify the JS output of PROD groups only (dev is never minified). Defaults to
|
|
2229
|
+
* false — this builder targets Node libraries where readable output is preferred.
|
|
2230
|
+
*/
|
|
2231
|
+
readonly minify?: boolean | undefined;
|
|
2232
|
+
/** Top-level `package.json` keys deleted from every emitted manifest, after the standard stripping. */
|
|
2233
|
+
readonly drop?: ReadonlyArray<string> | undefined;
|
|
2234
|
+
/** Top-level string keys written over every emitted manifest after `drop`; `name` is carried by each group. */
|
|
2235
|
+
readonly set?: Readonly<Record<string, string>> | undefined;
|
|
2236
|
+
/**
|
|
2237
|
+
* Extra rolldown plugins, forwarded to BOTH the JS pass and the dts-only pass. A plugin
|
|
2238
|
+
* with JS-lifecycle side effects (asset emitters, banner injectors) runs in both passes;
|
|
2239
|
+
* the dts pass uses `emitDtsOnly`, so for esm-only builds it produces no JS chunks and most
|
|
2240
|
+
* rolldown hooks are no-ops there. For DUAL (esm+cjs) builds, however, tsdown's dts pass
|
|
2241
|
+
* still RE-EMITS the `.cjs` JS chunk and overwrites the JS pass's `.cjs` output — so a
|
|
2242
|
+
* `renderChunk`/`generateBundle` plugin that must persist onto the final `.cjs` (e.g. the
|
|
2243
|
+
* built-in cjs-default-interop) has to run in the dts pass too. A caller relying on a hook
|
|
2244
|
+
* firing exactly once should guard the second invocation.
|
|
2245
|
+
*/
|
|
2246
|
+
readonly extraPlugins?: ReadonlyArray<Plugin>;
|
|
2247
|
+
/**
|
|
2248
|
+
* Compile-time global replacements forwarded to BOTH the JS and dts passes' `define`.
|
|
2249
|
+
* Build-wide (shared by every entry partition); merged after the auto-injected
|
|
2250
|
+
* `process.env.__PACKAGE_VERSION__` so a user key of the same name wins.
|
|
2251
|
+
*/
|
|
2252
|
+
readonly define?: Record<string, string> | undefined;
|
|
2253
|
+
/**
|
|
2254
|
+
* Entry partitions with their own format/bundling, built into the same outDir after
|
|
2255
|
+
* the base entries. Used for per-entry format overrides (e.g. one CJS entry in an
|
|
2256
|
+
* otherwise ESM-only package). The base `entry` must already EXCLUDE these entries.
|
|
2257
|
+
*/
|
|
2258
|
+
readonly overrides?: ReadonlyArray<EntryOverride$1> | undefined;
|
|
2259
|
+
/**
|
|
2260
|
+
* Standalone bundled output files emitted at literal paths into each group's pkg/ dir,
|
|
2261
|
+
* outside the exports/dts/meta graph (e.g. pnpm config-dependency pnpmfiles). Each runs as
|
|
2262
|
+
* one extra single-entry, bundled (unbundle:false), no-dts, no-manifest pass per group,
|
|
2263
|
+
* inheriting the group's bundleNodeModules/bundle/externals posture so the file is
|
|
2264
|
+
* self-contained. Caller passes the normalized form (see normalizeLooseFiles).
|
|
2265
|
+
*/
|
|
2266
|
+
readonly looseFiles?: ReadonlyArray<NormalizedLooseFile> | undefined;
|
|
2267
|
+
/**
|
|
2268
|
+
* Non-module assets for each group's pkg/ dir, handed to tsdown's `copy` on the base partition's JS pass, after its
|
|
2269
|
+
* clean. A `to` is taken relative to the group's pkg/ dir, where tsdown alone would read it against `cwd` and write
|
|
2270
|
+
* every group's copy to one place.
|
|
2271
|
+
*/
|
|
2272
|
+
readonly copy?: ReadonlyArray<string | CopyEntry> | undefined;
|
|
2273
|
+
/**
|
|
2274
|
+
* Which export keys get a CJS `require` condition in the emitted manifest. Pass a Set
|
|
2275
|
+
* when overrides give different entries different formats; omit for the uniform
|
|
2276
|
+
* `format`-includes-cjs behavior.
|
|
2277
|
+
*/
|
|
2278
|
+
readonly dualExports?: DualExports | undefined;
|
|
2279
|
+
/** Export keys built into a `<key>/index.*` subdir (e.g. an RSPress `./runtime`). */
|
|
2280
|
+
readonly subdirExports?: ReadonlySet<string> | undefined;
|
|
2281
|
+
/** When set, rewrite the emitted manifest's exports/bin values equal to the exe source to the SEA path and add it to `files`. */
|
|
2282
|
+
readonly exeRewrite?: ExeRewrite | undefined;
|
|
2283
|
+
/** Injectable for tests; defaults to tsdown's build. */
|
|
2284
|
+
readonly build?: TsdownBuild;
|
|
2285
|
+
/** Told when a pass starts, so a caller can name the pass a thrown error came from. */
|
|
2286
|
+
readonly onPass?: ((pass: PassKind) => void) | undefined;
|
|
2287
|
+
/** When set, muzzle tsdown (silent + customLogger) and capture metrics/timing into this collector. */
|
|
2288
|
+
readonly collector?: BuildCollector | undefined;
|
|
2289
|
+
/** Compute gzip sizes for emitted files (verbose render). Forwarded to the metrics plugin. */
|
|
2290
|
+
readonly verbose?: boolean | undefined;
|
|
2291
|
+
/**
|
|
2292
|
+
* Emit a per-module (`unbundle: true`) declaration tree into `dist/prod/<id>/declarations/` per
|
|
2293
|
+
* group, in addition to the bundled dts in `pkg/`. API Extractor's diagnostics-run input for the
|
|
2294
|
+
* meta pass. Prod-only; the bundler sets it for `--target prod`. Absent → no third pass
|
|
2295
|
+
* (byte-identical to the two-pass default). Not captured by the collector. Has no effect when
|
|
2296
|
+
* `emitDts` is `false` — the declarations pass exists only to feed the dts-derived meta pass.
|
|
2297
|
+
*/
|
|
2298
|
+
readonly emitDeclarations?: boolean | undefined;
|
|
2299
|
+
/**
|
|
2300
|
+
* When `false`, skip BOTH the bundled per-entry dts pass (Pass 2) and the prod per-module
|
|
2301
|
+
* declarations pass (Pass 3) — no TypeScript compiler load. The JS pass (Pass 1) and
|
|
2302
|
+
* `copyPublicDir` still run. Defaults to `true` (current two/three-pass behavior).
|
|
2303
|
+
*/
|
|
2304
|
+
readonly emitDts?: boolean | undefined;
|
|
2305
|
+
}
|
|
2306
|
+
/**
|
|
2307
|
+
* Run tsdown.build() per TargetGroup. Composable so the escape hatch gets multi-group too.
|
|
2308
|
+
*
|
|
2309
|
+
* Each group runs TWO passes to the SAME outDir:
|
|
2310
|
+
* 1. JS pass — per-module JS (`unbundle: true`, `dts: false`), with the `emitManifest` plugin
|
|
2311
|
+
* and the `public/` copy. Default `clean: true` gives it a fresh outDir.
|
|
2312
|
+
* 2. dts pass — bundled declarations only (`unbundle: false`, `dts: { emitDtsOnly: true }`,
|
|
2313
|
+
* `clean: false`). No manifest plugin, no copy, no sourcemaps. `clean: false` is load-bearing:
|
|
2314
|
+
* it must NOT wipe the JS the first pass just wrote.
|
|
2315
|
+
*
|
|
2316
|
+
* Why two passes: tsdown's `unbundle` maps to rolldown `output.preserveModules` for the whole
|
|
2317
|
+
* build (JS and the dts plugin share it), so a single pass cannot give per-module JS + bundled
|
|
2318
|
+
* dts. Per-module dts breaks type portability (TS2883); bundling the JS re-bundles workspace
|
|
2319
|
+
* consumers. The split keeps per-module JS AND rolled-up, self-contained declarations.
|
|
2320
|
+
*
|
|
2321
|
+
* **The JS pass's `unbundle` flips to `false` for a `bundleNodeModules` partition** (see
|
|
2322
|
+
* `DerivedTsdownOptions` in `target-groups.ts`), so that partition's JS pass ALSO bundles
|
|
2323
|
+
* instead of preserving modules — a per-module preserveModules JS pass writes every inlined
|
|
2324
|
+
* node_modules dependency to its own sibling file (mirroring its `node_modules/...` path),
|
|
2325
|
+
* which `npm pack` then strips, breaking the "self-contained" promise `bundleNodeModules`
|
|
2326
|
+
* already makes. Scoped to that flag alone; every other build's JS pass is unaffected.
|
|
2327
|
+
* @public
|
|
2328
|
+
*/
|
|
2329
|
+
export declare function buildTargetGroups(options: BuildTargetGroupsOptions): Promise<void>;
|
|
2330
|
+
/**
|
|
2331
|
+
* Which release versions a target receives: every version, only final versions, or only prereleases.
|
|
2332
|
+
*
|
|
2333
|
+
* @remarks
|
|
2334
|
+
* A prerelease is any version carrying a SemVer prerelease suffix (`1.2.0-beta.1`). The filter is
|
|
2335
|
+
* applied per target at publish time, never at build time, so a `from` target that shares a group
|
|
2336
|
+
* with a differently-filtered target still reuses the same bytes.
|
|
2337
|
+
*
|
|
2338
|
+
* @public
|
|
2339
|
+
*/
|
|
2340
|
+
type ReleaseChannel = "all" | "stable" | "prerelease";
|
|
2341
|
+
/**
|
|
2342
|
+
* Every {@link ReleaseChannel} value, in declaration order.
|
|
2343
|
+
*
|
|
2344
|
+
* @public
|
|
2345
|
+
*/
|
|
2346
|
+
export declare const RELEASE_CHANNELS: ReadonlyArray<ReleaseChannel>;
|
|
2347
|
+
/**
|
|
2348
|
+
* A single object-form publish target. Uses `from` XOR `name` (never both).
|
|
2349
|
+
*
|
|
2350
|
+
* @public
|
|
2351
|
+
*/
|
|
2352
|
+
interface PublishTargetObject {
|
|
2353
|
+
/** Registry endpoint. Required for custom keys; defaulted for `npm`/`github`. */
|
|
2354
|
+
readonly registry?: string | undefined;
|
|
2355
|
+
/** Name override for this target's own group. Mutually exclusive with `from`. */
|
|
2356
|
+
readonly name?: string | undefined;
|
|
2357
|
+
/** Reuse another target's group bytes (deploy them to this registry). Mutually exclusive with `name`. */
|
|
2358
|
+
readonly from?: string | undefined;
|
|
2359
|
+
/** Which release versions this target receives. Defaults to `"all"`. */
|
|
2360
|
+
readonly releases?: ReleaseChannel | undefined;
|
|
2361
|
+
/** Force the provenance attestation on or off, overriding the registry-derived default. */
|
|
2362
|
+
readonly provenance?: boolean | undefined;
|
|
2363
|
+
}
|
|
2364
|
+
/**
|
|
2365
|
+
* A `publishConfig.targets` value: `true` (well-known registry, base name), a string (name override), or an object.
|
|
2366
|
+
*
|
|
2367
|
+
* @public
|
|
2368
|
+
*/
|
|
2369
|
+
type PublishTargetValue = true | string | PublishTargetObject;
|
|
2370
|
+
/**
|
|
2371
|
+
* The `publishConfig.targets` map, keyed by target id (`npm`, `github`, or a custom key).
|
|
2372
|
+
*
|
|
2373
|
+
* @public
|
|
2374
|
+
*/
|
|
2375
|
+
type PublishTargets = Record<string, PublishTargetValue>;
|
|
2376
|
+
/**
|
|
2377
|
+
* A distinct byte-variant build group (one per distinct resolved name).
|
|
2378
|
+
*
|
|
2379
|
+
* @public
|
|
2380
|
+
*/
|
|
2381
|
+
interface ResolvedGroup {
|
|
2382
|
+
/** Folder id; the group's output dir nests this id under dist/prod, with a pkg subfolder. */
|
|
2383
|
+
readonly id: string;
|
|
2384
|
+
/** The `package.json.name` this group's manifest carries. */
|
|
2385
|
+
readonly name: string;
|
|
2386
|
+
/** The group's pkg output dir, relative to the package root. */
|
|
2387
|
+
readonly dir: string;
|
|
2388
|
+
}
|
|
2389
|
+
/**
|
|
2390
|
+
* A resolved registry target (one per `publishConfig.targets` key).
|
|
2391
|
+
*
|
|
2392
|
+
* @public
|
|
2393
|
+
*/
|
|
2394
|
+
interface ResolvedTarget {
|
|
2395
|
+
/** The `publishConfig.targets` key. */
|
|
2396
|
+
readonly id: string;
|
|
2397
|
+
/** The group id whose bytes this target deploys. */
|
|
2398
|
+
readonly group: string;
|
|
2399
|
+
/** The resolved name for that group. */
|
|
2400
|
+
readonly name: string;
|
|
2401
|
+
/** The resolved registry endpoint. */
|
|
2402
|
+
readonly registry: string;
|
|
2403
|
+
/** Which release versions this target receives; always written, `"all"` when undeclared. */
|
|
2404
|
+
readonly releases: ReleaseChannel;
|
|
2405
|
+
/** The declared provenance override; absent when the target leaves it to the registry default. */
|
|
2406
|
+
readonly provenance?: boolean;
|
|
2407
|
+
}
|
|
2408
|
+
/**
|
|
2409
|
+
* The full resolution of `publishConfig.targets`: the distinct groups to build, and every target bound to one.
|
|
2410
|
+
*
|
|
2411
|
+
* @public
|
|
2412
|
+
*/
|
|
2413
|
+
interface TargetResolution {
|
|
2414
|
+
readonly groups: ReadonlyArray<ResolvedGroup>;
|
|
2415
|
+
readonly targets: ReadonlyArray<ResolvedTarget>;
|
|
2416
|
+
}
|
|
2417
|
+
/**
|
|
2418
|
+
* True when a target value is the object form (carries registry/name/from).
|
|
2419
|
+
*
|
|
2420
|
+
* @public
|
|
2421
|
+
*/
|
|
2422
|
+
export declare function isTargetObject(value: PublishTargetValue): value is PublishTargetObject;
|
|
2423
|
+
/**
|
|
2424
|
+
* The `package.json` fields the build reads. Any other field reaches the emitted manifest untouched.
|
|
2425
|
+
*
|
|
2426
|
+
* @public
|
|
2427
|
+
*/
|
|
2428
|
+
interface BundlerPackageJson {
|
|
2429
|
+
readonly name?: string;
|
|
2430
|
+
readonly version?: string;
|
|
2431
|
+
readonly exports?: unknown;
|
|
2432
|
+
readonly bin?: unknown;
|
|
2433
|
+
readonly publishConfig?: unknown;
|
|
2434
|
+
readonly os?: unknown;
|
|
2435
|
+
readonly cpu?: unknown;
|
|
2436
|
+
readonly [key: string]: unknown;
|
|
2437
|
+
}
|
|
2438
|
+
/**
|
|
2439
|
+
* The orchestrator's side effects, each replaceable so a test can run it without tsdown, API Extractor or a
|
|
2440
|
+
* compiler. Every member defaults to the real implementation.
|
|
2441
|
+
*
|
|
2442
|
+
* @public
|
|
2443
|
+
*/
|
|
2444
|
+
interface BundlerSeams {
|
|
2445
|
+
/** The JS and declaration passes. */
|
|
2446
|
+
readonly buildTargetGroups: (options: BuildTargetGroupsOptions) => Promise<void>;
|
|
2447
|
+
/** The meta pass, once per build. */
|
|
2448
|
+
readonly runMetaPass: (options: RunMetaPassOptions) => Promise<void>;
|
|
2449
|
+
/** The API Extractor run inside the real meta pass. */
|
|
2450
|
+
readonly generateMeta: (options: GenerateMetaOptions) => Promise<MetaResult>;
|
|
2451
|
+
/** The optimistic next-version read inside the real meta pass. */
|
|
2452
|
+
readonly resolveNextVersions: (cwd: string) => Promise<{
|
|
2453
|
+
readonly versions: ReadonlyMap<string, string>;
|
|
2454
|
+
}>;
|
|
2455
|
+
/** Imports an optional peer of an Open Graph renderer, the check that it is installed. */
|
|
2456
|
+
readonly importOgPeer: (specifier: string) => Promise<unknown>;
|
|
2457
|
+
/** The SEA compile. */
|
|
2458
|
+
readonly runExeBuild: (options: RunExeBuildOptions) => Promise<void>;
|
|
2459
|
+
/** Writes `dist/prod/issues.json` and answers its path. */
|
|
2460
|
+
readonly writeIssues: (options: {
|
|
2461
|
+
readonly cwd: string;
|
|
2462
|
+
readonly target: "prod";
|
|
2463
|
+
readonly reports: ReadonlyArray<BuildReport>;
|
|
2464
|
+
readonly buildOk: boolean;
|
|
2465
|
+
readonly failure?: {
|
|
2466
|
+
readonly name?: string | undefined;
|
|
2467
|
+
readonly message: string;
|
|
2468
|
+
};
|
|
2469
|
+
}) => string | undefined;
|
|
2470
|
+
/** Reads the package's `package.json`. */
|
|
2471
|
+
readonly readPackageJson: (cwd: string) => BundlerPackageJson;
|
|
2472
|
+
/** Writes the resolved tsconfig and answers its path. */
|
|
2473
|
+
readonly writeTsconfig: (cwd: string, jsx: JsxConfig$1 | undefined) => string;
|
|
2474
|
+
/** Writes `dist/prod/targets.json` and answers its path. */
|
|
2475
|
+
readonly writeTargetsBinding: (cwd: string, resolution: TargetResolution) => string;
|
|
2476
|
+
/** Reads the jsx-relevant slice of the package's tsconfig. */
|
|
2477
|
+
readonly readTsconfigJsx: (cwd: string) => TsconfigJsx;
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* The inputs of one package build.
|
|
2481
|
+
*
|
|
2482
|
+
* @public
|
|
2483
|
+
*/
|
|
2484
|
+
interface BundlerBuildOptions {
|
|
2485
|
+
/** The package root, as an absolute path. The build never reads the process's own directory. */
|
|
2486
|
+
readonly cwd: string;
|
|
2487
|
+
/** The decoded `[package.build]` table. */
|
|
2488
|
+
readonly config: PackageBuildConfig;
|
|
2489
|
+
/** The decoded `[package.bundle]` table, the config tier of the emitted `bundle.json`. */
|
|
2490
|
+
readonly bundle: BundleConfig | undefined;
|
|
2491
|
+
/** Skips the SEA compile. The manifest still points at the binary. */
|
|
2492
|
+
readonly noExe: boolean;
|
|
2493
|
+
/** Measures gzip sizes for the report. */
|
|
2494
|
+
readonly verbose: boolean;
|
|
2495
|
+
/** Rolldown plugins added to the JS and declaration passes, already loaded. */
|
|
2496
|
+
readonly plugins: ReadonlyArray<Plugin>;
|
|
2497
|
+
/** Whether this build runs under CI. Resolves an `"auto"` optimistic meta setting, and read from nothing else. */
|
|
2498
|
+
readonly ci: boolean;
|
|
2499
|
+
/** Replaces side effects, for tests. */
|
|
2500
|
+
readonly seams?: Partial<BundlerSeams>;
|
|
2501
|
+
}
|
|
2502
|
+
declare const BundlerBuildResult_base: Schema.Class<BundlerBuildResult, Schema.Struct<{
|
|
2503
|
+
/** Everything the build recorded. */
|
|
2504
|
+
readonly report: typeof BuildReport;
|
|
2505
|
+
/** Where `issues.json` was written. */
|
|
2506
|
+
readonly issuesPath: Schema.String;
|
|
2507
|
+
/** Where `targets.json` was written. */
|
|
2508
|
+
readonly targetsPath: Schema.UndefinedOr<Schema.String>;
|
|
2509
|
+
}>, {}>;
|
|
2510
|
+
/**
|
|
2511
|
+
* A finished build.
|
|
2512
|
+
*
|
|
2513
|
+
* @public
|
|
2514
|
+
*/
|
|
2515
|
+
export declare class BundlerBuildResult extends BundlerBuildResult_base {}
|
|
2516
|
+
/**
|
|
2517
|
+
* Builds one package: the JS and declaration passes for every publish group, the emitted manifest,
|
|
2518
|
+
* `dist/prod/targets.json`, the API model, an optional SEA binary, and `dist/prod/issues.json`.
|
|
2519
|
+
*
|
|
2520
|
+
* @public
|
|
2521
|
+
*/
|
|
2522
|
+
export declare class Bundler {
|
|
2523
|
+
/**
|
|
2524
|
+
* Runs a build of the package at `options.cwd`, writing into its `dist/prod`.
|
|
2525
|
+
*
|
|
2526
|
+
* @remarks
|
|
2527
|
+
* It writes nothing to stdout; rendering the report belongs to the caller. A structurally invalid config fails
|
|
2528
|
+
* {@link ConfigValidationError} before any build work, and anything thrown afterwards fails
|
|
2529
|
+
* {@link BundlerError} naming the phase. Both paths write `issues.json` stamped `buildOk: false` first.
|
|
2530
|
+
*
|
|
2531
|
+
* The build's own reads and writes (`package.json`, the package's tsconfig, `targets.json`, `issues.json`, the
|
|
2532
|
+
* emitted manifest's checks) go through the provided `FileSystem` and `Path`, while tsdown, API Extractor and the
|
|
2533
|
+
* SEA compiler always work on the host disk. Provide the host's (`NodeServices.layer`) for a real build. A memory
|
|
2534
|
+
* filesystem suits a build whose passes are all replaced through `seams`.
|
|
2535
|
+
*/
|
|
2536
|
+
static readonly build: (options: BundlerBuildOptions) => Effect.Effect<BundlerBuildResult, BundlerError | ConfigValidationError, FileSystem.FileSystem | Path.Path>;
|
|
2537
|
+
}
|
|
2538
|
+
/**
|
|
2539
|
+
* Minimal shape of a `package.json` manifest needed to resolve catalog and
|
|
2540
|
+
* workspace specifiers.
|
|
2541
|
+
*
|
|
2542
|
+
* @public
|
|
2543
|
+
*/
|
|
2544
|
+
interface ManifestLike {
|
|
2545
|
+
readonly name: string;
|
|
2546
|
+
readonly version: string;
|
|
2547
|
+
dependencies?: Record<string, string>;
|
|
2548
|
+
devDependencies?: Record<string, string>;
|
|
2549
|
+
peerDependencies?: Record<string, string>;
|
|
2550
|
+
optionalDependencies?: Record<string, string>;
|
|
2551
|
+
[k: string]: unknown;
|
|
2552
|
+
}
|
|
2553
|
+
/**
|
|
2554
|
+
* Resolve every `catalog:`/`workspace:` specifier in a manifest to a concrete spec,
|
|
2555
|
+
* delegating to `@effected/workspaces`' one-shot `Workspaces.resolveManifest`. The
|
|
2556
|
+
* resolver re-discovers the workspace root from `cwd` on every call, never from the
|
|
2557
|
+
* process directory, and assembles catalogs durably (inline +
|
|
2558
|
+
* config-dependency hook-replay + lockfile), so no transient
|
|
2559
|
+
* `.pnpm-workspace-state-v1.json` is required.
|
|
2560
|
+
*
|
|
2561
|
+
* Rejects with `ManifestDecodeError` when a dependency field is not a string-to-string
|
|
2562
|
+
* record, `UnresolvedDependencyError` on a specifier the workspace cannot answer, or
|
|
2563
|
+
* `CatalogAssemblyError`/`DependencyResolutionError` when catalog assembly or the
|
|
2564
|
+
* resolution mechanism itself fails.
|
|
2565
|
+
* @public
|
|
2566
|
+
*/
|
|
2567
|
+
export declare function resolveManifest(pkg: ManifestLike, cwd: string): Promise<ManifestLike>;
|
|
2568
|
+
/**
|
|
2569
|
+
* Result of resolving next release versions for a workspace.
|
|
2570
|
+
*
|
|
2571
|
+
* @public
|
|
2572
|
+
*/
|
|
2573
|
+
interface NextVersions {
|
|
2574
|
+
/** Monorepo root containing `.changeset/` (or `cwd` when no workspace was found). */
|
|
2575
|
+
readonly root: string;
|
|
2576
|
+
/** Canonical package name `->` next release version (current version when unbumped). */
|
|
2577
|
+
readonly versions: ReadonlyMap<string, string>;
|
|
2578
|
+
}
|
|
2579
|
+
/**
|
|
2580
|
+
* Resolve the next release version of every workspace package from pending changesets.
|
|
2581
|
+
*
|
|
2582
|
+
* Walks up from `cwd` to the monorepo root via `@effected/workspaces`' `WorkspaceDiscovery`,
|
|
2583
|
+
* seeds the map with each package's CURRENT version, then overlays `newVersion` for
|
|
2584
|
+
* changeset-affected packages via `ReleasePlan.read`, including pre-release versions in pre
|
|
2585
|
+
* mode and fixed or linked groups. Never rejects: any failure (not a workspace, missing
|
|
2586
|
+
* `.changeset/config.json`, an invalid config or `pre.json`, parse error) degrades to current
|
|
2587
|
+
* versions (or an empty map).
|
|
2588
|
+
* @public
|
|
2589
|
+
*/
|
|
2590
|
+
export declare function resolveNextVersions(cwd: string): Promise<NextVersions>;
|
|
2591
|
+
declare const EffectedConfigError_base: Schema.Class<EffectedConfigError, Schema.TaggedStruct<"EffectedConfigError", {
|
|
2592
|
+
/** The file at fault. */
|
|
2593
|
+
readonly path: Schema.String;
|
|
2594
|
+
/** The TOML parser's message, or every schema issue rendered with its path. */
|
|
2595
|
+
readonly reason: Schema.String;
|
|
2596
|
+
/** The dotted path of the first schema issue, e.g. `package.build.formats`, when decoding failed. */
|
|
2597
|
+
readonly issuePath: Schema.optionalKey<Schema.String>;
|
|
2598
|
+
}>, import("effect/Cause").YieldableError>;
|
|
2599
|
+
/**
|
|
2600
|
+
* An `effected.toml` could not be read, parsed or decoded, or the workspace around it could not be discovered.
|
|
2601
|
+
*
|
|
2602
|
+
* @public
|
|
2603
|
+
*/
|
|
2604
|
+
export declare class EffectedConfigError extends EffectedConfigError_base {
|
|
2605
|
+
get message(): string;
|
|
2606
|
+
}
|
|
2607
|
+
declare const ResolvedConfig_base: Schema.Class<ResolvedConfig, Schema.Struct<{
|
|
2608
|
+
readonly action: Schema.optionalKey<typeof ActionConfig>;
|
|
2609
|
+
package: Schema.withDecodingDefaultKey<typeof PackageConfig, never>;
|
|
2610
|
+
}>, EffectedConfig> & Pick<{}, never>;
|
|
2611
|
+
/**
|
|
2612
|
+
* The effective config {@link EffectedConfigFile.load} answers: an {@link EffectedConfig} whose `package` table
|
|
2613
|
+
* is always present, with every default when no file wrote one, so a consumer never branches on its absence.
|
|
2614
|
+
*
|
|
2615
|
+
* @public
|
|
2616
|
+
*/
|
|
2617
|
+
export declare class ResolvedConfig extends ResolvedConfig_base {}
|
|
2618
|
+
declare const ResolvedEffectedConfig_base: Schema.Class<ResolvedEffectedConfig, Schema.Struct<{
|
|
2619
|
+
/** The merged, decoded config. */
|
|
2620
|
+
readonly config: typeof ResolvedConfig;
|
|
2621
|
+
/** The file each tier read, absent for a tier that found none. */
|
|
2622
|
+
readonly sources: Schema.Struct<{
|
|
2623
|
+
/** The workspace root tier's file. */
|
|
2624
|
+
readonly root: Schema.optionalKey<Schema.String>;
|
|
2625
|
+
/** The package tier's file. */
|
|
2626
|
+
readonly package: Schema.optionalKey<Schema.String>;
|
|
2627
|
+
}>;
|
|
2628
|
+
}>, {}>;
|
|
2629
|
+
/**
|
|
2630
|
+
* A package's effective `effected.toml` config and the files it came from.
|
|
2631
|
+
*
|
|
2632
|
+
* @public
|
|
2633
|
+
*/
|
|
2634
|
+
export declare class ResolvedEffectedConfig extends ResolvedEffectedConfig_base {}
|
|
2635
|
+
/**
|
|
2636
|
+
* Finds, merges and decodes `effected.toml`.
|
|
2637
|
+
*
|
|
2638
|
+
* @public
|
|
2639
|
+
*/
|
|
2640
|
+
export declare class EffectedConfigFile {
|
|
2641
|
+
private constructor();
|
|
2642
|
+
/**
|
|
2643
|
+
* Loads the config that applies to the package at `cwd`.
|
|
2644
|
+
*
|
|
2645
|
+
* @remarks
|
|
2646
|
+
* The root tier is the first of `.config/effected.toml` and `effected.toml` under the workspace root. The
|
|
2647
|
+
* package tier is the first of those two and `lib/configs/effected.toml` under `cwd`; it applies only when
|
|
2648
|
+
* `cwd` is not the root. The package tier merges over the root tier per {@link merge}, and the merged
|
|
2649
|
+
* document decodes once, so defaults apply after precedence.
|
|
2650
|
+
*
|
|
2651
|
+
* Decoding rejects unknown keys and reports all of them. When no workspace root sits above `cwd`, `cwd`
|
|
2652
|
+
* is the root. No file anywhere is not a failure: `config.package` holds every default and `sources` has no
|
|
2653
|
+
* keys.
|
|
2654
|
+
*
|
|
2655
|
+
* @param options - `cwd` is the package directory; `root` skips workspace discovery.
|
|
2656
|
+
*/
|
|
2657
|
+
static readonly load: (options: {
|
|
2658
|
+
readonly cwd: string;
|
|
2659
|
+
readonly root?: string;
|
|
2660
|
+
}) => Effect.Effect<ResolvedEffectedConfig, EffectedConfigError, FileSystem.FileSystem | Path.Path | WorkspaceDiscovery>;
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* Merges a package's raw `effected.toml` document over the workspace root's.
|
|
2664
|
+
*
|
|
2665
|
+
* @remarks
|
|
2666
|
+
* Two tables merge per key; an array or a scalar replaces whatever the root had, whole. It runs on the raw
|
|
2667
|
+
* documents, before any decoding, so a default can never outrank a value the root wrote. Neither input is
|
|
2668
|
+
* modified, and `__proto__`, `constructor` and `prototype` keys are dropped.
|
|
2669
|
+
*
|
|
2670
|
+
* @param root - The root tier's document.
|
|
2671
|
+
* @param pkg - The package tier's document, which wins every conflict.
|
|
2672
|
+
* @returns The merged document.
|
|
2673
|
+
*
|
|
2674
|
+
* @public
|
|
2675
|
+
*/
|
|
2676
|
+
export declare const merge: (root: unknown, pkg: unknown) => unknown;
|
|
2677
|
+
declare const PluginLoadError_base: Schema.Class<PluginLoadError, Schema.TaggedStruct<"PluginLoadError", {
|
|
2678
|
+
/** The module's resolved path. */
|
|
2679
|
+
readonly path: Schema.String;
|
|
2680
|
+
/** What was wrong with it. */
|
|
2681
|
+
readonly reason: Schema.String;
|
|
2682
|
+
}>, import("effect/Cause").YieldableError>;
|
|
2683
|
+
/**
|
|
2684
|
+
* A module named in `package.build.plugins` could not be loaded as a rolldown plugin.
|
|
2685
|
+
*
|
|
2686
|
+
* @public
|
|
2687
|
+
*/
|
|
2688
|
+
export declare class PluginLoadError extends PluginLoadError_base {
|
|
2689
|
+
get message(): string;
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* Loads the rolldown plugins named in `package.build.plugins`, in order.
|
|
2693
|
+
*
|
|
2694
|
+
* @remarks
|
|
2695
|
+
* Each module path resolves against `cwd`, so a bare `build/plugin.ts` is a file in the package rather than a
|
|
2696
|
+
* package name. A module's default export is a plugin, or a factory of one that is called once. Loading runs
|
|
2697
|
+
* the module's code, and stops at the first module that fails.
|
|
2698
|
+
*
|
|
2699
|
+
* @param options - `cwd` is the package directory and `modules` the paths to load. `importModule` replaces the
|
|
2700
|
+
* default importer, jiti, which loads TypeScript directly.
|
|
2701
|
+
*
|
|
2702
|
+
* @public
|
|
2703
|
+
*/
|
|
2704
|
+
export declare const loadPlugins: (options: {
|
|
2705
|
+
readonly cwd: string;
|
|
2706
|
+
readonly modules: ReadonlyArray<string>;
|
|
2707
|
+
readonly importModule?: (path: string) => Promise<unknown>;
|
|
2708
|
+
}) => Effect.Effect<Plugin<any>[], PluginLoadError, never>;
|
|
2709
|
+
/**
|
|
2710
|
+
* The normalized facts the validator checks, assembled by the bundler before any build work.
|
|
2711
|
+
*
|
|
2712
|
+
* @public
|
|
2713
|
+
*/
|
|
2714
|
+
interface ValidationInput {
|
|
2715
|
+
readonly baseName: string;
|
|
2716
|
+
/** Whether the package declares an exports map (for the model-without-exports cross-field rule). */
|
|
2717
|
+
readonly hasExports: boolean;
|
|
2718
|
+
readonly targets?: PublishTargets | undefined;
|
|
2719
|
+
readonly exe?: ExeConfig$1 | ReadonlyArray<ExeConfig$1> | undefined;
|
|
2720
|
+
readonly osCpu?: {
|
|
2721
|
+
readonly os: ReadonlyArray<string>;
|
|
2722
|
+
readonly cpu: ReadonlyArray<string>;
|
|
2723
|
+
} | undefined;
|
|
2724
|
+
readonly meta?: MetaOptions | undefined;
|
|
2725
|
+
/** Standalone bundled output files; validated structurally (extension/format) before any build. */
|
|
2726
|
+
readonly looseFiles?: LooseFiles | undefined;
|
|
2727
|
+
}
|
|
2728
|
+
declare const ConfigValidator_base: Context.ServiceClass<ConfigValidator, "@savvy-web/tsdown-plugins/ConfigValidator", {
|
|
2729
|
+
readonly validate: (input: ValidationInput) => Effect.Effect<void, ConfigValidationError>;
|
|
2730
|
+
}>;
|
|
2731
|
+
/**
|
|
2732
|
+
* Fast-fail config validator; runs first in the bundler over the resolved config.
|
|
2733
|
+
*
|
|
2734
|
+
* @public
|
|
2735
|
+
*/
|
|
2736
|
+
export declare class ConfigValidator extends ConfigValidator_base {
|
|
2737
|
+
static readonly layer: Layer.Layer<ConfigValidator, never, FileSystem.FileSystem>;
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* The analysis of an entry source treated as a candidate re-export barrel.
|
|
2741
|
+
*
|
|
2742
|
+
* @public
|
|
2743
|
+
*/
|
|
2744
|
+
interface ReexportBarrelAnalysis {
|
|
2745
|
+
/** Value (non-type-only) names the module re-exports, after `as` aliasing. */
|
|
2746
|
+
readonly valueNames: ReadonlyArray<string>;
|
|
2747
|
+
/** Type-only names the module re-exports (`export type { … }`), after `as` aliasing. */
|
|
2748
|
+
readonly typeNames: ReadonlyArray<string>;
|
|
2749
|
+
/**
|
|
2750
|
+
* True iff EVERY top-level statement is a NAMED re-export `from` another module
|
|
2751
|
+
* (`export { … } from "…"` / `export type { … } from "…"`). A module that declares anything
|
|
2752
|
+
* locally, re-exports a namespace (`export * as NS from`), star-re-exports (`export * from`), or
|
|
2753
|
+
* has a bare `export { … }` without `from` is NOT a pure named barrel and cannot be expressed as
|
|
2754
|
+
* a thin re-export stub of another entry.
|
|
2755
|
+
*/
|
|
2756
|
+
readonly isPureNamedReexportBarrel: boolean;
|
|
2757
|
+
}
|
|
2758
|
+
/**
|
|
2759
|
+
* The set of names a module exports, plus whether that set is fully known.
|
|
2760
|
+
*
|
|
2761
|
+
* @public
|
|
2762
|
+
*/
|
|
2763
|
+
interface ModuleExportNames {
|
|
2764
|
+
readonly names: ReadonlySet<string>;
|
|
2765
|
+
/**
|
|
2766
|
+
* False when the module contains a star re-export (`export * from "…"`) whose target exports
|
|
2767
|
+
* cannot be enumerated from this source alone — the name set is then a lower bound, not complete,
|
|
2768
|
+
* so callers must not use it for a strict subset decision.
|
|
2769
|
+
*/
|
|
2770
|
+
readonly complete: boolean;
|
|
2771
|
+
}
|
|
2772
|
+
/**
|
|
2773
|
+
* Analyze an entry source as a candidate pure re-export barrel: classify its re-exported names into
|
|
2774
|
+
* value vs type-only and report whether it is expressible as a thin stub. Pure parsing — no I/O.
|
|
2775
|
+
*
|
|
2776
|
+
* @public
|
|
2777
|
+
*/
|
|
2778
|
+
export declare function analyzeReexportBarrel(source: string, fileName?: string): ReexportBarrelAnalysis;
|
|
2779
|
+
/**
|
|
2780
|
+
* Collect every name a module exports (named re-exports, namespace re-exports, and local `export`
|
|
2781
|
+
* declarations). Used to test whether a barrel's re-exports are a strict subset of a base entry, so
|
|
2782
|
+
* a stub re-exporting from that base resolves every symbol. Pure parsing — no I/O.
|
|
2783
|
+
*
|
|
2784
|
+
* @public
|
|
2785
|
+
*/
|
|
2786
|
+
export declare function collectExportNames(source: string, fileName?: string): ModuleExportNames;
|
|
2787
|
+
/**
|
|
2788
|
+
* Render a thin re-export-stub `.d.ts`/`.d.cts` body: named re-exports of `valueNames` and
|
|
2789
|
+
* `typeNames` from `baseSpecifier` (the published file of the base entry, e.g. `./index.js` for the
|
|
2790
|
+
* ESM `.d.ts` or `./index.cjs` for the CJS `.d.cts`). Names are sorted so the output is
|
|
2791
|
+
* deterministic. Returns the empty string when there is nothing to re-export.
|
|
2792
|
+
*
|
|
2793
|
+
* @public
|
|
2794
|
+
*/
|
|
2795
|
+
export declare function renderReexportStub(options: {
|
|
2796
|
+
readonly valueNames: ReadonlyArray<string>;
|
|
2797
|
+
readonly typeNames: ReadonlyArray<string>;
|
|
2798
|
+
readonly baseSpecifier: string;
|
|
2799
|
+
}): string;
|
|
2800
|
+
export declare function findRelativeSpecifiers(source: string, fileName?: string): string[];
|
|
2801
|
+
/** @public */
|
|
2802
|
+
interface ResolvedTsconfigOptions {
|
|
2803
|
+
/** Absolute package root. */
|
|
2804
|
+
readonly cwd: string;
|
|
2805
|
+
/** TS `compilerOptions.jsx` override (e.g. "react-jsx"); wins over the resolved config. */
|
|
2806
|
+
readonly jsx?: string | undefined;
|
|
2807
|
+
/** TS `compilerOptions.jsxImportSource` override (e.g. "react"); wins over the resolved config. */
|
|
2808
|
+
readonly jsxImportSource?: string | undefined;
|
|
2809
|
+
}
|
|
2810
|
+
/** @public */
|
|
2811
|
+
interface ResolvedTsconfig {
|
|
2812
|
+
readonly compilerOptions: Record<string, unknown>;
|
|
2813
|
+
readonly include: ReadonlyArray<string>;
|
|
2814
|
+
readonly exclude: ReadonlyArray<string>;
|
|
2815
|
+
}
|
|
2816
|
+
/**
|
|
2817
|
+
* Build the portable absolute-path tsconfig object for the dts pass.
|
|
2818
|
+
*
|
|
2819
|
+
* @remarks
|
|
2820
|
+
* Resolves the package's own `<cwd>/tsconfig.json` (which extends the shared
|
|
2821
|
+
* `ecma.json` base) through `@effected/tsconfig-json`'s `TsconfigLoaderSync`, so the
|
|
2822
|
+
* result carries the package's real effective options — target, module, lib, strict,
|
|
2823
|
+
* jsx — with `${configDir}` already substituted to absolute paths. Only the dts-pass
|
|
2824
|
+
* overlay (composite/incremental/tsBuildInfoFile forced off, declarationMap forced on)
|
|
2825
|
+
* and an explicit jsx override are layered on top.
|
|
2826
|
+
*
|
|
2827
|
+
* `include`/`exclude` are NOT taken from the resolved config. The shared base includes
|
|
2828
|
+
* `__test__` and `lib` sources, which have no business in a declaration program; the
|
|
2829
|
+
* narrow list below is dts-pass-specific and deliberately held fixed.
|
|
2830
|
+
*
|
|
2831
|
+
* @public
|
|
2832
|
+
*/
|
|
2833
|
+
export declare function buildResolvedTsconfig(options: ResolvedTsconfigOptions): ResolvedTsconfig;
|
|
2834
|
+
/**
|
|
2835
|
+
* Write the resolved tsconfig to a temp file and return its absolute path.
|
|
2836
|
+
*
|
|
2837
|
+
* @public
|
|
2838
|
+
*/
|
|
2839
|
+
export declare function writeResolvedTsconfig(options: ResolvedTsconfigOptions): string;
|
|
2840
|
+
/**
|
|
2841
|
+
* What a dts-emit tsconfig adds for one partition.
|
|
2842
|
+
*
|
|
2843
|
+
* @public
|
|
2844
|
+
*/
|
|
2845
|
+
interface DtsEmitTsconfigOptions {
|
|
2846
|
+
/** The `paths` map of the bundled workspace siblings. Absent or empty, `paths` stays cleared. */
|
|
2847
|
+
readonly paths?: Readonly<Record<string, ReadonlyArray<string>>> | undefined;
|
|
2848
|
+
}
|
|
2849
|
+
/**
|
|
2850
|
+
* Derive a dts-EMIT variant of an already-written resolved tsconfig that adds
|
|
2851
|
+
* `stableTypeOrdering: true`, and return its path. This makes the TypeScript declaration emitter
|
|
2852
|
+
* (rolldown-plugin-dts' tsgo generator over this package's `typescript`) order union/type members
|
|
2853
|
+
* deterministically, so a multi-union `.d.ts` (e.g. an Effect `Layer.Layer<…>` requirement channel)
|
|
2854
|
+
* does not flip member order across otherwise-identical builds (#156). It is kept in a SEPARATE file
|
|
2855
|
+
* from the api-extractor tsconfig on purpose: `@microsoft/api-extractor` compiles with its own
|
|
2856
|
+
* bundled TypeScript 6, which predates the flag and hard-errors on the unknown compiler option — so
|
|
2857
|
+
* only the emit passes ever see it, while the api-extractor compile reads the original clean config.
|
|
2858
|
+
*
|
|
2859
|
+
* The wrapper is written for the tsgo generator, which opens it as a TypeScript PROJECT and then
|
|
2860
|
+
* looks every entry up by the realpath'd module id rolldown hands it — so it has to describe the
|
|
2861
|
+
* same file set under the same names:
|
|
2862
|
+
*
|
|
2863
|
+
* - `extends` names the base by its CANONICAL (symlink-free) path. Root files are resolved relative
|
|
2864
|
+
* to the base's directory, and on a symlinked base dir (macOS `/var` resolving to `/private/var`, a linked
|
|
2865
|
+
* checkout) a non-canonical name would key them differently from rolldown's ids and every entry
|
|
2866
|
+
* would fail with "No TypeScript Go project found".
|
|
2867
|
+
* - `files`/`include`/`exclude` are restated as ABSOLUTE paths under the base's directory. A base
|
|
2868
|
+
* that declares none would otherwise get TypeScript's default `**\/*` resolved against the
|
|
2869
|
+
* wrapper's own directory — the OS temp dir — so the project would be every stray temp file on
|
|
2870
|
+
* the machine and never the package's sources.
|
|
2871
|
+
*
|
|
2872
|
+
* The wrapper also ALWAYS clears `customConditions` and `paths` (written as `null`, which the TypeScript compiler
|
|
2873
|
+
* reads as removing an inherited value): the declaration program must resolve sibling packages the way the package
|
|
2874
|
+
* manifest says, never through a typecheck-only condition or path alias that would pull source files into the
|
|
2875
|
+
* emitted declarations. The one exception is `options.paths`, the bundled workspace siblings resolved to their built
|
|
2876
|
+
* declarations, which is the only `paths` map this file ever carries. The only reader of this file is the tsgo
|
|
2877
|
+
* declaration generator; nothing in the bundler reads it back through the kit's `TsconfigLoaderSync`, which rejects
|
|
2878
|
+
* `null` compiler options.
|
|
2879
|
+
*
|
|
2880
|
+
* Best-effort: if the base tsconfig cannot be read or parsed (e.g. a synthetic test path that was
|
|
2881
|
+
* never written), the original path is returned unchanged — the emit then simply keeps TS's
|
|
2882
|
+
* default ordering rather than aborting the build at this layer.
|
|
2883
|
+
*
|
|
2884
|
+
* @public
|
|
2885
|
+
*/
|
|
2886
|
+
export declare function writeDtsEmitTsconfig(resolvedTsconfigPath: string, options?: DtsEmitTsconfigOptions): string;
|
|
2887
|
+
/** @public */
|
|
2888
|
+
interface PackageJsonLike {
|
|
2889
|
+
readonly exports?: unknown;
|
|
2890
|
+
readonly bin?: unknown;
|
|
2891
|
+
}
|
|
2892
|
+
/** @public */
|
|
2893
|
+
interface ExtractOptions {
|
|
2894
|
+
readonly exportsAsIndexes?: boolean | undefined;
|
|
2895
|
+
/** Source paths to NOT turn into JS build entries (e.g. an exe entry compiled as a SEA). */
|
|
2896
|
+
readonly excludeSources?: ReadonlyArray<string> | undefined;
|
|
2897
|
+
}
|
|
2898
|
+
/** @public */
|
|
2899
|
+
interface ExtractResult {
|
|
2900
|
+
/** entry name to TS source path */
|
|
2901
|
+
readonly entries: Record<string, string>;
|
|
2902
|
+
/** entry name to original export key (for downstream output-map alignment) */
|
|
2903
|
+
readonly exportPaths: Record<string, string>;
|
|
2904
|
+
}
|
|
2905
|
+
/**
|
|
2906
|
+
* Map an export key to the tsdown entry name (the emitted output basename).
|
|
2907
|
+
*
|
|
2908
|
+
* `.` becomes `index`; otherwise the leading `./` is stripped and, unless
|
|
2909
|
+
* `exportsAsIndexes` is set, nested slashes are flattened to dashes
|
|
2910
|
+
* (e.g. `./changesets/markdownlint` to `changesets-markdownlint`). The manifest
|
|
2911
|
+
* transform reuses this so the declared output path always matches the emitted file.
|
|
2912
|
+
*
|
|
2913
|
+
* @internal
|
|
2914
|
+
*/
|
|
2915
|
+
export declare const createEntryName: (exportKey: string, exportsAsIndexes: boolean) => string;
|
|
2916
|
+
/** @public */
|
|
2917
|
+
export declare function extractEntries(pkg: PackageJsonLike, options?: ExtractOptions): ExtractResult;
|
|
2918
|
+
/** The declaration-file extension of a path, or undefined when it is not a declaration file. @public */
|
|
2919
|
+
export declare function declarationExt(p: string): ".d.ts" | ".d.cts" | ".d.mts" | undefined;
|
|
2920
|
+
/** Classification of a single export value for ambient-.d.ts handling. @public */
|
|
2921
|
+
type DtsExportClass = {
|
|
2922
|
+
readonly kind: "ambient";
|
|
2923
|
+
readonly source: string;
|
|
2924
|
+
} | {
|
|
2925
|
+
readonly kind: "mixed";
|
|
2926
|
+
} | {
|
|
2927
|
+
readonly kind: "none";
|
|
2928
|
+
};
|
|
2929
|
+
/**
|
|
2930
|
+
* Classify an export value:
|
|
2931
|
+
* - `ambient` — a types-only declaration source (bare `.d.ts` string, or `{ types: "*.d.ts" }` with no runtime source).
|
|
2932
|
+
* - `mixed` — a declaration `types` AND a compilable runtime source (`import`/`require`/`default` → `.ts`/`.tsx`).
|
|
2933
|
+
* - `none` — anything else (normal runtime export, json, etc.).
|
|
2934
|
+
* @public
|
|
2935
|
+
*/
|
|
2936
|
+
export declare function classifyDtsExport(value: unknown): DtsExportClass;
|
|
2937
|
+
/**
|
|
2938
|
+
* Output basename (including the preserved declaration extension) for an ambient export, derived
|
|
2939
|
+
* from the export KEY — consistent with how JS entries are named. @public
|
|
2940
|
+
*/
|
|
2941
|
+
export declare function ambientOutName(exportKey: string, source: string, exportsAsIndexes?: boolean): string;
|
|
2942
|
+
/**
|
|
2943
|
+
* The shared mixed-export error (Decision 2), used by both the extractor and the manifest transform. The reason ends
|
|
2944
|
+
* with the bare-string form to write instead, naming the export's runtime target when `value` holds one: a
|
|
2945
|
+
* hand-written `{ "types": "./dist/foo.d.ts", "import": "./dist/foo.js" }` becomes `"./foo": "./dist/foo.js"`, which
|
|
2946
|
+
* the bundler builds from `./src/foo.ts` and gives generated types. @public
|
|
2947
|
+
*/
|
|
2948
|
+
export declare function mixedDtsExportError(exportKey: string, value?: unknown): ConfigValidationError;
|
|
2949
|
+
/** One ambient `.d.ts` export resolved for copy + manifest. @public */
|
|
2950
|
+
interface AmbientDtsEntry {
|
|
2951
|
+
readonly exportKey: string;
|
|
2952
|
+
readonly source: string;
|
|
2953
|
+
readonly outName: string;
|
|
2954
|
+
}
|
|
2955
|
+
/** @public */
|
|
2956
|
+
interface ExtractAmbientOptions {
|
|
2957
|
+
readonly exportsAsIndexes?: boolean | undefined;
|
|
2958
|
+
}
|
|
2959
|
+
/**
|
|
2960
|
+
* Extract the types-only `.d.ts` exports from a package's `exports` map. Pure.
|
|
2961
|
+
* Throws {@link ConfigValidationError} on a mixed export (Decision 2) or an ambient-vs-ambient
|
|
2962
|
+
* output-name collision. @public
|
|
2963
|
+
*/
|
|
2964
|
+
export declare function extractAmbientDts(pkg: PackageJsonLike, options?: ExtractAmbientOptions): ReadonlyArray<AmbientDtsEntry>;
|
|
2965
|
+
/**
|
|
2966
|
+
* Throw {@link ConfigValidationError} if any ambient output name collides with a JS build-entry name.
|
|
2967
|
+
* The JS entry names carry no extension, so each ambient `outName` is compared with its declaration
|
|
2968
|
+
* extension stripped. @public
|
|
2969
|
+
*/
|
|
2970
|
+
export declare function assertNoEntryCollisions(jsEntryNames: ReadonlyArray<string>, ambient: ReadonlyArray<AmbientDtsEntry>): void;
|
|
2971
|
+
/**
|
|
2972
|
+
* Maps each build entry to its `package.json` export key: the key whose target is the entry's source, else `.`
|
|
2973
|
+
* for `index` and `./<name>` for the rest.
|
|
2974
|
+
*
|
|
2975
|
+
* @public
|
|
2976
|
+
*/
|
|
2977
|
+
export declare function deriveExportPaths(entries: Record<string, string>, exportsMap: Record<string, string> | undefined): Record<string, string>;
|
|
2978
|
+
/** @public */
|
|
2979
|
+
interface PackageJsonEntriesOptions extends ExtractOptions {
|
|
2980
|
+
/** In-memory package.json. If omitted, reads `<cwd>/package.json`. */
|
|
2981
|
+
readonly pkg?: PackageJsonLike;
|
|
2982
|
+
/** Working directory for reading package.json. Defaults to process.cwd(). */
|
|
2983
|
+
readonly cwd?: string;
|
|
2984
|
+
}
|
|
2985
|
+
/**
|
|
2986
|
+
* Derive a tsdown `entry` record (name to source path) from a package.json.
|
|
2987
|
+
*
|
|
2988
|
+
* @public
|
|
2989
|
+
*/
|
|
2990
|
+
export declare function packageJsonEntries(options?: PackageJsonEntriesOptions): Record<string, string>;
|
|
2991
|
+
/**
|
|
2992
|
+
* The exact filename `@tsdown/exe` emits for a SEA target, mirroring tsdown's
|
|
2993
|
+
* `resolveOutputFileName`: base fileName + `-<platform>-<arch>` + `.exe` on win.
|
|
2994
|
+
* Single source of truth so the manifest value never drifts from the on-disk file.
|
|
2995
|
+
*
|
|
2996
|
+
* @public
|
|
2997
|
+
*/
|
|
2998
|
+
export declare function computeExeFileName(fileName: string, target: ExeTarget): string;
|
|
2999
|
+
/**
|
|
3000
|
+
* A diagnostic flattened to a plain JSON object (only defined fields are present).
|
|
3001
|
+
*
|
|
3002
|
+
* @public
|
|
3003
|
+
*/
|
|
3004
|
+
interface PlainDiagnostic {
|
|
3005
|
+
source: DiagnosticEntry["source"];
|
|
3006
|
+
level: DiagnosticEntry["level"];
|
|
3007
|
+
text: string;
|
|
3008
|
+
code?: string;
|
|
3009
|
+
ciFatal?: boolean;
|
|
3010
|
+
file?: string;
|
|
3011
|
+
line?: number;
|
|
3012
|
+
column?: number;
|
|
3013
|
+
}
|
|
3014
|
+
/**
|
|
3015
|
+
* The aggregated build-issues artifact written to `dist/<target>/issues.json`.
|
|
3016
|
+
*
|
|
3017
|
+
* @public
|
|
3018
|
+
*/
|
|
3019
|
+
interface BuildIssues {
|
|
3020
|
+
generatedAt: string;
|
|
3021
|
+
package: string;
|
|
3022
|
+
target: "dev" | "prod";
|
|
3023
|
+
/**
|
|
3024
|
+
* Whether the build that produced this artifact reached its end without a terminal failure.
|
|
3025
|
+
*
|
|
3026
|
+
* The artifact is written on EVERY terminal path — success and failure alike — so a reader must
|
|
3027
|
+
* gate on this flag, not on `errors.length`. A crashed build (API Extractor blowing up, a racing
|
|
3028
|
+
* `rm -rf dist`) can leave all three diagnostic buckets empty; without this stamp that file is
|
|
3029
|
+
* byte-identical to a perfectly clean gate. Absent on artifacts written before this field existed;
|
|
3030
|
+
* treat a missing value as unknown rather than as a pass.
|
|
3031
|
+
*/
|
|
3032
|
+
buildOk: boolean;
|
|
3033
|
+
/** The terminal error that ended the build. Present only when `buildOk` is false. */
|
|
3034
|
+
failure?: {
|
|
3035
|
+
/** The error's `name` (e.g. `"Error"`, `"ConfigValidationError"`), when it has one. */
|
|
3036
|
+
name?: string;
|
|
3037
|
+
/** The error message, truncated to 2000 characters. */
|
|
3038
|
+
message: string;
|
|
3039
|
+
};
|
|
3040
|
+
warnings: ReadonlyArray<PlainDiagnostic>;
|
|
3041
|
+
errors: ReadonlyArray<PlainDiagnostic>;
|
|
3042
|
+
suppressed: ReadonlyArray<PlainDiagnostic>;
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* The schema of a {@link PlainDiagnostic}, for reading one back from `issues.json` or a journal.
|
|
3046
|
+
*
|
|
3047
|
+
* @public
|
|
3048
|
+
*/
|
|
3049
|
+
export declare const PlainDiagnosticSchema: Schema.Struct<{
|
|
3050
|
+
readonly source: Schema.Literals<readonly ["tsdown", "rolldown", "api-extractor", "meta", "config"]>;
|
|
3051
|
+
readonly level: Schema.Literals<readonly ["warn", "error"]>;
|
|
3052
|
+
readonly text: Schema.String;
|
|
3053
|
+
readonly code: Schema.optionalKey<Schema.String>;
|
|
3054
|
+
readonly ciFatal: Schema.optionalKey<Schema.Boolean>;
|
|
3055
|
+
readonly file: Schema.optionalKey<Schema.String>;
|
|
3056
|
+
readonly line: Schema.optionalKey<Schema.Number>;
|
|
3057
|
+
readonly column: Schema.optionalKey<Schema.Number>;
|
|
3058
|
+
}>;
|
|
3059
|
+
/**
|
|
3060
|
+
* The schema of a {@link BuildIssues} artifact, for reading `dist/<target>/issues.json` back.
|
|
3061
|
+
*
|
|
3062
|
+
* @remarks
|
|
3063
|
+
* `buildOk` is required here: an artifact without the stamp is unknown rather than a pass, so it does not decode.
|
|
3064
|
+
*
|
|
3065
|
+
* @public
|
|
3066
|
+
*/
|
|
3067
|
+
export declare const BuildIssuesSchema: Schema.Struct<{
|
|
3068
|
+
readonly generatedAt: Schema.String;
|
|
3069
|
+
readonly package: Schema.String;
|
|
3070
|
+
readonly target: Schema.Literals<readonly ["dev", "prod"]>;
|
|
3071
|
+
readonly buildOk: Schema.Boolean;
|
|
3072
|
+
readonly failure: Schema.optionalKey<Schema.Struct<{
|
|
3073
|
+
readonly name: Schema.optionalKey<Schema.String>;
|
|
3074
|
+
readonly message: Schema.String;
|
|
3075
|
+
}>>;
|
|
3076
|
+
readonly warnings: Schema.$Array<Schema.Struct<{
|
|
3077
|
+
readonly source: Schema.Literals<readonly ["tsdown", "rolldown", "api-extractor", "meta", "config"]>;
|
|
3078
|
+
readonly level: Schema.Literals<readonly ["warn", "error"]>;
|
|
3079
|
+
readonly text: Schema.String;
|
|
3080
|
+
readonly code: Schema.optionalKey<Schema.String>;
|
|
3081
|
+
readonly ciFatal: Schema.optionalKey<Schema.Boolean>;
|
|
3082
|
+
readonly file: Schema.optionalKey<Schema.String>;
|
|
3083
|
+
readonly line: Schema.optionalKey<Schema.Number>;
|
|
3084
|
+
readonly column: Schema.optionalKey<Schema.Number>;
|
|
3085
|
+
}>>;
|
|
3086
|
+
readonly errors: Schema.$Array<Schema.Struct<{
|
|
3087
|
+
readonly source: Schema.Literals<readonly ["tsdown", "rolldown", "api-extractor", "meta", "config"]>;
|
|
3088
|
+
readonly level: Schema.Literals<readonly ["warn", "error"]>;
|
|
3089
|
+
readonly text: Schema.String;
|
|
3090
|
+
readonly code: Schema.optionalKey<Schema.String>;
|
|
3091
|
+
readonly ciFatal: Schema.optionalKey<Schema.Boolean>;
|
|
3092
|
+
readonly file: Schema.optionalKey<Schema.String>;
|
|
3093
|
+
readonly line: Schema.optionalKey<Schema.Number>;
|
|
3094
|
+
readonly column: Schema.optionalKey<Schema.Number>;
|
|
3095
|
+
}>>;
|
|
3096
|
+
readonly suppressed: Schema.$Array<Schema.Struct<{
|
|
3097
|
+
readonly source: Schema.Literals<readonly ["tsdown", "rolldown", "api-extractor", "meta", "config"]>;
|
|
3098
|
+
readonly level: Schema.Literals<readonly ["warn", "error"]>;
|
|
3099
|
+
readonly text: Schema.String;
|
|
3100
|
+
readonly code: Schema.optionalKey<Schema.String>;
|
|
3101
|
+
readonly ciFatal: Schema.optionalKey<Schema.Boolean>;
|
|
3102
|
+
readonly file: Schema.optionalKey<Schema.String>;
|
|
3103
|
+
readonly line: Schema.optionalKey<Schema.Number>;
|
|
3104
|
+
readonly column: Schema.optionalKey<Schema.Number>;
|
|
3105
|
+
}>>;
|
|
3106
|
+
}>;
|
|
3107
|
+
/**
|
|
3108
|
+
* Flatten a build snapshot into the aggregated, de-duplicated issues artifact. Pure.
|
|
3109
|
+
*
|
|
3110
|
+
* `buildOk` defaults to `true`, so an existing caller that never fails keeps its current output plus
|
|
3111
|
+
* the stamp; a caller that also writes on a failure path MUST pass `buildOk: false` (and ideally the
|
|
3112
|
+
* `failure`), otherwise the artifact reads as a clean gate.
|
|
3113
|
+
*
|
|
3114
|
+
* @public
|
|
3115
|
+
*/
|
|
3116
|
+
export declare function flattenIssues(reports: ReadonlyArray<BuildReport>, opts: {
|
|
3117
|
+
target: "dev" | "prod";
|
|
3118
|
+
generatedAt: string;
|
|
3119
|
+
buildOk?: boolean | undefined;
|
|
3120
|
+
failure?: {
|
|
3121
|
+
name?: string | undefined;
|
|
3122
|
+
message: string;
|
|
3123
|
+
} | undefined;
|
|
3124
|
+
}): BuildIssues;
|
|
3125
|
+
/**
|
|
3126
|
+
* Serialize the issues artifact to pretty JSON with a trailing newline.
|
|
3127
|
+
*
|
|
3128
|
+
* @public
|
|
3129
|
+
*/
|
|
3130
|
+
export declare function serializeIssues(issues: BuildIssues): string;
|
|
3131
|
+
/**
|
|
3132
|
+
* Write the aggregated issues artifact to `<cwd>/dist/<target>/issues.json`. Returns the path written.
|
|
3133
|
+
*
|
|
3134
|
+
* The write is atomic: the JSON lands in a sibling temp file which is then `rename`d over the
|
|
3135
|
+
* destination, so a concurrent reader observes either the previous artifact or the complete new one,
|
|
3136
|
+
* never a torn or half-written file. Pass `buildOk: false` (plus `failure`, when there is an error to
|
|
3137
|
+
* report) on a failure path — see the `buildOk` field of `BuildIssues`.
|
|
3138
|
+
*
|
|
3139
|
+
* @public
|
|
3140
|
+
*/
|
|
3141
|
+
export declare const writeIssuesArtifact: (opts: {
|
|
3142
|
+
readonly cwd: string;
|
|
3143
|
+
readonly target: "dev" | "prod";
|
|
3144
|
+
readonly reports: ReadonlyArray<BuildReport>;
|
|
3145
|
+
readonly now?: () => Date;
|
|
3146
|
+
readonly buildOk?: boolean | undefined;
|
|
3147
|
+
readonly failure?: {
|
|
3148
|
+
readonly name?: string | undefined;
|
|
3149
|
+
readonly message: string;
|
|
3150
|
+
} | undefined;
|
|
3151
|
+
}) => Effect.Effect<string, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
|
|
3152
|
+
declare const IssueJournal_base: import("@effected/jsonl").JournalClass<IssueJournal, "effected/IssueJournal", readonly [JsonlEvent<"issue", Schema.Struct<{
|
|
3153
|
+
readonly source: Schema.Literals<readonly ["tsdown", "rolldown", "api-extractor", "meta", "config"]>;
|
|
3154
|
+
readonly level: Schema.Literals<readonly ["warn", "error"]>;
|
|
3155
|
+
readonly text: Schema.String;
|
|
3156
|
+
readonly code: Schema.optionalKey<Schema.String>;
|
|
3157
|
+
readonly ciFatal: Schema.optionalKey<Schema.Boolean>;
|
|
3158
|
+
readonly file: Schema.optionalKey<Schema.String>;
|
|
3159
|
+
readonly line: Schema.optionalKey<Schema.Number>;
|
|
3160
|
+
readonly column: Schema.optionalKey<Schema.Number>;
|
|
3161
|
+
readonly package: Schema.String;
|
|
3162
|
+
readonly generatedAt: Schema.String;
|
|
3163
|
+
}>, boolean, boolean>], never, never>;
|
|
3164
|
+
/**
|
|
3165
|
+
* The per-diagnostic journal: one line per error and warning of a build, in that order, scoped by package name.
|
|
3166
|
+
* Suppressed diagnostics stay in `issues.json` and are counted on the build's line.
|
|
3167
|
+
*
|
|
3168
|
+
* @public
|
|
3169
|
+
*/
|
|
3170
|
+
export declare class IssueJournal extends IssueJournal_base {
|
|
3171
|
+
/**
|
|
3172
|
+
* The journal at `<root>/.cache/effected/issues.jsonl`, with its directory and file created.
|
|
3173
|
+
*
|
|
3174
|
+
* @remarks
|
|
3175
|
+
* Every call is a fresh layer, and every build of one an independent journal: bind it to one const.
|
|
3176
|
+
*
|
|
3177
|
+
* @param root - The workspace root.
|
|
3178
|
+
*/
|
|
3179
|
+
static readonly layerAt: (root: string) => Layer.Layer<IssueJournal, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path | JournalWatcher>;
|
|
3180
|
+
}
|
|
3181
|
+
declare const BuildJournal_base: import("@effected/jsonl").JournalClass<BuildJournal, "effected/BuildJournal", readonly [JsonlEvent<"build", Schema.Struct<{
|
|
3182
|
+
readonly package: Schema.String;
|
|
3183
|
+
readonly cwd: Schema.String;
|
|
3184
|
+
readonly generatedAt: Schema.String;
|
|
3185
|
+
readonly buildOk: Schema.Boolean;
|
|
3186
|
+
readonly failure: Schema.optionalKey<Schema.Struct<{
|
|
3187
|
+
readonly name: Schema.optionalKey<Schema.String>;
|
|
3188
|
+
readonly message: Schema.String;
|
|
3189
|
+
}>>;
|
|
3190
|
+
readonly errors: Schema.Number;
|
|
3191
|
+
readonly warnings: Schema.Number;
|
|
3192
|
+
readonly suppressed: Schema.Number;
|
|
3193
|
+
readonly issuesPath: Schema.String;
|
|
3194
|
+
}>, boolean, boolean>], never, never>;
|
|
3195
|
+
/**
|
|
3196
|
+
* The per-build journal: one line per finished build, scoped by package name.
|
|
3197
|
+
*
|
|
3198
|
+
* @public
|
|
3199
|
+
*/
|
|
3200
|
+
export declare class BuildJournal extends BuildJournal_base {
|
|
3201
|
+
/**
|
|
3202
|
+
* The journal at `<root>/.cache/effected/build.jsonl`, with its directory and file created.
|
|
3203
|
+
*
|
|
3204
|
+
* @remarks
|
|
3205
|
+
* Every call is a fresh layer, and every build of one an independent journal: bind it to one const.
|
|
3206
|
+
*
|
|
3207
|
+
* @param root - The workspace root.
|
|
3208
|
+
*/
|
|
3209
|
+
static readonly layerAt: (root: string) => Layer.Layer<BuildJournal, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path | JournalWatcher>;
|
|
3210
|
+
/**
|
|
3211
|
+
* Appends one finished build: a line per error and warning, then the build's own line.
|
|
3212
|
+
*
|
|
3213
|
+
* @remarks
|
|
3214
|
+
* The build's line goes last, so a watcher that sees it finds that build's issues already written. Each line's
|
|
3215
|
+
* `scope` is the package name, which is what a read filters on. Parallel builds may record at once: each line is
|
|
3216
|
+
* one `O_APPEND` write.
|
|
3217
|
+
*
|
|
3218
|
+
* @param issues - The build's `issues.json`.
|
|
3219
|
+
* @param cwd - The package directory the artifact sits under.
|
|
3220
|
+
*/
|
|
3221
|
+
static readonly record: (issues: typeof BuildIssuesSchema.Type, cwd: string) => Effect.Effect<void, AppendError, BuildJournal | IssueJournal | Path.Path>;
|
|
3222
|
+
}
|
|
3223
|
+
/** @public */
|
|
3224
|
+
interface TargetGroupRef {
|
|
3225
|
+
readonly id: string;
|
|
3226
|
+
/** The package.json name this group's manifest carries (the declarative rename). */
|
|
3227
|
+
readonly name: string;
|
|
3228
|
+
readonly isProd: boolean;
|
|
3229
|
+
}
|
|
3230
|
+
/** @public */
|
|
3231
|
+
interface BuildEmittedManifestOptions {
|
|
3232
|
+
readonly pkg: Json;
|
|
3233
|
+
/** The package directory. Catalog and workspace specifiers resolve against the workspace found from here. */
|
|
3234
|
+
readonly cwd: string;
|
|
3235
|
+
readonly targetGroup: TargetGroupRef;
|
|
3236
|
+
readonly devManifest: "preserve" | "resolve";
|
|
3237
|
+
/** Top-level keys deleted from the emitted manifest, after the standard stripping. */
|
|
3238
|
+
readonly drop?: ReadonlyArray<string> | undefined;
|
|
3239
|
+
/** Top-level string keys written over the emitted manifest after `drop`; `name` is carried by `targetGroup`. */
|
|
3240
|
+
readonly set?: Readonly<Record<string, string>> | undefined;
|
|
3241
|
+
/** Which exports emit dual import/require conditions. boolean (uniform) or a Set of export keys (per-entry). */
|
|
3242
|
+
readonly dual?: DualExports | undefined;
|
|
3243
|
+
/** Export keys built into a `<key>/index.*` subdir (e.g. an RSPress `./runtime`). */
|
|
3244
|
+
readonly subdirExports?: ReadonlySet<string> | undefined;
|
|
3245
|
+
/** When set, rewrite exports/bin values equal to the exe source to the SEA path and add it to `files`. */
|
|
3246
|
+
readonly exeRewrite?: ExeRewrite | undefined;
|
|
3247
|
+
/** Whether the dts pass ran; `false` omits `types` conditions from the emitted manifest (issue #198). Defaults to `true`. */
|
|
3248
|
+
readonly emitDts?: boolean | undefined;
|
|
3249
|
+
}
|
|
3250
|
+
/**
|
|
3251
|
+
* Whether any of `pkg`'s four dependency fields carries at least one `catalog:`/`workspace:`
|
|
3252
|
+
* specifier. `resolveManifest` returns a manifest with none of these unchanged, so callers can
|
|
3253
|
+
* skip the CatalogResolver + pnpm-workspace + lockfile assembly entirely when this is false.
|
|
3254
|
+
*
|
|
3255
|
+
* @public
|
|
3256
|
+
*/
|
|
3257
|
+
export declare function manifestNeedsCatalogResolution(pkg: Json): boolean;
|
|
3258
|
+
/**
|
|
3259
|
+
* Compute the final manifest bytes for a TargetGroup (catalog resolution + standard transforms).
|
|
3260
|
+
*
|
|
3261
|
+
* @public
|
|
3262
|
+
*/
|
|
3263
|
+
export declare function buildEmittedManifest(options: BuildEmittedManifestOptions): Promise<Json>;
|
|
3264
|
+
/** @public */
|
|
3265
|
+
interface EmitManifestOptions {
|
|
3266
|
+
readonly targetGroup: TargetGroupRef;
|
|
3267
|
+
readonly devManifest?: "preserve" | "resolve" | undefined;
|
|
3268
|
+
/** Top-level keys deleted from the emitted manifest, after the standard stripping. */
|
|
3269
|
+
readonly drop?: ReadonlyArray<string> | undefined;
|
|
3270
|
+
/** Top-level string keys written over the emitted manifest after `drop`; `name` is carried by `targetGroup`. */
|
|
3271
|
+
readonly set?: Readonly<Record<string, string>> | undefined;
|
|
3272
|
+
/** Source package dir to read package.json/LICENSE/README from. */
|
|
3273
|
+
readonly sourceDir: string;
|
|
3274
|
+
/** Which exports emit dual import/require conditions. boolean (uniform) or a Set of export keys (per-entry). */
|
|
3275
|
+
readonly dual?: DualExports | undefined;
|
|
3276
|
+
/** Export keys built into a `<key>/index.*` subdir (e.g. an RSPress `./runtime`). */
|
|
3277
|
+
readonly subdirExports?: ReadonlySet<string> | undefined;
|
|
3278
|
+
/** When set, rewrite exports/bin values equal to the exe source to the SEA path and add it to `files`. */
|
|
3279
|
+
readonly exeRewrite?: ExeRewrite | undefined;
|
|
3280
|
+
/** Whether the dts pass ran; `false` omits `types` conditions from the emitted manifest (issue #198). Defaults to `true`. */
|
|
3281
|
+
readonly emitDts?: boolean | undefined;
|
|
3282
|
+
}
|
|
3283
|
+
/**
|
|
3284
|
+
* Rolldown plugin: emit the transformed package.json + LICENSE/README into the output pkg/ root.
|
|
3285
|
+
*
|
|
3286
|
+
* @public
|
|
3287
|
+
*/
|
|
3288
|
+
export declare function emitManifest(options: EmitManifestOptions): Plugin;
|
|
3289
|
+
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 & {
|
|
3290
|
+
readonly _tag: "OgGenerateError";
|
|
3291
|
+
} & Readonly<A>;
|
|
3292
|
+
/**
|
|
3293
|
+
* A configured `openGraph.generate` renderer threw, returned no bytes, or returned bytes that are
|
|
3294
|
+
* not an image. Fails the build: a half-written OG image is worse than none.
|
|
3295
|
+
*
|
|
3296
|
+
* @public
|
|
3297
|
+
*/
|
|
3298
|
+
export declare class OgGenerateError extends OgGenerateError_base<{
|
|
3299
|
+
readonly packageName: string;
|
|
3300
|
+
readonly cause: unknown;
|
|
3301
|
+
}> {
|
|
3302
|
+
get message(): string;
|
|
3303
|
+
}
|
|
3304
|
+
/**
|
|
3305
|
+
* The renderer an `[package.bundle.openGraph] generate` name selects.
|
|
3306
|
+
*
|
|
3307
|
+
* @remarks
|
|
3308
|
+
* Nothing renders here, but a build asking for an image fails now rather than after its passes when a peer is absent.
|
|
3309
|
+
* Both peers are optional, so the renderer's module and its peers load only for a package that asks. `importModule`
|
|
3310
|
+
* replaces the dynamic import of a peer.
|
|
3311
|
+
*
|
|
3312
|
+
* @public
|
|
3313
|
+
*/
|
|
3314
|
+
export declare const resolveOgGenerator: (name: "satori", options: {
|
|
3315
|
+
readonly packageName: string;
|
|
3316
|
+
readonly importModule?: (specifier: string) => Promise<unknown>;
|
|
3317
|
+
}) => Effect.Effect<OgImageGenerator, OgGenerateError>;
|
|
3318
|
+
/**
|
|
3319
|
+
* Where generated images persist across builds, and the salt naming the generator's identity.
|
|
3320
|
+
*
|
|
3321
|
+
* @public
|
|
3322
|
+
*/
|
|
3323
|
+
interface OgImageCacheOptions {
|
|
3324
|
+
readonly directory: string;
|
|
3325
|
+
/** Change it whenever the generator's output changes for the same input; the cache cannot see code. */
|
|
3326
|
+
readonly salt: string;
|
|
3327
|
+
}
|
|
3328
|
+
/**
|
|
3329
|
+
* The salt the cross-build cache runs under, or `undefined` to always regenerate: an explicit
|
|
3330
|
+
* `cacheSalt` string wins, `false` disables, and otherwise the generator's own salt applies.
|
|
3331
|
+
*
|
|
3332
|
+
* @public
|
|
3333
|
+
*/
|
|
3334
|
+
export declare function resolveOgCacheSalt(generate: OgImageGenerator, cacheSalt: string | false | undefined): string | undefined;
|
|
3335
|
+
/**
|
|
3336
|
+
* Options for {@link writeGeneratedOgImage}.
|
|
3337
|
+
*
|
|
3338
|
+
* @public
|
|
3339
|
+
*/
|
|
3340
|
+
interface WriteGeneratedOgImageOptions {
|
|
3341
|
+
readonly generate: (info: OgImageInfo) => Promise<Uint8Array>;
|
|
3342
|
+
readonly info: OgImageInfo;
|
|
3343
|
+
/** The meta bundle dir; the image lands at `og/<unscopedName>.<ext>` beneath it. */
|
|
3344
|
+
readonly outMetaDir: string;
|
|
3345
|
+
readonly unscopedName: string;
|
|
3346
|
+
/** Reuse a previous build's image for the same info and salt; omitted, the generator always runs. */
|
|
3347
|
+
readonly cache?: OgImageCacheOptions | undefined;
|
|
3348
|
+
}
|
|
3349
|
+
/**
|
|
3350
|
+
* Run the generator (or reuse a cached render), size the bytes, and write `og/<unscoped>.<ext>`
|
|
3351
|
+
* under the meta dir. Returns the manifest image entry (bundle-relative path, MIME type, dimensions).
|
|
3352
|
+
*
|
|
3353
|
+
* @public
|
|
3354
|
+
*/
|
|
3355
|
+
export declare function writeGeneratedOgImage(options: WriteGeneratedOgImageOptions): Promise<OpenGraphImage$1>;
|
|
3356
|
+
/**
|
|
3357
|
+
* Rewrite a meta `package.json` so the package's own `version` and any workspace-sibling
|
|
3358
|
+
* dependency version reflect their NEXT release version from `versions`. Pure: returns a new
|
|
3359
|
+
* object, never mutates the input. External/catalog-resolved deps (names absent from `versions`)
|
|
3360
|
+
* are left as-is.
|
|
3361
|
+
* @public
|
|
3362
|
+
*/
|
|
3363
|
+
export declare function rewriteMetaVersions(pkg: Record<string, unknown>, versions: ReadonlyMap<string, string>, selfName: string): Record<string, unknown>;
|
|
3364
|
+
/**
|
|
3365
|
+
* Compiler options with enum values converted to their string equivalents.
|
|
3366
|
+
*
|
|
3367
|
+
* @remarks
|
|
3368
|
+
* Open-ended record because TypeScript compiler options vary by version.
|
|
3369
|
+
*
|
|
3370
|
+
* @public
|
|
3371
|
+
*/
|
|
3372
|
+
interface ResolvedCompilerOptions {
|
|
3373
|
+
[key: string]: unknown;
|
|
3374
|
+
}
|
|
3375
|
+
/**
|
|
3376
|
+
* Portable, JSON-serializable tsconfig.json (compilerOptions-only).
|
|
3377
|
+
*
|
|
3378
|
+
* @remarks
|
|
3379
|
+
* Designed for virtual TypeScript environments (shiki/Twoslash, API Extractor)
|
|
3380
|
+
* where file paths and emit settings are controlled externally. Holds no
|
|
3381
|
+
* machine-specific absolute paths and no emit/path/file-selection options.
|
|
3382
|
+
*
|
|
3383
|
+
* @public
|
|
3384
|
+
*/
|
|
3385
|
+
interface PortableTsconfig {
|
|
3386
|
+
/** JSON schema for IDE support. */
|
|
3387
|
+
$schema: string;
|
|
3388
|
+
/** Compiler options with enum values converted to strings. */
|
|
3389
|
+
compilerOptions: ResolvedCompilerOptions;
|
|
3390
|
+
}
|
|
3391
|
+
/**
|
|
3392
|
+
* Resolves the package's effective compiler options (following `extends`) into a
|
|
3393
|
+
* portable, JSON-serializable tsconfig for the meta release bundle.
|
|
3394
|
+
*
|
|
3395
|
+
* @remarks
|
|
3396
|
+
* Resolves the package's own `<cwd>/tsconfig.json` (which extends the shared
|
|
3397
|
+
* `@effected/plugin/tsconfig/ecma.json` base) via `@effected/tsconfig-json`'s
|
|
3398
|
+
* synchronous `TsconfigLoaderSync` (tsc-parity `extends` resolution) so the
|
|
3399
|
+
* result carries the full effective options (target/module/strict/jsx/lib),
|
|
3400
|
+
* then projects them through the kit's `PortableTsconfig.make` allow-list
|
|
3401
|
+
* filter to a portable, compilerOptions-only shape with no absolute paths or
|
|
3402
|
+
* emit/file-selection options.
|
|
3403
|
+
*
|
|
3404
|
+
* When the package has no own `tsconfig.json` (e.g. a minimal test fixture),
|
|
3405
|
+
* falls back to `fallbackConfigPath` — the build's already-resolved dts tsconfig,
|
|
3406
|
+
* which always exists during a build. If neither is present, returns a minimal
|
|
3407
|
+
* portable config carrying only the virtual-environment flags.
|
|
3408
|
+
*
|
|
3409
|
+
* @param cwd - Absolute package root.
|
|
3410
|
+
* @param fallbackConfigPath - Optional resolved tsconfig to use when the package has no own one.
|
|
3411
|
+
* @returns The portable tsconfig object.
|
|
3412
|
+
*
|
|
3413
|
+
* @public
|
|
3414
|
+
*/
|
|
3415
|
+
export declare function resolvePortableTsconfig(cwd: string, fallbackConfigPath?: string): PortableTsconfig;
|
|
3416
|
+
/**
|
|
3417
|
+
* Rolldown plugin: append the CJS default-interop footer to ENTRY chunks of the
|
|
3418
|
+
* `cjs` format that export a default alongside named exports.
|
|
3419
|
+
*
|
|
3420
|
+
* Gated tightly so it never touches the wrong chunk:
|
|
3421
|
+
* - format must be `cjs` (ESM is untouched; `import().default` on ESM is already correct);
|
|
3422
|
+
* - the chunk must be an ENTRY chunk — never a SHARED chunk. Shared chunks are required by
|
|
3423
|
+
* entry chunks via their named bindings (e.g. `require_changesets.changesets_exports.X`);
|
|
3424
|
+
* reassigning a shared chunk's `module.exports` to its own default would break those reads
|
|
3425
|
+
* (many bundled vendor chunks carry an `exports.default`);
|
|
3426
|
+
* - the chunk must export a `default` AND at least one named export. A default-only chunk
|
|
3427
|
+
* already gets `module.exports = <default>` from rolldown, and a named-only chunk has no
|
|
3428
|
+
* default to promote.
|
|
3429
|
+
*
|
|
3430
|
+
* The emitted footer is also self-guarded (`module.exports.default !== void 0`), so it is a
|
|
3431
|
+
* runtime no-op whenever the static gate is ever too generous.
|
|
3432
|
+
* @public
|
|
3433
|
+
*/
|
|
3434
|
+
export declare function cjsDefaultInterop(): Plugin;
|
|
3435
|
+
/**
|
|
3436
|
+
* Rewrite a default import / default re-export of a Node built-in into the
|
|
3437
|
+
* equivalent NAMESPACE form, so rolldown's CJS codegen produces correct interop.
|
|
3438
|
+
*
|
|
3439
|
+
* Why this exists — a rolldown 1.1.0 codegen defect (verified against the latest
|
|
3440
|
+
* published rolldown 1.1.0 / tsdown 0.22.2, with no newer release to upgrade to):
|
|
3441
|
+
*
|
|
3442
|
+
* ```ts
|
|
3443
|
+
* // SOURCE (e.g. vfile's lib/minproc.js)
|
|
3444
|
+
* export {default as minproc} from 'node:process'
|
|
3445
|
+
* // ...consumed as minproc.cwd()
|
|
3446
|
+
*
|
|
3447
|
+
* // rolldown CJS OUTPUT (BROKEN)
|
|
3448
|
+
* let node_process = require("node:process");
|
|
3449
|
+
* node_process.default.cwd() // <- require("node:process").default is undefined
|
|
3450
|
+
* ```
|
|
3451
|
+
*
|
|
3452
|
+
* For a default import of an EXTERNAL Node builtin, rolldown emits a bare
|
|
3453
|
+
* `require("node:x")` WITHOUT its `__toESM` interop wrapper, yet still accesses
|
|
3454
|
+
* `.default` — which is `undefined` on a builtin's CJS export object, so the call
|
|
3455
|
+
* throws `Cannot read properties of undefined (reading 'cwd')` at runtime. NAMED
|
|
3456
|
+
* imports are unaffected (`(0, node_process.cwd)()` reads a real property), and a
|
|
3457
|
+
* NAMESPACE import is handled correctly: rolldown wraps it as
|
|
3458
|
+
* `node_process = __toESM(require("node:process"), 1)`, which synthesizes `.default`
|
|
3459
|
+
* and copies every own property, so member access works. This transform converts the
|
|
3460
|
+
* broken default form into the working namespace form BEFORE codegen, so it is immune
|
|
3461
|
+
* to minification and applies identically to per-module and bundled output.
|
|
3462
|
+
*
|
|
3463
|
+
* rolldown exposes no Rollup-style `output.interop` knob to fix this at the output
|
|
3464
|
+
* layer, which is why the correction happens here on the source.
|
|
3465
|
+
*
|
|
3466
|
+
* Rewrites (the two static forms that occur in practice, anchored to statement start):
|
|
3467
|
+
*
|
|
3468
|
+
* ```ts
|
|
3469
|
+
* import NAME from "node:x" -> import * as NAME from "node:x"
|
|
3470
|
+
* export { default as NAME } from "node:x" -> export * as NAME from "node:x"
|
|
3471
|
+
* import NAME, { a, b } from "node:x" -> import * as NAME from "node:x"; import { a, b } from "node:x"
|
|
3472
|
+
* ```
|
|
3473
|
+
*
|
|
3474
|
+
* The namespace binding NAME carries the builtin's named exports (`NAME.cwd`,
|
|
3475
|
+
* `NAME.join`, ...), which is exactly how a default import of a builtin is consumed
|
|
3476
|
+
* in practice. ESM output is unaffected at runtime (a namespace import of a builtin
|
|
3477
|
+
* resolves to the same members), so the plugin is safe to attach to dual builds.
|
|
3478
|
+
* @public
|
|
3479
|
+
*/
|
|
3480
|
+
export declare function nodeBuiltinDefaultInterop(): Plugin;
|
|
3481
|
+
/**
|
|
3482
|
+
* Remove declaration source-map files (`.d.ts.map` / `.d.cts.map`) from a built `pkg`
|
|
3483
|
+
* directory, returning the removed paths.
|
|
3484
|
+
*
|
|
3485
|
+
* The dts pass emits these next to each `.d.ts` (the resolved dts tsconfig sets
|
|
3486
|
+
* `declarationMap: true`) because API Extractor reads them during meta generation to
|
|
3487
|
+
* resolve original-source positions. But they are dead weight in a PUBLISHED package —
|
|
3488
|
+
* they reference `.ts` sources the tarball does not ship — and they leak local source
|
|
3489
|
+
* paths, so the prod build strips them AFTER meta generation has consumed them. The dev
|
|
3490
|
+
* build keeps them (it is never published, and `savvy build --target meta` reads them).
|
|
3491
|
+
*
|
|
3492
|
+
* Recurses, but skips `node_modules` so it does not traverse a self-contained bundle's
|
|
3493
|
+
* vendored tree — only the package's own emitted declarations carry maps worth stripping.
|
|
3494
|
+
* @public
|
|
3495
|
+
*/
|
|
3496
|
+
export declare const removeDeclarationMaps: (pkgDir: string) => Effect.Effect<ReadonlyArray<string>, DescendError | PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
|
|
3497
|
+
/**
|
|
3498
|
+
* Copy the CONTENTS of `sourceDir` into `outDir`, additively.
|
|
3499
|
+
*
|
|
3500
|
+
* Each `sourceDir/<rel>` copies to `outDir/<rel>` — only the `public/` directory itself is dropped;
|
|
3501
|
+
* the substructure under it is preserved (`public/tsconfig/ecma.json` becomes `<pkg>/tsconfig/ecma.json`,
|
|
3502
|
+
* NOT `<pkg>/ecma.json`). The published manifest mirrors this drop via `transformExports`, which strips
|
|
3503
|
+
* a leading `public/` from export values. This function NEVER deletes: `outDir` is the shared package
|
|
3504
|
+
* root that the JS/dts passes own, so deleting "files not in source" would wipe the build product.
|
|
3505
|
+
* Stale-asset pruning on a non-clean rebuild is therefore out of scope (a full build's `clean: true` handles it).
|
|
3506
|
+
*
|
|
3507
|
+
* Collision guard: when a destination already exists, identical bytes mean a prior copy of the same
|
|
3508
|
+
* asset (skipped); anything else — differing bytes, a directory where a file is needed, or a file
|
|
3509
|
+
* where a parent directory is needed — means a built output occupies that path, so it throws
|
|
3510
|
+
* {@link ConfigValidationError} rather than clobbering it or surfacing a raw fs error.
|
|
3511
|
+
* @public
|
|
3512
|
+
*/
|
|
3513
|
+
export declare function copyPublicDir(sourceDir: string, outDir: string): void;
|
|
3514
|
+
/** @public */
|
|
3515
|
+
interface CopyAmbientDtsOptions {
|
|
3516
|
+
/** The ambient exports to copy (from `extractAmbientDts`). */
|
|
3517
|
+
readonly ambient: ReadonlyArray<AmbientDtsEntry>;
|
|
3518
|
+
/** Package root the `source` paths are relative to. */
|
|
3519
|
+
readonly srcCwd: string;
|
|
3520
|
+
/** The built package dir to copy into (e.g. `dist/prod/npm/pkg`). */
|
|
3521
|
+
readonly outDir: string;
|
|
3522
|
+
}
|
|
3523
|
+
/**
|
|
3524
|
+
* Copy each ambient `.d.ts` export's source verbatim into `outDir/<outName>`, byte-stable (an
|
|
3525
|
+
* unchanged file keeps its timestamp). The copy is NOT compiled or bundled, so the build owns two
|
|
3526
|
+
* fast-fail checks: the source must exist, and it must be self-contained — a relative
|
|
3527
|
+
* import/export/reference would not resolve once the file is flattened to the package root.
|
|
3528
|
+
*
|
|
3529
|
+
* Throws {@link ConfigValidationError} on a missing source or any relative specifier.
|
|
3530
|
+
* @public
|
|
3531
|
+
*/
|
|
3532
|
+
export declare function copyAmbientDts(options: CopyAmbientDtsOptions): void;
|
|
3533
|
+
/**
|
|
3534
|
+
* Render a build report as GitHub Actions workflow-command annotations, one `::error` or `::warning`
|
|
3535
|
+
* line per diagnostic. Suppressed diagnostics are never annotated. Pure.
|
|
3536
|
+
*
|
|
3537
|
+
* @remarks
|
|
3538
|
+
* The text is a diagnostic's, so it is untrusted: control characters are removed, so it cannot repaint a terminal, and
|
|
3539
|
+
* property values have `:` and `,` escaped, so a file name cannot forge a property or end the list.
|
|
3540
|
+
*
|
|
3541
|
+
* @public
|
|
3542
|
+
*/
|
|
3543
|
+
export declare function renderCiAnnotations(report: BuildReport): ReadonlyArray<string>;
|
|
3544
|
+
/**
|
|
3545
|
+
* Rolldown plugin that records emitted-file metrics into the BuildCollector via writeBundle (which
|
|
3546
|
+
* fires for the JS pass AND the emitDtsOnly dts pass — verified against tsdown 0.22.3), plus a
|
|
3547
|
+
* defensive onLog for rolldown-level diagnostics that bypass tsdown's logger. Append it to each
|
|
3548
|
+
* build pass's `plugins` array. `bytes` is taken from the in-memory chunk/asset content (no fs);
|
|
3549
|
+
* `gzip` is computed only when `verbose`.
|
|
3550
|
+
*
|
|
3551
|
+
* Set `suppressMixedExports` for a pass whose emitted CJS carries the `cjsDefaultInterop()`
|
|
3552
|
+
* footer — see the onLog comment below for why rolldown's MIXED_EXPORTS advice does not apply
|
|
3553
|
+
* there.
|
|
3554
|
+
* @public
|
|
3555
|
+
*/
|
|
3556
|
+
export declare function buildMetricsPlugin(collector: BuildCollector, groupId: string, pass: PassKind, verbose: boolean, suppressMixedExports?: boolean): Plugin;
|
|
3557
|
+
/** @public */
|
|
3558
|
+
export declare function formatTime(ms: number): string;
|
|
3559
|
+
/** @public */
|
|
3560
|
+
interface Timer {
|
|
3561
|
+
readonly elapsed: () => number;
|
|
3562
|
+
readonly format: () => string;
|
|
3563
|
+
}
|
|
3564
|
+
/**
|
|
3565
|
+
* Create a wall-clock timer. (Date.now is fine in runtime build code.)
|
|
3566
|
+
*
|
|
3567
|
+
* @public
|
|
3568
|
+
*/
|
|
3569
|
+
export declare function createTimer(now?: () => number): Timer;
|
|
3570
|
+
/**
|
|
3571
|
+
* Structural match for tsdown's Logger interface (tsdown 0.22.x).
|
|
3572
|
+
*
|
|
3573
|
+
* @public
|
|
3574
|
+
*/
|
|
3575
|
+
interface TsdownLogger {
|
|
3576
|
+
level: "info";
|
|
3577
|
+
info: (...args: unknown[]) => void;
|
|
3578
|
+
warn: (...args: unknown[]) => void;
|
|
3579
|
+
warnOnce: (...args: unknown[]) => void;
|
|
3580
|
+
error: (...args: unknown[]) => void;
|
|
3581
|
+
success: (...args: unknown[]) => void;
|
|
3582
|
+
clearScreen: () => void;
|
|
3583
|
+
}
|
|
3584
|
+
/**
|
|
3585
|
+
* A tsdown `customLogger` that routes warnings/errors into the BuildCollector instead of the
|
|
3586
|
+
* console. Paired with `logLevel: "silent"` in the same build config: silent suppresses tsdown's
|
|
3587
|
+
* own console output while this logger still receives every message (verified against tsdown 0.22.3).
|
|
3588
|
+
* info/success are dropped — file metrics come from the writeBundle plugin and timing from our timer.
|
|
3589
|
+
* @public
|
|
3590
|
+
*/
|
|
3591
|
+
export declare function createTsdownLogger(collector: BuildCollector, groupId: string): TsdownLogger;
|
|
3592
|
+
/**
|
|
3593
|
+
* Write the target-to-group binding to dist/prod/targets.json for the release action to consume. Returns the path.
|
|
3594
|
+
*
|
|
3595
|
+
* @public
|
|
3596
|
+
*/
|
|
3597
|
+
export declare const writeTargetsBinding: (cwd: string, resolution: TargetResolution) => Effect.Effect<string, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
|
|
3598
|
+
/**
|
|
3599
|
+
* Resolve a `publishConfig.targets` map into the distinct groups to build and every target bound to one. Pure; throws ConfigValidationError on structurally-invalid config.
|
|
3600
|
+
*
|
|
3601
|
+
* @public
|
|
3602
|
+
*/
|
|
3603
|
+
export declare function resolveTargets(options: {
|
|
3604
|
+
targets: PublishTargets;
|
|
3605
|
+
baseName: string;
|
|
3606
|
+
}): TargetResolution;
|
|
3607
|
+
/**
|
|
3608
|
+
* Advisory warnings for a resolved target set that is valid but probably not what was meant.
|
|
3609
|
+
*
|
|
3610
|
+
* @remarks
|
|
3611
|
+
* Today the only one is a set whose every target is `releases: "prerelease"`, which leaves final
|
|
3612
|
+
* versions with nowhere to publish. A warning rather than a {@link ConfigValidationError}, since a
|
|
3613
|
+
* prerelease-only package is a legitimate if unusual setup. Pure; returns one message per finding.
|
|
3614
|
+
*
|
|
3615
|
+
* @public
|
|
3616
|
+
*/
|
|
3617
|
+
export declare function releaseWarnings(resolution: TargetResolution): ReadonlyArray<string>;
|
|
3618
|
+
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 };
|
|
3619
|
+
//# sourceMappingURL=index.d.ts.map
|