@effected/bundler 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Bundler.js +450 -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 +261 -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 +427 -0
- package/config/EffectedConfigFile.js +160 -0
- package/config/merge.js +20 -0
- package/config/plugins.js +84 -0
- package/config-validation/ConfigValidator.js +67 -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 +3919 -0
- package/index.js +58 -0
- package/internal/causeMessage.js +57 -0
- package/journal/BuildJournal.js +108 -0
- package/jsx/config.js +51 -0
- package/manifest/emit-manifest.js +88 -0
- package/manifest/export-patterns.js +58 -0
- package/manifest/transform.js +323 -0
- package/meta/BundleManifest.js +208 -0
- package/meta/ManifestSource.js +37 -0
- package/meta/api-extractor.js +241 -0
- package/meta/config.js +24 -0
- package/meta/generate.js +246 -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 +117 -0
- package/meta/scrub-declaration-maps.js +63 -0
- package/meta/tsconfig-resolver.js +55 -0
- package/meta/tsdoc-config.js +47 -0
- package/meta/tsdoctor-config.js +22 -0
- package/meta/tsdoctor-manifest.js +134 -0
- package/meta/tsdoctor-source.js +94 -0
- package/package.json +85 -5
- package/passes/build-target-groups.js +346 -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 +39 -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 +155 -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 +18 -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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { mkdtempSync, realpathSync, rmSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { execFile } from "node:child_process";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
|
|
7
|
+
// src/action/import-check.ts
|
|
8
|
+
/** What `checkImport` waits for by default before calling a bundle hung. */
|
|
9
|
+
const DEFAULT_TIMEOUT_MS = 6e4;
|
|
10
|
+
/** Tags the line the child writes about a thrown error, so nothing else on stderr can be read as it. */
|
|
11
|
+
const FAILURE_MARKER = "__EFFECTED_IMPORT_FAILURE__";
|
|
12
|
+
/** The failure of a read input: `@actions/core`'s text, a message opening on a missing input, or a `Config` read of `INPUT_*`. */
|
|
13
|
+
const MISSING_INPUT = /^Input required and not supplied\b|^(?:missing|required)(?: required)? input\b|\bat \["INPUT_[A-Z0-9_-]+"\]/i;
|
|
14
|
+
/** Errors that mean the code is wrong, whatever their message says. */
|
|
15
|
+
const PROGRAMMING_ERRORS = /* @__PURE__ */ new Set([
|
|
16
|
+
"TypeError",
|
|
17
|
+
"ReferenceError",
|
|
18
|
+
"RangeError",
|
|
19
|
+
"SyntaxError"
|
|
20
|
+
]);
|
|
21
|
+
const MODULE_NOT_FOUND_CODES = /* @__PURE__ */ new Set(["ERR_MODULE_NOT_FOUND", "MODULE_NOT_FOUND"]);
|
|
22
|
+
/**
|
|
23
|
+
* The program the child runs: it imports the bundle and reports a thrown error as data, so the verdict reads the
|
|
24
|
+
* error and never the source line Node echoes above an uncaught one.
|
|
25
|
+
*/
|
|
26
|
+
const childProgram = (url) => `try {
|
|
27
|
+
await import(${JSON.stringify(url)});
|
|
28
|
+
} catch (error) {
|
|
29
|
+
const code = typeof error?.code === "string" ? error.code : undefined;
|
|
30
|
+
const failure = { name: String(error?.name ?? "Error"), code, message: String(error?.message ?? error) };
|
|
31
|
+
process.stderr.write("\\n${FAILURE_MARKER}" + JSON.stringify(failure) + "\\n");
|
|
32
|
+
process.exitCode = 1;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
/** The error the child reported. A marker line that does not parse is not a report, so the run is read by its exit. */
|
|
36
|
+
const thrownFrom = (stderr) => {
|
|
37
|
+
const line = stderr.split("\n").find((candidate) => candidate.startsWith(FAILURE_MARKER));
|
|
38
|
+
if (line === void 0) return void 0;
|
|
39
|
+
try {
|
|
40
|
+
return JSON.parse(line.slice(27));
|
|
41
|
+
} catch {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const verdictOfThrown = (thrown, externals) => {
|
|
46
|
+
const message = `${thrown.name}: ${thrown.message}`;
|
|
47
|
+
if (thrown.code !== void 0 && MODULE_NOT_FOUND_CODES.has(thrown.code)) {
|
|
48
|
+
const packageName = /^Cannot find (?:package|module) '([^']+)'/.exec(thrown.message)?.[1];
|
|
49
|
+
return packageName !== void 0 && externals.some((name) => packageName === name || packageName.startsWith(`${name}/`)) ? {
|
|
50
|
+
kind: "external-missing",
|
|
51
|
+
packageName,
|
|
52
|
+
message
|
|
53
|
+
} : {
|
|
54
|
+
kind: "failed",
|
|
55
|
+
message
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return MISSING_INPUT.test(thrown.message) && !PROGRAMMING_ERRORS.has(thrown.name) ? {
|
|
59
|
+
kind: "missing-input",
|
|
60
|
+
message
|
|
61
|
+
} : {
|
|
62
|
+
kind: "failed",
|
|
63
|
+
message
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/** A run that ended itself reports through `::error::` lines, the only stdout it does not merely echo. */
|
|
67
|
+
const verdictOfExit = (stdout, stderr, exitCode) => {
|
|
68
|
+
const reported = stdout.split("\n").filter((line) => line.startsWith("::error::")).map((line) => line.slice(9));
|
|
69
|
+
const message = reported.join("; ") || stderr.trim() || `exited with code ${exitCode}`;
|
|
70
|
+
return reported.some((line) => MISSING_INPUT.test(line)) ? {
|
|
71
|
+
kind: "missing-input",
|
|
72
|
+
message
|
|
73
|
+
} : {
|
|
74
|
+
kind: "failed",
|
|
75
|
+
message
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Imports a bundle in a fresh Node and says whether it loaded.
|
|
80
|
+
*
|
|
81
|
+
* @remarks
|
|
82
|
+
* The child's environment is only `HOME` and `TMPDIR`, both a directory made for this run, which is also its working
|
|
83
|
+
* directory and is removed afterwards. So no `GITHUB_*` variable, token or `NODE_OPTIONS` reaches it, an action's
|
|
84
|
+
* `GITHUB_ACTIONS` guard stays closed, and what an action with no such guard writes stays out of its output.
|
|
85
|
+
*
|
|
86
|
+
* A timeout or an aborted `signal` kills the child with `SIGKILL`, so a child ignoring `SIGTERM` cannot outlive it.
|
|
87
|
+
*/
|
|
88
|
+
const checkImport = (file, options) => {
|
|
89
|
+
const timeout = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
90
|
+
const scratch = realpathSync(mkdtempSync(join(tmpdir(), "effected-import-check-")));
|
|
91
|
+
return new Promise((done) => {
|
|
92
|
+
const child = execFile(process.execPath, [
|
|
93
|
+
"--input-type=module",
|
|
94
|
+
"-e",
|
|
95
|
+
childProgram(pathToFileURL(file).href)
|
|
96
|
+
], {
|
|
97
|
+
cwd: scratch,
|
|
98
|
+
env: {
|
|
99
|
+
HOME: scratch,
|
|
100
|
+
TMPDIR: scratch
|
|
101
|
+
},
|
|
102
|
+
timeout,
|
|
103
|
+
killSignal: "SIGKILL",
|
|
104
|
+
maxBuffer: 16777216
|
|
105
|
+
}, (error, stdout, stderr) => {
|
|
106
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
107
|
+
rmSync(scratch, {
|
|
108
|
+
recursive: true,
|
|
109
|
+
force: true,
|
|
110
|
+
maxRetries: 2
|
|
111
|
+
});
|
|
112
|
+
if (error === null) done({ kind: "imported" });
|
|
113
|
+
else if (options?.signal?.aborted) done({
|
|
114
|
+
kind: "failed",
|
|
115
|
+
message: "the load check was aborted"
|
|
116
|
+
});
|
|
117
|
+
else if (typeof error.code !== "number") done({
|
|
118
|
+
kind: "failed",
|
|
119
|
+
message: error.killed ? `did not finish within ${timeout} ms` : error.message
|
|
120
|
+
});
|
|
121
|
+
else {
|
|
122
|
+
const thrown = thrownFrom(stderr);
|
|
123
|
+
done(thrown !== void 0 ? verdictOfThrown(thrown, options?.externals ?? []) : verdictOfExit(stdout, stderr, error.code));
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
function onAbort() {
|
|
127
|
+
child.kill("SIGKILL");
|
|
128
|
+
}
|
|
129
|
+
if (options?.signal?.aborted) onAbort();
|
|
130
|
+
else options?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export { checkImport };
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
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
|
+
import { Workspaces } from "@effected/workspaces";
|
|
6
|
+
|
|
7
|
+
// 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
|
+
/**
|
|
11
|
+
* Resolve every `catalog:`/`workspace:` specifier in a manifest to a concrete spec,
|
|
12
|
+
* delegating to `@effected/workspaces`' one-shot `Workspaces.resolveManifest`. The
|
|
13
|
+
* resolver re-discovers the workspace root from `cwd` on every call, never from the
|
|
14
|
+
* process directory, and assembles catalogs durably (inline +
|
|
15
|
+
* config-dependency hook-replay + lockfile), so no transient
|
|
16
|
+
* `.pnpm-workspace-state-v1.json` is required.
|
|
17
|
+
*
|
|
18
|
+
* Rejects with `ManifestDecodeError` when a dependency field is not a string-to-string
|
|
19
|
+
* record, `UnresolvedDependencyError` on a specifier the workspace cannot answer, or
|
|
20
|
+
* `CatalogAssemblyError`/`DependencyResolutionError` when catalog assembly or the
|
|
21
|
+
* resolution mechanism itself fails.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
function resolveManifest(pkg, cwd) {
|
|
25
|
+
const program = Effect.gen(function* () {
|
|
26
|
+
const manifest = yield* Manifest.decode(pkg);
|
|
27
|
+
return (manifest.needsResolution ? yield* Workspaces.resolveManifest(manifest, { cwd }) : manifest).toRecord();
|
|
28
|
+
});
|
|
29
|
+
return Effect.runPromise(program.pipe(Effect.provide(platform)));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { resolveManifest };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
|
+
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
|
|
3
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
4
|
+
import { WorkspaceDiscovery, Workspaces } from "@effected/workspaces";
|
|
5
|
+
import { ReleasePlan } from "@effected/changesets";
|
|
6
|
+
|
|
7
|
+
// 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
|
+
/**
|
|
11
|
+
* Resolve the next release version of every workspace package from pending changesets.
|
|
12
|
+
*
|
|
13
|
+
* Walks up from `cwd` to the monorepo root via `@effected/workspaces`' `WorkspaceDiscovery`,
|
|
14
|
+
* seeds the map with each package's CURRENT version, then overlays `newVersion` for
|
|
15
|
+
* changeset-affected packages via `ReleasePlan.read`, including pre-release versions in pre
|
|
16
|
+
* mode and fixed or linked groups. Never rejects: any failure (not a workspace, missing
|
|
17
|
+
* `.changeset/config.json`, an invalid config or `pre.json`, parse error) degrades to current
|
|
18
|
+
* versions (or an empty map).
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
async function resolveNextVersions(cwd) {
|
|
22
|
+
try {
|
|
23
|
+
const workspace = Workspaces.layer({ cwd }).pipe(Layer.provideMerge(platform));
|
|
24
|
+
const packages = await Effect.runPromise(Effect.gen(function* () {
|
|
25
|
+
return yield* (yield* WorkspaceDiscovery).listPackages();
|
|
26
|
+
}).pipe(Effect.provide(workspace)));
|
|
27
|
+
const rootDir = packages[0]?.isRootWorkspace ? packages[0].path : cwd;
|
|
28
|
+
const versions = /* @__PURE__ */ new Map();
|
|
29
|
+
for (const p of packages) {
|
|
30
|
+
if (p.isRootWorkspace) continue;
|
|
31
|
+
if (p.version === void 0) continue;
|
|
32
|
+
versions.set(p.name, p.version);
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const plan = await Effect.runPromise(ReleasePlan.read(rootDir).pipe(Effect.provide(workspace)));
|
|
36
|
+
for (const r of plan.releases) versions.set(r.name, r.newVersion);
|
|
37
|
+
} catch {}
|
|
38
|
+
return {
|
|
39
|
+
root: rootDir,
|
|
40
|
+
versions
|
|
41
|
+
};
|
|
42
|
+
} catch {
|
|
43
|
+
return {
|
|
44
|
+
root: cwd,
|
|
45
|
+
versions: /* @__PURE__ */ new Map()
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { resolveNextVersions };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
// src/config/ActionConfig.ts
|
|
4
|
+
/**
|
|
5
|
+
* The bundles a GitHub Action ships, the `[action.entries]` table.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* `main`, `pre` and `post` are the lifecycle entries `action.yml` runs. A worker is a bundle outside that
|
|
9
|
+
* lifecycle, which the action loads itself.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
var ActionEntries = class extends Schema.Class("ActionEntries")({
|
|
14
|
+
/** The main entry point's source. */
|
|
15
|
+
main: Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed("src/main.ts"))),
|
|
16
|
+
/** The source of the entry that runs before `main`. */
|
|
17
|
+
pre: Schema.optionalKey(Schema.String),
|
|
18
|
+
/** The source of the entry that runs after `main`, for cleanup. */
|
|
19
|
+
post: Schema.optionalKey(Schema.String),
|
|
20
|
+
/** Extra bundles outside the lifecycle: a name to its source, each emitted as `dist/<name>.js`. */
|
|
21
|
+
workers: Schema.Record(Schema.String, Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed({})))
|
|
22
|
+
}) {};
|
|
23
|
+
/**
|
|
24
|
+
* How an action's bundles are built, the `[action.build]` table.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* There is no key for keeping a package's dynamic imports native, and writing one fails like any unknown key.
|
|
28
|
+
* Rolldown leaves a computed `import()` native on its own, so a workaround for a bundler that compiles one into a
|
|
29
|
+
* module that cannot find its target has no counterpart here.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
var ActionBuildOptions = class extends Schema.Class("ActionBuildOptions")({
|
|
34
|
+
/** Whether to minify the bundles. */
|
|
35
|
+
minify: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(true))),
|
|
36
|
+
/** Whether to generate source maps. */
|
|
37
|
+
sourceMap: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(false))),
|
|
38
|
+
/** Packages left out of the bundles and imported at runtime, in addition to `node:` builtins. */
|
|
39
|
+
externals: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed([]))),
|
|
40
|
+
/**
|
|
41
|
+
* Packages left out of the bundles and replaced with a stub that throws if it is ever loaded.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* For an optional transitive dependency the action never exercises, such as a native module.
|
|
45
|
+
*/
|
|
46
|
+
ignore: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed([]))),
|
|
47
|
+
/**
|
|
48
|
+
* Whether to import each bundle in a fresh Node after building it, which proves it loads.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* A bundle can build cleanly and not load, and this is the only check that finds out. Turn it off for an action
|
|
52
|
+
* with no `GITHUB_ACTIONS` guard around its program, because the import runs that program for real.
|
|
53
|
+
*/
|
|
54
|
+
importCheck: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(true)))
|
|
55
|
+
}) {};
|
|
56
|
+
/**
|
|
57
|
+
* What an action build checks before it builds, the `[action.validation]` table.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
var ActionValidationOptions = class extends Schema.Class("ActionValidationOptions")({
|
|
62
|
+
/** Whether `action.yml` must exist and be valid. */
|
|
63
|
+
requireActionYml: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(true))),
|
|
64
|
+
/** The size past which a bundle is reported, such as `"5mb"` or `"500kb"`. */
|
|
65
|
+
maxBundleSize: Schema.optionalKey(Schema.String),
|
|
66
|
+
/** Whether a warning is an error. Absent means it is under CI and is not locally. */
|
|
67
|
+
strict: Schema.optionalKey(Schema.Boolean)
|
|
68
|
+
}) {};
|
|
69
|
+
/**
|
|
70
|
+
* The local copy of an action's build for testing with nektos/act, the `[action.persistLocal]` table.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
var ActionPersistLocalOptions = class extends Schema.Class("ActionPersistLocalOptions")({
|
|
75
|
+
/** Whether to copy the build output locally. */
|
|
76
|
+
enabled: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(true))),
|
|
77
|
+
/** The local action directory, relative to the package. */
|
|
78
|
+
path: Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed(".github/actions/local"))),
|
|
79
|
+
/** Whether to generate the act boilerplate, `.actrc` and `act-test.yml`, when those files do not exist. */
|
|
80
|
+
actTemplate: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(true)))
|
|
81
|
+
}) {};
|
|
82
|
+
/**
|
|
83
|
+
* A GitHub Action's build settings, the `[action]` table of `effected.toml`.
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* Every field has a default, so an empty table is a complete config. An `effected.toml` with no `[action]` table
|
|
87
|
+
* at all is a library rather than an action, which is why `config.action` stays absent in that case.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
var ActionConfig = class extends Schema.Class("ActionConfig")({
|
|
92
|
+
/** The bundles to build. */
|
|
93
|
+
entries: ActionEntries.pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
|
|
94
|
+
/** How to build them. */
|
|
95
|
+
build: ActionBuildOptions.pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
|
|
96
|
+
/** What to check before building. */
|
|
97
|
+
validation: ActionValidationOptions.pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
|
|
98
|
+
/** The local copy for testing with nektos/act. */
|
|
99
|
+
persistLocal: ActionPersistLocalOptions.pipe(Schema.withDecodingDefaultKey(Effect.succeed({})))
|
|
100
|
+
}) {};
|
|
101
|
+
|
|
102
|
+
export { ActionBuildOptions, ActionConfig, ActionEntries, ActionPersistLocalOptions, ActionValidationOptions };
|