File tree Expand file tree Collapse file tree 4 files changed +2125
-1909
lines changed
Expand file tree Collapse file tree 4 files changed +2125
-1909
lines changed Original file line number Diff line number Diff line change 44 "version" : " 1.2.0" ,
55 "scripts" : {
66 "clean" : " shx rm -rf lib lib-esm _bundles" ,
7- "build" : " npm run compile && rollup -c && rollup -c --environment MINIFY" ,
7+ "build" : " npm run compile && rollup -c rollup.config.mjs && rollup -c rollup.config.mjs --environment MINIFY" ,
88 "compile" : " npm run clean && tsc && tsc -m es6 --outDir lib-esm" ,
99 "test" : " jest" ,
1010 "test:downstream" : " test_downstream_projects" ,
4747 "@uirouter/core" : " >=5.0.0"
4848 },
4949 "devDependencies" : {
50+ "@rollup/plugin-node-resolve" : " ^16.0.3" ,
51+ "@rollup/plugin-terser" : " ^0.4.4" ,
5052 "@types/jest" : " ^30.0.0" ,
5153 "@types/jquery" : " ^3.3.38" ,
5254 "@types/lodash" : " ^4.14.152" ,
6365 "lodash" : " ^4.17.11" ,
6466 "prettier" : " ^2.0.5" ,
6567 "pretty-quick" : " ^2.0.1" ,
66- "rollup" : " ^2.10.9" ,
67- "rollup-plugin-node-resolve" : " ^5.2.0" ,
68- "rollup-plugin-sourcemaps" : " ^0.6.2" ,
69- "rollup-plugin-uglify" : " ^6.0.1" ,
68+ "rollup" : " ^4.54.0" ,
7069 "ts-jest" : " ^29.4.6" ,
7170 "typescript" : " ^5.9.3"
7271 },
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import nodeResolve from '@rollup/plugin-node-resolve' ;
2+ import terser from '@rollup/plugin-terser' ;
3+ import { readFileSync } from 'fs' ;
4+
5+ const MINIFY = process . env . MINIFY ;
6+
7+ const pkg = JSON . parse ( readFileSync ( './package.json' , 'utf-8' ) ) ;
8+ const banner = `/**
9+ * ${ pkg . description }
10+ * @version v${ pkg . version }
11+ * @link ${ pkg . homepage }
12+ * @license MIT License, http://www.opensource.org/licenses/MIT
13+ */` ;
14+
15+ const terserOpts = {
16+ output : {
17+ // retain multiline comment with @license
18+ comments : ( node , comment ) => comment . type === 'comment2' && / @ l i c e n s e / i. test ( comment . value ) ,
19+ } ,
20+ } ;
21+
22+ const plugins = [ nodeResolve ( ) ] ;
23+
24+ if ( MINIFY ) plugins . push ( terser ( terserOpts ) ) ;
25+
26+ const extension = MINIFY ? '.min.js' : '.js' ;
27+
28+ export default {
29+ input : 'lib-esm/index.js' ,
30+ output : {
31+ name : pkg . name ,
32+ globals : { '@uirouter/core' : '@uirouter/core' } ,
33+ sourcemap : true ,
34+ format : 'umd' ,
35+ exports : 'named' ,
36+ banner : banner ,
37+ file : '_bundles/ui-router-dsr' + extension ,
38+ } ,
39+ external : [ '@uirouter/core' ] ,
40+ plugins : plugins ,
41+ } ;
You can’t perform that action at this time.
0 commit comments