-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrading dependencies and switching build to all rollup (#2149)
* Build * Things * Stuff * Change * More stuff * Things * Stuff * Review * Self review * Review * Self review * Self review * Self review * Self review * Self review * Self review * Updating footprint script * Guy's feedback * Adding support for running test-browser-watch on Windows
- Loading branch information
1 parent
0f1161d
commit 7a75159
Showing
8 changed files
with
160 additions
and
74 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,123 @@ | ||
import replace from 'rollup-plugin-replace'; | ||
import replace from '@rollup/plugin-replace'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
|
||
const version = JSON.parse(fs.readFileSync('package.json')).version; | ||
const name = process.env.sjs ? 's' : 'system'; | ||
const extras = fs.readdirSync(path.resolve(__dirname, 'src/extras')); | ||
|
||
export default { | ||
input: `src/${name}.js`, | ||
const terserOptions = { | ||
mangle: { | ||
eval: true, | ||
module: true, | ||
safari10: true, | ||
toplevel: true | ||
}, | ||
parse: { | ||
}, | ||
compress: { | ||
unsafe: true, | ||
arguments: true, | ||
hoist_funs: true, | ||
hoist_props: true, | ||
keep_fargs: false, | ||
negate_iife: true, | ||
module: true, | ||
pure_getters: true, | ||
passes: 2, | ||
sequences: 400, | ||
toplevel: true, | ||
unsafe_proto: true, | ||
unsafe_regexp: true, | ||
unsafe_math: true, | ||
unsafe_symbols: true, | ||
unsafe_comps: true, | ||
unsafe_Function: true, | ||
unsafe_undefined: true | ||
}, | ||
output: { | ||
format: 'iife', | ||
strict: false, | ||
file: `dist/${name}.js`, | ||
banner: process.env.sjs ? `/* | ||
comments(node, comment) { | ||
return /^\* SystemJS [0-9]\./.test(comment.value.trim()); | ||
}, | ||
safari10: true | ||
}, | ||
ecma: 5, // specify one of: 5, 2015, 2016, 2017 or 2018 | ||
keep_classnames: false, | ||
keep_fnames: false, | ||
ie8: false, | ||
module: true, | ||
nameCache: null, // or specify a name cache object | ||
safari10: true, | ||
toplevel: true, | ||
warnings: false | ||
}; | ||
|
||
const buildProd = !process.env.dev; | ||
|
||
export default [ | ||
mainConfig('system', true), | ||
buildProd && mainConfig('system', false), | ||
mainConfig('s', true), | ||
buildProd && mainConfig('s', false), | ||
...extrasConfig(true), | ||
...prodExtras(), | ||
].filter(Boolean); | ||
|
||
function prodExtras() { | ||
if (buildProd) { | ||
return extrasConfig(false); | ||
} else { | ||
return []; | ||
} | ||
} | ||
|
||
function mainConfig(name, isDev) { | ||
const sjs = name === 's'; | ||
let banner; | ||
if (sjs) { | ||
banner = isDev ? `/* | ||
* SJS ${version} | ||
* Minimal SystemJS Build | ||
*/` : `/* | ||
*/` : null; | ||
} else { | ||
banner = `/* | ||
* SystemJS ${version} | ||
*/` | ||
}, | ||
plugins: [replace({ | ||
TRACING: process.env.sjs ? 'false' : 'true' | ||
})] | ||
}; | ||
*/`; | ||
} | ||
|
||
return { | ||
input: `src/${name}.js`, | ||
output: { | ||
file: `dist/${name}${isDev ? '' : '.min'}.js`, | ||
format: 'iife', | ||
strict: false, | ||
sourcemap: !isDev, | ||
banner | ||
}, | ||
plugins: [ | ||
replace({ | ||
TRACING: sjs ? 'false' : 'true', | ||
}), | ||
!isDev && terser(terserOptions) | ||
] | ||
}; | ||
} | ||
|
||
function extrasConfig(isDev) { | ||
return extras.map(extra => { | ||
extra = extra.replace('.js', ''); | ||
return { | ||
input: `src/extras/${extra}.js`, | ||
output: { | ||
file: `dist/extras/${extra}${isDev ? '' : '.min'}.js`, | ||
format: 'iife', | ||
strict: false, | ||
compact: true, | ||
sourcemap: !isDev | ||
}, | ||
plugins: [ | ||
!isDev && terser(terserOptions) | ||
] | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters