Skip to content

Commit

Permalink
fix(perf): do less work loading config (#7361)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wraithgar authored Apr 10, 2024
1 parent 64bcf4c commit 3760dd2
Show file tree
Hide file tree
Showing 10 changed files with 2,141 additions and 2,294 deletions.
10 changes: 5 additions & 5 deletions tap-snapshots/test/lib/commands/config.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"color": true,
"commit-hooks": true,
"cpu": null,
"os": null,
"libc": null,
"depth": null,
"description": true,
"dev": false,
Expand All @@ -50,8 +48,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"dry-run": false,
"editor": "{EDITOR}",
"engine-strict": false,
"expect-results": null,
"expect-result-count": null,
"expect-results": null,
"fetch-retries": 2,
"fetch-retry-factor": 10,
"fetch-retry-maxtimeout": 60000,
Expand Down Expand Up @@ -90,10 +88,9 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"key": null,
"legacy-bundling": false,
"legacy-peer-deps": false,
"libc": null,
"link": false,
"local-address": null,
"sbom-format": null,
"sbom-type": "library",
"location": "user",
"lockfile-version": null,
"loglevel": "notice",
Expand All @@ -111,6 +108,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"omit-lockfile-registry-resolved": false,
"only": null,
"optional": null,
"os": null,
"otp": null,
"package": [],
"package-lock": true,
Expand Down Expand Up @@ -138,6 +136,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"save-peer": false,
"save-prefix": "^",
"save-prod": false,
"sbom-format": null,
"sbom-type": "library",
"scope": "",
"script-shell": null,
"searchexclude": "",
Expand Down
8 changes: 4 additions & 4 deletions tap-snapshots/test/lib/commands/publish.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ Array [
]
`

exports[`test/lib/commands/publish.js TAP prioritize CLI flags over publishConfig > new package version 1`] = `
+ [email protected]
`

exports[`test/lib/commands/publish.js TAP public access > must match snapshot 1`] = `
Array [
Array [
Expand Down Expand Up @@ -452,10 +456,6 @@ exports[`test/lib/commands/publish.js TAP restricted access > new package versio
+ @npm/[email protected]
`

exports[`test/lib/commands/publish.js TAP prioritize CLI flags over publishConfig > new package version 1`] = `
+ [email protected]
`

exports[`test/lib/commands/publish.js TAP scoped _auth config scoped registry > new package version 1`] = `
+ @npm/[email protected]
`
Expand Down
20 changes: 10 additions & 10 deletions tap-snapshots/test/lib/docs.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2078,8 +2078,6 @@ Array [
"color",
"commit-hooks",
"cpu",
"os",
"libc",
"depth",
"description",
"dev",
Expand All @@ -2094,8 +2092,8 @@ Array [
"dry-run",
"editor",
"engine-strict",
"expect-results",
"expect-result-count",
"expect-results",
"fetch-retries",
"fetch-retry-factor",
"fetch-retry-maxtimeout",
Expand Down Expand Up @@ -2135,10 +2133,9 @@ Array [
"key",
"legacy-bundling",
"legacy-peer-deps",
"libc",
"link",
"local-address",
"sbom-format",
"sbom-type",
"location",
"lockfile-version",
"loglevel",
Expand All @@ -2154,6 +2151,7 @@ Array [
"omit-lockfile-registry-resolved",
"only",
"optional",
"os",
"otp",
"package",
"package-lock",
Expand Down Expand Up @@ -2182,6 +2180,8 @@ Array [
"save-peer",
"save-prefix",
"save-prod",
"sbom-format",
"sbom-type",
"scope",
"script-shell",
"searchexclude",
Expand Down Expand Up @@ -2238,8 +2238,6 @@ Array [
"color",
"commit-hooks",
"cpu",
"os",
"libc",
"depth",
"description",
"dev",
Expand Down Expand Up @@ -2281,9 +2279,8 @@ Array [
"key",
"legacy-bundling",
"legacy-peer-deps",
"libc",
"local-address",
"sbom-format",
"sbom-type",
"location",
"lockfile-version",
"loglevel",
Expand All @@ -2295,6 +2292,7 @@ Array [
"omit-lockfile-registry-resolved",
"only",
"optional",
"os",
"otp",
"package",
"package-lock",
Expand Down Expand Up @@ -2322,6 +2320,8 @@ Array [
"save-peer",
"save-prefix",
"save-prod",
"sbom-format",
"sbom-type",
"scope",
"script-shell",
"searchexclude",
Expand All @@ -2347,8 +2347,8 @@ Array [

exports[`test/lib/docs.js TAP config > keys that are not flattened 1`] = `
Array [
"expect-results",
"expect-result-count",
"expect-results",
"init-author-email",
"init-author-name",
"init-author-url",
Expand Down
Loading

0 comments on commit 3760dd2

Please sign in to comment.