Skip to content

Commit

Permalink
Ensure generated sourcemaps are valid.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Sep 18, 2018
1 parent 6685068 commit 5e1f2f3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
5 changes: 5 additions & 0 deletions broccoli/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports.routerES = function _routerES() {
external: ['route-recognizer', 'rsvp'],
input: 'index.js',
output: {
sourcemap: 'inline',
file: 'router.js',
format: 'es',
},
Expand Down Expand Up @@ -111,6 +112,7 @@ module.exports.handlebarsES = function _handlebars() {
rollup: {
input: 'handlebars/compiler/base.js',
output: {
sourcemap: false,
file: 'handlebars.js',
format: 'es',
exports: 'named',
Expand Down Expand Up @@ -145,6 +147,7 @@ module.exports.rsvpES = function _rsvpES() {
rollup: {
input: 'rsvp.js',
output: {
sourcemap: 'inline',
file: 'rsvp.js',
format: 'es',
exports: 'named',
Expand Down Expand Up @@ -196,6 +199,7 @@ module.exports.simpleHTMLTokenizerES = function _simpleHTMLTokenizerES() {
rollup: {
input: moduleInfo.base,
output: {
sourcemap: 'inline',
file: 'simple-html-tokenizer.js',
format: 'es',
exports: 'named',
Expand All @@ -215,6 +219,7 @@ function rollupGlimmerPackage(pkg) {
input: pkg.module.base,
external: pkg.dependencies,
output: {
sourcemap: 'inline',
file: name + '.js',
format: 'es',
},
Expand Down
2 changes: 1 addition & 1 deletion broccoli/to-es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function toES5(tree, _options) {
let isDebug = options.environment !== 'production';

options.moduleId = true;
options.inputSourceMap = false;
options.inputSourceMap = true;
options.sourceMaps = 'inline';
options.plugins = [
injectBabelHelpers,
Expand Down
1 change: 1 addition & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ function rollupPackage(packagesES, name) {
return true;
},
output: {
sourcemap: 'inline',
file: `${name}.js`,
format: 'es',
exports: 'named',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"semver": "^5.5.0",
"serve-static": "^1.12.2",
"simple-dom": "^0.3.0",
"sourcemap-validator": "^1.1.0",
"testem": "^1.18.4",
"tslint": "^5.9.1",
"tslint-config-prettier": "^1.10.0",
Expand Down
21 changes: 21 additions & 0 deletions tests/node/sourcemap-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const validate = require('sourcemap-validator');
const fs = require('fs');

QUnit.module('sourcemap validation', function() {
let assets = ['ember.debug', 'ember.prod', 'ember.min'];

assets.forEach(asset => {
QUnit.test(`${asset} has valid sourcemaps`, function(assert) {
assert.expect(0);

let jsPath = `dist/${asset}.js`;

if (fs.existsSync(jsPath)) {
let contents = fs.readFileSync(jsPath, 'utf-8');
let sourcemap = fs.readFileSync(`dist/${asset}.map`, 'utf-8');

validate(contents, sourcemap);
}
});
});
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
// Compilation Configuration
"target": "es2017",
"sourceMap": true,
"sourceMap": false,
"outDir": "dist",
"baseUrl": "packages",
"rootDir": "packages",
Expand Down

0 comments on commit 5e1f2f3

Please sign in to comment.