fix(build): fix source maps

Closes #5444
This commit is contained in:
vsavkin 2015-11-23 14:58:18 -08:00 committed by Victor Savkin
parent 8daa9b202d
commit 87d56acdaa
10 changed files with 234 additions and 119 deletions

View File

@ -524,7 +524,7 @@ function launchKarmaWithExternalBrowsers(reporters, browsers, done) {
gulp.task('!test.unit.js/karma-server', function(done) {
var watchStarted = false;
var server = new karma.Server({configFile: __dirname + '/karma-js.conf.js', reporters: 'dots'});
var server = new karma.Server({configFile: __dirname + '/karma-js.conf.js'});
server.on('run_complete', function() {
if (!watchStarted) {
watchStarted = true;
@ -548,10 +548,7 @@ gulp.task('test.unit.router', function(done) {
});
gulp.task('!test.unit.router/karma-server', function() {
new karma.Server({
configFile: __dirname + '/modules/angular1_router/karma-router.conf.js',
reporters: 'dots'
})
new karma.Server({configFile: __dirname + '/modules/angular1_router/karma-router.conf.js'})
.start();
});

View File

@ -1,4 +1,5 @@
var browserProvidersConf = require('./browser-providers.conf.js');
var internalAngularReporter = require('./tools/karma/reporter.js');
// Karma configuration
// Generated on Thu Sep 25 2014 11:52:02 GMT-0700 (PDT)
@ -35,6 +36,21 @@ module.exports = function(config) {
customLaunchers: browserProvidersConf.customLaunchers,
plugins: [
'karma-jasmine',
'karma-browserstack-launcher',
'karma-sauce-launcher',
'karma-chrome-launcher',
'karma-sourcemap-loader',
'karma-dart',
internalAngularReporter
],
preprocessors: {
'**/*.js': ['sourcemap']
},
reporters: ['internal-angular'],
sauceLabs: {
testName: 'Angular2',
startConnect: false,

View File

@ -29,7 +29,13 @@ describe('sourcemaps', function() {
expect(errorColumn).not.toBeNull();
var sourceMapData = fs.readFileSync('dist/js/prod/es5/playground/src/sourcemap/index.js.map');
const content =
fs.readFileSync('dist/js/dev/es5/playground/src/sourcemap/index.js').toString("utf8");
const marker = "//# sourceMappingURL=data:application/json;base64,";
const index = content.indexOf(marker);
const sourceMapData =
new Buffer(content.substring(index + marker.length), 'base64').toString("utf8");
var decoder = new sourceMap.SourceMapConsumer(JSON.parse(sourceMapData));
var originalPosition = decoder.originalPositionFor({line: errorLine, column: errorColumn});

View File

@ -12153,6 +12153,9 @@
}
}
},
"karma-sourcemap-loader": {
"version": "0.3.6"
},
"lodash": {
"version": "2.4.2"
},

213
npm-shrinkwrap.json generated
View File

@ -10513,166 +10513,166 @@
},
"gulp-gzip": {
"version": "1.2.0",
"from": "gulp-gzip@*",
"from": "https://registry.npmjs.org/gulp-gzip/-/gulp-gzip-1.2.0.tgz",
"resolved": "https://registry.npmjs.org/gulp-gzip/-/gulp-gzip-1.2.0.tgz",
"dependencies": {
"bytes": {
"version": "0.3.0",
"from": "bytes@>=0.3.0 <0.4.0",
"from": "https://registry.npmjs.org/bytes/-/bytes-0.3.0.tgz",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-0.3.0.tgz"
},
"gulp-util": {
"version": "2.2.20",
"from": "gulp-util@>=2.2.14 <3.0.0",
"from": "https://registry.npmjs.org/gulp-util/-/gulp-util-2.2.20.tgz",
"resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-2.2.20.tgz",
"dependencies": {
"chalk": {
"version": "0.5.1",
"from": "chalk@>=0.5.0 <0.6.0",
"from": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz",
"dependencies": {
"ansi-styles": {
"version": "1.1.0",
"from": "ansi-styles@>=1.1.0 <2.0.0",
"from": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz"
},
"escape-string-regexp": {
"version": "1.0.3",
"from": "escape-string-regexp@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz"
},
"has-ansi": {
"version": "0.1.0",
"from": "has-ansi@>=0.1.0 <0.2.0",
"from": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@>=0.2.0 <0.3.0",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz"
}
}
},
"strip-ansi": {
"version": "0.3.0",
"from": "strip-ansi@>=0.3.0 <0.4.0",
"from": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@>=0.2.0 <0.3.0",
"from": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz"
}
}
},
"supports-color": {
"version": "0.2.0",
"from": "supports-color@>=0.2.0 <0.3.0",
"from": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz"
}
}
},
"dateformat": {
"version": "1.0.11",
"from": "dateformat@>=1.0.7-1.2.3 <2.0.0",
"from": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.11.tgz",
"dependencies": {
"get-stdin": {
"version": "5.0.1",
"from": "get-stdin@*",
"from": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz"
},
"meow": {
"version": "3.5.0",
"from": "meow@*",
"from": "https://registry.npmjs.org/meow/-/meow-3.5.0.tgz",
"resolved": "https://registry.npmjs.org/meow/-/meow-3.5.0.tgz",
"dependencies": {
"camelcase-keys": {
"version": "1.0.0",
"from": "camelcase-keys@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-1.0.0.tgz",
"dependencies": {
"camelcase": {
"version": "1.2.1",
"from": "camelcase@>=1.0.1 <2.0.0",
"from": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz"
},
"map-obj": {
"version": "1.0.1",
"from": "map-obj@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz"
}
}
},
"loud-rejection": {
"version": "1.2.0",
"from": "loud-rejection@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.2.0.tgz",
"resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.2.0.tgz",
"dependencies": {
"signal-exit": {
"version": "2.1.2",
"from": "signal-exit@>=2.1.2 <3.0.0",
"from": "https://registry.npmjs.org/signal-exit/-/signal-exit-2.1.2.tgz",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-2.1.2.tgz"
}
}
},
"minimist": {
"version": "1.2.0",
"from": "minimist@>=1.1.3 <2.0.0",
"from": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz"
},
"normalize-package-data": {
"version": "2.3.5",
"from": "normalize-package-data@>=2.3.4 <3.0.0",
"from": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.3.5.tgz",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.3.5.tgz",
"dependencies": {
"hosted-git-info": {
"version": "2.1.4",
"from": "hosted-git-info@>=2.1.4 <3.0.0",
"from": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.4.tgz",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.4.tgz"
},
"is-builtin-module": {
"version": "1.0.0",
"from": "is-builtin-module@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
"dependencies": {
"builtin-modules": {
"version": "1.1.0",
"from": "builtin-modules@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.0.tgz"
}
}
},
"validate-npm-package-license": {
"version": "3.0.1",
"from": "validate-npm-package-license@>=3.0.1 <4.0.0",
"from": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz",
"dependencies": {
"spdx-correct": {
"version": "1.0.2",
"from": "spdx-correct@>=1.0.0 <1.1.0",
"from": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz",
"dependencies": {
"spdx-license-ids": {
"version": "1.1.0",
"from": "spdx-license-ids@>=1.0.2 <2.0.0",
"from": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.1.0.tgz"
}
}
},
"spdx-expression-parse": {
"version": "1.0.1",
"from": "spdx-expression-parse@>=1.0.0 <1.1.0",
"from": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.1.tgz",
"dependencies": {
"spdx-exceptions": {
"version": "1.0.4",
"from": "spdx-exceptions@>=1.0.4 <2.0.0",
"from": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-1.0.4.tgz",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-1.0.4.tgz"
},
"spdx-license-ids": {
"version": "1.1.0",
"from": "spdx-license-ids@>=1.0.2 <2.0.0",
"from": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.1.0.tgz"
}
}
@ -10683,32 +10683,32 @@
},
"object-assign": {
"version": "4.0.1",
"from": "object-assign@>=4.0.1 <5.0.0",
"from": "https://registry.npmjs.org/object-assign/-/object-assign-4.0.1.tgz",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.0.1.tgz"
},
"read-pkg-up": {
"version": "1.0.1",
"from": "read-pkg-up@>=1.0.1 <2.0.0",
"from": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"dependencies": {
"find-up": {
"version": "1.1.0",
"from": "find-up@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/find-up/-/find-up-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.0.tgz",
"dependencies": {
"path-exists": {
"version": "2.1.0",
"from": "path-exists@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz"
},
"pinkie-promise": {
"version": "2.0.0",
"from": "pinkie-promise@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"dependencies": {
"pinkie": {
"version": "2.0.0",
"from": "pinkie@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz"
}
}
@ -10717,32 +10717,32 @@
},
"read-pkg": {
"version": "1.1.0",
"from": "read-pkg@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"dependencies": {
"load-json-file": {
"version": "1.1.0",
"from": "load-json-file@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"dependencies": {
"graceful-fs": {
"version": "4.1.2",
"from": "graceful-fs@>=4.1.2 <5.0.0",
"from": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.2.tgz",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.2.tgz"
},
"parse-json": {
"version": "2.2.0",
"from": "parse-json@>=2.2.0 <3.0.0",
"from": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
"dependencies": {
"error-ex": {
"version": "1.3.0",
"from": "error-ex@>=1.2.0 <2.0.0",
"from": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz",
"dependencies": {
"is-arrayish": {
"version": "0.2.1",
"from": "is-arrayish@>=0.2.1 <0.3.0",
"from": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz"
}
}
@ -10751,29 +10751,29 @@
},
"pify": {
"version": "2.3.0",
"from": "pify@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz"
},
"pinkie-promise": {
"version": "2.0.0",
"from": "pinkie-promise@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"dependencies": {
"pinkie": {
"version": "2.0.0",
"from": "pinkie@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz"
}
}
},
"strip-bom": {
"version": "2.0.0",
"from": "strip-bom@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"dependencies": {
"is-utf8": {
"version": "0.2.0",
"from": "is-utf8@>=0.2.0 <0.3.0",
"from": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.0.tgz",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.0.tgz"
}
}
@ -10782,27 +10782,27 @@
},
"path-type": {
"version": "1.1.0",
"from": "path-type@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"dependencies": {
"graceful-fs": {
"version": "4.1.2",
"from": "graceful-fs@>=4.1.2 <5.0.0",
"from": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.2.tgz",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.2.tgz"
},
"pify": {
"version": "2.3.0",
"from": "pify@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz"
},
"pinkie-promise": {
"version": "2.0.0",
"from": "pinkie-promise@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz",
"dependencies": {
"pinkie": {
"version": "2.0.0",
"from": "pinkie@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.0.tgz"
}
}
@ -10815,27 +10815,27 @@
},
"redent": {
"version": "1.0.0",
"from": "redent@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",
"dependencies": {
"indent-string": {
"version": "2.1.0",
"from": "indent-string@>=2.1.0 <3.0.0",
"from": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz",
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz",
"dependencies": {
"repeating": {
"version": "2.0.0",
"from": "repeating@>=2.0.0 <3.0.0",
"from": "https://registry.npmjs.org/repeating/-/repeating-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.0.tgz",
"dependencies": {
"is-finite": {
"version": "1.0.1",
"from": "is-finite@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.1.tgz",
"dependencies": {
"number-is-nan": {
"version": "1.0.0",
"from": "number-is-nan@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.0.tgz"
}
}
@ -10846,12 +10846,12 @@
},
"strip-indent": {
"version": "1.0.1",
"from": "strip-indent@>=1.0.1 <2.0.0",
"from": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz",
"dependencies": {
"get-stdin": {
"version": "4.0.1",
"from": "get-stdin@>=4.0.1 <5.0.0",
"from": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz"
}
}
@ -10860,7 +10860,7 @@
},
"trim-newlines": {
"version": "1.0.0",
"from": "trim-newlines@>=1.0.0 <2.0.0",
"from": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz"
}
}
@ -10869,51 +10869,51 @@
},
"lodash._reinterpolate": {
"version": "2.4.1",
"from": "lodash._reinterpolate@>=2.4.1 <3.0.0",
"from": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-2.4.1.tgz"
},
"lodash.template": {
"version": "2.4.1",
"from": "lodash.template@>=2.4.1 <3.0.0",
"from": "https://registry.npmjs.org/lodash.template/-/lodash.template-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-2.4.1.tgz",
"dependencies": {
"lodash.defaults": {
"version": "2.4.1",
"from": "lodash.defaults@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-2.4.1.tgz",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1",
"from": "lodash._objecttypes@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz"
}
}
},
"lodash.escape": {
"version": "2.4.1",
"from": "lodash.escape@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-2.4.1.tgz",
"dependencies": {
"lodash._escapehtmlchar": {
"version": "2.4.1",
"from": "lodash._escapehtmlchar@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._escapehtmlchar/-/lodash._escapehtmlchar-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._escapehtmlchar/-/lodash._escapehtmlchar-2.4.1.tgz",
"dependencies": {
"lodash._htmlescapes": {
"version": "2.4.1",
"from": "lodash._htmlescapes@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._htmlescapes/-/lodash._htmlescapes-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._htmlescapes/-/lodash._htmlescapes-2.4.1.tgz"
}
}
},
"lodash._reunescapedhtml": {
"version": "2.4.1",
"from": "lodash._reunescapedhtml@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._reunescapedhtml/-/lodash._reunescapedhtml-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._reunescapedhtml/-/lodash._reunescapedhtml-2.4.1.tgz",
"dependencies": {
"lodash._htmlescapes": {
"version": "2.4.1",
"from": "lodash._htmlescapes@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._htmlescapes/-/lodash._htmlescapes-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._htmlescapes/-/lodash._htmlescapes-2.4.1.tgz"
}
}
@ -10922,39 +10922,39 @@
},
"lodash._escapestringchar": {
"version": "2.4.1",
"from": "lodash._escapestringchar@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._escapestringchar/-/lodash._escapestringchar-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._escapestringchar/-/lodash._escapestringchar-2.4.1.tgz"
},
"lodash.keys": {
"version": "2.4.1",
"from": "lodash.keys@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz",
"dependencies": {
"lodash._isnative": {
"version": "2.4.1",
"from": "lodash._isnative@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._isnative/-/lodash._isnative-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._isnative/-/lodash._isnative-2.4.1.tgz"
},
"lodash.isobject": {
"version": "2.4.1",
"from": "lodash.isobject@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-2.4.1.tgz",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1",
"from": "lodash._objecttypes@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz"
}
}
},
"lodash._shimkeys": {
"version": "2.4.1",
"from": "lodash._shimkeys@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._shimkeys/-/lodash._shimkeys-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._shimkeys/-/lodash._shimkeys-2.4.1.tgz",
"dependencies": {
"lodash._objecttypes": {
"version": "2.4.1",
"from": "lodash._objecttypes@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz"
}
}
@ -10963,54 +10963,54 @@
},
"lodash.templatesettings": {
"version": "2.4.1",
"from": "lodash.templatesettings@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz"
},
"lodash.values": {
"version": "2.4.1",
"from": "lodash.values@>=2.4.1 <2.5.0",
"from": "https://registry.npmjs.org/lodash.values/-/lodash.values-2.4.1.tgz",
"resolved": "https://registry.npmjs.org/lodash.values/-/lodash.values-2.4.1.tgz"
}
}
},
"minimist": {
"version": "0.2.0",
"from": "minimist@>=0.2.0 <0.3.0",
"from": "https://registry.npmjs.org/minimist/-/minimist-0.2.0.tgz",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.2.0.tgz"
},
"multipipe": {
"version": "0.1.2",
"from": "multipipe@>=0.1.0 <0.2.0",
"from": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz",
"resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz",
"dependencies": {
"duplexer2": {
"version": "0.0.2",
"from": "duplexer2@0.0.2",
"from": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz",
"resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz",
"dependencies": {
"readable-stream": {
"version": "1.1.13",
"from": "readable-stream@>=1.1.9 <1.2.0",
"from": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"from": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"from": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"from": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
@ -11021,51 +11021,51 @@
},
"through2": {
"version": "0.5.1",
"from": "through2@>=0.5.0 <0.6.0",
"from": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
"dependencies": {
"readable-stream": {
"version": "1.0.33",
"from": "readable-stream@>=1.0.17 <1.1.0",
"from": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"from": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"from": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"from": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"xtend": {
"version": "3.0.0",
"from": "xtend@>=3.0.0 <3.1.0",
"from": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz"
}
}
},
"vinyl": {
"version": "0.2.3",
"from": "vinyl@>=0.2.1 <0.3.0",
"from": "https://registry.npmjs.org/vinyl/-/vinyl-0.2.3.tgz",
"resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.2.3.tgz",
"dependencies": {
"clone-stats": {
"version": "0.0.1",
"from": "clone-stats@>=0.0.1 <0.1.0",
"from": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz"
}
}
@ -11074,49 +11074,49 @@
},
"stream-to-array": {
"version": "1.0.0",
"from": "stream-to-array@>=1.0.0 <1.1.0",
"from": "https://registry.npmjs.org/stream-to-array/-/stream-to-array-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/stream-to-array/-/stream-to-array-1.0.0.tgz"
},
"through2": {
"version": "0.4.2",
"from": "through2@>=0.4.1 <0.5.0",
"from": "https://registry.npmjs.org/through2/-/through2-0.4.2.tgz",
"resolved": "https://registry.npmjs.org/through2/-/through2-0.4.2.tgz",
"dependencies": {
"readable-stream": {
"version": "1.0.33",
"from": "readable-stream@>=1.0.17 <1.1.0",
"from": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"from": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"from": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"from": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"xtend": {
"version": "2.1.2",
"from": "xtend@>=2.1.1 <2.2.0",
"from": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz",
"dependencies": {
"object-keys": {
"version": "0.4.0",
"from": "object-keys@>=0.4.0 <0.5.0",
"from": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz"
}
}
@ -18626,6 +18626,11 @@
}
}
},
"karma-sourcemap-loader": {
"version": "0.3.6",
"from": "https://registry.npmjs.org/karma-sourcemap-loader/-/karma-sourcemap-loader-0.3.6.tgz",
"resolved": "https://registry.npmjs.org/karma-sourcemap-loader/-/karma-sourcemap-loader-0.3.6.tgz"
},
"lodash": {
"version": "2.4.2",
"from": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz",

View File

@ -81,6 +81,7 @@
"karma-dart": "^0.3.0",
"karma-jasmine": "^0.3.6",
"karma-sauce-launcher": "^0.2.14",
"karma-sourcemap-loader": "^0.3.6",
"lodash": "^2.4.1",
"madge": "0.5.0",
"merge": "^1.2.0",

View File

@ -70,6 +70,7 @@ export class AngularBuilder {
{
name: 'dev',
typeAssertions: true,
sourceMaps: true,
projects: opts.projects,
noTypeChecks: opts.noTypeChecks,
generateEs6: opts.generateEs6
@ -84,6 +85,7 @@ export class AngularBuilder {
{
name: 'prod',
typeAssertions: false,
sourceMaps: false,
projects: opts.projects,
noTypeChecks: opts.noTypeChecks,
generateEs6: opts.generateEs6

View File

@ -103,7 +103,7 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
output.outputFiles.forEach(o => {
let destDirPath = path.dirname(o.name);
fse.mkdirsSync(destDirPath);
fs.writeFileSync(o.name, o.text, FS_OPTS);
fs.writeFileSync(o.name, this.fixSourceMapSources(o.text), FS_OPTS);
});
}
});
@ -145,9 +145,9 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
private doFullBuild() {
let program = this.tsService.getProgram();
let emitResult = program.emit(undefined, function(absoluteFilePath, fileContent) {
let emitResult = program.emit(undefined, (absoluteFilePath, fileContent) => {
fse.mkdirsSync(path.dirname(absoluteFilePath));
fs.writeFileSync(absoluteFilePath, fileContent, FS_OPTS);
fs.writeFileSync(absoluteFilePath, this.fixSourceMapSources(fileContent), FS_OPTS);
});
if (emitResult.emitSkipped) {
@ -176,6 +176,33 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
}
}
/**
* There is a bug in TypeScript 1.6, where the sourceRoot and inlineSourceMap properties
* are exclusive. This means that the sources property always contains relative paths
* (e.g, ../../../../angular2/src/di/injector.ts).
*
* Here, we normalize the sources property and remove the ../../../
*
* This issue is fixed in https://github.com/Microsoft/TypeScript/pull/5620.
* Once we switch to TypeScript 1.8, we can remove this method.
*/
private fixSourceMapSources(content: string): string {
try {
const marker = "//# sourceMappingURL=data:application/json;base64,";
const index = content.indexOf(marker);
if (index == -1) return content;
const base = content.substring(0, index + marker.length);
const sourceMapBit =
new Buffer(content.substring(index + marker.length), 'base64').toString("utf8");
const sourceMaps = JSON.parse(sourceMapBit);
const source = sourceMaps.sources[0];
sourceMaps.sources = [source.substring(source.lastIndexOf("../") + 3)];
return `${base}${new Buffer(JSON.stringify(sourceMaps)).toString('base64')}`;
} catch (e) {
return content;
}
}
private removeOutputFor(tsFilePath: string) {
let absoluteJsFilePath = path.join(this.cachePath, tsFilePath.replace(/\.ts$/, '.js'));

View File

@ -74,6 +74,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
const modules = options.projects;
const noTypeChecks = options.noTypeChecks;
const generateEs6 = options.generateEs6;
const sourceMaps = options.sourceMaps;
if (modules.angular2) {
var angular2Tree = new Funnel('modules/angular2', {
@ -147,14 +148,13 @@ module.exports = function makeBrowserTree(options, destinationPath) {
declaration: false,
emitDecoratorMetadata: true,
experimentalDecorators: true,
mapRoot: '', // force sourcemaps to use relative path
module: 'commonjs',
moduleResolution: 'classic',
noEmitOnError: !noTypeChecks,
rootDir: './',
rootFilePaths: ['angular2/manual_typings/globals.d.ts'],
sourceMap: true,
sourceRoot: '.',
inlineSourceMap: sourceMaps,
inlineSources: sourceMaps,
target: 'es5'
});
@ -276,12 +276,11 @@ module.exports = function makeBrowserTree(options, destinationPath) {
declaration: false,
emitDecoratorMetadata: true,
experimentalDecorators: true,
mapRoot: '', // force sourcemaps to use relative path
noEmitOnError: false,
rootDir: './',
rootFilePaths: ['angular2/manual_typings/globals-es6.d.ts'],
sourceMap: true,
sourceRoot: '.',
inlineSourceMap: sourceMaps,
inlineSources: sourceMaps,
target: 'es6'
});

59
tools/karma/reporter.js Normal file
View File

@ -0,0 +1,59 @@
var SourceMapConsumer = require('source-map').SourceMapConsumer;
var DotsReporter = require('karma/lib/reporters/dots_color');
var createErrorFormatter = function (basePath, emitter, SourceMapConsumer) {
var lastServedFiles = [];
emitter.on('file_list_modified', function (files) {
lastServedFiles = files.served
});
function findFile(path) {
return lastServedFiles.filter(_ => _.path === path)[0];
}
var URL_REGEXP = new RegExp('(?:https?:\\/\\/[^\\/]*)?\\/?' +
'(base|absolute)' + // prefix
'((?:[A-z]\\:)?[^\\?\\s\\:]*)' + // path
'(\\?\\w*)?' + // sha
'(\\:(\\d+))?' + // line
'(\\:(\\d+))?' + // column
'', 'g')
return function (msg, indentation) {
msg = (msg || '').replace(URL_REGEXP, function (_, prefix, path, __, ___, line, ____, column) {
if (prefix === 'base') {
path = basePath + path;
}
line = parseInt(line || '0', 10);
column = parseInt(column || '0', 10);
var file = findFile(path)
if (file && file.sourceMap) {
try {
var original = new SourceMapConsumer(file.sourceMap).originalPositionFor({
line: line,
column: column
});
return process.cwd() + "/modules/" + original.source + ":" + original.line + ":" + original.column;
} catch (e) {
log.warn('SourceMap position not found for trace: %s', msg);
}
}
return path + ':' + line + ':' + column;
});
// indent every line
if (indentation) {
msg = indentation + msg.replace(/\n/g, '\n' + indentation)
}
return msg + '\n';
}
}
var InternalAngularReporter = function (config, emitter) {
var formatter = createErrorFormatter(config.basePath, emitter, SourceMapConsumer);
DotsReporter.call(this, formatter, false)
}
InternalAngularReporter.$inject = ['config', 'emitter']
module.exports = {'reporter:internal-angular': ['type', InternalAngularReporter]};