Use rollup for redux-devtools-intrument

This commit is contained in:
Nathan Bierema 2022-01-08 23:50:25 -05:00
parent 5d1ff2f5e5
commit 70449307c1
9 changed files with 60 additions and 19 deletions

View File

@ -1,3 +1,6 @@
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
"presets": [
["@babel/preset-env", { "targets": "defaults" }],
"@babel/preset-typescript"
]
}

View File

@ -1 +1 @@
lib
dist

View File

@ -1,10 +1,13 @@
module.exports = {
extends: '../../eslintrc.ts.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
extends: '../../eslintrc.js.base.json',
overrides: [
{
extends: '../../eslintrc.ts.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
},
{
files: ['test/**/*.ts'],
extends: '../../eslintrc.ts.jest.base.json',

View File

@ -17,20 +17,19 @@
"license": "MIT",
"author": "Dan Abramov <dan.abramov@me.com> (http://github.com/gaearon)",
"files": [
"lib",
"dist",
"src"
],
"main": "lib/instrument.js",
"types": "lib/instrument.d.ts",
"main": "dist/redux-devtools-instrument.cjs.js",
"module": "dist/redux-devtools-instrument.esm.js",
"types": "dist/instrument.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/reduxjs/redux-devtools.git"
},
"scripts": {
"build": "yarn run build:types && yarn run build:js",
"build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src --out-dir lib --extensions \".ts\" --source-maps inline",
"clean": "rimraf lib",
"build": "rollup -c",
"clean": "rimraf dist",
"test": "jest",
"lint": "eslint . --ext .ts",
"type-check": "tsc --noEmit",
@ -38,13 +37,16 @@
"prepublish": "yarn run type-check && yarn run lint && yarn run test"
},
"dependencies": {
"@babel/runtime": "^7.16.7",
"lodash": "^4.17.21"
},
"devDependencies": {
"@babel/cli": "^7.16.7",
"@babel/core": "^7.16.7",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@rollup/plugin-babel": "^5.3.0",
"@types/jest": "^27.4.0",
"@types/lodash": "^4.14.178",
"@types/node": "^16.11.17",
@ -56,8 +58,11 @@
"jest": "^27.4.5",
"redux": "^4.1.2",
"rimraf": "^3.0.2",
"rollup": "^2.63.0",
"rollup-plugin-typescript2": "^0.31.1",
"rxjs": "^7.5.1",
"ts-jest": "^27.1.2",
"tslib": "^2.3.1",
"typescript": "~4.5.4"
},
"peerDependencies": {

View File

@ -0,0 +1,23 @@
import typescript from 'rollup-plugin-typescript2';
import babel from '@rollup/plugin-babel';
const config = [
{
input: 'src/instrument.ts',
output: [
{ file: 'dist/redux-devtools-instrument.cjs.js', format: 'cjs' },
{ file: 'dist/redux-devtools-instrument.esm.js', format: 'esm' },
],
plugins: [
typescript(),
babel({
babelHelpers: 'runtime',
extensions: ['.ts'],
plugins: ['@babel/plugin-transform-runtime'],
}),
],
external: [/@babel\/runtime/, /lodash/],
},
];
export default config;

View File

@ -981,7 +981,7 @@ export interface Options<
/**
* Redux instrumentation store enhancer.
*/
export default function instrument<
export function instrument<
OptionsS,
OptionsA extends Action<unknown>,
MonitorState = null,

View File

@ -1,7 +1,8 @@
import React, { Children, Component } from 'react';
import PropTypes from 'prop-types';
import { connect, Provider, ReactReduxContext } from 'react-redux';
import instrument, {
import {
instrument,
EnhancedStore,
LiftedState,
LiftedStore,

View File

@ -1,5 +1,5 @@
export {
default as instrument,
instrument,
ActionCreators,
ActionTypes,
PerformAction,

View File

@ -4970,10 +4970,13 @@ __metadata:
version: 0.0.0-use.local
resolution: "@redux-devtools/instrument@workspace:packages/redux-devtools-instrument"
dependencies:
"@babel/cli": ^7.16.7
"@babel/core": ^7.16.7
"@babel/eslint-parser": ^7.16.5
"@babel/plugin-transform-runtime": ^7.16.7
"@babel/preset-env": ^7.16.7
"@babel/preset-typescript": ^7.16.7
"@babel/runtime": ^7.16.7
"@rollup/plugin-babel": ^5.3.0
"@types/jest": ^27.4.0
"@types/lodash": ^4.14.178
"@types/node": ^16.11.17
@ -4986,8 +4989,11 @@ __metadata:
lodash: ^4.17.21
redux: ^4.1.2
rimraf: ^3.0.2
rollup: ^2.63.0
rollup-plugin-typescript2: ^0.31.1
rxjs: ^7.5.1
ts-jest: ^27.1.2
tslib: ^2.3.1
typescript: ~4.5.4
peerDependencies:
redux: ^3.4.0 || ^4.0.0