Update app and tooling

This commit is contained in:
Lawrence Chen 2026-01-29 17:36:26 -08:00
parent 3046531bdd
commit e620ec7349
4950 changed files with 2975120 additions and 10 deletions

48
node_modules/web-vitals/src/lib/bindReporter.ts generated vendored Normal file
View file

@ -0,0 +1,48 @@
/*
* 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 {Metric, ReportHandler} from '../types.js';
export const bindReporter = (
callback: ReportHandler,
metric: Metric,
po: PerformanceObserver | undefined,
observeAllUpdates?: boolean,
) => {
let prevValue: number;
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;
}
}
}
}
}

24
node_modules/web-vitals/src/lib/generateUniqueID.ts generated vendored Normal file
View file

@ -0,0 +1,24 @@
/*
* 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}`;
};

39
node_modules/web-vitals/src/lib/getFirstHidden.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
/*
* 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: number
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;
}
}
};

30
node_modules/web-vitals/src/lib/initMetric.ts generated vendored Normal file
View 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.
*/
import {Metric} from '../types.js';
import {generateUniqueID} from './generateUniqueID.js';
export const initMetric = (name: Metric['name'], value = -1): Metric => {
return {
name,
value,
delta: 0,
entries: [],
id: generateUniqueID(),
isFinal: false
};
};

45
node_modules/web-vitals/src/lib/observe.ts generated vendored Normal file
View file

@ -0,0 +1,45 @@
/*
* 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 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 const observe = (
type: string,
callback: PerformanceEntryHandler,
): PerformanceObserver | undefined => {
try {
if (PerformanceObserver.supportedEntryTypes.includes(type)) {
const po: PerformanceObserver =
new PerformanceObserver((l) => l.getEntries().map(callback));
po.observe({type, buffered: true});
return po;
}
} catch (e) {
// Do nothing.
}
return;
};

50
node_modules/web-vitals/src/lib/onHidden.ts generated vendored Normal file
View file

@ -0,0 +1,50 @@
/*
* 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 interface OnHiddenCallback {
// TODO(philipwalton): add `isPersisted` if needed for bfcache.
({timeStamp, isUnloading}: {timeStamp: number; isUnloading: boolean}): void;
}
let isUnloading = false;
let listenersAdded = false;
const onPageHide = (event: PageTransitionEvent) => {
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: OnHiddenCallback, once = false) => {
if (!listenersAdded) {
addListeners();
listenersAdded = true;
}
addEventListener('visibilitychange', ({timeStamp}) => {
if (document.visibilityState === 'hidden') {
cb({timeStamp, isUnloading});
}
}, {capture: true, once});
};

32
node_modules/web-vitals/src/lib/whenInput.ts generated vendored Normal file
View file

@ -0,0 +1,32 @@
/*
* 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: Promise<Event>;
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;
};