Skip to content

Commit 2a6abe3

Browse files
committed
Update webpack to use Banner plugin for adding license header so sourcemaps are generated correctly. Change uglify to preserve license comment from webpack so we only have to manually add it to .d.ts files.
1 parent 23e0432 commit 2a6abe3

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
lines changed

dist/embed.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ export interface IInternalEventHandler<T> {
3030
handle(event: service.IEvent<T>): void;
3131
}
3232
export declare abstract class Embed {
33+
static allowedEvents: string[];
3334
static accessTokenAttribute: string;
3435
static embedUrlAttribute: string;
3536
static nameAttribute: string;
3637
static typeAttribute: string;
3738
static type: string;
3839
private static defaultSettings;
40+
allowedEvents: any[];
3941
eventHandlers: IInternalEventHandler<any>[];
4042
hpm: hpm.HttpPostMessage;
4143
service: service.Service;

dist/powerbi.js

+9-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/powerbi.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/powerbi.min.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/report.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export declare class Report extends embed.Embed {
66
static allowedEvents: string[];
77
static reportIdAttribute: string;
88
static type: string;
9+
constructor(service: service.Service, hpmFactory: service.IHpmFactory, element: HTMLElement, config: embed.IEmbedConfiguration);
910
/**
1011
* This adds backwards compatibility for older config which used the reportId query param to specify report id.
1112
* E.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1
@@ -68,7 +69,6 @@ export declare class Report extends embed.Embed {
6869
* ```
6970
*/
7071
getPages(): Promise<models.IPage[]>;
71-
on<T>(eventName: string, handler: service.IEventHandler<T>): void;
7272
/**
7373
* Set the active page
7474
*/

gulpfile.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ gulp.task('build', 'Runs a full build', function (done) {
5454
});
5555

5656
gulp.task('header', 'Add header to distributed files', function () {
57-
return gulp.src(['!./dist/*.map', './dist/*'])
57+
return gulp.src(['./dist/*.d.ts'])
5858
.pipe(header(banner, { package : package }))
5959
.pipe(gulp.dest('./dist'));
6060
});
@@ -72,7 +72,9 @@ gulp.task('lint:ts', 'Lints all TypeScript', function() {
7272
gulp.task('min:js', 'Creates minified JavaScript file', function() {
7373
return gulp.src(['!./dist/*.min.js', './dist/*.js'])
7474
.pipe(sourcemaps.init({ debug: true }))
75-
.pipe(uglify())
75+
.pipe(uglify({
76+
preserveComments: 'license'
77+
}))
7678
.pipe(sourcemaps.write())
7779
.pipe(rename({ suffix: '.min' }))
7880
.pipe(gulp.dest('./dist'));

webpack.config.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
var webpack = require('webpack');
12
var package = require('./package.json');
3+
var banner = package.name + " v" + package.version + " | (c) 2016 Microsoft Corporation " + package.license;
24

35
module.exports = {
46
entry: {
@@ -21,5 +23,8 @@ module.exports = {
2123
{ test: /\.ts$/, exclude: /\.d.ts$/, loader: 'ts-loader' },
2224
{ test: /\.json$/, loader: 'json-loader' }
2325
]
24-
}
26+
},
27+
plugins: [
28+
new webpack.BannerPlugin(banner)
29+
]
2530
}

0 commit comments

Comments
 (0)