Skip to content

Commit 8a22b18

Browse files
committed
feat: add code splitting and treesake for optimize deps
1 parent 528ab2a commit 8a22b18

9 files changed

Lines changed: 593 additions & 584 deletions

File tree

apps/remix-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
},
2525
"devDependencies": {
2626
"@remix-run/dev": "^2.9.2",
27-
"@types/react": "^18.2.20",
28-
"@types/react-dom": "^18.2.7",
27+
"@types/react": "18.2.15",
28+
"@types/react-dom": "18.2.7",
2929
"@typescript-eslint/eslint-plugin": "^6.7.4",
3030
"@typescript-eslint/parser": "^6.7.4",
3131
"autoprefixer": "^10.4.19",

apps/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"@storybook/testing-library": "0.2.2",
4343
"@storybook/theming": "^7.6.17",
4444
"@types/node": "^18.11.17",
45-
"@types/react": "^18.2.5",
46-
"@types/react-dom": "^18.2.4",
45+
"@types/react": "18.2.15",
46+
"@types/react-dom": "18.2.7",
4747
"@var-meta/eslint-config": "workspace:*",
4848
"autoprefixer": "^10.4.13",
4949
"postcss": "^8.4.20",

packages/icons/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@var-meta/icons",
3-
"version": "0.0.14",
3+
"version": "0.0.15",
44
"sideEffects": [
55
"*.svg"
66
],
@@ -30,8 +30,8 @@
3030
},
3131
"devDependencies": {
3232
"@types/node": "^20.9.2",
33-
"@types/react": "^18.2.15",
34-
"@types/react-dom": "^18.2.7",
33+
"@types/react": "18.2.15",
34+
"@types/react-dom": "18.2.7",
3535
"@babel/core": "^7.22.17",
3636
"@babel/preset-env": "^7.22.15",
3737
"@babel/preset-react": "^7.22.15",

packages/theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@var-meta/theme",
3-
"version": "0.0.14",
3+
"version": "0.0.15",
44
"license": "MIT",
55
"sideEffects": false,
66
"exports": {

packages/ui/package.json

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@var-meta/ui",
33
"license": "MIT",
4-
"version": "0.0.14",
4+
"version": "0.0.15",
55
"sideEffects": [
66
"**/*.css"
77
],
@@ -15,9 +15,16 @@
1515
"module": "dist/index.mjs",
1616
"exports": {
1717
".": {
18-
"types": "./dist/index.d.ts",
19-
"import": "./dist/index.mjs",
20-
"default": "./dist/index.js"
18+
"import": {
19+
"types": "./dist/index.d.mts",
20+
"module": "./dist/index.mjs",
21+
"default": "./dist/index.mjs"
22+
},
23+
"require": {
24+
"types": "./dist/index.d.ts",
25+
"module": "./dist/index.js",
26+
"default": "./dist/index.js"
27+
}
2128
},
2229
"./package.json": "./package.json"
2330
},
@@ -33,12 +40,14 @@
3340
"format:check": "prettier --check \"src/**/*.{ts,tsx}\" --cache"
3441
},
3542
"peerDependencies": {
36-
"react": "^18.2.0"
43+
"@types/react": "^17.0.0 || ^18.0.0",
44+
"react": "^17.0.0 || ^18.0.0",
45+
"react-dom": "^17.0.0 || ^18.0.0"
3746
},
3847
"devDependencies": {
3948
"@types/node": "^20.9.2",
40-
"@types/react": "^18.2.15",
41-
"@types/react-dom": "^18.2.7",
49+
"@types/react": "18.2.15",
50+
"@types/react-dom": "18.2.7",
4251
"@var-meta/eslint-config": "workspace:*",
4352
"@var-meta/test-utils": "workspace:^",
4453
"esbuild-plugin-file-path-extensions": "^2.1.0",

packages/ui/src/components/modal/dialog.styles.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ interface DialogContentProps extends DialogPrimitive.DialogContentProps {
4242
}
4343

4444
const dialogContentVariants = tv({
45-
base: 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] duration-200 sm:mx-6 sm:my-16 border border-border bg-background w-full max-w-[400px] h-fit min-h-[200px] p-0 shadow-lg rounded-lg md:w-full flex flex-col box-border z-100',
45+
base: [
46+
'sm:mx-6 sm:my-16 border border-border bg-background w-full max-w-[400px] h-fit min-h-[200px] p-0 shadow-lg rounded-lg md:w-full flex flex-col box-border z-100',
47+
'duration-200 group-data-[state=open]/wrapper:animate-in group-data-[state=closed]/wrapper:animate-out group-data-[state=closed]/wrapper:fade-out-0 group-data-[state=open]/wrapper:fade-in-0 group-data-[state=closed]/wrapper:zoom-out-75 group-data-[state=open]/wrapper:zoom-in-75 group-data-[state=closed]/wrapper:slide-out-to-top-[48%] group-data-[state=open]/wrapper:slide-in-from-top-[48%]',
48+
],
4649
variants: {
4750
fitContent: {
4851
true: 'max-w-fit w-fit',
@@ -59,7 +62,7 @@ const dialogContentVariants = tv({
5962
});
6063

6164
const dialogWrapperVariants = tv({
62-
base: 'h-[100dvh] fixed inset-0 flex justify-center w-screen z-100',
65+
base: 'h-[100dvh] group/wrapper fixed inset-0 flex justify-center w-screen z-100',
6366
variants: {
6467
scrollBehavior: {
6568
default: 'overflow-y-hidden',

packages/ui/src/components/navigation/navigation-dropdown.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Children, cloneElement, forwardRef, isValidElement, type ElementRef, type ReactNode } from 'react';
1+
import { Children, cloneElement, forwardRef, isValidElement, useEffect, type ElementRef, type ReactNode } from 'react';
22
import { DropdownMenuGroup, DropdownMenuItem } from '@radix-ui/react-dropdown-menu';
33
import { useControllableState } from '@radix-ui/react-use-controllable-state';
44
import { tv, type VariantProps } from 'tailwind-variants';
@@ -68,6 +68,11 @@ const NavigationDropdown = forwardRef<ElementRef<'div'>, NavigationDropdownProps
6868

6969
const expanded = open && !collapsed;
7070

71+
useEffect(() => {
72+
setOpen(false);
73+
// eslint-disable-next-line react-hooks/exhaustive-deps
74+
}, [collapsed]);
75+
7176
if (type === 'floating') {
7277
return (
7378
<Dropdown

packages/ui/tsup.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ async function cleanFile(dir = DIST_PATH): Promise<void> {
3030
}
3131

3232
export default defineConfig((options: Options) => ({
33-
treeshake: false,
34-
splitting: false,
3533
entry: ['src', '!src/**/__tests__/**', '!src/**/*.test.*'],
3634
format: ['esm', 'cjs'],
3735
target: 'esnext',
3836
outDir: DIST_PATH,
3937
dts: true,
40-
minify: true,
38+
minify: !options.watch,
4139
clean: !options.watch,
42-
external: ['react'],
43-
sourcemap: true,
40+
external: ['react', 'react-dom'],
41+
sourcemap: !!options.watch,
42+
treeshake: true,
43+
splitting: true,
4444
async onSuccess() {
4545
await cleanFile();
4646
},

0 commit comments

Comments
 (0)