Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: updates js transpiler to use babel 7 #10627

Merged
merged 3 commits into from Sep 15, 2020

Commits on Sep 9, 2020

  1. DEV: updates js transpiler to use babel 7

    Updates our js transpiler code to use Babel 7.11.6
    
    List of changes in this commit:
    
    - Updates plugins, babel plugins all have a new version which doesn't contain -es2015- anymore
    - Drops (transform-es2015-classes)[https://babeljs.io/docs/en/babel-plugin-transform-classes] this plugin shouldn't be needed now that we don't support IE
    - Drops check-es2015-constants, checking constants is now part of babel and the check-constants plugin is deprecated. As a result the behavior slightly changed, and is now wrapping every const call in a readOnlyError function which would throw if assigned a new value. This explains the modified spec.
    - Adds (proposal-optional-chaining)[https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining]
    
    ```javascript
    const obj = {
      foo: {
        bar: {
          baz: 42,
        },
      },
    };
    
    const baz = obj?.foo?.bar?.baz; // 42
    ```
    
    - Adds (proposal-json-strings)[https://babeljs.io/docs/en/babel-plugin-proposal-json-strings]
    
    ```javascript
    // IN
    const ex = "before
    after";
    //                ^ There's a U+2028 char between 'before' and 'after'
    
    // OUT
    const ex = "before\u2028after";
    //                ^ There's a U+2028 char between 'before' and 'after'
    ```
    
    - Adds (proposal-nullish-coalescing-operator)[https://babeljs.io/docs/en/babel-plugin-proposal-nullish-coalescing-operator]
    
    ```javascript
    var object = {};
    var foo = object.foo ?? "default"; // default
    ```
    
    - Adds (proposal-logical-assignment-operators)[https://babeljs.io/docs/en/babel-plugin-proposal-logical-assignment-operators]
    
    ```javascript
    let a;
    let b = 2;
    a ||= b; // 2
    ```
    
    - Adds (proposal-numeric-separator)[https://babeljs.io/docs/en/babel-plugin-proposal-numeric-separator]
    
    ```javascript
    let budget = 1_000_000_000_000;
    console.log(budget === 10 ** 12); // true
    ```
    
    - Adds proposal-object-rest-spread https://babeljs.io/docs/en/babel-plugin-proposal-object-rest-spread
    
    ```javascript
    let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
    console.log(x); // 1
    console.log(y); // 2
    console.log(z); // { a: 3, b: 4 }
    ```
    
    - Adds proposal-optional-catch-binding https://babeljs.io/docs/en/babel-plugin-proposal-optional-catch-binding
    
    ```javascript
    try {
    
    } catch {
    
    } finally {
      // ensures finally is available in every browsers
    }
    ```
    
    - Adds improved regex support for firefox through [transform-dotall-regex](https://babeljs.io/docs/en/next/babel-plugin-transform-dotall-regex.html) and [proposal-unicode-property-regex](https://babeljs.io/docs/en/babel-plugin-proposal-unicode-property-regex)
    
    - Adds (for-await...of)[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of] support for Edge through [proposal-async-generator-functions](https://babeljs.io/docs/en/babel-plugin-proposal-async-generator-functions)
    jjaffeux committed Sep 9, 2020
    Copy the full SHA
    8bd831b View commit details
    Browse the repository at this point in the history
  2. fix specs

    the failues are due to minor differences in the ouput due to new plugins and updated babel
    jjaffeux committed Sep 9, 2020
    Copy the full SHA
    9744615 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2020

  1. drops async/generator stuff

    jjaffeux committed Sep 10, 2020
    Copy the full SHA
    ca50934 View commit details
    Browse the repository at this point in the history