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

fix: updates to optimize tree shaking #467

Merged
merged 21 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6267ea8
fix: remove nested exports
joshhowenstine Feb 8, 2024
96db4c8
fix: update paths accross the project
joshhowenstine Feb 8, 2024
811d30f
fix: remove .js from all imports
joshhowenstine Feb 8, 2024
db1233c
fix: adjust rollup settings for tree shaking
joshhowenstine Feb 13, 2024
fa1f7fc
fix: misc tree shaking optimizations
joshhowenstine Feb 16, 2024
4ada8aa
fix: run linting
joshhowenstine Mar 1, 2024
91dc020
fix: update paths
joshhowenstine Mar 1, 2024
be8c8a1
fix: update paths to textures in tests
joshhowenstine Mar 1, 2024
51d8452
fix: lower statement coverage to 84
joshhowenstine Mar 1, 2024
0f9db20
fix: add bundle analyzer
joshhowenstine Mar 1, 2024
1802508
fix: remove rollup warning
joshhowenstine Mar 1, 2024
6a22640
fix: remove unused json plugin from config. Fix unused import error
joshhowenstine Mar 1, 2024
e2df6ce
fix: ignore class transforms
joshhowenstine Mar 2, 2024
ff223b9
fix: formatting issues
joshhowenstine Mar 3, 2024
aa66718
fix: lower the threadhold for lines temporarily
joshhowenstine Mar 4, 2024
0e2bcad
fix: add ts definition for context
joshhowenstine Mar 12, 2024
0d3c416
fix: add peer dependency for @lightningjs/core that includes a range
joshhowenstine Mar 13, 2024
b8fd35f
fix: add peer dependency for @lightningjs/core that includes a range
joshhowenstine Mar 13, 2024
c47f67e
fix: revert change in withThemeStyles
joshhowenstine Mar 13, 2024
817bfeb
fix: removed unused files
joshhowenstine Mar 13, 2024
c7dd5b1
fix: update definition for context to fix linting errors. Revert chan…
joshhowenstine Mar 13, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ CHANGELOG.md
/packages/apps/lightning-ui-docs/scripts/themePropertyTables

# Copied into folder from root directory during release
/packages/@lightningjs/ui-components/README.md
/packages/@lightningjs/ui-components/README.md

/packages/@lightningjs/ui-components/bundle-analysis.html
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ module.exports = {
coverageReporters: ['html', 'text-summary'],
coverageThreshold: {
global: {
statements: 85,
functions: 85,
lines: 85
statements: 84,
functions: 84,
lines: 84
}
},
maxWorkers: '4',
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"scripts": {
"start": "yarn workspace lightning-ui-docs start",
"build": "yarn workspaces foreach --exclude lightning-ui-docs run build",
"build:analyze": "cross-env ANALYZE=true yarn build",
"prepare": "husky install",
"release": "git fetch origin && git checkout develop && git pull origin develop && git pull origin release && git push origin develop && git checkout release && git pull origin release && git pull origin develop && git push origin release",
"lint": "yarn eslint . --ext .js,.ts",
Expand All @@ -24,6 +25,7 @@
"createComponent": "node bin/create.js"
},
"devDependencies": {
"@babel/plugin-transform-optional-chaining": "^7.23.4",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@rollup/plugin-babel": "^6.0.2",
Expand All @@ -37,6 +39,7 @@
"@semantic-release/release-notes-generator": "^10.0.3",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"cross-env": "^7.0.3",
"eslint": "^7.22.0",
"eslint-config-prettier": "^7.2.0",
"eslint-config-standard-with-typescript": "^26.0.0",
Expand All @@ -57,6 +60,7 @@
"rollup-plugin-dts": "5.2.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-visualizer": "^5.12.0",
"semantic-release": "^19.0.5",
"semantic-release-monorepo": "^7.0.5",
"semantic-release-slack-bot": "^3.5.3",
Expand Down
19 changes: 0 additions & 19 deletions packages/@lightningjs/ui-components/babel.config.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion packages/@lightningjs/ui-components/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
export * from './src/components';
export * from './src/mixins';
export * from './src/types/lui';
// export * from './src/globals';
export * from './src/globals';

// exports without type definitions
export { default as utils } from './src/utils';
Expand Down
115 changes: 109 additions & 6 deletions packages/@lightningjs/ui-components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,113 @@
* SPDX-License-Identifier: Apache-2.0
*/

// Utils
export { default as utils } from './src/utils';
export * from './src/components';
export * from './src/globals';
export * from './src/mixins';
export * from './src/shaders';
export * from './src/textures';
export * from './src/docs/story-components';

// Components
export { default as Artwork } from './src/components/Artwork/Artwork';
export { default as Badge } from './src/components/Badge/Badge';
export { default as Base } from './src/components/Base/Base';
export { default as Button } from './src/components/Button/Button';
export { default as ButtonSmall } from './src/components/Button/ButtonSmall';
export {
default as Card,
CardRadio,
CardSection,
CardTitle
} from './src/components/Card';
export {
default as CardContent,
CardContentHorizontal,
CardContentHorizontalLarge,
CardContentVertical,
CardContentVerticalSmall
} from './src/components/CardContent';
export { default as Checkbox } from './src/components/Checkbox/Checkbox';
export { default as CheckboxSmall } from './src/components/Checkbox/CheckboxSmall';
export { default as Column } from './src/components/Column/Column';
export { default as Control } from './src/components/Control/Control';
export { default as ControlSmall } from './src/components/Control/ControlSmall';
export { default as ControlRow } from './src/components/ControlRow/ControlRow';
export { default as FocusManager } from './src/components/FocusManager/FocusManager';
export { default as Gradient } from './src/components/Gradient/Gradient';
export { default as GridOverlay } from './src/components/GridOverlay/GridOverlay';
export { default as Icon } from './src/components/Icon/Icon';
export { default as InlineContent } from './src/components/InlineContent/InlineContent';
export { default as Input } from './src/components/Input/Input';
export { default as Key } from './src/components/Key/Key';
export {
default as Keyboard,
KeyboardEmail,
KeyboardFullscreen,
KeyboardNumbers,
KeyboardQwerty,
KeyboardInput,
KeyboardSearch
} from './src/components/Keyboard';
export { default as Knob } from './src/components/Knob/Knob';
export { default as Label } from './src/components/Label/Label';
export {
default as ListItem,
ListItemPicker,
ListItemSlider
} from './src/components/ListItem';
export { default as Marquee } from './src/components/Marquee/Marquee';
export { default as MetadataBase } from './src/components/MetadataBase/MetadataBase';
export { default as MetadataCard } from './src/components/MetadataCard';
export { default as MetadataCardContent } from './src/components/MetadataCardContent';
export { default as MetadataTile } from './src/components/MetadataTile/MetadataTile';
export { default as NavigationManager } from './src/components/NavigationManager';
export { default as ProgressBar } from './src/components/ProgressBar/ProgressBar';
export { default as Provider } from './src/components/Provider';
export { default as Radio } from './src/components/Radio/Radio';
export { default as RadioSmall } from './src/components/Radio/RadioSmall';
export { default as Row } from './src/components/Row/Row';
export { default as ScrollWrapper } from './src/components/ScrollWrapper/ScrollWrapper';
export { default as Shadow } from './src/components/Shadow/Shadow';
export { default as Slider } from './src/components/Slider/Slider';
export { default as SliderLarge } from './src/components/Slider/SliderLarge';
export { default as Surface } from './src/components/Surface/Surface';
export { default as TabBar, Tab } from './src/components/TabBar';
export { default as TextBox } from './src/components/TextBox/TextBox';
export { default as Tile } from './src/components/Tile/Tile';
export { default as TitleRow } from './src/components/TitleRow/TitleRow';
export { default as Toggle } from './src/components/Toggle/Toggle';
export { default as ToggleSmall } from './src/components/Toggle/ToggleSmall';
export { default as Tooltip } from './src/components/Tooltip/Tooltip';

// Globals
export { default as context } from './src/globals/context';
export { updateManager } from './src/globals/global-update-manager/GlobalUpdateManager';
export { default as pool } from './src/globals/pool';

// Mixins
export {
default as withAnnouncer,
generateAbbrevConfig,
defaultAbbrevConfig
} from './src/mixins/withAnnouncer';
export { default as Speech } from './src/mixins/withAnnouncer/Speech';
export { default as withClassCache } from './src/mixins/withClassCache';
export { default as withHandleKey } from './src/mixins/withHandleKey';
export { default as withLayout } from './src/mixins/withLayout';
export { default as withMarqueeSync } from './src/mixins/withMarqueeSync';
export { default as withSelections } from './src/mixins/withSelections';
export { default as withThemeStyles } from './src/mixins/withThemeStyles';
export { default as withTags } from './src/mixins/withTags';
export { default as withUpdates } from './src/mixins/withUpdates';
export { default as withEditItems } from './src/mixins/withEditItems';
export { default as withExtensions } from './src/mixins/withExtensions';

// Shaders
export { default as FadeShader } from './src/shaders/FadeShader';

// Textures
export { default as LinearGradient } from './src/textures/LinearGradient';
export { default as Circle } from './src/textures/Circle';
export { default as Arrow } from './src/textures/Arrow';
export { default as Bubble } from './src/textures/Bubble';
export { default as Line } from './src/textures/Line';

// Storybook
export { default as SignalButton } from './src/docs/story-components/SignalButton';
4 changes: 3 additions & 1 deletion packages/@lightningjs/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --no-coverage --watch --colors"
},
"peerDependencies": {
"@lightningjs/core": "2.11.0"
"@lightningjs/core": ">=2.0.0 <=2.11.0"
},
"devDependencies": {
"@babel/core": "^7.19.3",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4",
"@lightningjs/ui-components-test-utils": "workspace:^",
"@mdx-js/react": "^1.6.22",
"@rollup/plugin-babel": "^6.0.4",
"babel-jest": "^29.0.3",
"babel-loader": "^8.2.5",
"enhanced-resolve": "^5.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import lng from '@lightningjs/core';
import { getValidColor, reduceFraction } from '../../utils';
import Base from '../Base';
import Gradient from '../Gradient';
import * as styles from './Artwork.styles.js';
import { context } from '../../globals';
import * as styles from './Artwork.styles';
import context from '../../globals/context/index';
import CustomImageTexture from '../../textures/CustomImageTexture';

export default class Artwork extends Base {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SPDX-License-Identifier: Apache-2.0
\*/}

import { Meta, Title } from '@storybook/blocks';
import * as ArtworkStories from './Artwork.stories.js';
import * as ArtworkStories from './Artwork.stories';

<Meta of={ArtworkStories} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export { default as default } from './Artwork.js';
export { default as default } from './Artwork';
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import Base from '../Base';
import Icon from '../Icon';
import { getHexColor } from '../../utils';
import * as styles from './Badge.styles.js';
import * as styles from './Badge.styles';
import lng from '@lightningjs/core';

export default class Badge extends Base {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SPDX-License-Identifier: Apache-2.0

import { Meta, Title } from '@storybook/blocks';
import Badge from '.';
import * as BadgeStories from './Badge.stories.js';
import * as BadgeStories from './Badge.stories';

<Meta of={BadgeStories} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export { default as default } from './Badge.js';
export { default as default } from './Badge';
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
*/

import lng from '@lightningjs/core';
import { context } from '../../globals';
import {
withUpdates,
withTags,
withHandleKey,
withLayout,
withThemeStyles,
withExtensions
} from '../../mixins';
import context from '../../globals/context/index';
import withUpdates from '../../mixins/withUpdates';
import withTags from '../../mixins/withTags';
import withHandleKey from '../../mixins/withHandleKey';
import withLayout from '../../mixins/withLayout';
import withThemeStyles from '../../mixins/withThemeStyles';
import withExtensions from '../../mixins/withExtensions';
import { isComponentOnScreen } from '../../utils';

class Base extends lng.Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export { default as default } from './Base.js';
export { default as default } from './Base';
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import * as styles from './Button.styles.js';
import * as styles from './Button.styles';
import Row from '../Row';
import Surface from '../Surface';
import TextBox from '../TextBox'; // There seams to be some issue with the circular dependency here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SPDX-License-Identifier: Apache-2.0
\*/}

import { ArgTypes, Meta, Title, Description } from '@storybook/blocks';
import * as ButtonStories from './Button.stories.js';
import * as ButtonStories from './Button.stories';

<Meta title="Components / Button" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import Button from './Button';
import * as styles from './ButtonSmall.styles.js';
import * as styles from './ButtonSmall.styles';

export default class ButtonSmall extends Button {
static get __componentName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
* SPDX-License-Identifier: Apache-2.0
*/

export { default as default } from './Button.js';
export { default as ButtonSmall } from './ButtonSmall.js';
export { default as default } from './Button';
export { default as ButtonSmall } from './ButtonSmall';
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import * as styles from './Card.styles.js';
import * as styles from './Card.styles';
import TextBox from '../TextBox';
import Surface from '../Surface';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import lng from '@lightningjs/core';
import { createModeControl } from '../../docs/utils';
import { default as CardComponent } from './Card.js';
import { default as CardComponent } from './Card';

export default {
title: 'Components/Card/Card'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import CardTitle from './CardTitle';
import TextBox from '../TextBox';
import * as styles from './CardRadio.styles.js';
import * as styles from './CardRadio.styles';
import Radio from '../Radio';

export default class CardRadio extends CardTitle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/

import lng from '@lightningjs/core';
import { default as CardRadioComponent } from './CardRadio.js';
import { Radio as RadioStory } from '../Radio/Radio.stories.js';
import { default as CardRadioComponent } from './CardRadio';
import { Radio as RadioStory } from '../Radio/Radio.stories';
import { createModeControl, generateSubStory } from '../../docs/utils';

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import lng from '@lightningjs/core';
import { default as CardSectionComponent } from './CardSection.js';
import { default as CardSectionComponent } from './CardSection';
import sectionIcon from '../../assets/images/ic_check_circle_outline_inverse_24.png';
import { createModeControl } from '../../docs/utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import lng from '@lightningjs/core';
import { default as CardTitleComponent } from './CardTitle.js';
import { default as CardTitleComponent } from './CardTitle';
import { createModeControl } from '../../docs/utils';

export default {
Expand Down
Loading
Loading