@theholocron/lighthouse-config 8.9.0-alpha.1 → 8.9.0-alpha.15
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/dist/index.cjs +2 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.mjs +2 -0
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
// index.ts
|
|
3
|
+
/** The assertions used when `defineConfig` is given none: each is a warning, with a minimum score of 0.9 (or zero reported items for the two `maxLength` audits). */
|
|
3
4
|
const defaultAssertions = {
|
|
4
5
|
"bf-cache": ["warn", { minScore: .9 }],
|
|
5
6
|
"errors-in-console": ["warn", { minScore: .9 }],
|
|
@@ -12,6 +13,7 @@ const defaultAssertions = {
|
|
|
12
13
|
"unused-javascript": ["warn", { maxLength: 0 }],
|
|
13
14
|
"uses-long-cache-ttl": ["warn", { maxLength: 0 }]
|
|
14
15
|
};
|
|
16
|
+
/** Builds a Lighthouse CI (`lhci`) configuration: what to collect, which assertions to enforce and where to upload the results. */
|
|
15
17
|
function defineConfig({ url, startServerCommand, startServerReadyPattern, startServerReadyTimeout, assertions = defaultAssertions, uploadTarget = "temporary-public-storage" }) {
|
|
16
18
|
return { ci: {
|
|
17
19
|
collect: {
|
package/dist/index.d.cts
CHANGED
|
@@ -5,31 +5,48 @@ type MinScoreAssertion = [AssertionLevel, {
|
|
|
5
5
|
type MaxLengthAssertion = [AssertionLevel, {
|
|
6
6
|
maxLength: number;
|
|
7
7
|
}];
|
|
8
|
+
/** Lighthouse CI assertions for the audits this package knows about, plus any other audit by id. Each is a `[level, options]` pair, where the level is `off`, `warn` or `error`. */
|
|
8
9
|
export interface LighthouseAssertion {
|
|
10
|
+
/** Assertion for the back/forward cache audit; fails below `minScore`. */
|
|
9
11
|
"bf-cache"?: MinScoreAssertion;
|
|
12
|
+
/** Assertion for the audit of errors logged to the browser console; fails below `minScore`. */
|
|
10
13
|
"errors-in-console"?: MinScoreAssertion;
|
|
14
|
+
/** Assertion for the `font-display` audit; fails below `minScore`. */
|
|
11
15
|
"font-display"?: MinScoreAssertion;
|
|
16
|
+
/** Assertion for the audit that checks form elements have labels; fails below `minScore`. */
|
|
12
17
|
label?: MinScoreAssertion;
|
|
18
|
+
/** Assertion for the Largest Contentful Paint audit; fails below `minScore`. */
|
|
13
19
|
"largest-contentful-paint"?: MinScoreAssertion;
|
|
20
|
+
/** Assertion for the audit that flags a lazy-loaded Largest Contentful Paint image; fails below `minScore`. */
|
|
14
21
|
"lcp-lazy-loaded"?: MinScoreAssertion;
|
|
22
|
+
/** Assertion for the audit that flags animations that cannot run on the compositor; fails below `minScore`. */
|
|
15
23
|
"non-composited-animations"?: MinScoreAssertion;
|
|
24
|
+
/** Assertion for the audit that checks the Largest Contentful Paint image is prioritised; fails below `minScore`. */
|
|
16
25
|
"prioritize-lcp-image"?: MinScoreAssertion;
|
|
26
|
+
/** Assertion for the unused JavaScript audit; `maxLength` caps how many items it may report. */
|
|
17
27
|
"unused-javascript"?: MaxLengthAssertion;
|
|
28
|
+
/** Assertion for the cache lifetime audit; `maxLength` caps how many items it may report. */
|
|
18
29
|
"uses-long-cache-ttl"?: MaxLengthAssertion;
|
|
19
30
|
[key: string]: MinScoreAssertion | MaxLengthAssertion | undefined;
|
|
20
31
|
}
|
|
32
|
+
/** The assertions used when `defineConfig` is given none: each is a warning, with a minimum score of 0.9 (or zero reported items for the two `maxLength` audits). */
|
|
21
33
|
export declare const defaultAssertions: LighthouseAssertion;
|
|
34
|
+
/** Options for `defineConfig`. */
|
|
22
35
|
export interface LighthouseConfigOptions {
|
|
36
|
+
/** The URL, or URLs, Lighthouse CI audits (lhci `collect.url`). */
|
|
23
37
|
url: string | string[];
|
|
38
|
+
/** The command lhci runs to start the site before auditing (lhci `collect.startServerCommand`). Omitted when unset. */
|
|
24
39
|
startServerCommand?: string;
|
|
25
40
|
/** Pattern lhci waits for in server stdout before running audits. Defaults to lhci's built-in /(listen|ready)/i. */
|
|
26
41
|
startServerReadyPattern?: string;
|
|
27
42
|
/** Milliseconds to wait for startServerReadyPattern before timing out. */
|
|
28
43
|
startServerReadyTimeout?: number;
|
|
44
|
+
/** Per-audit assertions (lhci `assert.assertions`). Defaults to `defaultAssertions`. */
|
|
29
45
|
assertions?: LighthouseAssertion;
|
|
30
46
|
/** @default "temporary-public-storage" */
|
|
31
47
|
uploadTarget?: string;
|
|
32
48
|
}
|
|
49
|
+
/** Builds a Lighthouse CI (`lhci`) configuration: what to collect, which assertions to enforce and where to upload the results. */
|
|
33
50
|
export declare function defineConfig({ url, startServerCommand, startServerReadyPattern, startServerReadyTimeout, assertions, uploadTarget }: LighthouseConfigOptions): {
|
|
34
51
|
ci: {
|
|
35
52
|
collect: {
|
package/dist/index.d.mts
CHANGED
|
@@ -5,31 +5,48 @@ type MinScoreAssertion = [AssertionLevel, {
|
|
|
5
5
|
type MaxLengthAssertion = [AssertionLevel, {
|
|
6
6
|
maxLength: number;
|
|
7
7
|
}];
|
|
8
|
+
/** Lighthouse CI assertions for the audits this package knows about, plus any other audit by id. Each is a `[level, options]` pair, where the level is `off`, `warn` or `error`. */
|
|
8
9
|
export interface LighthouseAssertion {
|
|
10
|
+
/** Assertion for the back/forward cache audit; fails below `minScore`. */
|
|
9
11
|
"bf-cache"?: MinScoreAssertion;
|
|
12
|
+
/** Assertion for the audit of errors logged to the browser console; fails below `minScore`. */
|
|
10
13
|
"errors-in-console"?: MinScoreAssertion;
|
|
14
|
+
/** Assertion for the `font-display` audit; fails below `minScore`. */
|
|
11
15
|
"font-display"?: MinScoreAssertion;
|
|
16
|
+
/** Assertion for the audit that checks form elements have labels; fails below `minScore`. */
|
|
12
17
|
label?: MinScoreAssertion;
|
|
18
|
+
/** Assertion for the Largest Contentful Paint audit; fails below `minScore`. */
|
|
13
19
|
"largest-contentful-paint"?: MinScoreAssertion;
|
|
20
|
+
/** Assertion for the audit that flags a lazy-loaded Largest Contentful Paint image; fails below `minScore`. */
|
|
14
21
|
"lcp-lazy-loaded"?: MinScoreAssertion;
|
|
22
|
+
/** Assertion for the audit that flags animations that cannot run on the compositor; fails below `minScore`. */
|
|
15
23
|
"non-composited-animations"?: MinScoreAssertion;
|
|
24
|
+
/** Assertion for the audit that checks the Largest Contentful Paint image is prioritised; fails below `minScore`. */
|
|
16
25
|
"prioritize-lcp-image"?: MinScoreAssertion;
|
|
26
|
+
/** Assertion for the unused JavaScript audit; `maxLength` caps how many items it may report. */
|
|
17
27
|
"unused-javascript"?: MaxLengthAssertion;
|
|
28
|
+
/** Assertion for the cache lifetime audit; `maxLength` caps how many items it may report. */
|
|
18
29
|
"uses-long-cache-ttl"?: MaxLengthAssertion;
|
|
19
30
|
[key: string]: MinScoreAssertion | MaxLengthAssertion | undefined;
|
|
20
31
|
}
|
|
32
|
+
/** The assertions used when `defineConfig` is given none: each is a warning, with a minimum score of 0.9 (or zero reported items for the two `maxLength` audits). */
|
|
21
33
|
export declare const defaultAssertions: LighthouseAssertion;
|
|
34
|
+
/** Options for `defineConfig`. */
|
|
22
35
|
export interface LighthouseConfigOptions {
|
|
36
|
+
/** The URL, or URLs, Lighthouse CI audits (lhci `collect.url`). */
|
|
23
37
|
url: string | string[];
|
|
38
|
+
/** The command lhci runs to start the site before auditing (lhci `collect.startServerCommand`). Omitted when unset. */
|
|
24
39
|
startServerCommand?: string;
|
|
25
40
|
/** Pattern lhci waits for in server stdout before running audits. Defaults to lhci's built-in /(listen|ready)/i. */
|
|
26
41
|
startServerReadyPattern?: string;
|
|
27
42
|
/** Milliseconds to wait for startServerReadyPattern before timing out. */
|
|
28
43
|
startServerReadyTimeout?: number;
|
|
44
|
+
/** Per-audit assertions (lhci `assert.assertions`). Defaults to `defaultAssertions`. */
|
|
29
45
|
assertions?: LighthouseAssertion;
|
|
30
46
|
/** @default "temporary-public-storage" */
|
|
31
47
|
uploadTarget?: string;
|
|
32
48
|
}
|
|
49
|
+
/** Builds a Lighthouse CI (`lhci`) configuration: what to collect, which assertions to enforce and where to upload the results. */
|
|
33
50
|
export declare function defineConfig({ url, startServerCommand, startServerReadyPattern, startServerReadyTimeout, assertions, uploadTarget }: LighthouseConfigOptions): {
|
|
34
51
|
ci: {
|
|
35
52
|
collect: {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// index.ts
|
|
2
|
+
/** The assertions used when `defineConfig` is given none: each is a warning, with a minimum score of 0.9 (or zero reported items for the two `maxLength` audits). */
|
|
2
3
|
const defaultAssertions = {
|
|
3
4
|
"bf-cache": ["warn", { minScore: .9 }],
|
|
4
5
|
"errors-in-console": ["warn", { minScore: .9 }],
|
|
@@ -11,6 +12,7 @@ const defaultAssertions = {
|
|
|
11
12
|
"unused-javascript": ["warn", { maxLength: 0 }],
|
|
12
13
|
"uses-long-cache-ttl": ["warn", { maxLength: 0 }]
|
|
13
14
|
};
|
|
15
|
+
/** Builds a Lighthouse CI (`lhci`) configuration: what to collect, which assertions to enforce and where to upload the results. */
|
|
14
16
|
function defineConfig({ url, startServerCommand, startServerReadyPattern, startServerReadyTimeout, assertions = defaultAssertions, uploadTarget = "temporary-public-storage" }) {
|
|
15
17
|
return { ci: {
|
|
16
18
|
collect: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/lighthouse-config",
|
|
3
|
-
"version": "8.9.0-alpha.
|
|
3
|
+
"version": "8.9.0-alpha.15",
|
|
4
4
|
"description": "A Lighthouse CI configuration for auditing performance and accessibility within the Galaxy.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lighthouse",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"dist/"
|
|
43
43
|
],
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@vitest/coverage-v8": "^5.0
|
|
46
|
-
"tsdown": "^0.23.
|
|
45
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
46
|
+
"tsdown": "^0.23.5",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
|
-
"vitest": "^5.0
|
|
49
|
-
"@theholocron/tsconfig": "8.9.0-alpha.
|
|
50
|
-
"@theholocron/vitest-config": "8.9.0-alpha.
|
|
48
|
+
"vitest": "^5.1.0",
|
|
49
|
+
"@theholocron/tsconfig": "8.9.0-alpha.15",
|
|
50
|
+
"@theholocron/vitest-config": "8.9.0-alpha.15"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=22.0.0"
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
-
"
|
|
60
|
-
"
|
|
59
|
+
"build": "tsdown",
|
|
60
|
+
"lint:code": "eslint .",
|
|
61
|
+
"test:unit": "vitest run --coverage",
|
|
61
62
|
"test:watch": "vitest",
|
|
62
|
-
"
|
|
63
|
-
"verification.unitTests": "vitest run"
|
|
63
|
+
"typecheck": "tsc --noEmit"
|
|
64
64
|
}
|
|
65
65
|
}
|