fix!: remove performance-now module, use perf_hooks (#2065)

This commit is contained in:
Nolan Lawson 2021-07-04 16:39:48 -07:00 committed by GitHub
parent f012369d72
commit b3ab427ac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 9 deletions

View File

@ -5,7 +5,7 @@ import { promisify } from 'util'
import { buildSass } from './build-sass' import { buildSass } from './build-sass'
import { buildInlineScript } from './build-inline-script' import { buildInlineScript } from './build-inline-script'
import { buildSvg } from './build-svg' import { buildSvg } from './build-svg'
import now from 'performance-now' import { performance } from 'perf_hooks'
import debounce from 'lodash-es/debounce' import debounce from 'lodash-es/debounce'
import applyIntl from '../webpack/svelte-intl-loader' import applyIntl from '../webpack/svelte-intl-loader'
import { LOCALE } from '../src/routes/_static/intl' import { LOCALE } from '../src/routes/_static/intl'
@ -80,7 +80,7 @@ function doWatch () {
} }
async function buildAll () { async function buildAll () {
const start = now() const start = performance.now()
let html = (await Promise.all(partials.map(async partial => { let html = (await Promise.all(partials.map(async partial => {
if (typeof partial === 'string') { if (typeof partial === 'string') {
return partial return partial
@ -95,7 +95,7 @@ async function buildAll () {
.replace('{process.env.LOCALE}', LOCALE) .replace('{process.env.LOCALE}', LOCALE)
.replace('{process.env.LOCALE_DIRECTION}', LOCALE_DIRECTION) .replace('{process.env.LOCALE_DIRECTION}', LOCALE_DIRECTION)
await writeFile(path.resolve(__dirname, '../src/template.html'), html, 'utf8') await writeFile(path.resolve(__dirname, '../src/template.html'), html, 'utf8')
const end = now() const end = performance.now()
console.log(`Built template.html in ${(end - start).toFixed(2)}ms`) console.log(`Built template.html in ${(end - start).toFixed(2)}ms`)
} }

View File

@ -82,7 +82,6 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"p-any": "^3.0.0", "p-any": "^3.0.0",
"page-lifecycle": "^0.1.2", "page-lifecycle": "^0.1.2",
"performance-now": "^2.1.0",
"pinch-zoom-element": "^1.1.1", "pinch-zoom-element": "^1.1.1",
"promise-worker": "^2.0.1", "promise-worker": "^2.0.1",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",

View File

@ -4857,11 +4857,6 @@ pathval@^1.1.1:
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d"
integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==
performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3: picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3:
version "2.3.0" version "2.3.0"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"