Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webpack-build-scripts] feat: migrate to swc #6453

Merged
merged 19 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"importHelpers": true,
"importsNotUsedAsValues": "error",
"jsx": "react",
"lib": ["dom", "dom.iterable", "es5", "es2015.collection", "es2015.iterable"],
"module": "es2020",
Expand Down
6 changes: 6 additions & 0 deletions packages/core/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ module.exports = async function (config) {
createKarmaConfig({
dirname: __dirname,
coverageExcludes: [
// don't check barrel files
"src/**/index.ts",

// no need to test legacy APIs
"src/legacy/*",
"src/common/keyCodes.ts",
"src/deprecatedTypeAliases.ts",

// not worth full coverage
"src/accessibility/*",
"src/common/abstractComponent*",
"src/common/abstractPureComponent*",
"src/components/html/html.tsx",

// HACKHACK: for karma upgrade only
"src/common/refs.ts",
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/accessibility/focusStyleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import { FOCUS_DISABLED } from "../common/classes";
import { InteractionModeEngine } from "../common/interactionMode";

/* istanbul ignore next */
const fakeFocusEngine = {
isActive: () => true,
start: () => true,
Expand Down
18 changes: 9 additions & 9 deletions packages/core/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ export { Intent } from "./intent";
export { KeyCodes as Keys } from "./keyCodes";
export { Position } from "./position";
export {
ActionProps,
ControlledProps,
IntentProps,
LinkProps,
OptionProps,
Props,
type ActionProps,
type ControlledProps,
type IntentProps,
type LinkProps,
type OptionProps,
type Props,
removeNonHTMLProps,
DISPLAYNAME_PREFIX,
HTMLDivProps,
HTMLInputProps,
MaybeElement,
type HTMLDivProps,
type HTMLInputProps,
type MaybeElement,
} from "./props";
export { getRef, isRefCallback, isRefObject, mergeRefs, refHandler, setRef } from "./refs";

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/common/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

import * as React from "react";
import type * as React from "react";

import type { IconName } from "@blueprintjs/icons";

import { Intent } from "./intent";
import type { Intent } from "./intent";

export const DISPLAYNAME_PREFIX = "Blueprint5";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/common/refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as React from "react";
import type * as React from "react";

export function isRefObject<T>(value: React.Ref<T> | undefined): value is React.RefObject<T> {
return value != null && typeof value !== "function";
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/common/utils/domUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export function throttleReactEventCallback<E extends React.SyntheticEvent = Reac
* Throttle a method by wrapping it in a `requestAnimationFrame` call. Returns
* the throttled function.
*/
/* istanbul ignore next */
// eslint-disable-next-line @typescript-eslint/ban-types
export function throttle<T extends Function>(method: T): T {
return throttleImpl(method);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/common/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export { isFunction } from "./functionUtils";
export * from "./jsUtils";
export * from "./reactUtils";
export { isArrowKey, isKeyboardClick } from "./keyboardUtils";
export { Extends } from "./typeUtils";
export type { Extends } from "./typeUtils";
export { isDarkTheme } from "./isDarkTheme";

// ref utils used to live in this folder, but got refactored and moved elsewhere.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { Button } from "../button/buttons";
import { Dialog } from "../dialog/dialog";
import { Icon, IconName } from "../icon/icon";
import { OverlayLifecycleProps } from "../overlay/overlay";
import type { OverlayLifecycleProps } from "../overlay/overlay";

export interface AlertProps extends OverlayLifecycleProps, Props {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/button/buttonProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as React from "react";
import type * as React from "react";

import type { ActionProps, Alignment, MaybeElement } from "../../common";
import type { IconName } from "../icon/icon";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/button/buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { DISPLAYNAME_PREFIX, removeNonHTMLProps } from "../../common/props";
import { mergeRefs } from "../../common/refs";
import { Icon } from "../icon/icon";
import { Spinner, SpinnerSize } from "../spinner/spinner";
import { AnchorButtonProps, ButtonProps } from "./buttonProps";
import type { AnchorButtonProps, ButtonProps } from "./buttonProps";

/**
* Button component.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/context-menu/contextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as React from "react";
import { Classes, DISPLAYNAME_PREFIX, mergeRefs, Props, Utils } from "../../common";
import { TooltipContext, TooltipProvider } from "../popover/tooltipContext";
import { ContextMenuPopover } from "./contextMenuPopover";
import { ContextMenuPopoverOptions, Offset } from "./contextMenuShared";
import type { ContextMenuPopoverOptions, Offset } from "./contextMenuShared";

/**
* Render props relevant to the _content_ of a context menu (rendered as the underlying Popover's content).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import * as React from "react";

import { Classes, DISPLAYNAME_PREFIX } from "../../common";
import { Popover } from "../popover/popover";
import { PopoverTargetProps } from "../popover/popoverSharedProps";
import type { PopoverTargetProps } from "../popover/popoverSharedProps";
import { Portal } from "../portal/portal";
import { ContextMenuPopoverOptions, Offset } from "./contextMenuShared";
import type { ContextMenuPopoverOptions, Offset } from "./contextMenuShared";

export interface ContextMenuPopoverProps extends ContextMenuPopoverOptions {
isOpen: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/dialog/dialogBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import classNames from "classnames";
import * as React from "react";

import { AbstractPureComponent, Classes } from "../../common";
import { Props } from "../../common/props";
import type { Props } from "../../common/props";

export interface DialogBodyProps extends Props {
/** Dialog body contents. */
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/dialog/dialogFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import classNames from "classnames";
import * as React from "react";

import { AbstractPureComponent, Classes } from "../../common";
import { Props } from "../../common/props";
import type { Props } from "../../common/props";

export interface DialogFooterProps extends Props {
/** Child contents are rendered on the left side of the footer. */
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/dialog/dialogStepButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as React from "react";

import { ButtonSharedPropsAndAttributes } from "../button/buttonProps";
import type { ButtonSharedPropsAndAttributes } from "../button/buttonProps";
import { AnchorButton } from "../button/buttons";
import { Tooltip, TooltipProps } from "../tooltip/tooltip";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/hotkeys/hotkey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import classNames from "classnames";
import * as React from "react";

import { AbstractPureComponent, Classes, DISPLAYNAME_PREFIX, Props } from "../../common";
import { HotkeyConfig } from "../../hooks";
import type { HotkeyConfig } from "../../hooks";
import { KeyComboTag } from "./keyComboTag";

export type HotkeyProps = Props & HotkeyConfig;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/hotkeys/hotkeysDialog2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import classNames from "classnames";
import * as React from "react";

import { Classes } from "../../common";
import { HotkeyConfig } from "../../hooks";
import type { HotkeyConfig } from "../../hooks";
import { Dialog, DialogProps } from "../dialog/dialog";
import { DialogBody } from "../dialog/dialogBody";
import { Hotkey } from "./hotkey";
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/components/hotkeys/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

export { Hotkey, HotkeyProps } from "./hotkey";
export { Hotkeys, HotkeysProps } from "./hotkeys";
export { KeyComboTag, KeyComboTagProps } from "./keyComboTag";
export { KeyCombo, comboMatches, getKeyCombo, getKeyComboString, parseKeyCombo } from "./hotkeyParser";
export { Hotkey, type HotkeyProps } from "./hotkey";
export { Hotkeys, type HotkeysProps } from "./hotkeys";
export { KeyComboTag, type KeyComboTagProps } from "./keyComboTag";
export { type KeyCombo, comboMatches, getKeyCombo, getKeyComboString, parseKeyCombo } from "./hotkeyParser";

// N.B. "V1" variants of these APIs are exported from src/legacy/
export { HotkeysDialog2 } from "./hotkeysDialog2";
export { HotkeysTarget2, HotkeysTarget2Props, HotkeysTarget2RenderProps } from "./hotkeysTarget2";
export { HotkeysTarget2, type HotkeysTarget2Props, type HotkeysTarget2RenderProps } from "./hotkeysTarget2";
2 changes: 1 addition & 1 deletion packages/core/src/components/html-select/htmlSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { CaretDown, DoubleCaretVertical, IconName, SVGIconProps } from "@bluepri

import { DISABLED, FILL, HTML_SELECT, LARGE, MINIMAL } from "../../common/classes";
import { DISPLAYNAME_PREFIX, OptionProps } from "../../common/props";
import { Extends } from "../../common/utils";
import type { Extends } from "../../common/utils";

export type HTMLSelectIconName = Extends<IconName, "double-caret-vertical" | "caret-down">;

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
import { Classes, DISPLAYNAME_PREFIX, IntentProps, MaybeElement, Props, removeNonHTMLProps } from "../../common";

// re-export for convenience, since some users won't be importing from or have a direct dependency on the icons package
export { IconName, IconSize };
export { type IconName, IconSize };

export interface IconOwnProps {
/**
Expand Down
Loading