eaa-kit 0.7.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -135
- package/dist/astro/index.d.ts +1 -3
- package/dist/astro/index.js +2 -3
- package/dist/audit/runners/worker.js +2 -3
- package/dist/{audit-DRjAY2iY.js → audit-DbqNIrt6.js} +85 -219
- package/dist/audit-rUhqnm3o.js +1 -0
- package/dist/{baseline-BpE7DbDq.js → baseline-CKElWbx4.js} +18 -8
- package/dist/baseline-DU0EPiTq.js +1 -0
- package/dist/baseline-DYOejLFO.js +1 -0
- package/dist/baseline-DvdsFTQy.js +126 -0
- package/dist/{cache-D4dOIuOi.js → cache-DIV4G0TI.js} +24 -5
- package/dist/{checklist-DDd9jewi.js → checklist-CA0Ri71Z.js} +8 -9
- package/dist/cli/index.js +115 -158
- package/dist/{collect-Cu1q9NTB.js → collect-CjucwTEF.js} +16 -8
- package/dist/{command-3r4fht5f.js → command-C8ZFvcc1.js} +33 -10
- package/dist/completeness-Cg-XIKWN.js +1 -0
- package/dist/completeness-Dzyvgr4Z.js +72 -0
- package/dist/component-CgbeRgJa.js +1 -0
- package/dist/{component-ChisoFyY.js → component-ZLd8DA_a.js} +3 -4
- package/dist/countries-B_PE6r5R.js +180 -0
- package/dist/countries-CCqog6dy.js +28 -0
- package/dist/coverage-B9_6yv_8.js +2 -0
- package/dist/{coverage-cb5kPp48.js → coverage-C1Z6t9Ct.js} +5 -7
- package/dist/{crawl-BHkJmUkA.js → crawl-CkHJJV4w.js} +135 -25
- package/dist/{criteria-CnPJKGeb.js → criteria-CacF0HP1.js} +1 -2
- package/dist/{load-BaWMa-G_.js → define-BdTPIfqE.js} +46 -99
- package/dist/detect-DnFHXpWh.js +49 -0
- package/dist/detect-oLDadgee.js +160 -0
- package/dist/doctor-q8IebwAb.js +248 -0
- package/dist/eleventy/index.d.ts +1 -3
- package/dist/eleventy/index.js +2 -3
- package/dist/entry-kf94P140.js +173 -0
- package/dist/{fingerprint-BjYV_0F7.js → fingerprint-CcoQ1WxQ.js} +1 -2
- package/dist/{frameworks-B4ClIJgE.js → frameworks-BboC8eNk.js} +234 -28
- package/dist/frameworks-Y-n3NUuG.js +1 -0
- package/dist/{fs-BmPtmFke.js → fs-tPD5r0wY.js} +1 -2
- package/dist/hosts-B48qR6Vt.js +19 -0
- package/dist/{html-BIxxF3FC.js → html-Bjq3Iw3g.js} +56 -14
- package/dist/{impact-luGCnN8F.js → impact-BGlJ6j0Y.js} +1 -2
- package/dist/{impact-EEB9ZXmC.d.ts → impact-CZjUloYC.d.ts} +0 -2
- package/dist/index.d.ts +50 -26
- package/dist/index.js +3 -2
- package/dist/init-3Ti3ao5Z.js +232 -0
- package/dist/issues-WLlepU95.js +120 -0
- package/dist/{jsdom-CsW_xVcA.js → jsdom-C4pLIMyP.js} +2 -3
- package/dist/jsdom-Zle--VQ1.js +2 -0
- package/dist/{json-Bus6YhxB.js → json-B_k4CDmR.js} +5 -6
- package/dist/json-IL1JxlTL.js +1 -0
- package/dist/load-C3eFEdoH.js +98 -0
- package/dist/load-oQQJPNlV.js +1 -0
- package/dist/markdown-D-QpPYsz.js +138 -0
- package/dist/next-8zDgH0nP.js +119 -0
- package/dist/nuxt/index.d.ts +1 -3
- package/dist/nuxt/index.js +2 -3
- package/dist/pages-CCP1WfYe.js +363 -0
- package/dist/{playwright-ukCr_5o3.js → playwright-ky4b_HME.js} +98 -16
- package/dist/{pool-B4tEUa2S.js → pool-B3XKdk57.js} +4 -5
- package/dist/project-B21NT_aX.js +502 -0
- package/dist/project-Dht13sb1.js +1 -0
- package/dist/{remediation-C0klJblu.js → remediation-BkE7q7dT.js} +2 -176
- package/dist/{render-C1sUZZI_.js → render-ky8cm4QF.js} +50 -24
- package/dist/result-DhoT4g0P.js +1 -0
- package/dist/{result-B7_zVxAX.js → result-g8dGsrcv.js} +1 -2
- package/dist/{review-CdMK2GpQ.js → review-BGjTBFvd.js} +11 -4
- package/dist/review-iheEjp7_.js +1 -0
- package/dist/{routes-CmdRUuOs.js → routes-BpQeBDmM.js} +4 -5
- package/dist/{run-DrS0Komf.js → run-D7tc7IU2.js} +2 -3
- package/dist/{run-BK2blxMI.d.ts → run-VXnP4uLp.d.ts} +2 -6
- package/dist/{sarif-BNCE0PNT.js → sarif-v66-PjdE.js} +9 -9
- package/dist/{schema-DJSF4K05.js → schema-DfC-Ww1w.js} +1 -2
- package/dist/setup-BYlqHlo0.js +2 -0
- package/dist/setup-Cf82ONw0.js +353 -0
- package/dist/shell-BdQYTaBQ.js +89 -0
- package/dist/site-CxVyh8IO.js +71 -0
- package/dist/start-bdanSxZr.js +100 -0
- package/dist/statement/templates/be.de.md +148 -0
- package/dist/statement/templates/be.en.md +142 -0
- package/dist/statement/templates/be.fr.md +146 -0
- package/dist/statement/templates/be.nl.md +147 -0
- package/dist/statement/templates/cz.cs.md +138 -0
- package/dist/statement/templates/cz.en.md +140 -0
- package/dist/statement/templates/dk.da.md +142 -0
- package/dist/statement/templates/dk.en.md +142 -0
- package/dist/statement/templates/fi.en.md +139 -0
- package/dist/statement/templates/fi.fi.md +141 -0
- package/dist/statement/templates/ie.en.md +144 -0
- package/dist/statement/templates/pl.en.md +143 -0
- package/dist/statement/templates/pl.pl.md +144 -0
- package/dist/statement/templates/pt.en.md +143 -0
- package/dist/statement/templates/pt.pt.md +145 -0
- package/dist/statement/templates/se.en.md +148 -0
- package/dist/statement/templates/se.sv.md +150 -0
- package/dist/{text-BF1LHMiV.js → text-CISDPU49.js} +11 -3
- package/dist/{version-B3v4rNoG.js → version-C8aJm8YJ.js} +1 -2
- package/dist/vite/index.d.ts +1 -3
- package/dist/vite/index.js +2 -3
- package/dist/watch-CefxwMsZ.js +121 -0
- package/dist/webpack/index.d.ts +1 -3
- package/dist/webpack/index.js +2 -3
- package/dist/{worksheet-BIxMtbUd.js → worksheet-CcBo9G7s.js} +4 -5
- package/dist/workspaces-BBFXOyeV.js +85 -0
- package/package.json +16 -14
- package/dist/audit-Bwm1xBdJ.js +0 -2
- package/dist/baseline-rtnj3RHB.js +0 -2
- package/dist/component-DcCn3BJS.js +0 -2
- package/dist/coverage-n1X9CkiG.js +0 -3
- package/dist/frameworks-etFg_O8K.js +0 -2
- package/dist/init-DrFfzjvm.js +0 -119
- package/dist/jsdom-BUYuVJJm.js +0 -3
- package/dist/json-CrQmoTj6.js +0 -2
- package/dist/load-n62iXDq_.js +0 -2
- package/dist/project-CzOnkLH6.js +0 -274
- package/dist/project-MFrXcw1M.js +0 -2
- package/dist/result-CRmjjoAA.js +0 -2
- package/dist/review-DIbOTmOM.js +0 -2
package/dist/eleventy/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as auditBuild, r as stderrLogger, t as BuildAuditError } from "../run-
|
|
1
|
+
import { n as auditBuild, r as stderrLogger, t as BuildAuditError } from "../run-D7tc7IU2.js";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/eleventy/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* Usable both as a bare plugin and as a configured one.
|
|
6
6
|
*
|
|
@@ -15,5 +15,4 @@ function eaaKit(eleventyConfig, options = {}) {
|
|
|
15
15
|
await auditBuild(path.resolve(event.dir.output), options, stderrLogger());
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { BuildAuditError, eaaKit as default };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// src/audit/entry.ts
|
|
2
|
+
/**
|
|
3
|
+
* What the entry URL of a crawl actually leads to, found before any page is
|
|
4
|
+
* crawled.
|
|
5
|
+
*
|
|
6
|
+
* Two things can put a run somewhere other than where it was sent, and both
|
|
7
|
+
* used to be discovered too late or not at all:
|
|
8
|
+
*
|
|
9
|
+
* - **A redirect to another site.** `https://www.gtainside.de` answers with a
|
|
10
|
+
* 301 to `https://www.gtainside.com`. The crawl refused every page as
|
|
11
|
+
* "redirected off", and the run ended with an error that did not say what to
|
|
12
|
+
* do about it. The run should stop and say where the site went, and it should
|
|
13
|
+
* only go on there when somebody agrees to.
|
|
14
|
+
* - **A sign-in wall.** A preview deployment or a staging CMS answers 401, or
|
|
15
|
+
* sends every request to a login form. The crawl then audited the login form
|
|
16
|
+
* and reported it as the site, which is the failure this tool is written
|
|
17
|
+
* against: a clean result for pages nobody looked at.
|
|
18
|
+
*
|
|
19
|
+
* So the entry is fetched first, one hop at a time, with redirects not
|
|
20
|
+
* followed automatically. That gives the whole chain, the status of each hop,
|
|
21
|
+
* and the page at the end of it. What to do with a redirect is the caller's
|
|
22
|
+
* decision. It depends on flags and on whether there is a terminal to ask at.
|
|
23
|
+
* This module only establishes the facts.
|
|
24
|
+
*/
|
|
25
|
+
/** How many redirects to follow before calling it a loop. */
|
|
26
|
+
const MAX_HOPS = 10;
|
|
27
|
+
/** The origins that sign people in for other sites. Suffix-matched. */
|
|
28
|
+
const IDENTITY_PROVIDERS = [
|
|
29
|
+
"accounts.google.com",
|
|
30
|
+
"login.microsoftonline.com",
|
|
31
|
+
"login.live.com",
|
|
32
|
+
"login.windows.net",
|
|
33
|
+
"b2clogin.com",
|
|
34
|
+
"okta.com",
|
|
35
|
+
"oktapreview.com",
|
|
36
|
+
"auth0.com",
|
|
37
|
+
"onelogin.com",
|
|
38
|
+
"amazoncognito.com",
|
|
39
|
+
"appleid.apple.com",
|
|
40
|
+
"id.atlassian.com"
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Paths that are a sign-in page by name: `/login`, `/sign-in`, `/wp-login.php`,
|
|
44
|
+
* Keycloak's `/protocol/openid-connect/auth`, and a few other languages' words.
|
|
45
|
+
*/
|
|
46
|
+
const SIGN_IN_PATH = /(?:^|\/)(?:log-?in|sign-?in|signin|sso|oauth2?|authorize|auth|anmelden|connexion|accedi|inloggen|logowanie|wp-login\.php|users\/sign_in|openid-connect\/auth)(?:[/.?]|$)/i;
|
|
47
|
+
function isIdentityProvider(url) {
|
|
48
|
+
const host = url.hostname.toLowerCase();
|
|
49
|
+
return IDENTITY_PROVIDERS.some((provider) => host === provider || host.endsWith(`.${provider}`));
|
|
50
|
+
}
|
|
51
|
+
function isSignInPath(url) {
|
|
52
|
+
return SIGN_IN_PATH.test(url.pathname);
|
|
53
|
+
}
|
|
54
|
+
/** A form somebody types a password into. The shape every sign-in page has. */
|
|
55
|
+
function hasPasswordField(html) {
|
|
56
|
+
return /<input\b[^>]*\btype\s*=\s*["']?password\b/i.test(html);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Whether two URLs are the same site in the sense a reader means it: the same
|
|
60
|
+
* host, give or take a leading `www.`, over http or https. A redirect between
|
|
61
|
+
* two of these is the site tidying its own address, not a different site.
|
|
62
|
+
*/
|
|
63
|
+
function isSameSite(a, b) {
|
|
64
|
+
const host = (url) => url.hostname.toLowerCase().replace(/^www\./, "");
|
|
65
|
+
return host(a) === host(b) && a.port === b.port;
|
|
66
|
+
}
|
|
67
|
+
/** Follow the entry's redirects one at a time, and look at where they end. */
|
|
68
|
+
async function probeEntry(entry, options) {
|
|
69
|
+
const impl = options.fetchImpl ?? fetch;
|
|
70
|
+
const hops = [];
|
|
71
|
+
let current = new URL(entry.href);
|
|
72
|
+
for (let hop = 0; hop <= MAX_HOPS; hop += 1) {
|
|
73
|
+
let response;
|
|
74
|
+
const controller = new AbortController();
|
|
75
|
+
const timer = setTimeout(() => controller.abort(), options.timeoutMs);
|
|
76
|
+
try {
|
|
77
|
+
response = await impl(current.href, {
|
|
78
|
+
signal: controller.signal,
|
|
79
|
+
redirect: "manual",
|
|
80
|
+
headers: {
|
|
81
|
+
accept: "text/html,application/xhtml+xml",
|
|
82
|
+
"user-agent": "eaa-kit",
|
|
83
|
+
...current.origin === entry.origin ? options.headers : {}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
} catch (cause) {
|
|
87
|
+
clearTimeout(timer);
|
|
88
|
+
const reason = controller.signal.aborted ? `timed out after ${options.timeoutMs}ms` : cause instanceof Error ? cause.message : String(cause);
|
|
89
|
+
return {
|
|
90
|
+
hops,
|
|
91
|
+
final: current,
|
|
92
|
+
status: 0,
|
|
93
|
+
error: reason
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
hops.push({
|
|
98
|
+
url: current.href,
|
|
99
|
+
status: response.status
|
|
100
|
+
});
|
|
101
|
+
const location = response.headers.get("location");
|
|
102
|
+
if (response.status >= 300 && response.status < 400 && location !== null) {
|
|
103
|
+
await discard(response);
|
|
104
|
+
current = new URL(location, current);
|
|
105
|
+
current.hash = "";
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const result = {
|
|
109
|
+
hops,
|
|
110
|
+
final: current,
|
|
111
|
+
status: response.status
|
|
112
|
+
};
|
|
113
|
+
const signIn = await signInEvidence(entry, current, response, options.maxBodyBytes);
|
|
114
|
+
if (signIn !== void 0) result.signIn = signIn;
|
|
115
|
+
await discard(response);
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
hops,
|
|
120
|
+
final: current,
|
|
121
|
+
status: 0,
|
|
122
|
+
error: `more than ${MAX_HOPS} redirects, which is a loop or close enough to one`
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
async function signInEvidence(entry, final, response, maxBodyBytes) {
|
|
126
|
+
if (response.status === 401) return "http-401";
|
|
127
|
+
if (response.status === 403) return "http-403";
|
|
128
|
+
if (final.href === entry.href) return void 0;
|
|
129
|
+
if (isIdentityProvider(final)) return "identity-provider";
|
|
130
|
+
if (isSignInPath(final)) return "sign-in-path";
|
|
131
|
+
if (!response.ok) return void 0;
|
|
132
|
+
const type = response.headers.get("content-type") ?? "";
|
|
133
|
+
if (!/\b(?:text\/html|application\/xhtml\+xml)\b/i.test(type)) return void 0;
|
|
134
|
+
return hasPasswordField(await readUpTo(response, maxBodyBytes)) ? "password-field" : void 0;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Let go of a body that was not read, so the connection is released. One that
|
|
138
|
+
* was read is locked to its reader and already finished with.
|
|
139
|
+
*/
|
|
140
|
+
async function discard(response) {
|
|
141
|
+
if (response.body === null || response.body.locked) return;
|
|
142
|
+
await response.body.cancel();
|
|
143
|
+
}
|
|
144
|
+
/** A body, cut off at a limit rather than refused: this only looks for a form. */
|
|
145
|
+
async function readUpTo(response, limit) {
|
|
146
|
+
const reader = response.body?.getReader();
|
|
147
|
+
if (reader === void 0) return "";
|
|
148
|
+
const decoder = new TextDecoder();
|
|
149
|
+
let text = "";
|
|
150
|
+
let size = 0;
|
|
151
|
+
for (;;) {
|
|
152
|
+
const { done, value } = await reader.read();
|
|
153
|
+
if (done) break;
|
|
154
|
+
size += value.byteLength;
|
|
155
|
+
text += decoder.decode(value, { stream: true });
|
|
156
|
+
if (size >= limit) {
|
|
157
|
+
await reader.cancel();
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return text;
|
|
162
|
+
}
|
|
163
|
+
/** What each piece of evidence is, in words, for the message and the report. */
|
|
164
|
+
function describeSignIn(evidence, at) {
|
|
165
|
+
switch (evidence) {
|
|
166
|
+
case "http-401": return `${at} answered 401: it asks for credentials before it shows any page`;
|
|
167
|
+
case "http-403": return `${at} answered 403: it refuses requests that are not signed in`;
|
|
168
|
+
case "identity-provider": return `it sends visitors to sign in at ${new URL(at).origin}`;
|
|
169
|
+
case "sign-in-path": return `it sends visitors to a sign-in page at ${at}`;
|
|
170
|
+
case "password-field": return `it sends visitors to ${at}, a page with a password field on it`;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
export { describeSignIn, hasPasswordField, isSameSite, probeEntry };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
|
|
2
|
+
// src/audit/fingerprint.ts
|
|
3
3
|
/**
|
|
4
4
|
* A stable identity for one violating element.
|
|
5
5
|
*
|
|
@@ -63,5 +63,4 @@ function openingTag(html) {
|
|
|
63
63
|
}
|
|
64
64
|
return trimmed;
|
|
65
65
|
}
|
|
66
|
-
//#endregion
|
|
67
66
|
export { elementFingerprint as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as exists } from "./fs-
|
|
1
|
+
import { t as exists } from "./fs-tPD5r0wY.js";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
|
|
4
|
+
// src/audit/frameworks.ts
|
|
5
5
|
/**
|
|
6
6
|
* Most specific first. Several of these depend on Vite, so Vite is last: a
|
|
7
7
|
* SvelteKit project is a SvelteKit project, not a Vite one.
|
|
@@ -69,6 +69,38 @@ const FRAMEWORKS = [
|
|
|
69
69
|
outputs: ["build/client"],
|
|
70
70
|
serves: true
|
|
71
71
|
},
|
|
72
|
+
{
|
|
73
|
+
id: "qwik",
|
|
74
|
+
name: "Qwik",
|
|
75
|
+
packages: ["@builder.io/qwik-city", "@qwik.dev/router"],
|
|
76
|
+
outputs: ["dist"],
|
|
77
|
+
staticOutput: {
|
|
78
|
+
needs: "the static adapter",
|
|
79
|
+
how: "run npm run qwik add static, then build"
|
|
80
|
+
},
|
|
81
|
+
serves: true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "solidstart",
|
|
85
|
+
name: "SolidStart",
|
|
86
|
+
packages: ["@solidjs/start"],
|
|
87
|
+
outputs: [".output/public", "dist"],
|
|
88
|
+
serves: true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "tanstack-start",
|
|
92
|
+
name: "TanStack Start",
|
|
93
|
+
packages: ["@tanstack/react-start", "@tanstack/solid-start"],
|
|
94
|
+
outputs: [".output/public", "dist/client"],
|
|
95
|
+
serves: true
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "analog",
|
|
99
|
+
name: "Analog",
|
|
100
|
+
packages: ["@analogjs/platform"],
|
|
101
|
+
outputs: ["dist/analog/public"],
|
|
102
|
+
serves: true
|
|
103
|
+
},
|
|
72
104
|
{
|
|
73
105
|
id: "astro",
|
|
74
106
|
name: "Astro",
|
|
@@ -136,6 +168,93 @@ const FRAMEWORKS = [
|
|
|
136
168
|
outputs: ["build"],
|
|
137
169
|
serves: false
|
|
138
170
|
},
|
|
171
|
+
{
|
|
172
|
+
id: "hexo",
|
|
173
|
+
name: "Hexo",
|
|
174
|
+
packages: ["hexo"],
|
|
175
|
+
outputs: ["public"],
|
|
176
|
+
configs: ["_config.yml"],
|
|
177
|
+
outputPattern: /^public_dir:\s*['"]?([^'"\s#]+)/m,
|
|
178
|
+
serves: false
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: "mkdocs",
|
|
182
|
+
name: "MkDocs",
|
|
183
|
+
packages: [],
|
|
184
|
+
files: ["mkdocs.yml", "mkdocs.yaml"],
|
|
185
|
+
outputs: ["site"],
|
|
186
|
+
configs: ["mkdocs.yml", "mkdocs.yaml"],
|
|
187
|
+
outputPattern: /^site_dir:\s*['"]?([^'"\s#]+)/m,
|
|
188
|
+
buildCommand: "mkdocs build",
|
|
189
|
+
serves: false
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "sphinx",
|
|
193
|
+
name: "Sphinx",
|
|
194
|
+
packages: [],
|
|
195
|
+
files: [
|
|
196
|
+
"conf.py",
|
|
197
|
+
"docs/conf.py",
|
|
198
|
+
"doc/conf.py",
|
|
199
|
+
"source/conf.py",
|
|
200
|
+
"docs/source/conf.py"
|
|
201
|
+
],
|
|
202
|
+
outputs: [
|
|
203
|
+
"_build/html",
|
|
204
|
+
"docs/_build/html",
|
|
205
|
+
"build/html",
|
|
206
|
+
"docs/build/html",
|
|
207
|
+
"doc/_build/html"
|
|
208
|
+
],
|
|
209
|
+
buildCommand: "sphinx-build -M html docs docs/_build",
|
|
210
|
+
serves: false
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: "mdbook",
|
|
214
|
+
name: "mdBook",
|
|
215
|
+
packages: [],
|
|
216
|
+
files: ["book.toml"],
|
|
217
|
+
outputs: ["book"],
|
|
218
|
+
configs: ["book.toml"],
|
|
219
|
+
outputPattern: /build-dir\s*=\s*['"]([^'"]+)['"]/,
|
|
220
|
+
buildCommand: "mdbook build",
|
|
221
|
+
serves: false
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: "quarto",
|
|
225
|
+
name: "Quarto",
|
|
226
|
+
packages: [],
|
|
227
|
+
files: ["_quarto.yml", "_quarto.yaml"],
|
|
228
|
+
outputs: ["_site"],
|
|
229
|
+
configs: ["_quarto.yml", "_quarto.yaml"],
|
|
230
|
+
outputPattern: /output-dir:\s*['"]?([^'"\s#]+)/,
|
|
231
|
+
buildCommand: "quarto render",
|
|
232
|
+
serves: false
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "pelican",
|
|
236
|
+
name: "Pelican",
|
|
237
|
+
packages: [],
|
|
238
|
+
files: ["pelicanconf.py"],
|
|
239
|
+
outputs: ["output"],
|
|
240
|
+
configs: ["pelicanconf.py", "publishconf.py"],
|
|
241
|
+
outputPattern: /OUTPUT_PATH\s*=\s*['"]([^'"]+)['"]/,
|
|
242
|
+
buildCommand: "pelican content",
|
|
243
|
+
serves: false
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: "zola",
|
|
247
|
+
name: "Zola",
|
|
248
|
+
packages: [],
|
|
249
|
+
files: ["zola.toml"],
|
|
250
|
+
contents: {
|
|
251
|
+
file: "config.toml",
|
|
252
|
+
pattern: /^\s*base_url\s*=/m
|
|
253
|
+
},
|
|
254
|
+
outputs: ["public"],
|
|
255
|
+
buildCommand: "zola build",
|
|
256
|
+
serves: false
|
|
257
|
+
},
|
|
139
258
|
{
|
|
140
259
|
id: "hugo",
|
|
141
260
|
name: "Hugo",
|
|
@@ -143,9 +262,12 @@ const FRAMEWORKS = [
|
|
|
143
262
|
files: [
|
|
144
263
|
"hugo.toml",
|
|
145
264
|
"hugo.yaml",
|
|
146
|
-
"
|
|
265
|
+
"hugo.json",
|
|
266
|
+
"config.toml",
|
|
267
|
+
"config/_default"
|
|
147
268
|
],
|
|
148
269
|
outputs: ["public"],
|
|
270
|
+
buildCommand: "hugo",
|
|
149
271
|
serves: false
|
|
150
272
|
},
|
|
151
273
|
{
|
|
@@ -154,6 +276,7 @@ const FRAMEWORKS = [
|
|
|
154
276
|
packages: [],
|
|
155
277
|
files: ["_config.yml"],
|
|
156
278
|
outputs: ["_site"],
|
|
279
|
+
buildCommand: "bundle exec jekyll build",
|
|
157
280
|
serves: false
|
|
158
281
|
},
|
|
159
282
|
{
|
|
@@ -191,6 +314,28 @@ const FRAMEWORKS = [
|
|
|
191
314
|
serves: true,
|
|
192
315
|
serveCommand: "ddev start, or php craft serve"
|
|
193
316
|
},
|
|
317
|
+
{
|
|
318
|
+
id: "drupal",
|
|
319
|
+
name: "Drupal",
|
|
320
|
+
packages: [],
|
|
321
|
+
files: [
|
|
322
|
+
"core/lib/Drupal.php",
|
|
323
|
+
"web/core/lib/Drupal.php",
|
|
324
|
+
"docroot/core/lib/Drupal.php"
|
|
325
|
+
],
|
|
326
|
+
outputs: [],
|
|
327
|
+
serves: true,
|
|
328
|
+
serveCommand: "ddev start, or drush runserver"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: "statamic",
|
|
332
|
+
name: "Statamic",
|
|
333
|
+
packages: [],
|
|
334
|
+
files: ["please"],
|
|
335
|
+
outputs: [],
|
|
336
|
+
serves: true,
|
|
337
|
+
serveCommand: "php artisan serve"
|
|
338
|
+
},
|
|
194
339
|
{
|
|
195
340
|
id: "laravel",
|
|
196
341
|
name: "Laravel",
|
|
@@ -227,6 +372,65 @@ const FRAMEWORKS = [
|
|
|
227
372
|
serves: true,
|
|
228
373
|
serveCommand: "python manage.py runserver"
|
|
229
374
|
},
|
|
375
|
+
{
|
|
376
|
+
id: "ghost",
|
|
377
|
+
name: "Ghost theme",
|
|
378
|
+
packages: [],
|
|
379
|
+
files: ["default.hbs"],
|
|
380
|
+
outputs: [],
|
|
381
|
+
serves: true,
|
|
382
|
+
serveCommand: "ghost start, in the Ghost install this theme belongs to"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
id: "shopify",
|
|
386
|
+
name: "Shopify theme",
|
|
387
|
+
packages: [],
|
|
388
|
+
files: ["layout/theme.liquid"],
|
|
389
|
+
outputs: [],
|
|
390
|
+
serves: true,
|
|
391
|
+
serveCommand: "shopify theme dev"
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: "vue-cli",
|
|
395
|
+
name: "Vue CLI",
|
|
396
|
+
packages: ["@vue/cli-service"],
|
|
397
|
+
outputs: ["dist"],
|
|
398
|
+
configs: [
|
|
399
|
+
"vue.config.js",
|
|
400
|
+
"vue.config.mjs",
|
|
401
|
+
"vue.config.ts"
|
|
402
|
+
],
|
|
403
|
+
outputPattern: /outputDir\s*:\s*['"`]([^'"`]+)['"`]/,
|
|
404
|
+
serves: false
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
id: "ember",
|
|
408
|
+
name: "Ember",
|
|
409
|
+
packages: ["ember-cli"],
|
|
410
|
+
outputs: ["dist"],
|
|
411
|
+
serves: false
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
id: "parcel",
|
|
415
|
+
name: "Parcel",
|
|
416
|
+
packages: ["parcel"],
|
|
417
|
+
outputs: ["dist"],
|
|
418
|
+
serves: false
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
id: "rsbuild",
|
|
422
|
+
name: "Rsbuild",
|
|
423
|
+
packages: ["@rsbuild/core"],
|
|
424
|
+
outputs: ["dist"],
|
|
425
|
+
serves: false
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
id: "rspack",
|
|
429
|
+
name: "Rspack",
|
|
430
|
+
packages: ["@rspack/cli", "@rspack/core"],
|
|
431
|
+
outputs: ["dist"],
|
|
432
|
+
serves: false
|
|
433
|
+
},
|
|
230
434
|
{
|
|
231
435
|
id: "vite",
|
|
232
436
|
name: "Vite",
|
|
@@ -264,33 +468,33 @@ async function detectFramework(cwd, pkg) {
|
|
|
264
468
|
...pkg?.devDependencies
|
|
265
469
|
};
|
|
266
470
|
for (const framework of FRAMEWORKS) {
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
byFile = true;
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
if (!byPackage && !byFile) continue;
|
|
276
|
-
const configured = await outputFromConfig(cwd, framework);
|
|
277
|
-
const outputs = configured === void 0 ? [...framework.outputs] : [configured, ...framework.outputs];
|
|
471
|
+
const evidence = await identify(cwd, framework, deps);
|
|
472
|
+
if (evidence === void 0) continue;
|
|
473
|
+
const configured = await configuredOutput(cwd, framework);
|
|
474
|
+
const outputs = configured === void 0 ? [...framework.outputs] : [configured.output, ...framework.outputs];
|
|
278
475
|
return {
|
|
279
476
|
framework,
|
|
280
|
-
outputs: [...new Set(outputs)]
|
|
477
|
+
outputs: [...new Set(outputs)],
|
|
478
|
+
evidence: [evidence, ...configured === void 0 ? [] : [`${configured.file} sets the output to ${configured.output}/`]]
|
|
281
479
|
};
|
|
282
480
|
}
|
|
283
481
|
}
|
|
284
|
-
/**
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
482
|
+
/** What identifies this framework here, in words, or undefined if nothing does. */
|
|
483
|
+
async function identify(cwd, framework, deps) {
|
|
484
|
+
const dependency = framework.packages.find((name) => deps[name] !== void 0);
|
|
485
|
+
if (dependency !== void 0) return `package.json depends on ${dependency}`;
|
|
486
|
+
for (const file of framework.files ?? []) if (await exists(file, cwd)) return `found ${file}`;
|
|
487
|
+
if (framework.contents !== void 0) {
|
|
488
|
+
const { file, pattern } = framework.contents;
|
|
489
|
+
try {
|
|
490
|
+
if (pattern.test(await readFile(path.resolve(cwd, file), "utf8"))) return `${file} is ${article(framework.name)} ${framework.name} config`;
|
|
491
|
+
} catch {}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
function article(name) {
|
|
495
|
+
return /^[AEFHILMNORSX]/.test(name) ? "an" : "a";
|
|
496
|
+
}
|
|
497
|
+
async function configuredOutput(cwd, framework) {
|
|
294
498
|
if (framework.configs === void 0 || framework.outputPattern === void 0) return void 0;
|
|
295
499
|
for (const name of framework.configs) {
|
|
296
500
|
let source;
|
|
@@ -302,7 +506,10 @@ async function outputFromConfig(cwd, framework) {
|
|
|
302
506
|
const value = framework.outputPattern.exec(source)?.[1];
|
|
303
507
|
if (value === void 0 || value === "") continue;
|
|
304
508
|
if (path.isAbsolute(value)) continue;
|
|
305
|
-
return
|
|
509
|
+
return {
|
|
510
|
+
file: name,
|
|
511
|
+
output: value.replace(/^\.\//, "").replace(/\/$/, "")
|
|
512
|
+
};
|
|
306
513
|
}
|
|
307
514
|
}
|
|
308
515
|
/** Every output directory worth trying, framework-aware, most likely first. */
|
|
@@ -310,5 +517,4 @@ async function candidateOutputs(cwd, pkg) {
|
|
|
310
517
|
const detected = await detectFramework(cwd, pkg);
|
|
311
518
|
return [.../* @__PURE__ */ new Set([...detected?.outputs ?? [], ...FALLBACK_OUTPUTS])];
|
|
312
519
|
}
|
|
313
|
-
|
|
314
|
-
export { outputFromConfig as a, detectFramework as i, FRAMEWORKS as n, candidateOutputs as r, FALLBACK_OUTPUTS as t };
|
|
520
|
+
export { detectFramework as i, FRAMEWORKS as n, candidateOutputs as r, FALLBACK_OUTPUTS as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as FALLBACK_OUTPUTS, r as candidateOutputs, i as detectFramework } from "./frameworks-BboC8eNk.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stat } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/fs.ts
|
|
4
4
|
/**
|
|
5
5
|
* Asking the filesystem a yes-or-no question.
|
|
6
6
|
*
|
|
@@ -36,5 +36,4 @@ async function isDirectory(target) {
|
|
|
36
36
|
function toPosix(filePath) {
|
|
37
37
|
return filePath.split(path.sep).join("/");
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { toPosix as i, isDirectory as n, isFile as r, exists as t };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/cli/hosts.ts
|
|
2
|
+
/**
|
|
3
|
+
* The CI systems `init` writes a pipeline for.
|
|
4
|
+
*
|
|
5
|
+
* On their own so the command line can list them in `--help` without loading
|
|
6
|
+
* the project detection that writing a pipeline needs.
|
|
7
|
+
*/
|
|
8
|
+
const CI_HOSTS = [
|
|
9
|
+
"github",
|
|
10
|
+
"gitlab",
|
|
11
|
+
"bitbucket"
|
|
12
|
+
];
|
|
13
|
+
/** How each host's pipeline is named to a person. */
|
|
14
|
+
const CI_HOST_NAMES = {
|
|
15
|
+
github: "GitHub Actions workflow",
|
|
16
|
+
gitlab: "GitLab CI job",
|
|
17
|
+
bitbucket: "Bitbucket Pipelines step"
|
|
18
|
+
};
|
|
19
|
+
export { CI_HOST_NAMES as n, CI_HOSTS as t };
|