Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
2
node_modules/web-vitals/dist/lib/bindReporter.d.ts
generated
vendored
Normal file
2
node_modules/web-vitals/dist/lib/bindReporter.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { Metric, ReportHandler } from '../types.js';
|
||||
export declare const bindReporter: (callback: ReportHandler, metric: Metric, po: PerformanceObserver | undefined, observeAllUpdates?: boolean | undefined) => () => void;
|
||||
38
node_modules/web-vitals/dist/lib/bindReporter.js
generated
vendored
Normal file
38
node_modules/web-vitals/dist/lib/bindReporter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const bindReporter = (callback, metric, po, observeAllUpdates) => {
|
||||
let prevValue;
|
||||
return () => {
|
||||
if (po && metric.isFinal) {
|
||||
po.disconnect();
|
||||
}
|
||||
if (metric.value >= 0) {
|
||||
if (observeAllUpdates ||
|
||||
metric.isFinal ||
|
||||
document.visibilityState === 'hidden') {
|
||||
metric.delta = metric.value - (prevValue || 0);
|
||||
// Report the metric if there's a non-zero delta, if the metric is
|
||||
// final, or if no previous value exists (which can happen in the case
|
||||
// of the document becoming hidden when the metric value is 0).
|
||||
// See: https://github.com/GoogleChrome/web-vitals/issues/14
|
||||
if (metric.delta || metric.isFinal || prevValue === undefined) {
|
||||
callback(metric);
|
||||
prevValue = metric.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
6
node_modules/web-vitals/dist/lib/generateUniqueID.d.ts
generated
vendored
Normal file
6
node_modules/web-vitals/dist/lib/generateUniqueID.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* Performantly generate a unique, 27-char string by combining the current
|
||||
* timestamp with a 13-digit random number.
|
||||
* @return {string}
|
||||
*/
|
||||
export declare const generateUniqueID: () => string;
|
||||
23
node_modules/web-vitals/dist/lib/generateUniqueID.js
generated
vendored
Normal file
23
node_modules/web-vitals/dist/lib/generateUniqueID.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Performantly generate a unique, 27-char string by combining the current
|
||||
* timestamp with a 13-digit random number.
|
||||
* @return {string}
|
||||
*/
|
||||
export const generateUniqueID = () => {
|
||||
return `${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;
|
||||
};
|
||||
3
node_modules/web-vitals/dist/lib/getFirstHidden.d.ts
generated
vendored
Normal file
3
node_modules/web-vitals/dist/lib/getFirstHidden.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export declare const getFirstHidden: () => {
|
||||
readonly timeStamp: number;
|
||||
};
|
||||
33
node_modules/web-vitals/dist/lib/getFirstHidden.js
generated
vendored
Normal file
33
node_modules/web-vitals/dist/lib/getFirstHidden.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { onHidden } from './onHidden.js';
|
||||
let firstHiddenTime;
|
||||
export const getFirstHidden = () => {
|
||||
if (firstHiddenTime === undefined) {
|
||||
// If the document is hidden when this code runs, assume it was hidden
|
||||
// since navigation start. This isn't a perfect heuristic, but it's the
|
||||
// best we can do until an API is available to support querying past
|
||||
// visibilityState.
|
||||
firstHiddenTime = document.visibilityState === 'hidden' ? 0 : Infinity;
|
||||
// Update the time if/when the document becomes hidden.
|
||||
onHidden(({ timeStamp }) => firstHiddenTime = timeStamp, true);
|
||||
}
|
||||
return {
|
||||
get timeStamp() {
|
||||
return firstHiddenTime;
|
||||
}
|
||||
};
|
||||
};
|
||||
2
node_modules/web-vitals/dist/lib/initMetric.d.ts
generated
vendored
Normal file
2
node_modules/web-vitals/dist/lib/initMetric.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { Metric } from '../types.js';
|
||||
export declare const initMetric: (name: Metric['name'], value?: number) => Metric;
|
||||
26
node_modules/web-vitals/dist/lib/initMetric.js
generated
vendored
Normal file
26
node_modules/web-vitals/dist/lib/initMetric.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { generateUniqueID } from './generateUniqueID.js';
|
||||
export const initMetric = (name, value = -1) => {
|
||||
return {
|
||||
name,
|
||||
value,
|
||||
delta: 0,
|
||||
entries: [],
|
||||
id: generateUniqueID(),
|
||||
isFinal: false
|
||||
};
|
||||
};
|
||||
12
node_modules/web-vitals/dist/lib/observe.d.ts
generated
vendored
Normal file
12
node_modules/web-vitals/dist/lib/observe.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export interface PerformanceEntryHandler {
|
||||
(entry: PerformanceEntry): void;
|
||||
}
|
||||
/**
|
||||
* Takes a performance entry type and a callback function, and creates a
|
||||
* `PerformanceObserver` instance that will observe the specified entry type
|
||||
* with buffering enabled and call the callback _for each entry_.
|
||||
*
|
||||
* This function also feature-detects entry support and wraps the logic in a
|
||||
* try/catch to avoid errors in unsupporting browsers.
|
||||
*/
|
||||
export declare const observe: (type: string, callback: PerformanceEntryHandler) => PerformanceObserver | undefined;
|
||||
36
node_modules/web-vitals/dist/lib/observe.js
generated
vendored
Normal file
36
node_modules/web-vitals/dist/lib/observe.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Takes a performance entry type and a callback function, and creates a
|
||||
* `PerformanceObserver` instance that will observe the specified entry type
|
||||
* with buffering enabled and call the callback _for each entry_.
|
||||
*
|
||||
* This function also feature-detects entry support and wraps the logic in a
|
||||
* try/catch to avoid errors in unsupporting browsers.
|
||||
*/
|
||||
export const observe = (type, callback) => {
|
||||
try {
|
||||
if (PerformanceObserver.supportedEntryTypes.includes(type)) {
|
||||
const po = new PerformanceObserver((l) => l.getEntries().map(callback));
|
||||
po.observe({ type, buffered: true });
|
||||
return po;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// Do nothing.
|
||||
}
|
||||
return;
|
||||
};
|
||||
7
node_modules/web-vitals/dist/lib/onHidden.d.ts
generated
vendored
Normal file
7
node_modules/web-vitals/dist/lib/onHidden.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export interface OnHiddenCallback {
|
||||
({ timeStamp, isUnloading }: {
|
||||
timeStamp: number;
|
||||
isUnloading: boolean;
|
||||
}): void;
|
||||
}
|
||||
export declare const onHidden: (cb: OnHiddenCallback, once?: boolean) => void;
|
||||
38
node_modules/web-vitals/dist/lib/onHidden.js
generated
vendored
Normal file
38
node_modules/web-vitals/dist/lib/onHidden.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
let isUnloading = false;
|
||||
let listenersAdded = false;
|
||||
const onPageHide = (event) => {
|
||||
isUnloading = !event.persisted;
|
||||
};
|
||||
const addListeners = () => {
|
||||
addEventListener('pagehide', onPageHide);
|
||||
// `beforeunload` is needed to fix this bug:
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=987409
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
addEventListener('beforeunload', () => { });
|
||||
};
|
||||
export const onHidden = (cb, once = false) => {
|
||||
if (!listenersAdded) {
|
||||
addListeners();
|
||||
listenersAdded = true;
|
||||
}
|
||||
addEventListener('visibilitychange', ({ timeStamp }) => {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
cb({ timeStamp, isUnloading });
|
||||
}
|
||||
}, { capture: true, once });
|
||||
};
|
||||
1
node_modules/web-vitals/dist/lib/whenInput.d.ts
generated
vendored
Normal file
1
node_modules/web-vitals/dist/lib/whenInput.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const whenInput: () => Promise<Event>;
|
||||
30
node_modules/web-vitals/dist/lib/whenInput.js
generated
vendored
Normal file
30
node_modules/web-vitals/dist/lib/whenInput.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
let inputPromise;
|
||||
export const whenInput = () => {
|
||||
if (!inputPromise) {
|
||||
inputPromise = new Promise((r) => {
|
||||
return ['scroll', 'keydown', 'pointerdown'].map((type) => {
|
||||
addEventListener(type, r, {
|
||||
once: true,
|
||||
passive: true,
|
||||
capture: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
return inputPromise;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue