Skip to content

Commit

Permalink
fix: update rollup to version ^0.55.0 (#534)
Browse files Browse the repository at this point in the history
Closes #488, #523
  • Loading branch information
dherges authored Feb 3, 2018
1 parent f25ae59 commit 0cb0cce
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 35 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"postcss-discard-comments": "^2.0.4",
"postcss-url": "^7.3.0",
"rimraf": "^2.6.1",
"rollup": "0.53.0",
"rollup": "^0.55.0",
"rollup-plugin-commonjs": "^8.2.1",
"rollup-plugin-node-resolve": "^3.0.0",
"rxjs": "^5.5.0",
Expand All @@ -54,8 +54,8 @@
"peerDependencies": {
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"tslib": "^1.7.1",
"tsickle": ">=0.25.5",
"tslib": "^1.7.1",
"typescript": ">=2.4.2"
},
"devDependencies": {
Expand All @@ -70,6 +70,7 @@
"@angular/platform-browser": "~5.2.0",
"@commitlint/cli": "^6.0.0",
"@commitlint/config-angular": "^6.0.2",
"@types/acorn": "^4.0.3",
"@types/chai": "^4.0.0",
"@types/cpx": "^1.5.0",
"@types/fs-extra": "^5.0.0",
Expand All @@ -80,7 +81,6 @@
"@types/node": "^9.3.0",
"@types/react": "^16.0.19",
"@types/react-dom": "^16.0.2",
"@types/rollup": "^0.51.2",
"@types/sinon": "^4.0.0",
"@types/strip-bom": "^3.0.0",
"chai": "^4.0.1",
Expand All @@ -98,8 +98,8 @@
"sinon": "^4.0.0",
"standard-version": "^4.0.0",
"ts-node": "^4.0.0",
"tslib": "^1.7.1",
"tsickle": "^0.26.0",
"tslib": "^1.7.1",
"typescript": "~2.6.1",
"zone.js": "^0.8.10"
},
Expand Down
6 changes: 3 additions & 3 deletions src/lib/flatten/flatten.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path';
import { remapSourceMap } from '../sourcemaps/remap';
import * as log from '../util/log';
import { rollup } from './rollup';
import { rollupBundleFile } from './rollup';
import { downlevelWithTsc } from './tsc';
import { minifyJsFile } from './uglify';

Expand Down Expand Up @@ -40,7 +40,7 @@ export async function writeFlatBundleFiles(opts: FlattenOpts) {
export async function flattenToFesm15(opts: FlattenOpts): Promise<string> {
const destFile = path.resolve(opts.outDir, 'esm2015', opts.flatModuleFile + '.js');

await rollup({
await rollupBundleFile({
moduleName: opts.esmModuleId,
entry: opts.entryFile,
format: 'es',
Expand All @@ -63,7 +63,7 @@ export async function flattenToUmd(opts: FlattenOpts): Promise<string> {
const destFile = path.resolve(opts.outDir, 'bundles', opts.flatModuleFile + '.umd.js');
const { embedded = [] } = opts;

await rollup({
await rollupBundleFile({
moduleName: opts.umdModuleId,
entry: opts.entryFile,
format: 'umd',
Expand Down
32 changes: 20 additions & 12 deletions src/lib/flatten/rollup.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
import * as __rollup from 'rollup';
import * as rollup from 'rollup';
import * as nodeResolve from 'rollup-plugin-node-resolve';
import * as commonJs from 'rollup-plugin-commonjs';
import * as path from 'path';
import * as log from '../util/log';
import { externalModuleIdStrategy } from './external-module-id-strategy';
import { umdModuleIdStrategy } from './umd-module-id-strategy';

export type BundleFormat = __rollup.Format;

/**
* Options used in `ng-packagr` for writing flat bundle files.
*
* These options are passed through to rollup.
*/
export interface RollupOptions {
moduleName: string;
entry: string;
format: BundleFormat;
format: rollup.ModuleFormat;
dest: string;
umdModuleIds?: { [key: string]: string };
embedded?: string[];
}

/** Runs rollup over the given entry file, writes a bundle file. */
export async function rollup(opts: RollupOptions): Promise<void> {
log.debug(`rollup (v${__rollup.VERSION}) ${opts.entry} to ${opts.dest} (${opts.format})`);
export async function rollupBundleFile(opts: RollupOptions): Promise<void> {
log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dest} (${opts.format})`);

// Create the bundle
const bundle: __rollup.Bundle = await __rollup.rollup({
const bundle: rollup.OutputChunk = await rollup.rollup({
context: 'this',
external: moduleId => externalModuleIdStrategy(moduleId, opts.embedded || []),
input: opts.entry,
plugins: [nodeResolve({ jsnext: true, module: true }), commonJs()],
onwarn: warning => {
if (warning.code === 'THIS_IS_UNDEFINED') {
return;
}
if (typeof warning === 'string') {
log.warn(warning);
} else {
if (warning.code === 'THIS_IS_UNDEFINED') {
return;
}

log.warn(warning.message);
}
log.warn(warning.message);
}
},
preserveSymlinks: true
});

// Output the bundle to disk
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ng-v5/entry-point/ts/analyse-sources.transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { byEntryPoint, isInProgress } from '../../entry-point.node';
export const analyseSourcesTransform: Transform = pipe(
map(graph => {
const entryPoint = graph.find(byEntryPoint().and(isInProgress));
log.debug(`Analyzing sources for ${entryPoint.data.entryPoint.moduleId}`);
log.debug(`Analysing sources for ${entryPoint.data.entryPoint.moduleId}`);

const tsConfig = entryPoint.data.tsConfig;

Expand Down
19 changes: 4 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
version "1.1.0"
resolved "https://registry.yarnpkg.com/@ngtools/json-schema/-/json-schema-1.1.0.tgz#c3a0c544d62392acc2813a42c8a0dc6f58f86922"

"@types/acorn@*":
"@types/acorn@^4.0.3":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@types/acorn/-/acorn-4.0.3.tgz#d1f3e738dde52536f9aad3d3380d14e448820afd"
dependencies:
Expand Down Expand Up @@ -264,13 +264,6 @@
version "16.0.28"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.0.28.tgz#eb0b31272528da8f20477ec27569c4f767315b33"

"@types/rollup@^0.51.2":
version "0.51.2"
resolved "https://registry.yarnpkg.com/@types/rollup/-/rollup-0.51.2.tgz#1b1b868e6f79be444916a7611914c0049914d547"
dependencies:
"@types/acorn" "*"
"@types/source-map" "*"

"@types/sinon@^4.0.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-4.1.0.tgz#cdfb934d656b2c888e51f53e95900c7bbca11c08"
Expand All @@ -281,10 +274,6 @@
dependencies:
"@types/node" "*"

"@types/source-map@*":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@types/source-map/-/source-map-0.5.2.tgz#973459e744cc7445c85b97f770275b479b138e08"

"@types/strip-bom@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/strip-bom/-/strip-bom-3.0.0.tgz#14a8ec3956c2e81edb7520790aecf21c290aebd2"
Expand Down Expand Up @@ -2969,9 +2958,9 @@ rollup-pluginutils@^2.0.1:
estree-walker "^0.3.0"
micromatch "^2.3.11"

rollup@0.53.0:
version "0.53.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.53.0.tgz#7a3d5a04ba2b0a8f2405899fa6a0ac48da480ed1"
rollup@^0.55.0:
version "0.55.3"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.55.3.tgz#0af082a766d51c3058430c8372442ff5207d8736"

rxjs@^5.5.0, rxjs@^5.5.6:
version "5.5.6"
Expand Down

0 comments on commit 0cb0cce

Please sign in to comment.