buble merge requestshttps://staging.gitlab.com/Rich-Harris/buble/-/merge_requests2016-10-08T12:21:17Zhttps://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/44WIP: feat: transpile object spread2016-10-08T12:21:17Zusername-removed-498219dario@uxtemple.comWIP: feat: transpile object spreadI know this isn't a standard feature yet but it is a pretty handy one that helps write very succinct code. I understand if it's not in the spirit of buble to support it. It doesn't really add a big overhead, so I figured I'd submit it fo...I know this isn't a standard feature yet but it is a pretty handy one that helps write very succinct code. I understand if it's not in the spirit of buble to support it. It doesn't really add a big overhead, so I figured I'd submit it for inspection and let the community decide.
I flagged it as WIP because there's one test that isn't working and maybe someone could help, here's the offending test:
```
1) buble object-rest-spread.js transpiles object rest spread nested:
AssertionError: 'var c = Object.assign({}, a, {b: 1}, {dd: Object.assign({}, d, {f: 1}}), {e: e});' == 'var c = Object.assign({}, a, {b: 1}, {dd: Object.assign({}, d, {f: 1})}, {e: e});'
+ expected - actual
-var c = Object.assign({}, a, {b: 1}, {dd: Object.assign({}, d, {f: 1}}), {e: e});
+var c = Object.assign({}, a, {b: 1}, {dd: Object.assign({}, d, {f: 1})}, {e: e});
```
Thanks! :)https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/45Object spread redux2016-06-02T19:58:06Zusername-removed-383729Object spread reduxThis builds on @dariocravero's work in https://gitlab.com/Rich-Harris/buble/merge_requests/44, fixing the remaining bug and ensuring that consecutive non-spread properties don't get turned into separate objects:
```js
// before
var ...This builds on @dariocravero's work in https://gitlab.com/Rich-Harris/buble/merge_requests/44, fixing the remaining bug and ensuring that consecutive non-spread properties don't get turned into separate objects:
```js
// before
var obj = { ...a, b: b, c: c } --> var obj = Object.assign( {}, a, {b: b}, {c: c})
// after
var obj = { ...a, b: b, c: c } --> var obj = Object.assign( {}, a, {b: b, c: c})
```https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/46JSX spread attributes2016-06-02T18:29:14Zusername-removed-383729JSX spread attributesThis is based on https://gitlab.com/Rich-Harris/buble/merge_requests/43, but adds the same change as !45, combining consecutive non-spread attributes into a single objectThis is based on https://gitlab.com/Rich-Harris/buble/merge_requests/43, but adds the same change as !45, combining consecutive non-spread attributes into a single objecthttps://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/47test: deeply nested object spread2016-06-02T21:48:56Zusername-removed-498219dario@uxtemple.comtest: deeply nested object spreadThis merge request includes a bit of a crazy test with some deeply nested spreads, I think it's a nice safety check but feel free to reject it if you think the basic tests are ok :)This merge request includes a bit of a crazy test with some deeply nested spreads, I think it's a nice safety check but feel free to reject it if you think the basic tests are ok :)https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/48remove stuff from readme2016-06-03T16:14:13Zusername-removed-383729remove stuff from readmesee #57 see #57 https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/50When compiling a directory, automatically create destination dirs2016-06-03T16:16:14Zusername-removed-565223When compiling a directory, automatically create destination dirsSo that you can compile a nested tree of dirs without first creating all the matching directories in the output dir.
Should fix issue #63So that you can compile a nested tree of dirs without first creating all the matching directories in the output dir.
Should fix issue #63https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/51Customize output of spread operator2016-06-14T14:13:10Zusername-removed-506044Customize output of spread operatorRef #66 Ref #66 https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/52Compose acorn extensions2016-06-14T14:11:58Zusername-removed-506044Compose acorn extensionsThis makes acorn extension more structured.This makes acorn extension more structured.https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/53Computed properties2016-06-14T21:27:46Zusername-removed-383729Computed propertiesCloses #67 Closes #67 https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/54allow rest parameters with super call2016-06-14T21:26:17Zusername-removed-383729allow rest parameters with super callfixes #69fixes #69https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/55ensure inserted statements follow use strict pragma2016-06-15T13:27:31Zusername-removed-383729ensure inserted statements follow use strict pragmafixes #72 fixes #72 https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/56Computed class methods2016-06-18T17:26:53Zusername-removed-383729Computed class methodsDoesn't yet support computed accessors, those are a bit fiddly. Test is currently skipped, will open a separate issueDoesn't yet support computed accessors, those are a bit fiddly. Test is currently skipped, will open a separate issuehttps://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/58Compound destructuring2016-09-17T20:28:13Zusername-removed-383729Compound destructuringCode like `var { a: { b: c }, d: { e: f, g: h } } = x()` is terrible and you should never, ever write it, but it's valid ES2015 without size or performance hazards, so we should support it. This PR allows arbitrarily complex destructurin...Code like `var { a: { b: c }, d: { e: f, g: h } } = x()` is terrible and you should never, ever write it, but it's valid ES2015 without size or performance hazards, so we should support it. This PR allows arbitrarily complex destructuring.
For array patterns, the result is more similar to Babel's `es2015-loose` than `es2015` because that's what you want in the vast majority of situations – though we could support the stricter version in future if we really wanted to:
```js
// in
var [[[a]], [[b, c = 1]]] = x;
// out
var a = x[0][0][0];
var x_1_0 = x[1][0];
var b = x_1_0[0];
var c = x_1_0[1]; if ( c === void 0 ) c = 1;
// Babel es2015-loose
var _x = x;
var _x$ = _x[0];
var _x$$ = _x$[0];
var a = _x$$[0];
var _x$2 = _x[1];
var _x$2$ = _x$2[0];
var b = _x$2$[0];
var _x$2$$ = _x$2$[1];
var c = _x$2$$ === undefined ? 1 : _x$2$$;
// Babel es2015
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _x = x;
var _x2 = _slicedToArray(_x, 2);
var _x2$ = _slicedToArray(_x2[0], 1);
var _x2$$ = _slicedToArray(_x2$[0], 1);
var a = _x2$$[0];
var _x2$2 = _slicedToArray(_x2[1], 1);
var _x2$2$ = _slicedToArray(_x2$2[0], 2);
var b = _x2$2$[0];
var _x2$2$$ = _x2$2$[1];
var c = _x2$2$$ === undefined ? 1 : _x2$2$$;
```https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/59fix whitespace between JSX tags on same line2016-06-19T13:23:59Zusername-removed-383729fix whitespace between JSX tags on same linecloses #65closes #65https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/60handle computed method names2016-06-21T17:05:12Zusername-removed-383729handle computed method namesfixes #78fixes #78https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/61include snippet in error.toString()2016-09-17T20:28:13Zusername-removed-383729include snippet in error.toString()Closes #79Closes #79https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/62Support unicode flag in regular expression literals2016-06-22T16:16:05Zusername-removed-383729Support unicode flag in regular expression literalsSee #3 See #3 https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/63Cache buble/register transformations2016-06-22T16:14:20Zusername-removed-383729Cache buble/register transformationsThis speeds up app startup with `buble/register` by caching transformations. On reading a file, it creates a SHA256 hash of the source code, then attempts to read the contents of `$HOME/.buble-cache/{node_version}/{hash}.json`. If it suc...This speeds up app startup with `buble/register` by caching transformations. On reading a file, it creates a SHA256 hash of the source code, then attempts to read the contents of `$HOME/.buble-cache/{node_version}/{hash}.json`. If it succeeds, it uses those contents, otherwise it does the transformation and saves the result to that file. It speeds up Bublé's own tests by about half a second.
I considered doing it on a per-filename basis with `fs.statSync` and `mtime`, but `fs.readFileSync` and SHA256 are so fast that there's really no point. This approach saves retransforming identical files that exist in multiple locations.https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/64Test subset2016-06-22T19:15:28Zusername-removed-383729Test subsetInspired by @dariocravero's idea in https://gitlab.com/Rich-Harris/buble/merge_requests/42, but slightly different in that it uses the existing test.js and adds support for multiple files. So you can do
```bash
npm run test -- --subs...Inspired by @dariocravero's idea in https://gitlab.com/Rich-Harris/buble/merge_requests/42, but slightly different in that it uses the existing test.js and adds support for multiple files. So you can do
```bash
npm run test -- --subset arrow-functions,classes,loops
```
or whatever. Also adds a `test:node` task which is identical except that it doesn't create the browser build, which makes it a bit quicker.https://staging.gitlab.com/Rich-Harris/buble/-/merge_requests/65remove for-of blocks without a body2016-07-10T03:39:07Zusername-removed-383729remove for-of blocks without a bodyfixes #80fixes #80