mirror of
https://github.com/SableClient/Sable.git
synced 2026-12-06 00:32:26 -08:00
fix: deprecated esbuild options
Signed-off-by: hazre <[email protected]>
This commit is contained in:
5 files changed
+66
-74
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/knip@6/schema.json",
|
||||
"entry": ["src/sw.ts", "scripts/**/*.js"],
|
||||
"entry": ["scripts/**/*.js"],
|
||||
"ignore": ["src/test/choochmeque-notifications-stub.ts"],
|
||||
"ignoreExportsUsedInFile": {
|
||||
"interface": true,
|
||||
|
||||
+1
-1
@@ -49,6 +49,7 @@
|
||||
"@lottiefiles/dotlottie-react": "^0.19.10",
|
||||
"@noble/hashes": "^2.2.0",
|
||||
"@phosphor-icons/react": "^2.1.10",
|
||||
"@rolldown/plugin-node-polyfills": "^1.0.3",
|
||||
"@sableclient/twemoji-font": "^1.0.4",
|
||||
"@sentry/react": "^10.67.0",
|
||||
"@tanstack/react-query": "^5.101.3",
|
||||
@@ -121,7 +122,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.45.1",
|
||||
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
||||
"@playwright/test": "^1.61.1",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@rollup/plugin-wasm": "^6.2.2",
|
||||
|
||||
Generated
+8
-12
@@ -52,6 +52,9 @@ importers:
|
||||
'@phosphor-icons/react':
|
||||
specifier: ^2.1.10
|
||||
version: 2.1.10([email protected]([email protected]))([email protected])
|
||||
'@rolldown/plugin-node-polyfills':
|
||||
specifier: ^1.0.3
|
||||
version: 1.0.3
|
||||
'@sableclient/twemoji-font':
|
||||
specifier: ^1.0.4
|
||||
version: 1.0.4
|
||||
@@ -263,9 +266,6 @@ importers:
|
||||
'@cloudflare/vite-plugin':
|
||||
specifier: ^1.45.1
|
||||
version: 1.49.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])
|
||||
'@esbuild-plugins/node-globals-polyfill':
|
||||
specifier: ^0.2.3
|
||||
version: 0.2.3([email protected])
|
||||
'@playwright/test':
|
||||
specifier: ^1.61.1
|
||||
version: 1.62.1
|
||||
@@ -1060,11 +1060,6 @@ packages:
|
||||
'@emotion/[email protected]':
|
||||
resolution: {integrity: sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==}
|
||||
|
||||
'@esbuild-plugins/[email protected]':
|
||||
resolution: {integrity: sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==}
|
||||
peerDependencies:
|
||||
esbuild: '>=0.25.0'
|
||||
|
||||
'@esbuild/[email protected]':
|
||||
resolution: {integrity: sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -2231,6 +2226,9 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@rolldown/[email protected]':
|
||||
resolution: {integrity: sha512-V7iWE6UI+InppK51NfuHlaCpep7Rzv4w92pZif6BtRP3ULDHfQjU6HNyIS41Plrx1tqzcANcAsnjDS6ye+1kFQ==}
|
||||
|
||||
'@rolldown/[email protected]':
|
||||
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
|
||||
|
||||
@@ -6494,10 +6492,6 @@ snapshots:
|
||||
|
||||
'@emotion/[email protected]': {}
|
||||
|
||||
'@esbuild-plugins/[email protected]([email protected])':
|
||||
dependencies:
|
||||
esbuild: 0.28.1
|
||||
|
||||
'@esbuild/[email protected]':
|
||||
optional: true
|
||||
|
||||
@@ -7217,6 +7211,8 @@ snapshots:
|
||||
'@rolldown/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@rolldown/[email protected]': {}
|
||||
|
||||
'@rolldown/[email protected]': {}
|
||||
|
||||
'@rollup/[email protected](@babel/[email protected])([email protected])':
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ComponentProps, CSSProperties, RefObject } from "react";
|
||||
import type { ComponentProps, CSSProperties, RefObject } from 'react';
|
||||
import React, {
|
||||
createContext,
|
||||
useCallback,
|
||||
@@ -6,22 +6,22 @@ import React, {
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { Box } from "folds";
|
||||
import FocusTrap from "focus-trap-react";
|
||||
import { useDrag } from "@use-gesture/react";
|
||||
import * as css from "$features/room/message/styles.css";
|
||||
import { useDismissOnBack } from "$utils/androidBack";
|
||||
import { stopPropagation } from "$utils/keyboard";
|
||||
import { getMobileSheetTiming, useMobileSheetAnimation } from "./mobileSheetAnimation";
|
||||
import { MOBILE_SHEET_DURATION_MS, MOBILE_SHEET_EASING } from "./mobileSheetAnimationConstants";
|
||||
import * as animationCss from "./mobileSheetAnimation.css";
|
||||
} from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { Box } from 'folds';
|
||||
import { FocusTrap } from 'focus-trap-react';
|
||||
import { useDrag } from '@use-gesture/react';
|
||||
import * as css from '$features/room/message/styles.css';
|
||||
import { useDismissOnBack } from '$utils/androidBack';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { getMobileSheetTiming, useMobileSheetAnimation } from './mobileSheetAnimation';
|
||||
import { MOBILE_SHEET_DURATION_MS, MOBILE_SHEET_EASING } from './mobileSheetAnimationConstants';
|
||||
import * as animationCss from './mobileSheetAnimation.css';
|
||||
|
||||
interface MobileSwipeDownModalProps {
|
||||
children: () => React.ReactNode;
|
||||
requestClose: () => void;
|
||||
containerRef?: RefObject<HTMLElement>;
|
||||
containerRef?: RefObject<HTMLElement | null>;
|
||||
focusTrap?: boolean;
|
||||
dialogLabel?: string;
|
||||
skipReturnFocusRef?: RefObject<boolean>;
|
||||
@@ -30,7 +30,7 @@ interface MobileSwipeDownModalProps {
|
||||
keyboardAware?: boolean;
|
||||
}
|
||||
|
||||
type FocusTrapOptions = ComponentProps<typeof FocusTrap>["focusTrapOptions"];
|
||||
type FocusTrapOptions = ComponentProps<typeof FocusTrap>['focusTrapOptions'];
|
||||
|
||||
const MobileSheetCloseContext = createContext<(() => void) | null>(null);
|
||||
|
||||
@@ -42,8 +42,8 @@ const DISMISS_VELOCITY = 0.5;
|
||||
/** Keeps a fling that lands at the top of a list from turning into a sheet drag. */
|
||||
const DRAG_BLOCKED_COOLDOWN_MS = 200;
|
||||
|
||||
const HANDLE_ATTRIBUTE = "data-mobile-sheet-handle";
|
||||
const NO_DRAG_ATTRIBUTE = "data-mobile-sheet-no-drag";
|
||||
const HANDLE_ATTRIBUTE = 'data-mobile-sheet-handle';
|
||||
const NO_DRAG_ATTRIBUTE = 'data-mobile-sheet-no-drag';
|
||||
|
||||
function getKeyboardOverlap(): number {
|
||||
const viewport = window.visualViewport;
|
||||
@@ -57,7 +57,7 @@ function findScroller(from: HTMLElement | null, boundary: HTMLElement): HTMLElem
|
||||
while (element && element !== boundary) {
|
||||
const { overflowY } = window.getComputedStyle(element);
|
||||
if (
|
||||
(overflowY === "auto" || overflowY === "scroll") &&
|
||||
(overflowY === 'auto' || overflowY === 'scroll') &&
|
||||
element.scrollHeight > element.clientHeight
|
||||
) {
|
||||
return element;
|
||||
@@ -123,15 +123,15 @@ export function MobileSwipeDownModal({
|
||||
sheet.style.transition =
|
||||
animate && !shouldReduceMotion
|
||||
? `transform ${MOBILE_SHEET_DURATION_MS}ms ${MOBILE_SHEET_EASING}`
|
||||
: "";
|
||||
sheet.style.transform = y === 0 ? "" : `translate3d(0, ${y}px, 0)`;
|
||||
: '';
|
||||
sheet.style.transform = y === 0 ? '' : `translate3d(0, ${y}px, 0)`;
|
||||
// Once lifted above the keyboard the bottom inset is no longer a safe area.
|
||||
sheet.style.setProperty(
|
||||
"--mobile-sheet-safe-bottom",
|
||||
keyboardOffset.current > 0 ? "0px" : "",
|
||||
'--mobile-sheet-safe-bottom',
|
||||
keyboardOffset.current > 0 ? '0px' : ''
|
||||
);
|
||||
},
|
||||
[shouldReduceMotion],
|
||||
[shouldReduceMotion]
|
||||
);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
@@ -144,7 +144,7 @@ export function MobileSwipeDownModal({
|
||||
const next = Math.max(stableViewportHeight, window.innerHeight);
|
||||
if (next === stableViewportHeight) return;
|
||||
stableViewportHeight = next;
|
||||
sheetRef.current?.style.setProperty("--mobile-sheet-viewport", `${next}px`);
|
||||
sheetRef.current?.style.setProperty('--mobile-sheet-viewport', `${next}px`);
|
||||
};
|
||||
|
||||
// The two viewports shrink in separate stages. Mid-way the visual one alone
|
||||
@@ -157,7 +157,7 @@ export function MobileSwipeDownModal({
|
||||
if (closingRef.current) return;
|
||||
publishViewportHeight();
|
||||
const visible = window.visualViewport?.height ?? window.innerHeight;
|
||||
sheetRef.current?.style.setProperty("--mobile-sheet-visible", `${visible}px`);
|
||||
sheetRef.current?.style.setProperty('--mobile-sheet-visible', `${visible}px`);
|
||||
|
||||
const next = getKeyboardOverlap();
|
||||
if (next === keyboardOffset.current) return;
|
||||
@@ -181,19 +181,19 @@ export function MobileSwipeDownModal({
|
||||
const viewport = window.visualViewport;
|
||||
|
||||
applySettled();
|
||||
window.addEventListener("resize", handleViewportChange);
|
||||
window.addEventListener("scroll", handleViewportChange);
|
||||
window.addEventListener("orientationchange", handleOrientationChange);
|
||||
viewport?.addEventListener("resize", handleViewportChange);
|
||||
viewport?.addEventListener("scroll", handleViewportChange);
|
||||
window.addEventListener('resize', handleViewportChange);
|
||||
window.addEventListener('scroll', handleViewportChange);
|
||||
window.addEventListener('orientationchange', handleOrientationChange);
|
||||
viewport?.addEventListener('resize', handleViewportChange);
|
||||
viewport?.addEventListener('scroll', handleViewportChange);
|
||||
|
||||
return () => {
|
||||
window.clearTimeout(settleTimer);
|
||||
window.removeEventListener("resize", handleViewportChange);
|
||||
window.removeEventListener("scroll", handleViewportChange);
|
||||
window.removeEventListener("orientationchange", handleOrientationChange);
|
||||
viewport?.removeEventListener("resize", handleViewportChange);
|
||||
viewport?.removeEventListener("scroll", handleViewportChange);
|
||||
window.removeEventListener('resize', handleViewportChange);
|
||||
window.removeEventListener('scroll', handleViewportChange);
|
||||
window.removeEventListener('orientationchange', handleOrientationChange);
|
||||
viewport?.removeEventListener('resize', handleViewportChange);
|
||||
viewport?.removeEventListener('scroll', handleViewportChange);
|
||||
};
|
||||
}, [keyboardAware, applySheetOffset]);
|
||||
|
||||
@@ -209,16 +209,16 @@ export function MobileSwipeDownModal({
|
||||
}
|
||||
|
||||
container.getAnimations().forEach((animation) => animation.cancel());
|
||||
container.style.transition = "";
|
||||
container.style.transition = '';
|
||||
const startY = touchYDiff.current - keyboardOffset.current;
|
||||
const animation = container.animate(
|
||||
[{ transform: `translate3d(0, ${startY}px, 0)` }, { transform: "translate3d(0, 100%, 0)" }],
|
||||
[{ transform: `translate3d(0, ${startY}px, 0)` }, { transform: 'translate3d(0, 100%, 0)' }],
|
||||
{
|
||||
...getMobileSheetTiming(shouldReduceMotion),
|
||||
duration: shouldReduceMotion ? 0 : 140,
|
||||
},
|
||||
}
|
||||
);
|
||||
animation.addEventListener("finish", requestClose, { once: true });
|
||||
animation.addEventListener('finish', requestClose, { once: true });
|
||||
}, [requestClose, shouldReduceMotion]);
|
||||
|
||||
// Android back closes the overlay instead of navigating away.
|
||||
@@ -285,10 +285,10 @@ export function MobileSwipeDownModal({
|
||||
target: sheetRef,
|
||||
eventOptions: { passive: false },
|
||||
pointer: { capture: false, touch: true },
|
||||
axis: "y",
|
||||
axis: 'y',
|
||||
// MobileMenuItem owns tap activation for marked actions; the sheet owns drag arbitration.
|
||||
filterTaps: false,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// A sheet opened by a long press mounts under the finger, and releasing it
|
||||
@@ -296,7 +296,7 @@ export function MobileSwipeDownModal({
|
||||
// backdrop is a dismiss.
|
||||
const handleBackdropClick = (e: React.MouseEvent) => {
|
||||
const fromTouch =
|
||||
e.nativeEvent instanceof PointerEvent && e.nativeEvent.pointerType === "touch";
|
||||
e.nativeEvent instanceof PointerEvent && e.nativeEvent.pointerType === 'touch';
|
||||
if (fromTouch && !backdropTouchRef.current) return;
|
||||
closeWithAnimation();
|
||||
};
|
||||
@@ -306,7 +306,7 @@ export function MobileSwipeDownModal({
|
||||
className={css.MessageMobileDragHandle}
|
||||
data-gestures="ignore"
|
||||
data-testid="mobile-sheet-drag-handle"
|
||||
{...{ [HANDLE_ATTRIBUTE]: "" }}
|
||||
{...{ [HANDLE_ATTRIBUTE]: '' }}
|
||||
>
|
||||
<div className={css.MessageMobileDragIndicator} />
|
||||
</div>
|
||||
@@ -326,7 +326,7 @@ export function MobileSwipeDownModal({
|
||||
fallbackFocus: () => sheetRef.current ?? target,
|
||||
preventScroll: true,
|
||||
returnFocusOnDeactivate: true,
|
||||
setReturnFocus: (previousActiveElement: HTMLElement) =>
|
||||
setReturnFocus: (previousActiveElement: HTMLElement | SVGElement) =>
|
||||
skipReturnFocusRef?.current ? false : previousActiveElement,
|
||||
allowOutsideClick: true,
|
||||
clickOutsideDeactivates: false,
|
||||
@@ -356,10 +356,10 @@ export function MobileSwipeDownModal({
|
||||
return createPortal(
|
||||
<Box
|
||||
className={`${css.MessageMobileOptionsWrapped} ${
|
||||
portalRef ? css.MessageMobileOptionsWrappedContained : ""
|
||||
portalRef ? css.MessageMobileOptionsWrappedContained : ''
|
||||
}`}
|
||||
data-gestures="ignore"
|
||||
style={closing ? { opacity: 0, transition: "opacity 100ms ease-out" } : undefined}
|
||||
style={closing ? { opacity: 0, transition: 'opacity 100ms ease-out' } : undefined}
|
||||
onClick={handleBackdropClick}
|
||||
// Touch events deliberately propagate: the drag binds them on `document`, and
|
||||
// stopping them here would starve it. `data-gestures="ignore"` is what keeps the
|
||||
@@ -373,10 +373,10 @@ export function MobileSwipeDownModal({
|
||||
>
|
||||
<Box
|
||||
ref={sheetRef}
|
||||
className={`${css.MessageMobileOptionsContainer} ${sheetClassName ?? ""} ${
|
||||
portalRef ? css.MessageMobileOptionsContainerContained : ""
|
||||
className={`${css.MessageMobileOptionsContainer} ${sheetClassName ?? ''} ${
|
||||
portalRef ? css.MessageMobileOptionsContainerContained : ''
|
||||
} ${animationCss.SheetEntrance}`}
|
||||
style={{ ...(shouldReduceMotion ? { animation: "none" } : undefined), ...sheetStyle }}
|
||||
style={{ ...(shouldReduceMotion ? { animation: 'none' } : undefined), ...sheetStyle }}
|
||||
onPointerDown={(e: React.PointerEvent) => e.stopPropagation()}
|
||||
onPointerMove={(e: React.PointerEvent) => e.stopPropagation()}
|
||||
onPointerUp={(e: React.PointerEvent) => e.stopPropagation()}
|
||||
@@ -386,6 +386,6 @@ export function MobileSwipeDownModal({
|
||||
<div className={css.MessageMobileSheetFill}>{dialog}</div>
|
||||
</Box>
|
||||
</Box>,
|
||||
target,
|
||||
target
|
||||
);
|
||||
}
|
||||
+7
-11
@@ -6,7 +6,7 @@ import svgr from 'vite-plugin-svgr';
|
||||
import { wasm } from '@rollup/plugin-wasm';
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
||||
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
|
||||
import nodePolyfills from '@rolldown/plugin-node-polyfills';
|
||||
import inject from '@rollup/plugin-inject';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
import { compression, defineAlgorithm } from 'vite-plugin-compression2';
|
||||
@@ -280,17 +280,13 @@ export default defineConfig(({ command }) => {
|
||||
'@vanilla-extract/recipes/createRuntimeFn',
|
||||
],
|
||||
needsInterop: ['matrix-widget-api'],
|
||||
esbuildOptions: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
rolldownOptions: {
|
||||
transform: {
|
||||
define: {
|
||||
global: 'globalThis',
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
// Enable esbuild polyfill plugins
|
||||
NodeGlobalsPolyfillPlugin({
|
||||
process: false,
|
||||
buffer: true,
|
||||
}),
|
||||
],
|
||||
plugins: [nodePolyfills()],
|
||||
},
|
||||
},
|
||||
build: {
|
||||
|
||||
Reference in new issue
Block a user