From 920a35f792aeba6822466eb000446c14c48ca22e Mon Sep 17 00:00:00 2001 From: Michael Peyper Date: Sun, 17 Oct 2021 00:06:04 +1100 Subject: [PATCH] Add /light module and type definitions for LottiePlayerLight --- README.md | 4 ++-- example/src/Test.js | 2 +- light/index.d.ts | 2 ++ light/index.js | 1 + package.json | 5 +++-- src/LottiePlayerLight.d.ts | 3 +++ 6 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 light/index.d.ts create mode 100644 light/index.js create mode 100644 src/LottiePlayerLight.d.ts diff --git a/README.md b/README.md index a5cf887..9bb904a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ npm install --save react-lottie-player import React from 'react' import Lottie from 'react-lottie-player' // Alternatively: -// import Lottie from 'react-lottie-player/dist/LottiePlayerLight' +// import Lottie from 'react-lottie-player/light' import lottieJson from './my-lottie.json' @@ -64,7 +64,7 @@ const MyComponent = () => { ## LottiePlayerLight -The default lottie player uses `eval`. If you don't want eval to be used in your code base, you can instead import `react-lottie-player/dist/LottiePlayerLight`. For more discussion see [#39](https://github.com/mifi/react-lottie-player/pull/39). +The default lottie player uses `eval`. If you don't want eval to be used in your code base, you can instead import `react-lottie-player/light`. For more discussion see [#39](https://github.com/mifi/react-lottie-player/pull/39). See also [#11](https://github.com/mifi/react-lottie-player/issues/11) diff --git a/example/src/Test.js b/example/src/Test.js index cef5a3e..85362c6 100644 --- a/example/src/Test.js +++ b/example/src/Test.js @@ -1,5 +1,5 @@ import Lottie from 'react-lottie-player' -import LottieLight from 'react-lottie-player/dist/LottiePlayerLight' +import LottieLight from 'react-lottie-player/light' import React from 'react'; diff --git a/light/index.d.ts b/light/index.d.ts new file mode 100644 index 0000000..cab0539 --- /dev/null +++ b/light/index.d.ts @@ -0,0 +1,2 @@ +export { default } from '../dist/LottiePlayerLight' +export * from '../dist/LottiePlayerLight' diff --git a/light/index.js b/light/index.js new file mode 100644 index 0000000..b568810 --- /dev/null +++ b/light/index.js @@ -0,0 +1 @@ +module.exports = require('../dist/LottiePlayerLight') diff --git a/package.json b/package.json index 2bd9058..45ea13c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "types": "dist/index.d.ts", "scripts": { - "build": "rm -rf dist && microbundle-crl src/LottiePlayer.js src/LottiePlayerLight.js --no-compress --format modern,cjs -o dist && cp src/index.d.ts dist", + "build": "rm -rf dist && microbundle-crl src/LottiePlayer.js src/LottiePlayerLight.js --no-compress --format modern,cjs -o dist && cp src/*.d.ts dist", "start": "rm -rf dist && microbundle-crl watch src/LottiePlayer.js src/LottiePlayerLight.js --no-compress --format modern,cjs -o dist", "prepare": "run-s build", "test": "run-s test:lint test:build test:unit", @@ -49,7 +49,8 @@ "wait-on": "^5.2.1" }, "files": [ - "dist" + "dist", + "light" ], "dependencies": { "fast-deep-equal": "^3.1.3", diff --git a/src/LottiePlayerLight.d.ts b/src/LottiePlayerLight.d.ts new file mode 100644 index 0000000..86258b3 --- /dev/null +++ b/src/LottiePlayerLight.d.ts @@ -0,0 +1,3 @@ +import '.' +export { default } from 'react-lottie-player' +export * from 'react-lottie-player'