Skip to content

Commit 3760dd2

Browse files
authored
fix(perf): do less work loading config (#7361)
This adds some lazy loading, inlines some single use functions, and also removes the "define" function in the definitions file. That was guarding against something that isn't worth the runtime to check for.
1 parent 64bcf4c commit 3760dd2

File tree

10 files changed

+2141
-2294
lines changed

10 files changed

+2141
-2294
lines changed

tap-snapshots/test/lib/commands/config.js.test.cjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
3434
"color": true,
3535
"commit-hooks": true,
3636
"cpu": null,
37-
"os": null,
38-
"libc": null,
3937
"depth": null,
4038
"description": true,
4139
"dev": false,
@@ -50,8 +48,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
5048
"dry-run": false,
5149
"editor": "{EDITOR}",
5250
"engine-strict": false,
53-
"expect-results": null,
5451
"expect-result-count": null,
52+
"expect-results": null,
5553
"fetch-retries": 2,
5654
"fetch-retry-factor": 10,
5755
"fetch-retry-maxtimeout": 60000,
@@ -90,10 +88,9 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
9088
"key": null,
9189
"legacy-bundling": false,
9290
"legacy-peer-deps": false,
91+
"libc": null,
9392
"link": false,
9493
"local-address": null,
95-
"sbom-format": null,
96-
"sbom-type": "library",
9794
"location": "user",
9895
"lockfile-version": null,
9996
"loglevel": "notice",
@@ -111,6 +108,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
111108
"omit-lockfile-registry-resolved": false,
112109
"only": null,
113110
"optional": null,
111+
"os": null,
114112
"otp": null,
115113
"package": [],
116114
"package-lock": true,
@@ -138,6 +136,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
138136
"save-peer": false,
139137
"save-prefix": "^",
140138
"save-prod": false,
139+
"sbom-format": null,
140+
"sbom-type": "library",
141141
"scope": "",
142142
"script-shell": null,
143143
"searchexclude": "",

tap-snapshots/test/lib/commands/publish.js.test.cjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ Array [
350350
]
351351
`
352352

353+
exports[`test/lib/commands/publish.js TAP prioritize CLI flags over publishConfig > new package version 1`] = `
354+
355+
`
356+
353357
exports[`test/lib/commands/publish.js TAP public access > must match snapshot 1`] = `
354358
Array [
355359
Array [
@@ -452,10 +456,6 @@ exports[`test/lib/commands/publish.js TAP restricted access > new package versio
452456
453457
`
454458

455-
exports[`test/lib/commands/publish.js TAP prioritize CLI flags over publishConfig > new package version 1`] = `
456-
457-
`
458-
459459
exports[`test/lib/commands/publish.js TAP scoped _auth config scoped registry > new package version 1`] = `
460460
461461
`

tap-snapshots/test/lib/docs.js.test.cjs

+10-10
Original file line numberDiff line numberDiff line change
@@ -2078,8 +2078,6 @@ Array [
20782078
"color",
20792079
"commit-hooks",
20802080
"cpu",
2081-
"os",
2082-
"libc",
20832081
"depth",
20842082
"description",
20852083
"dev",
@@ -2094,8 +2092,8 @@ Array [
20942092
"dry-run",
20952093
"editor",
20962094
"engine-strict",
2097-
"expect-results",
20982095
"expect-result-count",
2096+
"expect-results",
20992097
"fetch-retries",
21002098
"fetch-retry-factor",
21012099
"fetch-retry-maxtimeout",
@@ -2135,10 +2133,9 @@ Array [
21352133
"key",
21362134
"legacy-bundling",
21372135
"legacy-peer-deps",
2136+
"libc",
21382137
"link",
21392138
"local-address",
2140-
"sbom-format",
2141-
"sbom-type",
21422139
"location",
21432140
"lockfile-version",
21442141
"loglevel",
@@ -2154,6 +2151,7 @@ Array [
21542151
"omit-lockfile-registry-resolved",
21552152
"only",
21562153
"optional",
2154+
"os",
21572155
"otp",
21582156
"package",
21592157
"package-lock",
@@ -2182,6 +2180,8 @@ Array [
21822180
"save-peer",
21832181
"save-prefix",
21842182
"save-prod",
2183+
"sbom-format",
2184+
"sbom-type",
21852185
"scope",
21862186
"script-shell",
21872187
"searchexclude",
@@ -2238,8 +2238,6 @@ Array [
22382238
"color",
22392239
"commit-hooks",
22402240
"cpu",
2241-
"os",
2242-
"libc",
22432241
"depth",
22442242
"description",
22452243
"dev",
@@ -2281,9 +2279,8 @@ Array [
22812279
"key",
22822280
"legacy-bundling",
22832281
"legacy-peer-deps",
2282+
"libc",
22842283
"local-address",
2285-
"sbom-format",
2286-
"sbom-type",
22872284
"location",
22882285
"lockfile-version",
22892286
"loglevel",
@@ -2295,6 +2292,7 @@ Array [
22952292
"omit-lockfile-registry-resolved",
22962293
"only",
22972294
"optional",
2295+
"os",
22982296
"otp",
22992297
"package",
23002298
"package-lock",
@@ -2322,6 +2320,8 @@ Array [
23222320
"save-peer",
23232321
"save-prefix",
23242322
"save-prod",
2323+
"sbom-format",
2324+
"sbom-type",
23252325
"scope",
23262326
"script-shell",
23272327
"searchexclude",
@@ -2347,8 +2347,8 @@ Array [
23472347

23482348
exports[`test/lib/docs.js TAP config > keys that are not flattened 1`] = `
23492349
Array [
2350-
"expect-results",
23512350
"expect-result-count",
2351+
"expect-results",
23522352
"init-author-email",
23532353
"init-author-name",
23542354
"init-author-url",

0 commit comments

Comments
 (0)