-
Notifications
You must be signed in to change notification settings - Fork 122
Conversation
var sourceMapFile = path.basename(opts.outFile) + '.map'; | ||
output.source += '\n//# sourceMappingURL=' + sourceMapFile; | ||
} | ||
|
||
return asp(mkdirp)(path.dirname(path.resolve(basePath, opts.outFile))) | ||
.then(function() { | ||
if (!opts.sourceMaps) return; | ||
if (!output.SourceMap) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small s
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😮
Having some race conditions with Would love to squish this - something I can block on to know that systemjs is ready? |
78e4747
to
2e5b464
Compare
That would be if |
Travis fails are just that issue, going see about putting in a diabolical spin loop. |
I may have fixed this build issue in 75e8eec. |
|
||
|
||
})(); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRyZWUvYW1kLTIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7T0FPTyxFQUFFLEdBQUUsQ0FBRyxJQUFFLENBQUU7RUFBRTtBQUFBIn0= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried about all these exact source tests - everytime we update compiler implementations we will be needing to update and generate these tests. How do we update the generated code? etc etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it's brittle as hell. Big advantage when test coverage is low is that you don't miss details. Updating the generated code could be as easy as setting an environment variable before running the tests again.
Had pretty good experience with "test everything, even the incidental things" as the initial strategy. You can immediately refactor quickly, and it's hard to write targeted tests without refactoring or abusing mocks and spies (which is often more expensive than no tests..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could replace this full-text match with a few assertions and keep high confidence:
- Only one
//# sourceMappingURL
comment, and it's on the last line - Type is
data:application/json;base64
- Decoding and parsing it generates a valid source map
3d459f6
to
296073d
Compare
@guybedford merge? |
@@ -22,7 +22,8 @@ | |||
"es6-module-loader": "0.14.0", | |||
"mocha": "~2.0.0", | |||
"chai": "^1.10.0", | |||
"react-tools": "^0.12.1" | |||
"react-tools": "^0.12.1", | |||
"atob": "^1.1.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not just use Buffer directly here? https://github.com/node-browser-compat/atob/blob/master/index.js#L5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure we want to get on the wrong side of the Modularity Wars?!
Thanks, will drop atob
.
d6994b3
to
12b2133
Compare
Hit all the feedback I think |
var opts = {}; | ||
keys.forEach(function(key) { | ||
opts[key] = opts_ && opts_[key]; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of this is to allow type inference through the setting of default values.
A common pattern I find useful is:
function prepend(a, b) {
for (var p in b) {
if (!(p in a))
a[p] = b[p];
}
return a;
}
function processOpts(opts_, outFile) {
// apply defaults
prepend(opts_, {
config: {},
lowResSourceMaps: true,
minify: true,
normalize: false,
outFile: outFile || '',
runtime: false,
sourceMaps: true,
sourceMapContents: _opts.sourceMaps == 'inline'
});
}
Sorry to be a pain...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost added it as extend(defaults, normalize(opts), overrides)
, but then stopped because really config should also be normalized, and that triggered my subscription to the religion that configuration should never be nested, so then I went back to "smallest thing that meets this nitpickers explicit points" 👹
Sure we could add this prepend form as a "stopgap" ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current behaviour has every default or falsey. Assume your example was just to demonstrate, and you're not wanting to enforce new defaults?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah of course - yes defaults can stay falsey.
Looks great, thanks. |
OK, gave you something similar to your (what the hell.. no lambda or wizard emoji when I needed them there) |
Nice, thanks! In terms of giving JS basic data wrangling powers, Rick Waldron kindly proposed this for us in ES6 :) The pattern going forward for this in JS will be |
Can we rebase? Then good to merge! |
* Also ensure content option gets to where it needs to go
* Fix typos around (opts|output).sourceMap(s) * Fix typos around opts.lowRes(olution)SourceMaps * Fix typos around inlineSourceMap(s) * Make exports.inlineSourceMap more visible * Explicitly list all `opts` keys in one place * Remove atob dependency
c897079
to
3c90544
Compare
Rebased! Don't link me to articles about OO, I was having such a nice day ☁️ |
Closes #74