Skip to content

Commit

Permalink
fix: bundle
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Mar 16, 2024
1 parent 458bfd2 commit a98a465
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 30 deletions.
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"type": "git",
"url": "https://github.com/Innei/rc-modal"
},
"type": "module",
"main": "./src/index.ts",
"exports": {
".": {
Expand All @@ -25,33 +24,33 @@
"src"
],
"publishConfig": {
"main": "dist/index.cjs",
"module": "dist/index.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
"require": "./dist/index.mjs",
"import": "./dist/index.js"
},
"./index.css": {
"import": "./dist/index.css",
"require": "./dist/index.css"
"require": "./dist/index.css",
"import": "./dist/index.css"
},
"./motion": {
"import": "./dist/helpers/motion.js",
"require": "./dist/helpers/motion.cjs"
"require": "./dist/helpers/motion.js",
"import": "./dist/helpers/motion.mjs"
},
"./m": {
"import": "./dist/helpers/m.js",
"require": "./dist/helpers/m.cjs"
"require": "./dist/helpers/m.js",
"import": "./dist/helpers/m.mjs"
},
"./mobile-detector": {
"import": "./dist/helpers/mobile-detector.js",
"require": "./dist/helpers/mobile-detector.cjs"
"require": "./dist/helpers/mobile-detector.js",
"import": "./dist/helpers/mobile-detector.mjs"
},
"./dist/*": {
"import": "./dist/*",
"require": "./dist/*"
"require": "./dist/*",
"import": "./dist/*"
},
"./*": [
"./*",
Expand All @@ -63,6 +62,7 @@
"*": {
"*": [
"./dist/*",
"./dist/helpers/*",
"./*"
]
}
Expand Down
2 changes: 1 addition & 1 deletion src/dialog/DialogOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Dialog from '@radix-ui/react-dialog'
import { forwardRef } from 'react'
import React, { forwardRef } from 'react'
import type { LegacyRef } from 'react'

import { useMotionComponent } from '~/providers'
Expand Down
9 changes: 5 additions & 4 deletions src/helpers/m.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use client'

import React from 'react'
import { m } from 'framer-motion'
import type { ModalStackContainerProps } from '~/modal'
import type { PropsWithChildren } from 'react'
import type { FC, PropsWithChildren } from 'react'

import { ModalStackContainer as MSC } from '~/modal'

export const ModalStackContainer = (
props: PropsWithChildren & Omit<ModalStackContainerProps, 'm'>,
) => <MSC m={m}>{props.children}</MSC>
export const ModalStackContainer: FC<
PropsWithChildren & Omit<ModalStackContainerProps, 'm'>
> = (props) => <MSC m={m}>{props.children}</MSC>
9 changes: 5 additions & 4 deletions src/helpers/motion.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use client'

import React from 'react'
import { motion } from 'framer-motion'
import type { ModalStackContainerProps } from '~/modal'
import type { PropsWithChildren } from 'react'
import type { FC, PropsWithChildren } from 'react'

import { ModalStackContainer as MSC } from '~/modal'

export const ModalStackContainer = (
props: PropsWithChildren & Omit<ModalStackContainerProps, 'm'>,
) => <MSC m={motion}>{props.children}</MSC>
export const ModalStackContainer: FC<
PropsWithChildren & Omit<ModalStackContainerProps, 'm'>
> = (props) => <MSC m={motion}>{props.children}</MSC>
2 changes: 1 addition & 1 deletion src/lib/craete-context-state.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, useContext, useState } from 'react'
import React, { createContext, useContext, useState } from 'react'

const throwError = () => {
throw 'setState must be used within a Provider with a value'
Expand Down
2 changes: 1 addition & 1 deletion src/modal/container.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { memo, useMemo } from 'react'
import React, { memo, useMemo } from 'react'
import { AnimatePresence } from 'framer-motion'
import type { FC, PropsWithChildren } from 'react'
import type { ModalStackContainerProps } from './types'
Expand Down
2 changes: 1 addition & 1 deletion src/modal/helper.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { memo, useContext } from 'react'
import React, { memo, useContext } from 'react'
import type { Context, PropsWithChildren } from 'react'

export const InjectContext = (context: Context<any>) => {
Expand Down
2 changes: 1 addition & 1 deletion src/modal/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import * as Dialog from '@radix-ui/react-dialog'
import {
import React, {
createContext,
createElement,
Fragment,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"baseUrl": "./src",
"rootDir": "./src",
"outDir": "/tmp",
"jsx": "preserve",
"jsx": "react",
"target": "ES2020",
"lib": [
"ESNext",
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
// rollupTypes: true

beforeWriteFile: (filePath, content) => {
writeFileSync(filePath.replace('.d.ts', '.d.cts'), content)
writeFileSync(filePath.replace('.d.ts', '.d.mts'), content)
return { filePath, content }
},
}),
Expand Down

0 comments on commit a98a465

Please sign in to comment.