Skip to content

Commit

Permalink
feat!: upgrade to rollup v3
Browse files Browse the repository at this point in the history
it also skip type-checking `dts.config.ts` for user friendly.
  • Loading branch information
aladdin-add committed Mar 23, 2023
1 parent aa9018b commit aa5493e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
"test:post-build": "node dist/index.js test",
"start": "tsc -p tsconfig.json --watch",
"release": "npm run test && release-it",
"prepublishOnly": "pinst --disable",
"postpublish": "pinst --enable",
"doctoc": "doctoc README.md",
"prepare": "npx husky install"
"prepare": "husky install"
},
"files": [
"dist",
Expand All @@ -50,11 +48,12 @@
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.20.2",
"@babel/traverse": "^7.20.5",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^3.1.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.0",
"@types/jest": "^27.5.2",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
Expand Down Expand Up @@ -92,12 +91,11 @@
"prettier": "^2.8.1",
"progress-estimator": "^0.3.0",
"regenerator-runtime": "^0.13.9",
"rollup": "^2.66.0",
"rollup": "^3.20.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-dts": "^5.3.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.32.1",
"rollup-plugin-typescript2": "^0.34.1",
"sade": "^1.8.1",
"semver": "^7.3.8",
"shelljs": "^0.8.5",
Expand Down Expand Up @@ -132,7 +130,6 @@
"dts-cli": "file:.",
"husky": "^8.0.0",
"lint-staged": "^12.5.0",
"pinst": "^3.0.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-is": "^16.13.1",
Expand Down
1 change: 1 addition & 0 deletions src/createBuildConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function loadDtsConfigTs(): DtsConfig | undefined {
compilerOptions: {
module: 'CommonJS',
},
transpileOnly: true, // skip type checking
});
return interopRequireDefault(require(paths.appConfigTs)).default;
} catch (error) {
Expand Down
5 changes: 3 additions & 2 deletions src/createRollupConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { safeVariableName, external } from './utils';
import { paths } from './constants';
import { RollupOptions } from 'rollup';
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';
import { DEFAULT_EXTENSIONS as DEFAULT_BABEL_EXTENSIONS } from '@babel/core';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
Expand Down Expand Up @@ -111,6 +111,7 @@ export async function createRollupConfig(
},
plugins: [
!!opts.extractErrors && {
name: 'error-extractor',
async transform(source: any) {
await findAndRecordErrorCodes(source);
return source;
Expand All @@ -134,6 +135,7 @@ export async function createRollupConfig(
}),
json(),
{
name: 'shebang',
// Custom plugin that removes shebang from code because newer
// versions of bublé bundle their own private version of `acorn`
// and I don't know a way to patch in the option `allowHashBang`
Expand Down Expand Up @@ -216,7 +218,6 @@ export async function createRollupConfig(
},
ecma: 5,
toplevel: opts.format === 'cjs',
warnings: true,
}),
],
};
Expand Down
2 changes: 1 addition & 1 deletion src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ declare module '@babel/core' {
}

// Rollup plugins
declare module 'rollup-plugin-terser';
// declare module 'rollup-plugin-terser';
declare module '@babel/traverse';
declare module '@babel/helper-module-imports';

Expand Down

0 comments on commit aa5493e

Please sign in to comment.