Skip to content

Commit ec44967

Browse files
committed
Configure rollup
1 parent 8331b69 commit ec44967

File tree

6 files changed

+72
-187
lines changed

6 files changed

+72
-187
lines changed

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
{
22
"name": "react-dsv-import",
33
"version": "0.0.1",
4-
"main": "dist/react-dsv-import.cjs.js",
5-
"module": "dist/react-dsv-import.esm.js",
6-
"browser": "dist/react-dsv-import.umd.js",
4+
"main": "dist/index.js",
5+
"module": "dist/es/index.js",
6+
"types": "dist/index.d.ts",
77
"dependencies": {},
88
"devDependencies": {
9+
"@rollup/plugin-typescript": "^4.0.0",
10+
"@types/node": "^13.11.1",
911
"@types/react": "^16.9.34",
1012
"@types/react-dom": "^16.9.6",
11-
"rollup": "^2.4.0",
12-
"rollup-plugin-commonjs": "^10.1.0",
13-
"rollup-plugin-node-resolve": "^5.2.0",
14-
"rollup-plugin-typescript": "^1.0.0",
13+
"rollup": "^2.6.0",
1514
"ts-node": "^8.8.2",
16-
"tslib": "^1.9.3",
17-
"typescript": "^3.2.2"
15+
"tslib": "^1.11.1",
16+
"typescript": "^3.8.3"
1817
},
1918
"scripts": {
2019
"build": "rollup -c",

rollup.config.js

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,31 @@
1-
import resolve from 'rollup-plugin-node-resolve';
2-
import commonjs from 'rollup-plugin-commonjs';
3-
import typescript from 'rollup-plugin-typescript';
1+
import typescript from '@rollup/plugin-typescript';
42
import pkg from './package.json';
53

4+
const outputDefaults = { globals: { react: 'React' }, "sourcemap": true };
5+
const defaults = {
6+
input: 'src/index.tsx',
7+
external: [
8+
...Object.keys(pkg.peerDependencies || {})
9+
],
10+
plugins: [
11+
typescript()
12+
]
13+
}
14+
615
export default [
7-
// browser-friendly UMD build
816
{
9-
input: 'src/index.tsx',
10-
output: {
11-
name: 'react-dsv-import',
12-
file: pkg.browser,
13-
format: 'umd'
14-
},
15-
plugins: [
16-
resolve(), // so Rollup can find `ms`
17-
commonjs(), // so Rollup can convert `ms` to an ES module
18-
typescript() // so Rollup can convert TypeScript to JavaScript
17+
...defaults,
18+
output: [
19+
{ dir: 'dist/iife', name: 'ReactDSVImport', format: 'iife', ...outputDefaults },
20+
{ dir: 'dist/es', format: 'es', ...outputDefaults }
1921
]
20-
},
21-
22-
// CommonJS (for Node) and ES module (for bundlers) build.
23-
// (We could have three entries in the configuration array
24-
// instead of two, but it's quicker to generate multiple
25-
// builds from a single configuration where possible, using
26-
// an array for the `output` option, where we can specify
27-
// `file` and `format` for each target)
28-
{
29-
input: 'src/main.ts',
30-
external: [],
22+
}, {
23+
...defaults,
3124
plugins: [
32-
typescript() // so Rollup can convert TypeScript to JavaScript
25+
typescript({ declaration: true, declarationDir: 'dist' })
3326
],
3427
output: [
35-
{ file: pkg.main, format: 'cjs' },
36-
{ file: pkg.module, format: 'es' }
28+
{ dir: 'dist', format: 'cjs', ...outputDefaults }
3729
]
3830
}
3931
];

src/DSVImport.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
3+
export const DSVImport: React.FC = () => {
4+
return <div>Hello</div>;
5+
}

src/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
1+
import { DSVImport } from './DSVImport';
22

3-
export const DSVImport: React.FC = () => {
4-
return <div>Hello</div>;
5-
}
3+
export { DSVImport };

tsconfig.json

Lines changed: 11 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,14 @@
11
{
22
"compilerOptions": {
3-
/* Basic Options */
4-
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
5-
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
6-
// "lib": [], /* Specify library files to be included in the compilation. */
7-
// "allowJs": true, /* Allow javascript files to be compiled. */
8-
// "checkJs": true, /* Report errors in .js files. */
9-
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
10-
// "declaration": true, /* Generates corresponding '.d.ts' file. */
11-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
12-
// "sourceMap": true, /* Generates corresponding '.map' file. */
13-
// "outFile": "./", /* Concatenate and emit output to single file. */
14-
// "outDir": "./", /* Redirect output structure to the directory. */
15-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
16-
// "composite": true, /* Enable project compilation */
17-
// "removeComments": true, /* Do not emit comments to output. */
18-
// "noEmit": true, /* Do not emit outputs. */
19-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
20-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
21-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
22-
23-
/* Strict Type-Checking Options */
24-
"strict": true, /* Enable all strict type-checking options. */
25-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
26-
// "strictNullChecks": true, /* Enable strict null checks. */
27-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
28-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
29-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
30-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
31-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
32-
33-
/* Additional Checks */
34-
// "noUnusedLocals": true, /* Report errors on unused locals. */
35-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
36-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
37-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
38-
39-
/* Module Resolution Options */
40-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
41-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
42-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
43-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
44-
// "typeRoots": [], /* List of folders to include type definitions from. */
45-
// "types": [], /* Type declaration files to be included in compilation. */
46-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
47-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
48-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
49-
50-
/* Source Map Options */
51-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
52-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
53-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
54-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
55-
56-
/* Experimental Options */
57-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
58-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
59-
}
3+
"target": "es5",
4+
"module": "es6",
5+
"lib": ["es6", "DOM"],
6+
"allowJs": false,
7+
"jsx": "react",
8+
"sourceMap": true,
9+
"strict": true,
10+
"esModuleInterop": true,
11+
"rootDir": "src"
12+
},
13+
"include": ["src"]
6014
}

yarn.lock

Lines changed: 26 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22
# yarn lockfile v1
33

44

5-
6-
version "0.0.39"
7-
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
8-
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==
5+
"@rollup/plugin-typescript@^4.0.0":
6+
version "4.0.0"
7+
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-4.0.0.tgz#7a4f7b2844d28669e58c03c880f6ed0d6e926685"
8+
integrity sha512-qA3r4WlR8JnTm+VdBzvQSIkfXt802keGxXuE4SAjUjRMKK3nMXTUCvOGSzFkav2qf0QiGv6yijfbjuf+bhwmZQ==
9+
dependencies:
10+
"@rollup/pluginutils" "^3.0.1"
11+
resolve "^1.14.1"
12+
13+
"@rollup/pluginutils@^3.0.1":
14+
version "3.0.8"
15+
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.8.tgz#4e94d128d94b90699e517ef045422960d18c8fde"
16+
integrity sha512-rYGeAc4sxcZ+kPG/Tw4/fwJODC3IXHYDH4qusdN/b6aLw5LPUbzpecYbEJh4sVQGPFJxd2dBU4kc1H3oy9/bnw==
17+
dependencies:
18+
estree-walker "^1.0.1"
919

10-
"@types/node@*":
20+
"@types/node@^13.11.1":
1121
version "13.11.1"
1222
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.11.1.tgz#49a2a83df9d26daacead30d0ccc8762b128d53c7"
1323
integrity sha512-eWQGP3qtxwL8FGneRrC5DwrJLGN4/dH1clNTuLfN81HCrxVtxRjygDTUoZJ5ASlDEeo0ppYFQjQIlXhtXpOn6g==
@@ -32,13 +42,6 @@
3242
"@types/prop-types" "*"
3343
csstype "^2.2.0"
3444

35-
36-
version "0.0.8"
37-
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194"
38-
integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==
39-
dependencies:
40-
"@types/node" "*"
41-
4245
arg@^4.1.0:
4346
version "4.1.3"
4447
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
@@ -49,11 +52,6 @@ buffer-from@^1.0.0:
4952
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
5053
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
5154

52-
builtin-modules@^3.1.0:
53-
version "3.1.0"
54-
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484"
55-
integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==
56-
5755
csstype@^2.2.0:
5856
version "2.6.10"
5957
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.10.tgz#e63af50e66d7c266edb6b32909cfd0aabe03928b"
@@ -64,35 +62,16 @@ diff@^4.0.1:
6462
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
6563
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
6664

67-
estree-walker@^0.6.1:
68-
version "0.6.1"
69-
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
70-
integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==
65+
estree-walker@^1.0.1:
66+
version "1.0.1"
67+
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700"
68+
integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==
7169

7270
fsevents@~2.1.2:
7371
version "2.1.2"
7472
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805"
7573
integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==
7674

77-
is-module@^1.0.0:
78-
version "1.0.0"
79-
resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"
80-
integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=
81-
82-
is-reference@^1.1.2:
83-
version "1.1.4"
84-
resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427"
85-
integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==
86-
dependencies:
87-
"@types/estree" "0.0.39"
88-
89-
magic-string@^0.25.2:
90-
version "0.25.7"
91-
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
92-
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
93-
dependencies:
94-
sourcemap-codec "^1.4.4"
95-
9675
make-error@^1.1.1:
9776
version "1.3.6"
9877
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
@@ -103,54 +82,17 @@ path-parse@^1.0.6:
10382
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
10483
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
10584

106-
resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1:
85+
resolve@^1.14.1:
10786
version "1.15.1"
10887
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8"
10988
integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==
11089
dependencies:
11190
path-parse "^1.0.6"
11291

113-
rollup-plugin-commonjs@^10.1.0:
114-
version "10.1.0"
115-
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz#417af3b54503878e084d127adf4d1caf8beb86fb"
116-
integrity sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==
117-
dependencies:
118-
estree-walker "^0.6.1"
119-
is-reference "^1.1.2"
120-
magic-string "^0.25.2"
121-
resolve "^1.11.0"
122-
rollup-pluginutils "^2.8.1"
123-
124-
rollup-plugin-node-resolve@^5.2.0:
125-
version "5.2.0"
126-
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523"
127-
integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==
128-
dependencies:
129-
"@types/resolve" "0.0.8"
130-
builtin-modules "^3.1.0"
131-
is-module "^1.0.0"
132-
resolve "^1.11.1"
133-
rollup-pluginutils "^2.8.1"
134-
135-
rollup-plugin-typescript@^1.0.0:
136-
version "1.0.1"
137-
resolved "https://registry.yarnpkg.com/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz#86565033b714c3d1f3aba510aad3dc519f7091e9"
138-
integrity sha512-rwJDNn9jv/NsKZuyBb/h0jsclP4CJ58qbvZt2Q9zDIGILF2LtdtvCqMOL+Gq9IVq5MTrTlHZNrn8h7VjQgd8tw==
139-
dependencies:
140-
resolve "^1.10.0"
141-
rollup-pluginutils "^2.5.0"
142-
143-
rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.8.1:
144-
version "2.8.2"
145-
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e"
146-
integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==
147-
dependencies:
148-
estree-walker "^0.6.1"
149-
150-
rollup@^2.4.0:
151-
version "2.4.0"
152-
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.4.0.tgz#b136a4d701d24dd79ec9551ee0330e7f632ee9d2"
153-
integrity sha512-dYE2ZKl9+kxuFKDaaSuauZjIPa8hcKDqI7WrOq1pTXYG4GJw+6ypLifGIvCKw5yJpSmuFohuimYpg0wfRXTCLw==
92+
rollup@^2.6.0:
93+
version "2.6.0"
94+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.6.0.tgz#e69d50dc2217af23ab5f6df9a48e45df4ab56df1"
95+
integrity sha512-qbvQ9ZbvbhBdtRBZ/A4g+9z3iJQ1rHAtjinn3FiN+j5tfz8xiNyTE1JEEMcFWqlH7+NHadI9ieeqKdp8HwYLnQ==
15496
optionalDependencies:
15597
fsevents "~2.1.2"
15698

@@ -167,11 +109,6 @@ source-map@^0.6.0:
167109
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
168110
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
169111

170-
sourcemap-codec@^1.4.4:
171-
version "1.4.8"
172-
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
173-
integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==
174-
175112
ts-node@^8.8.2:
176113
version "8.8.2"
177114
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.8.2.tgz#0b39e690bee39ea5111513a9d2bcdc0bc121755f"
@@ -183,12 +120,12 @@ ts-node@^8.8.2:
183120
source-map-support "^0.5.6"
184121
yn "3.1.1"
185122

186-
tslib@^1.9.3:
123+
tslib@^1.11.1:
187124
version "1.11.1"
188125
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
189126
integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==
190127

191-
typescript@^3.2.2:
128+
typescript@^3.8.3:
192129
version "3.8.3"
193130
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
194131
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==

0 commit comments

Comments
 (0)