dropsintheocean / dih-webapp

Webapp for the volunteer management system
http://app.drapenihavet.no
0 stars 0 forks source link

[Doppins] Upgrade dependency babel-preset-es2015 to ~6.22.0 #294

Closed doppins-bot closed 7 years ago

doppins-bot commented 7 years ago

Hi!

A new version was just released of babel-preset-es2015, so Doppins has upgraded your project's dependency ranges.

Make sure that it doesn't break anything, and happy merging! :shipit:


Upgraded babel-preset-es2015 from ~6.9.0 to ~6.22.0

Changelog:

Version 6.22.0

6.22.0 (2017-01-19)

Thanks to 10 new contributors! (23 total)

A quick update since it's been over a month already: adds support for shorthand import syntax in Flow + some fixes!

We'll be merging in our current 7.0 PRs on a 7.0 branch soon and I'l be making some more issues (most should be beginner-friendly).

To follow our progress check out our 7.0 milestone](https://github.com/babel/babel/milestone/9), the [wiki (https://github.com/babel/babel/wiki/Babel-7) and upcoming announcements on twitter!

We support stripping out and generating the new shorthand import syntax in Flow (parser support was added in babylon@6.15.0 (https://github.com/babel/babylon/releases/tag/v6.15.0).

import {
  someValue,
  type someType,
  typeof someOtherValue,
} from "blah";

:rocket: New Feature

:bug: Bug Fix

const { x, ...y } = foo();

Old Behavior

const { x } = foo();
const y = _objectWithoutProperties(foo(), ["x"]);

New/Expected Behavior

const _ref = foo(); // should only be called once
const { x } = _ref; 
const y = _objectWithoutProperties(_ref, ["x"]);

Accounts for default values in object rest params

function fn({a = 1, ...b} = {}) {
  return {a, b};
}
const assign = ([...arr], index, value) => {
  arr[index] = value
  return arr
}

const arr = [1, 2, 3]
assign(arr, 1, 42)
console.log(arr) // [1, 2, 3]

Input

export const x = ({ x }) => x;
export const y = function () {};

Output

export const x = ({ x }) => x;
export const y = function y() {}; 

:nail_care: Polish

:memo: Documentation

:house: Internal

Committers: 23, First PRs: 10

Version 6.18.0

v6.18.0 (2016-10-24)

:rocket: New Feature

Check out the blog post and flow docs for more info:

type T = { +p: T };
interface T { -p: T };
declare class T { +[k:K]: V };
class T { -[k:K]: V };
class C2 { +p: T = e };
// in
['a' + 'b']: 10 * 20, 'z': [1, 2, 3]}
// out
{ab: 200, z: [1, 2, 3]}

Parser support was added in https://github.com/babel/babylon/releases/tag/v6.12.0.

Just the plugin to enable it in babel.

// install
$ npm install babel-plugin-syntax-dynamic-import --save-dev

or use the new parserOpts

// .babelrc
{
  "parserOpts": {
    "plugins": ['dynamicImport']
  }
}

Previously we added a useBuiltIns for object-rest-spread so that it use the native/built in version if you use a polyfill or have it supported natively.

This change just uses the same option from the plugin to be applied with spread inside of jsx.

// in
var div = <Component {...props} foo="bar" />
// out
var div = React.createElement(Component, Object.assign({}, props, { foo: "bar" }));

EmptyTypeAnnotation

Added in flow here](https://github.com/facebook/flow/commit/c603505583993aa953904005f91c350f4b65d6bd) and in babylon [here (https://github.com/babel/babylon/pull/171).

function f<T>(x: empty): T {
  return x;
}
f(); // nothing to pass...

Track LabeledStatement separately (not part of bindings).

:bug: Bug Fix

Will give examples of code that was fixed below

  • babel-plugin-transform-react-inline-elements, babel-traverse
  • #4765](https://github.com/babel/babel/pull/4765) Don't treat JSXIdentifier in JSXMemberExpression as HTML tag. Closes [#4027 (https://github.com/babel/babel/issues/4027). (@DrewML)
// issue with imported components that were JSXMemberExpression
import { form } from "./export";

function ParentComponent() {
  return <form.TestComponent />;
}
import { Modal } from "react-bootstrap";
export default CustomModal = () => <Modal.Header>foobar</Modal.Header>;
if ( true ) {
  loop: for (let ch of []) {}
}
class A {
  prop1 = () => this;
  static prop2 = () => this;
  prop3 = () => arguments;
}
// in
class C {
  async *g() { await 1; }
}
// out
class C {
  g() { // was incorrectly outputting the method with a generator still `*g(){`
    return _asyncGenerator.wrap(function* () {
      yield _asyncGenerator.await(1);
    })();
  }
}
// was wrapping variables in an IIFE incorrectly
for ( let i = 0, { length } = list; i < length; i++ ) {
    console.log( i + ': ' + list[i] )
}
// was producing invalid code
class Ref {
  static nextId = 0
  constructor(id = ++Ref.nextId, n = id) {
    this.id = n
  }
}

assert.equal(1, new Ref().id)
assert.equal(2, new Ref().id)
function first(...values) {
    let index = 0;
    return values[index++]; // ++ was happening twice
}

console.log(first(1, 2));
let x = 10;
if (1)
{
    ca: let x = 20;
}
a[`${b++}`] **= 1;
foo = {
  bar() {
    return super.baz **= 12;
  }
}
// `@flow`
var obj = {
  method(a: string): number {
    return 5 + 5;
  }
};
// `@flow`
class C {
  m(x: number): string {
    return 'a';
  }
}

:nail_care: Polish

// in
const [a, b] = [1, 2];
// out
var a = 1,
    b = 2;
// was outputting an extra `index++ + 0`
function first(...values) {
  var index = 0;
  return values[index++];
}

We've had a few reports of users not wrapping a preset in [] when passing in options so we added an extra error message for this.

ReferenceError: [BABEL] /test.js: Unknown option: base.loose2. Check out http://babeljs.io/docs/usage/options/ for more information about options.

A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

Invalid:
  `{ presets: [{option: value}] }`
Valid:
  `{ presets: ["pluginName", {option: value}] }`

For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.
var a: Promise<boolean>[];
// instead of
var a: Promise<bool>[];

Documentation

So that our MIT License shows up.

:house: Internal

It's a one-time use tool (helpful after the initial release when upgrading from v5 to v6) that doesn't need to be a part of babel-cli. We'll publish it as a standalone package it someone asks for it.

Commiters: 17

Version 6.16.0

v6.16.0 (2016-09-28)

If you are seeing something like: No compatible version found: babel-types@^6.16.0 run npm view babel-types dist-tags to be sure

Babel 6.16: Happy 2nd Birthday 🎂 !

Blog post here: http://babeljs.io/blog/2016/09/28/6.16.0

:eyeglasses: Spec Compliancy

This change implements the async iteration proposal, currently at stage 2 (and pushing to stage 3 at the current TC-39 meeting). It includes the following features:


async function* agf() {
  this;
  await 1;
  yield 2;
  return 3;
}
async function f() {
  for await (let x of y) {
    g(x);
  }
}

Example Usage

async function* genAnswers() {
  var stream = [ Promise.resolve(4), Promise.resolve(9), Promise.resolve(12) ];
  var total = 0;
  for await (let val of stream) {
    total += await val;
    yield total;
  }
}

function forEach(ai, fn) {
  return ai.next().then(function (r) {
    if (!r.done) {
      fn(r);
      return forEach(ai, fn);
    }
  });
}

var output = 0;
return forEach(genAnswers(), function(val) { output += val.value })
.then(function () {
  assert.equal(output, 42);
});

Parser support was added in babylon@6.11.0](https://github.com/babel/babylon/releases/tag/v6.11.0) with [babel/babylon#121 (https://github.com/babel/babylon/pull/121)

// Example
class Foo {
  [x]
  ['y']
}

class Bar {
  [p]
  [m] () {}
}

Parser support was added in babylon@6.10.0](https://github.com/babel/babylon/releases/tag/v6.10.0) with [babel/babylon#104 (https://github.com/babel/babylon/pull/104)

// Example
var a : {| x: number, y: string |} = { x: 0, y: 'foo' };

:rocket: New Feature

Babel will now also take the options: parserOpts and generatorOpts (as objects).

parserOpts will pass all properties down to the default babylon parser. You can also pass a parser option to substitute for a different parser.

This will allow passing down any of babylon's options:

{
  "parserOpts": {
    "allowImportExportEverywhere": true,
    "allowReturnOutsideFunction": true,
    "sourceType": "module",
    "plugins": ["flow"]
  }
}

Another use case (the main reason for doing this), is to be able to use recast with Babel.

{
  "parserOpts": {
    "parser": "recast"
  },
  "generatorOpts": {
    "generator": "recast"
  }
}
{
  presets: ["`@org`/babel-preset-name"], // actual package
  presets: ["`@org`/name"] // shorthand name
}

useBuiltIns - Do not use Babel's helper's and just transform to use the built-in method (Disabled by default).

{
  "plugins": [
    ["transform-object-rest-spread", { "useBuiltIns": true }]
  ]
}

// source
z = { x, ...y };
// compiled
z = Object.assign({ x }, y);

babel-code-frame is a standalone package that we use in Babel when reporting errors.

Now there is an option (https://github.com/babel/babel/blob/master/packages/babel-code-frame/README.md#options) to specify the number of lines above and below the error

  1 | class Foo {
> 2 |   constructor()
    |                ^
  3 | }

We previously made presets with commonjs exports

module.exports = {
  plugins: [
    require("babel-plugin-syntax-trailing-function-commas")
  ]
};

Now you can use export default as well

import transformExponentiationOperator from "babel-plugin-transform-exponentiation-operator";
export default {
  plugins: [
    transformExponentiationOperator
  ]
};

:bug: Bug Fix

// `typeof Symbol.prototype` should be 'object'
typeof Symbol.prototype === 'object'

Fix an issue with defaults not being overidden. This was causing options like comments: false not to work correctly.

// wasn't exporting correctly before
export default ({ onClick }) => {
  return <div onClick={() => onClick()}></div>;
}
export default class {};
// wasn't correctly transforming to
exports["default"] = class {}
// with the es3-tranforms
// <X> wasn't stripped out
const find = <X> (f: (x:X) => X, xs: Array<X>): ?X => (
  xs.reduce(((b, x) => b ? b : f(x) ? x : null), null)
)

We noticed that we can not make this optimizations if there are function calls or member expressions on the right hand side of the assignment since the function call or the member expression (which might be a getter with side-effect) could potentially change the variables we are assigning to.

[x, y] = [a(), obj.x];
// was tranforming to
x = a();
y = obj.x;
// now transforms to 
var _ref = [a(), obj.x];
x = _ref[0];
y = _ref[1];

:nail_care: Polish

Before

screen shot 2016-09-27 at 11 12 47 am

After

screen shot 2016-09-27 at 3 50 02 pm

:house: Internal

Cleanup tests, remove various unused dependencies, do not run CI with only readme changes.

Commiters: 20

First PRs!

Version 6.14.0

v6.14.0 (2016-08-23) TAKE ME TO FLAVOR TOWN

Lots of stuff in this release!

npm install babel-preset-es2017 --save-dev
// .babelrc
{ "presets": ["es2017"] }

We also will be working on getting a target/env (autoprefixer) preset soon.

npm install babel-preset-latest --save-dev
// .babelrc
{ "presets": ["latest"] }
// with options
{ "presets": [
  ["latest", {
    "es2015": {
      "modules": false 
    }
  }]
] }

spec for arrow functions adds a runtime check to make sure arrow functions are not instantiated (since they transform into normal functions). spec for template literals wraps all expressions in String rather than simple string concatenation.

// .babelrc
{
  "presets": [
    ["es2015", { "spec": true }]
  ]
}

Notable Bug Fixes

Guy Fieri

Commiters: 17

It's also a lot folk's first PR (or first code PR)!

New Feature

Spec Compliancy

Bug Fix

Documentation

Internal

Version 6.13.2

v6.13.2 (2016-08-05)

Backwards compat is hard

Hi again, just fixing up logic from the backwards-compatibility fix which broke options in presets. Also added more tests and will update Babel to use the new preset options after this release.

Bug Fix

Version 6.13.1

v6.13.1 (2016-08-04)

We had a regression in our new babel-preset-es2015@6.13.0 that made it unexpectedly backward-incompatible. This release introduces a new alternative plugin-options approach that is uglier but supports backward-compatiblity. Ideally new plugins would use the new module.exports = function(babel, options){ } approach and simple skip supporting babel-core@<6.13.x.

Bug Fix

Version 6.13.0

v6.13.0 (2016-08-04)

If you are getting an error like "Invalid options type for " then check that you have an updated version of babel-core/cli/etc. If you are using greenkeeper, it will fail because it will only update the preset and not the other packages.

Since the last release we've created https://github.com/babel/notes to track discussions on our slack and features/changes that could be added - definetely check it out if you're interested in Babel's development!

Please join #discussion on slack if you have questions and #development for dev

Some small but very important additions in this release:

Preset options (babel/notes (https://github.com/babel/notes/blob/master/2016-07/july-31.md#preset-options-pr-3331))

Initially, presets were supposed to be one-off sets of plugins that didn't have any configuration. If you wanted to do something different you would make your own presets. There are > 600 presets on npm now. We want to give users more flexibility in certain cases: like when you want to pass the same option to multiple presets or to remove a default plugin.

loose and modules options for babel-preset-es2015 (#3331](https://github.com/babel/babel/pull/3331), [#3627 (https://github.com/babel/babel/pull/3627))

This has been rather annoying. Having to install babel-preset-es2015-loose-native-modules seems rather crazy when it could be an option.

With #3627 (https://github.com/babel/babel/pull/3627), you can pass 2 options in:

// for loose and native modules
{
  presets: [
    ["es2015", { "loose": true, "modules": false }]
  ]
}

Updates to babel-preset-stage-2

Coming Up

New Feature

Bug Fix

Polish

Internal

Commiters: 7