@effected/bundler 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Bundler.js +30 -27
- package/catalog/resolve-catalogs.js +6 -13
- package/changesets/next-versions.js +16 -22
- package/config/ActionConfig.js +90 -29
- package/config/BuildConfig.js +308 -104
- package/config/EffectedConfigSchema.js +37 -0
- package/dts/bundled-siblings.js +38 -42
- package/dts/resolved-tsconfig.js +44 -53
- package/entries/package-json-entries.js +2 -5
- package/index.d.ts +90 -28
- package/index.js +2 -1
- package/internal/exists.js +14 -0
- package/internal/native-realpath.js +15 -0
- package/manifest/emit-manifest.js +53 -28
- package/meta/api-extractor.js +42 -32
- package/meta/bundle-source.js +42 -58
- package/meta/generate.js +92 -101
- package/meta/og-image.js +29 -35
- package/meta/og-satori.js +10 -4
- package/meta/run-pass.js +44 -40
- package/meta/scrub-declaration-maps.js +16 -18
- package/meta/tsconfig-resolver.js +9 -16
- package/meta/tsdoc-config.js +6 -10
- package/package.json +9 -9
- package/passes/build-target-groups.js +97 -75
- package/passes/bundled-deps.js +62 -0
- package/passes/stamp-versions.js +121 -0
- package/passes/sync-public.js +52 -53
- package/passes/third-party-licenses.js +102 -0
- package/tsconfig/sync-options.js +0 -20
package/Bundler.js
CHANGED
|
@@ -44,7 +44,7 @@ var BundlerBuildResult = class extends Schema.Class("BundlerBuildResult")({
|
|
|
44
44
|
/** Where `targets.json` was written. */
|
|
45
45
|
targetsPath: Schema.UndefinedOr(Schema.String)
|
|
46
46
|
}) {};
|
|
47
|
-
const defaultRunMetaPass = (options) => import("./meta/run-pass.js")
|
|
47
|
+
const defaultRunMetaPass = (options) => Effect.flatMap(Effect.promise(() => import("./meta/run-pass.js")), (module) => module.runMetaPass(options));
|
|
48
48
|
const defaultRunExeBuild = (options) => import("./exe/build.js").then((module) => module.runExeBuild(options));
|
|
49
49
|
/** Reduce a thrown value to the `{ name?, message }` shape the issues artifact stamps on a failed build. */
|
|
50
50
|
function describeFailure(err) {
|
|
@@ -68,16 +68,14 @@ const readJsonOrUndefined = (file) => Effect.flatMap(Fs.FileSystem, (fs) => fs.r
|
|
|
68
68
|
/** Read and parse package.json at cwd, answering an empty object on any error. */
|
|
69
69
|
const readPackageJson = (cwd, path) => Effect.map(readJsonOrUndefined(path.join(cwd, "package.json")), (pkg) => pkg ?? {});
|
|
70
70
|
/** Write the resolved tsconfig with the resolved JSX settings in `compilerOptions`. */
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
}
|
|
71
|
+
const writeTsconfig = (cwd, jsx) => writeResolvedTsconfig({
|
|
72
|
+
cwd,
|
|
73
|
+
...jsx?.runtime === "automatic" ? {
|
|
74
|
+
jsx: "react-jsx",
|
|
75
|
+
jsxImportSource: jsx.importSource
|
|
76
|
+
} : {},
|
|
77
|
+
...jsx?.runtime === "classic" ? { jsx: "react" } : {}
|
|
78
|
+
});
|
|
81
79
|
/** The publish targets declared in `publishConfig.targets`; only the map form drives multi-target. */
|
|
82
80
|
function readPublishTargets(pkg) {
|
|
83
81
|
const declared = pkg.publishConfig?.targets;
|
|
@@ -178,8 +176,8 @@ const readEmittedExports = (cwd, groupId, path) => Effect.map(readJsonOrUndefine
|
|
|
178
176
|
* The optimistic next-version read for a package `set.name` renames: changesets key the release by the workspace
|
|
179
177
|
* package's own name, so the emitted name takes that entry's version.
|
|
180
178
|
*/
|
|
181
|
-
function aliasNextVersions(seam, sourceName, emittedName) {
|
|
182
|
-
const read = seam ?? ((cwd) => import("./changesets/next-versions.js").then((module) => module.resolveNextVersions(cwd)));
|
|
179
|
+
function aliasNextVersions(seam, sourceName, emittedName, run) {
|
|
180
|
+
const read = seam ?? ((cwd) => import("./changesets/next-versions.js").then((module) => run(module.resolveNextVersions(cwd))));
|
|
183
181
|
return async (cwd) => {
|
|
184
182
|
const { versions } = await read(cwd);
|
|
185
183
|
const own = versions.get(sourceName);
|
|
@@ -211,15 +209,16 @@ function resolveConfiguredGenerator(options, packageName, groups, collector, sea
|
|
|
211
209
|
})));
|
|
212
210
|
}
|
|
213
211
|
/**
|
|
214
|
-
* The orchestration. Its own reads and writes
|
|
215
|
-
* API Extractor and the SEA compiler stay promise-returning
|
|
216
|
-
* reaches {@link Bundler.build} as the thrown value itself
|
|
217
|
-
*
|
|
212
|
+
* The orchestration. Its own reads and writes, and those of the JS, declaration and meta passes, go through
|
|
213
|
+
* `FileSystem` and `Path`. tsdown, API Extractor and the SEA compiler stay promise-returning or synchronous and work
|
|
214
|
+
* on the host disk; a rejection from one reaches {@link Bundler.build} as the thrown value itself, and so does a
|
|
215
|
+
* promise-typed seam's. The issues artifact is written on the way out of either terminal path.
|
|
218
216
|
*/
|
|
219
217
|
const runBuild = Effect.fnUntraced(function* (options, collector, progress) {
|
|
220
218
|
const { cwd, config, noExe, verbose, seams = {} } = options;
|
|
221
219
|
const fs = yield* Fs.FileSystem;
|
|
222
220
|
const path = yield* PathService.Path;
|
|
221
|
+
const services = yield* Effect.context();
|
|
223
222
|
const { join, resolve } = path;
|
|
224
223
|
let issuesPath = join(cwd, "dist", "prod", "issues.json");
|
|
225
224
|
const writeIssuesBestEffort = (err) => {
|
|
@@ -247,7 +246,7 @@ const runBuild = Effect.fnUntraced(function* (options, collector, progress) {
|
|
|
247
246
|
const pkg = stripBuiltCondition(sourcePkg);
|
|
248
247
|
const tsconfigJsx = seams.readTsconfigJsx !== void 0 ? seams.readTsconfigJsx(cwd) : yield* readTsconfigJsx(cwd);
|
|
249
248
|
const jsx = resolveJsxConfig(tsconfigJsx, config.jsx);
|
|
250
|
-
const tsconfigPath =
|
|
249
|
+
const tsconfigPath = seams.writeTsconfig !== void 0 ? seams.writeTsconfig(cwd, jsx) : yield* writeTsconfig(cwd, jsx);
|
|
251
250
|
const exportsMap = pkg.exports;
|
|
252
251
|
const publishTargets = readPublishTargets(pkg);
|
|
253
252
|
const osCpu = {
|
|
@@ -318,8 +317,7 @@ const runBuild = Effect.fnUntraced(function* (options, collector, progress) {
|
|
|
318
317
|
});
|
|
319
318
|
if (hasJsEntries || config.exe === void 0) {
|
|
320
319
|
progress.phase = "js";
|
|
321
|
-
const
|
|
322
|
-
yield* Effect.promise(() => buildGroups({
|
|
320
|
+
const buildOptions = {
|
|
323
321
|
cwd,
|
|
324
322
|
version,
|
|
325
323
|
entry: baseEntries,
|
|
@@ -350,7 +348,10 @@ const runBuild = Effect.fnUntraced(function* (options, collector, progress) {
|
|
|
350
348
|
...config.copy.length > 0 ? { copy: config.copy } : {},
|
|
351
349
|
...options.plugins.length > 0 ? { extraPlugins: options.plugins } : {},
|
|
352
350
|
...exeRewrite !== void 0 ? { exeRewrite } : {}
|
|
353
|
-
}
|
|
351
|
+
};
|
|
352
|
+
const buildGroups = seams.buildTargetGroups;
|
|
353
|
+
if (buildGroups !== void 0) yield* Effect.promise(() => buildGroups(buildOptions));
|
|
354
|
+
else yield* buildTargetGroups(buildOptions);
|
|
354
355
|
}
|
|
355
356
|
progress.phase = "manifest";
|
|
356
357
|
const targetsPath = seams.writeTargetsBinding !== void 0 ? seams.writeTargetsBinding(cwd, resolution) : yield* writeTargetsBinding(cwd, resolution);
|
|
@@ -358,8 +359,7 @@ const runBuild = Effect.fnUntraced(function* (options, collector, progress) {
|
|
|
358
359
|
progress.phase = "meta";
|
|
359
360
|
const generate = yield* resolveConfiguredGenerator(options, packageName, groups, collector, seams);
|
|
360
361
|
const bundleMeta = options.bundle !== void 0 ? bundleMetaOptionsOf(options.bundle, generate) : void 0;
|
|
361
|
-
const
|
|
362
|
-
yield* Effect.promise(() => runMetaPass({
|
|
362
|
+
const metaPassOptions = {
|
|
363
363
|
cwd,
|
|
364
364
|
packageName,
|
|
365
365
|
tsconfigPath,
|
|
@@ -375,8 +375,11 @@ const runBuild = Effect.fnUntraced(function* (options, collector, progress) {
|
|
|
375
375
|
ci: options.ci,
|
|
376
376
|
targets: resolution.targets,
|
|
377
377
|
...seams.generateMeta !== void 0 ? { generateMeta: seams.generateMeta } : {},
|
|
378
|
-
...packageName !== sourceName ? { resolveNextVersions: aliasNextVersions(seams.resolveNextVersions, sourceName, packageName) } : seams.resolveNextVersions !== void 0 ? { resolveNextVersions: seams.resolveNextVersions } : {}
|
|
379
|
-
}
|
|
378
|
+
...packageName !== sourceName ? { resolveNextVersions: aliasNextVersions(seams.resolveNextVersions, sourceName, packageName, Effect.runPromiseWith(services)) } : seams.resolveNextVersions !== void 0 ? { resolveNextVersions: seams.resolveNextVersions } : {}
|
|
379
|
+
};
|
|
380
|
+
const runMetaPass = seams.runMetaPass;
|
|
381
|
+
if (runMetaPass !== void 0) yield* Effect.promise(() => runMetaPass(metaPassOptions));
|
|
382
|
+
else yield* defaultRunMetaPass(metaPassOptions);
|
|
380
383
|
}
|
|
381
384
|
progress.phase = "dts";
|
|
382
385
|
for (const g of groups) yield* removeDeclarationMaps(join(cwd, "dist", "prod", g.id, "pkg"));
|
|
@@ -384,7 +387,7 @@ const runBuild = Effect.fnUntraced(function* (options, collector, progress) {
|
|
|
384
387
|
const outDir = join(cwd, "dist", "prod", g.id, "pkg");
|
|
385
388
|
if (!hasJsEntries) {
|
|
386
389
|
progress.phase = "manifest";
|
|
387
|
-
const manifest = yield*
|
|
390
|
+
const manifest = yield* buildEmittedManifest({
|
|
388
391
|
pkg,
|
|
389
392
|
cwd,
|
|
390
393
|
targetGroup: {
|
|
@@ -396,7 +399,7 @@ const runBuild = Effect.fnUntraced(function* (options, collector, progress) {
|
|
|
396
399
|
drop: config.manifest.drop,
|
|
397
400
|
set: config.manifest.set,
|
|
398
401
|
exeRewrite
|
|
399
|
-
})
|
|
402
|
+
});
|
|
400
403
|
yield* fs.makeDirectory(outDir, { recursive: true });
|
|
401
404
|
yield* fs.writeFileString(join(outDir, "package.json"), `${JSON.stringify(manifest, null, " ")}\n`);
|
|
402
405
|
for (const file of ["LICENSE", "README.md"]) yield* fs.copyFile(join(cwd, file), join(outDir, file)).pipe(Effect.ignore);
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { Effect
|
|
1
|
+
import { Effect } from "effect";
|
|
2
2
|
import { Manifest } from "@effected/npm";
|
|
3
|
-
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
|
|
4
|
-
import * as NodePath from "@effect/platform-node/NodePath";
|
|
5
3
|
import { Workspaces } from "@effected/workspaces";
|
|
6
4
|
|
|
7
5
|
// src/catalog/resolve-catalogs.ts
|
|
8
|
-
/** Bound once: the platform layer is stateless and layers memoize by reference. */
|
|
9
|
-
const platform = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
|
|
10
6
|
/**
|
|
11
7
|
* Resolve every `catalog:`/`workspace:` specifier in a manifest to a concrete spec,
|
|
12
8
|
* delegating to `@effected/workspaces`' one-shot `Workspaces.resolveManifest`. The
|
|
@@ -15,18 +11,15 @@ const platform = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
|
|
|
15
11
|
* config-dependency hook-replay + lockfile), so no transient
|
|
16
12
|
* `.pnpm-workspace-state-v1.json` is required.
|
|
17
13
|
*
|
|
18
|
-
*
|
|
14
|
+
* Fails with `ManifestDecodeError` when a dependency field is not a string-to-string
|
|
19
15
|
* record, `UnresolvedDependencyError` on a specifier the workspace cannot answer, or
|
|
20
16
|
* `CatalogAssemblyError`/`DependencyResolutionError` when catalog assembly or the
|
|
21
17
|
* resolution mechanism itself fails.
|
|
22
18
|
* @public
|
|
23
19
|
*/
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
return Effect.runPromise(program.pipe(Effect.provide(platform)));
|
|
30
|
-
}
|
|
20
|
+
const resolveManifest = (pkg, cwd) => Effect.gen(function* () {
|
|
21
|
+
const manifest = yield* Manifest.decode(pkg);
|
|
22
|
+
return (manifest.needsResolution ? yield* Workspaces.resolveManifest(manifest, { cwd }) : manifest).toRecord();
|
|
23
|
+
});
|
|
31
24
|
|
|
32
25
|
export { resolveManifest };
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import { Effect
|
|
2
|
-
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
|
|
3
|
-
import * as NodePath from "@effect/platform-node/NodePath";
|
|
1
|
+
import { Effect } from "effect";
|
|
4
2
|
import { WorkspaceDiscovery, Workspaces } from "@effected/workspaces";
|
|
5
3
|
import { ReleasePlan } from "@effected/changesets";
|
|
6
4
|
|
|
7
5
|
// src/changesets/next-versions.ts
|
|
8
|
-
/** Bound once: the platform layer is stateless and layers memoize by reference. */
|
|
9
|
-
const platform = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
|
|
10
6
|
/**
|
|
11
7
|
* Resolve the next release version of every workspace package from pending changesets.
|
|
12
8
|
*
|
|
13
9
|
* Walks up from `cwd` to the monorepo root via `@effected/workspaces`' `WorkspaceDiscovery`,
|
|
14
10
|
* seeds the map with each package's CURRENT version, then overlays `newVersion` for
|
|
15
11
|
* changeset-affected packages via `ReleasePlan.read`, including pre-release versions in pre
|
|
16
|
-
* mode and fixed or linked groups. Never
|
|
12
|
+
* mode and fixed or linked groups. Never fails: any failure (not a workspace, missing
|
|
17
13
|
* `.changeset/config.json`, an invalid config or `pre.json`, parse error) degrades to current
|
|
18
14
|
* versions (or an empty map).
|
|
19
15
|
* @public
|
|
20
16
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const packages =
|
|
25
|
-
return yield* (yield* WorkspaceDiscovery).listPackages();
|
|
26
|
-
}).pipe(Effect.provide(workspace)));
|
|
17
|
+
const resolveNextVersions = (cwd) => {
|
|
18
|
+
const workspace = Workspaces.layer({ cwd });
|
|
19
|
+
return Effect.gen(function* () {
|
|
20
|
+
const packages = yield* Effect.flatMap(WorkspaceDiscovery, (discovery) => discovery.listPackages()).pipe(Effect.provide(workspace));
|
|
27
21
|
const rootDir = packages[0]?.isRootWorkspace ? packages[0].path : cwd;
|
|
28
22
|
const versions = /* @__PURE__ */ new Map();
|
|
29
23
|
for (const p of packages) {
|
|
@@ -31,20 +25,20 @@ async function resolveNextVersions(cwd) {
|
|
|
31
25
|
if (p.version === void 0) continue;
|
|
32
26
|
versions.set(p.name, p.version);
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
const plan = await Effect.runPromise(ReleasePlan.read(rootDir).pipe(Effect.provide(workspace)));
|
|
28
|
+
yield* ReleasePlan.read(rootDir).pipe(Effect.provide(workspace), Effect.tap((plan) => Effect.sync(() => {
|
|
36
29
|
for (const r of plan.releases) versions.set(r.name, r.newVersion);
|
|
37
|
-
}
|
|
30
|
+
})), Effect.orElseSucceed(() => void 0), Effect.catchDefect(() => Effect.void));
|
|
38
31
|
return {
|
|
39
32
|
root: rootDir,
|
|
40
33
|
versions
|
|
41
34
|
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
35
|
+
}).pipe(Effect.orElseSucceed(() => ({
|
|
36
|
+
root: cwd,
|
|
37
|
+
versions: /* @__PURE__ */ new Map()
|
|
38
|
+
})), Effect.catchDefect(() => Effect.succeed({
|
|
39
|
+
root: cwd,
|
|
40
|
+
versions: /* @__PURE__ */ new Map()
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
49
43
|
|
|
50
44
|
export { resolveNextVersions };
|
package/config/ActionConfig.js
CHANGED
|
@@ -9,9 +9,12 @@ import { Effect, Schema } from "effect";
|
|
|
9
9
|
*
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
|
-
var ActionWorker = class extends Schema.Class("ActionWorker")({
|
|
12
|
+
var ActionWorker = class extends Schema.Class("ActionWorker")(Schema.Struct({
|
|
13
13
|
/** The worker's source, relative to the package. */
|
|
14
|
-
source: Schema.String
|
|
14
|
+
source: Schema.String.annotate({
|
|
15
|
+
description: "The worker's source, relative to the package.",
|
|
16
|
+
examples: ["src/worker.ts"]
|
|
17
|
+
}),
|
|
15
18
|
/**
|
|
16
19
|
* Whether this worker's bundle is imported after the build to prove it loads.
|
|
17
20
|
*
|
|
@@ -20,8 +23,14 @@ var ActionWorker = class extends Schema.Class("ActionWorker")({
|
|
|
20
23
|
* action passes through the environment is missing. `[action.build] importCheck = false` still turns the check off
|
|
21
24
|
* for every bundle, this one included.
|
|
22
25
|
*/
|
|
23
|
-
importCheck: Schema.Boolean.
|
|
24
|
-
|
|
26
|
+
importCheck: Schema.Boolean.annotate({
|
|
27
|
+
description: "Whether this worker's bundle is imported after the build to prove it loads. [action.build] importCheck = false turns the check off for every bundle, this one included.",
|
|
28
|
+
default: true
|
|
29
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed(true)))
|
|
30
|
+
}).annotate({
|
|
31
|
+
title: "Action worker",
|
|
32
|
+
description: "A worker written as a table, for a worker that needs more than its source. A plain string is the source with every setting at its default."
|
|
33
|
+
})) {};
|
|
25
34
|
/**
|
|
26
35
|
* The bundles a GitHub Action ships, the `[action.entries]` table.
|
|
27
36
|
*
|
|
@@ -31,19 +40,29 @@ var ActionWorker = class extends Schema.Class("ActionWorker")({
|
|
|
31
40
|
*
|
|
32
41
|
* @public
|
|
33
42
|
*/
|
|
34
|
-
var ActionEntries = class extends Schema.Class("ActionEntries")({
|
|
43
|
+
var ActionEntries = class extends Schema.Class("ActionEntries")(Schema.Struct({
|
|
35
44
|
/** The main entry point's source. */
|
|
36
|
-
main: Schema.String.
|
|
45
|
+
main: Schema.String.annotate({
|
|
46
|
+
description: "The main entry point's source.",
|
|
47
|
+
default: "src/main.ts"
|
|
48
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed("src/main.ts"))),
|
|
37
49
|
/** The source of the entry that runs before `main`. */
|
|
38
|
-
pre: Schema.optionalKey(Schema.String),
|
|
50
|
+
pre: Schema.optionalKey(Schema.String.annotate({ description: "The source of the entry that runs before main. Absent, a conventional src/pre.ts builds when it exists." })),
|
|
39
51
|
/** The source of the entry that runs after `main`, for cleanup. */
|
|
40
|
-
post: Schema.optionalKey(Schema.String),
|
|
52
|
+
post: Schema.optionalKey(Schema.String.annotate({ description: "The source of the entry that runs after main, for cleanup. Absent, a conventional src/post.ts builds when it exists." })),
|
|
41
53
|
/**
|
|
42
54
|
* Extra bundles outside the lifecycle, each emitted as `dist/<name>.js`: a name to its source, or to an
|
|
43
55
|
* {@link ActionWorker} table.
|
|
44
56
|
*/
|
|
45
|
-
workers: Schema.Record(Schema.String, Schema.Union([Schema.String, ActionWorker])
|
|
46
|
-
|
|
57
|
+
workers: Schema.Record(Schema.String, Schema.Union([Schema.String, ActionWorker]).annotate({ description: "The worker's source, or a table of its settings." })).annotate({
|
|
58
|
+
description: "Extra bundles outside the lifecycle, each emitted as dist/<name>.js: a name to its source, or to a table of its own.",
|
|
59
|
+
default: {},
|
|
60
|
+
examples: [{ telemetry: "src/telemetry.ts" }]
|
|
61
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed({})))
|
|
62
|
+
}).annotate({
|
|
63
|
+
title: "Action entries",
|
|
64
|
+
description: "The bundles the action ships, the [action.entries] table. main, pre and post are the lifecycle entries action.yml runs; a worker is a bundle the action loads itself."
|
|
65
|
+
})) {};
|
|
47
66
|
/**
|
|
48
67
|
* How an action's bundles are built, the `[action.build]` table.
|
|
49
68
|
*
|
|
@@ -54,20 +73,32 @@ var ActionEntries = class extends Schema.Class("ActionEntries")({
|
|
|
54
73
|
*
|
|
55
74
|
* @public
|
|
56
75
|
*/
|
|
57
|
-
var ActionBuildOptions = class extends Schema.Class("ActionBuildOptions")({
|
|
76
|
+
var ActionBuildOptions = class extends Schema.Class("ActionBuildOptions")(Schema.Struct({
|
|
58
77
|
/** Whether to minify the bundles. */
|
|
59
|
-
minify: Schema.Boolean.
|
|
78
|
+
minify: Schema.Boolean.annotate({
|
|
79
|
+
description: "Whether to minify the bundles.",
|
|
80
|
+
default: true
|
|
81
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed(true))),
|
|
60
82
|
/** Whether to generate source maps. */
|
|
61
|
-
sourceMap: Schema.Boolean.
|
|
83
|
+
sourceMap: Schema.Boolean.annotate({
|
|
84
|
+
description: "Whether to generate source maps.",
|
|
85
|
+
default: false
|
|
86
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed(false))),
|
|
62
87
|
/** Packages left out of the bundles and imported at runtime, in addition to `node:` builtins. */
|
|
63
|
-
externals: Schema.Array(Schema.String).
|
|
88
|
+
externals: Schema.Array(Schema.String).annotate({
|
|
89
|
+
description: "Packages left out of the bundles and imported at runtime, beside node: builtins.",
|
|
90
|
+
default: []
|
|
91
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed([]))),
|
|
64
92
|
/**
|
|
65
93
|
* Packages left out of the bundles and replaced with a stub that throws if it is ever loaded.
|
|
66
94
|
*
|
|
67
95
|
* @remarks
|
|
68
96
|
* For an optional transitive dependency the action never exercises, such as a native module.
|
|
69
97
|
*/
|
|
70
|
-
ignore: Schema.Array(Schema.String).
|
|
98
|
+
ignore: Schema.Array(Schema.String).annotate({
|
|
99
|
+
description: "Packages left out of the bundles and replaced with a stub that throws if loaded, for an optional dependency the action never exercises.",
|
|
100
|
+
default: []
|
|
101
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed([]))),
|
|
71
102
|
/**
|
|
72
103
|
* Whether to import each bundle in a fresh Node after building it, which proves it loads.
|
|
73
104
|
*
|
|
@@ -76,34 +107,61 @@ var ActionBuildOptions = class extends Schema.Class("ActionBuildOptions")({
|
|
|
76
107
|
* with no `GITHUB_ACTIONS` guard around its program, because the import runs that program for real. To exempt one
|
|
77
108
|
* worker and keep the check on the rest, set `importCheck = false` in that worker's own table instead.
|
|
78
109
|
*/
|
|
79
|
-
importCheck: Schema.Boolean.
|
|
80
|
-
|
|
110
|
+
importCheck: Schema.Boolean.annotate({
|
|
111
|
+
description: "Whether to import each bundle in a fresh Node after building it, proving it loads. Turn it off for an action with no GITHUB_ACTIONS guard, because the import runs it for real.",
|
|
112
|
+
default: true
|
|
113
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed(true)))
|
|
114
|
+
}).annotate({
|
|
115
|
+
title: "Action build",
|
|
116
|
+
description: "How the action's bundles are built, the [action.build] table."
|
|
117
|
+
})) {};
|
|
81
118
|
/**
|
|
82
119
|
* What an action build checks before it builds, the `[action.validation]` table.
|
|
83
120
|
*
|
|
84
121
|
* @public
|
|
85
122
|
*/
|
|
86
|
-
var ActionValidationOptions = class extends Schema.Class("ActionValidationOptions")({
|
|
123
|
+
var ActionValidationOptions = class extends Schema.Class("ActionValidationOptions")(Schema.Struct({
|
|
87
124
|
/** Whether `action.yml` must exist and be valid. */
|
|
88
|
-
requireActionYml: Schema.Boolean.
|
|
125
|
+
requireActionYml: Schema.Boolean.annotate({
|
|
126
|
+
description: "Whether action.yml must exist and be valid.",
|
|
127
|
+
default: true
|
|
128
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed(true))),
|
|
89
129
|
/** The size past which a bundle is reported, such as `"5mb"` or `"500kb"`. */
|
|
90
|
-
maxBundleSize: Schema.optionalKey(Schema.String
|
|
130
|
+
maxBundleSize: Schema.optionalKey(Schema.String.annotate({
|
|
131
|
+
description: "The size past which a bundle is reported.",
|
|
132
|
+
examples: ["5mb", "500kb"]
|
|
133
|
+
})),
|
|
91
134
|
/** Whether a warning is an error. Absent means it is under CI and is not locally. */
|
|
92
|
-
strict: Schema.optionalKey(Schema.Boolean)
|
|
93
|
-
})
|
|
135
|
+
strict: Schema.optionalKey(Schema.Boolean.annotate({ description: "Whether a warning is an error. Absent, it is under CI and is not locally." }))
|
|
136
|
+
}).annotate({
|
|
137
|
+
title: "Action validation",
|
|
138
|
+
description: "What an action build checks before it builds, the [action.validation] table."
|
|
139
|
+
})) {};
|
|
94
140
|
/**
|
|
95
141
|
* The local copy of an action's build for testing with nektos/act, the `[action.persistLocal]` table.
|
|
96
142
|
*
|
|
97
143
|
* @public
|
|
98
144
|
*/
|
|
99
|
-
var ActionPersistLocalOptions = class extends Schema.Class("ActionPersistLocalOptions")({
|
|
145
|
+
var ActionPersistLocalOptions = class extends Schema.Class("ActionPersistLocalOptions")(Schema.Struct({
|
|
100
146
|
/** Whether to copy the build output locally. */
|
|
101
|
-
enabled: Schema.Boolean.
|
|
147
|
+
enabled: Schema.Boolean.annotate({
|
|
148
|
+
description: "Whether to copy the build output locally.",
|
|
149
|
+
default: true
|
|
150
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed(true))),
|
|
102
151
|
/** The local action directory, relative to the package. */
|
|
103
|
-
path: Schema.String.
|
|
152
|
+
path: Schema.String.annotate({
|
|
153
|
+
description: "The local action directory, relative to the package.",
|
|
154
|
+
default: ".github/actions/local"
|
|
155
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed(".github/actions/local"))),
|
|
104
156
|
/** Whether to generate the act boilerplate, `.actrc` and `act-test.yml`, when those files do not exist. */
|
|
105
|
-
actTemplate: Schema.Boolean.
|
|
106
|
-
|
|
157
|
+
actTemplate: Schema.Boolean.annotate({
|
|
158
|
+
description: "Whether to generate the act boilerplate, .actrc and act-test.yml, when those files do not exist.",
|
|
159
|
+
default: true
|
|
160
|
+
}).pipe(Schema.withDecodingDefaultKey(Effect.succeed(true)))
|
|
161
|
+
}).annotate({
|
|
162
|
+
title: "Local action copy",
|
|
163
|
+
description: "The local copy of the action's build for testing with nektos/act, the [action.persistLocal] table."
|
|
164
|
+
})) {};
|
|
107
165
|
/**
|
|
108
166
|
* A GitHub Action's build settings, the `[action]` table of `effected.toml`.
|
|
109
167
|
*
|
|
@@ -113,7 +171,7 @@ var ActionPersistLocalOptions = class extends Schema.Class("ActionPersistLocalOp
|
|
|
113
171
|
*
|
|
114
172
|
* @public
|
|
115
173
|
*/
|
|
116
|
-
var ActionConfig = class extends Schema.Class("ActionConfig")({
|
|
174
|
+
var ActionConfig = class extends Schema.Class("ActionConfig")(Schema.Struct({
|
|
117
175
|
/** The bundles to build. */
|
|
118
176
|
entries: ActionEntries.pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
|
|
119
177
|
/** How to build them. */
|
|
@@ -122,6 +180,9 @@ var ActionConfig = class extends Schema.Class("ActionConfig")({
|
|
|
122
180
|
validation: ActionValidationOptions.pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
|
|
123
181
|
/** The local copy for testing with nektos/act. */
|
|
124
182
|
persistLocal: ActionPersistLocalOptions.pipe(Schema.withDecodingDefaultKey(Effect.succeed({})))
|
|
125
|
-
})
|
|
183
|
+
}).annotate({
|
|
184
|
+
title: "Action",
|
|
185
|
+
description: "A GitHub Action's build settings, the [action] table. Every key has a default, so an empty table is a complete config; a file with no [action] table is a library."
|
|
186
|
+
})) {};
|
|
126
187
|
|
|
127
188
|
export { ActionBuildOptions, ActionConfig, ActionEntries, ActionPersistLocalOptions, ActionValidationOptions, ActionWorker };
|