Skip to content

Commit

Permalink
Latest
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry committed Feb 3, 2025
1 parent cbeafb2 commit 97f7cb2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/framer-motion/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"types": "../dist/client.d.ts",
"types": "../dist/types/client.d.ts",
"main": "../dist/cjs/client.js",
"module": "../dist/es/client.mjs"
}
4 changes: 2 additions & 2 deletions packages/framer-motion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"module": "dist/es/index.mjs",
"exports": {
".": {
"types": "./dist/index.d.ts",
"types": "./dist/types/index.d.ts",
"require": "./dist/cjs/index.js",
"import": "./dist/es/index.mjs",
"default": "./dist/cjs/index.js"
Expand All @@ -24,7 +24,7 @@
"default": "./dist/cjs/dom.js"
},
"./client": {
"types": "./dist/client.d.ts",
"types": "./dist/types/client.d.ts",
"require": "./dist/cjs/client.js",
"import": "./dist/es/client.mjs",
"default": "./dist/cjs/client.js"
Expand Down
18 changes: 12 additions & 6 deletions packages/framer-motion/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const umdDomProd = createUmd("lib/dom.js", `dist/dom.js`)
const umdDomMiniProd = createUmd("lib/dom-mini.js", `dist/dom-mini.js`)

const cjs = Object.assign({}, config, {
input: "lib/index.js",
input: ["lib/index.js", "lib/client.js"],
output: {
entryFileNames: `[name].js`,
dir: "dist/cjs",
Expand All @@ -138,7 +138,6 @@ const cjs = Object.assign({}, config, {
const cjsDom = Object.assign({}, cjs, { input : "lib/dom.js" })
const cjsMini = Object.assign({}, cjs, { input : "lib/mini.js" })
const cjsDomMini = Object.assign({}, cjs, { input : "lib/dom-mini.js" })
const cjsClient = Object.assign({}, cjs, { input : "lib/client.js" })
const cjsM = Object.assign({}, cjs, { input : "lib/m.js" })

export const es = Object.assign({}, config, {
Expand All @@ -162,6 +161,17 @@ export const es = Object.assign({}, config, {

const typePlugins = [dts({compilerOptions: {...tsconfig, baseUrl:"types"}})]

const types = {
input: ["types/index.d.ts", "types/client.d.ts"],
output: {
format: "es",
entryFileNames: "[name].d.ts",
dir: "dist",
},
plugins: typePlugins,
}


function createTypes(input, file) {
return {
input,
Expand All @@ -174,12 +184,10 @@ function createTypes(input, file) {
}


const types = createTypes("types/index.d.ts", "dist/index.d.ts")
const miniTypes = createTypes("types/mini.d.ts", "dist/mini.d.ts")
const animateTypes = createTypes("types/dom.d.ts", "dist/dom.d.ts")
const animateMiniTypes = createTypes("types/dom-mini.d.ts", "dist/dom-mini.d.ts")
const mTypes = createTypes("types/m.d.ts", "dist/m.d.ts")
const clientTypes = createTypes("types/client.d.ts", "dist/client.d.ts")
const threeTypes = createTypes("types/three-entry.d.ts", "dist/three.d.ts")

// eslint-disable-next-line import/no-default-export
Expand All @@ -193,13 +201,11 @@ export default [
cjsMini,
cjsDom,
cjsDomMini,
cjsClient,
cjsM,
es,
types,
mTypes,
miniTypes,
clientTypes,
animateTypes,
animateMiniTypes,
threeTypes,
Expand Down
20 changes: 20 additions & 0 deletions packages/framer-motion/src/motion/__tests__/types.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { motion, useMotionValue } from "framer-motion"
import * as clientMotion from "framer-motion/client"
import * as React from "react"
import { render } from "../../../jest.setup"

describe("accepts motion values into both motion components from both entry points", () => {
it("renders", () => {
function Component() {
const x = useMotionValue(0)
return (
<>
<motion.div style={{ x }} />
<clientMotion.div style={{ x }} />
</>
)
}

render(<Component />)
})
})

0 comments on commit 97f7cb2

Please sign in to comment.