Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/sour-monkeys-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/fuselage': minor
---

Reduces the bundle size of `@rocket.chat/fuselage` by externalizing more dependencies and increasing the ECMAScript version.
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.16.0'
node-version: '22.19.0'
cache: 'yarn'
- uses: actions/cache@v4
id: yarn-cache
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '22.16.0'
node-version: '22.19.0'
registry-url: 'https://registry.npmjs.org'
scope: '@rocket.chat'
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.16.0'
node-version: '22.19.0'
cache: 'yarn'
- uses: actions/cache@v4
id: yarn-cache
Expand Down
716 changes: 358 additions & 358 deletions .yarn/releases/yarn-4.9.2.cjs → .yarn/releases/yarn-4.9.4.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.9.2.cjs
yarnPath: .yarn/releases/yarn-4.9.4.cjs
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,12 @@ export default tseslint.config(
},
},
},
tseslint.configs.eslintRecommended,
...tseslint.configs.recommended,
{
files: ['**/*.{ts,tsx,cts,ctsx,mts,mtsx}'],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-dupe-class-members': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,9 @@
"typescript-eslint": "~8.38.0",
"update-readme": "workspace:~"
},
"packageManager": "yarn@4.9.2",
"engines": {
"node": "22.16.0"
},
"packageManager": "yarn@4.9.4",
"volta": {
"node": "22.16.0",
"yarn": "4.9.2"
"node": "22.19.0",
"yarn": "4.9.4"
}
}
2 changes: 1 addition & 1 deletion packages/fuselage-forms/src/Field/Field.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Field as FieldComponent } from '@rocket.chat/fuselage';
import { ComponentProps, ReactNode } from 'react';
import type { ComponentProps, ReactNode } from 'react';

import FieldProvider from './FieldProvider';

Expand Down
6 changes: 4 additions & 2 deletions packages/fuselage-forms/src/Field/FieldProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { useState, useCallback, ReactNode } from 'react';
import type { ReactNode } from 'react';
import { useState, useCallback } from 'react';
import { useId } from 'react-aria';

import { FieldContext, LabelTypes, FieldType } from './FieldContext';
import type { LabelTypes, FieldType } from './FieldContext';
import { FieldContext } from './FieldContext';

type FieldProviderProps = { children: ReactNode };

Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage-forms/src/Field/Label/FieldLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FieldLabel as FieldLabelComponent } from '@rocket.chat/fuselage';
import type { FieldLabel as FieldLabelComponent } from '@rocket.chat/fuselage';
import { type ComponentPropsWithoutRef } from 'react';

import { useFieldFieldType } from '../FieldContext';
Expand Down
4 changes: 2 additions & 2 deletions packages/fuselage-hooks/src/testing.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
import type {
queries,
Queries,
RenderHookOptions,
RenderHookResult,
renderHook as _renderHook,
} from '@testing-library/react';
import { renderHook as _renderHook } from '@testing-library/react';
import { createElement } from 'react';
import { renderToString } from 'react-dom/server';

Expand Down
3 changes: 2 additions & 1 deletion packages/fuselage-toastbar/src/ToastBarContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createContext, ReactNode, useContext } from 'react';
import type { ReactNode } from 'react';
import { createContext, useContext } from 'react';

export type ToastBarPayload = {
type?: 'success' | 'info' | 'error';
Expand Down
9 changes: 2 additions & 7 deletions packages/fuselage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@
"storybook": "storybook dev -p 6006 --no-version-updates",
"build": "run-s .:build:clean .:build:dev .:build:prod",
".:build:clean": "rimraf dist",
".:build:prod": "run-s .:build:prod:bundle .:build:prod:check",
".:build:dev": "run-s .:build:dev:bundle .:build:dev:check",
".:build:prod:bundle": "webpack --mode production",
".:build:prod:check": "es-check es5 dist/*.production.js",
".:build:dev:bundle": "webpack --mode development",
".:build:dev:check": "es-check es5 dist/*.development.js",
".:build:prod": "webpack --mode production",
".:build:dev": "webpack --mode development",
"lint": "lint",
"lint-and-fix": "lint-and-fix",
"test": "jest --runInBand",
Expand Down Expand Up @@ -79,7 +75,6 @@
"cross-env": "^7.0.3",
"css-loader": "~7.1.2",
"cssnano": "~7.1.0",
"es-check": "~9.1.4",
"eslint": "~9.29.0",
"jest": "~30.0.0",
"jest-axe": "~10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage/src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ReactNode } from 'react';

import { cx, cxx } from '../../helpers/composeClassNames';
import { StylingBox } from '../Box';
import { StylingProps } from '../Box/stylingProps';
import type { StylingProps } from '../Box/stylingProps';

export type AccordionProps = {
children: ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import Chip from '../Chip';
import { Icon } from '../Icon';
import { InputBox } from '../InputBox';
import Margins from '../Margins';
import { useCursor, Options, OptionType } from '../Options';
import type { OptionType } from '../Options';
import { useCursor, Options } from '../Options';
import PositionAnimated from '../PositionAnimated';

const Addon = (props: ComponentProps<typeof Box>) => (
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage/src/components/Box/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default, default as Box, BoxProps } from './Box';
export { default, default as Box, type BoxProps } from './Box';
export { default as StylingBox, type StylingBoxProps } from './StylingBox';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ItemProps } from '@react-types/shared';
import { Children, ReactElement } from 'react';
import { Children, type ReactElement } from 'react';

import type { PartialNode } from './PartialNode';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffectEvent, useResizeObserver } from '@rocket.chat/fuselage-hooks';
import { type ComponentProps, useState, useRef, ElementType } from 'react';
import { type ComponentProps, useState, useRef, type ElementType } from 'react';

import { prevent } from '../../helpers/prevent';
import AnimatedVisibility from '../AnimatedVisibility';
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage/src/components/Select/SelectTrigger.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AllHTMLAttributes, RefObject } from 'react';
import { forwardRef } from 'react';
import { useButton, AriaButtonProps } from 'react-aria';
import { useButton, type AriaButtonProps } from 'react-aria';

import Box from '../Box';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { StoryFn, Meta } from '@storybook/react-webpack5';
import { ComponentType } from 'react';
import type { ComponentType } from 'react';

import { PropsVariationSection } from '../../../.storybook/helpers';
import { Icon } from '../Icon';
Expand Down
5 changes: 3 additions & 2 deletions packages/fuselage/src/components/Skeleton/Skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { AllHTMLAttributes } from 'react';
import type { AllHTMLAttributes } from 'react';

import { cx, cxx } from '../../helpers/composeClassNames';
import { StylingBox, StylingBoxProps } from '../Box';
import type { StylingBoxProps } from '../Box';
import { StylingBox } from '../Box';

type SkeletonProps = Omit<StylingBoxProps, 'children'> & {
variant?: 'text' | 'rect' | 'circle';
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage/src/helpers/composeClassNames.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Falsy } from '../types/Falsy';
import type { Falsy } from '../types/Falsy';

import { exhaustiveCheck } from './exhaustiveCheck';

Expand Down
12 changes: 7 additions & 5 deletions packages/fuselage/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDirs": ["./src", "./.storybook"],
"target": "ES5",
"module": "CommonJS",
"target": "es2024",
"module": "es2022",
Comment thread
tassoevan marked this conversation as resolved.
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,
"lib": ["ES2020", "DOM"],
"downlevelIteration": true,
"outDir": "./dist",
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"allowJs": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"erasableSyntaxOnly": true,
"isolatedModules": true
},
"include": [
"./src",
Expand Down
34 changes: 6 additions & 28 deletions packages/fuselage/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ module.exports = (env, { mode = 'production' }) => ({
use: [
MiniCssExtractPlugin.loader,
'babel-loader',
// {
// loader: 'style-loader',
// options: {
// attributes: {
// id: 'fuselage-style',
// },
// injectType: 'lazySingletonStyleTag',
// },
// },
{
loader: 'css-loader',
options: {
Expand Down Expand Up @@ -90,25 +81,12 @@ module.exports = (env, { mode = 'production' }) => ({
extensions: ['.tsx', '.ts', '.jsx', '.js', '.json'],
},
externals: [
{
react: {
commonjs: 'react',
commonjs2: 'react',
amd: 'react',
root: 'React',
},
},
'react-virtuoso',
'react-dom',
'@rocket.chat/icons',
'@rocket.chat/fuselage-hooks',
'react-aria',
'react-stately',
'@rocket.chat/css-in-js',
'@rocket.chat/css-supports',
'@rocket.chat/fuselage-tokens',
'@rocket.chat/memo',
'@rocket.chat/styled',
...Object.keys(pkg.dependencies ?? {}).map(
(dep) => new RegExp(`^${dep}(/.+)?$`),
),
...Object.keys(pkg.peerDependencies ?? {}).map(
(dep) => new RegExp(`^${dep}(/.+)?$`),
),
],
plugins: [
new MiniCssExtractPlugin(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const BackgroundLayer = ({ children }: BackgroundLayerProps): ReactElement => {
<BackgroundImage backgroundColor={backgroundColor} />,
),
)}`,
[backgroundColor],
[background, backgroundColor, backgroundDark, darkMode],
);

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box } from '@rocket.chat/fuselage';
import { ReactElement, ReactNode } from 'react';
import type { ReactElement, ReactNode } from 'react';

const HeroLayoutSubtitle = ({
children,
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/src/layouts/HeroLayout/HeroLayoutTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box } from '@rocket.chat/fuselage';
import { ReactElement, ReactNode } from 'react';
import type { ReactElement, ReactNode } from 'react';

const HeroLayoutTitle = ({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactElement, ReactNode } from 'react';
import type { ReactElement, ReactNode } from 'react';

import * as FormPageLayout from '../../components/FormPageLayout/FormPageLayout.styles';
import LayoutLogo from '../../components/LayoutLogo';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box } from '@rocket.chat/fuselage';
import { ReactNode } from 'react';
import type { ReactNode } from 'react';

const HorizontalWizardLayoutFooter = ({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentProps, ReactElement } from 'react';
import type { ComponentProps, ReactElement } from 'react';

import * as FormPageLayout from '../../components/FormPageLayout/FormPageLayout.styles';

Expand Down
Loading
Loading