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

chore(deps): update all non-major dev dependencies #1712

Merged
merged 1 commit into from
Jan 16, 2022

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 8, 2021

WhiteSource Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@types/chai 4.2.22 -> 4.3.0 age adoption passing confidence
@types/lodash 4.14.176 -> 4.14.178 age adoption passing confidence
@types/sinon-chai 3.2.5 -> 3.2.8 age adoption passing confidence
@typescript-eslint/eslint-plugin 5.3.0 -> 5.9.1 age adoption passing confidence
@typescript-eslint/parser 5.3.0 -> 5.9.1 age adoption passing confidence
esbuild 0.13.12 -> 0.14.11 age adoption passing confidence
eslint (source) 8.2.0 -> 8.7.0 age adoption passing confidence
jsdom 18.0.1 -> 18.1.1 age adoption passing confidence
mocha (source) 9.1.3 -> 9.1.4 age adoption passing confidence
prettier (source) 2.4.1 -> 2.5.1 age adoption passing confidence
shx 0.3.3 -> 0.3.4 age adoption passing confidence
source-map-support 0.5.20 -> 0.5.21 age adoption passing confidence
typescript (source) 4.4.4 -> 4.5.4 age adoption passing confidence
vuepress 1.8.2 -> 1.9.5 age adoption passing confidence
webpack 5.62.1 -> 5.66.0 age adoption passing confidence

Release Notes

typescript-eslint/typescript-eslint (@​typescript-eslint/eslint-plugin)

v5.9.1

Compare Source

Note: Version bump only for package @​typescript-eslint/eslint-plugin

v5.9.0

Compare Source

Features
  • experimental-utils: move isTypeReadonly from eslint-plugin to experimental-utils (#​3658) (a9eb0b9)

5.8.1 (2021-12-27)

Bug Fixes
  • eslint-plugin: [consistent-indexed-object-style] do not report for circular references (#​4347) (6edebcd)
  • eslint-plugin: [consistent-type-definitions] correct fixer with declare keyword (#​4334) (0cd911a)
  • eslint-plugin: [padding-line-between-statements] make function overloading is also processed (#​4345) (d31ec26)

v5.8.1

Compare Source

Bug Fixes
  • eslint-plugin: [consistent-indexed-object-style] do not report for circular references (#​4347) (6edebcd)
  • eslint-plugin: [consistent-type-definitions] correct fixer with declare keyword (#​4334) (0cd911a)
  • eslint-plugin: [padding-line-between-statements] make function overloading is also processed (#​4345) (d31ec26)

v5.8.0

Compare Source

Bug Fixes
  • eslint-plugin: [no-implied-eval] improve performance (#​4313) (e344596)
  • eslint-plugin: [padding-line-between-statements] type StatementTypes can't differenciate from variable (#​4270) (bfc4324)
  • eslint-plugin: [strict-boolean-expression] false positive for truthy boolean (#​4275) (72c2e41)
  • eslint-plugin: array-type mark AST_NODE_TYPES.TSBigIntKeyword as simple (#​4274) (74e544e)
  • eslint-plugin: handle method overloading in semi (#​4318) (3b87b49)
  • experimental-utils: support immutable members (#​3844) (3d33a77)
Features
  • eslint-plugin: [no-throw-literal] add options to to disallow any/unknown (#​4207) (ff0adf9)
  • eslint-plugin: [restrict-plus-operand] add allowAny option (#​4260) (2788545)

v5.7.0

Compare Source

Features
  • eslint-plugin: [consistent-type-exports] support TS4.5 inline export specifiers (#​4236) (be4d976)
  • eslint-plugin: [consistent-type-imports] support TS4.5 inline import specifiers (#​4237) (f61af7c)
  • eslint-plugin: [no-shadow] support TS4.5 inline import specifiers (#​4239) (96b7e8e)

v5.6.0

Compare Source

Features
  • scope-manager: support TS4.5 import/export specifier kind (#​4234) (833f822)

v5.5.0

Compare Source

Bug Fixes
  • eslint-plugin: [member-ordering] order literal names correctly in (#​4054) (d57141a)
  • eslint-plugin: [no-duplicate-imports] remove unnecessary type checking for node.source (#​4196) (637722a)
  • eslint-plugin: [no-var-requires] do not report require created from createRequire (#​4221) (0040186)
  • eslint-plugin: [prefer-for-of] do nor error when iterating over this (#​4176) (258ddb0)
  • eslint-plugin: [require-await] treat yield* asynciterable as an await (#​4125) (5a4ce6a)
  • eslint-plugin: remove all whitespaces in comparison #​4220 (#​4223) (853d799)
Features
  • eslint-plugin: [member-ordering] add option to sort case insensitive (#​3896) (e3533d5)
  • eslint-plugin: array-type distinguish whether readonly or not (#​4066) (314af44)

v5.4.0

Compare Source

Bug Fixes
  • correct issues with circular imports (#​4140) (4c87b24)
  • eslint-plugin: [explicit-member-accessibility] private fields cannot have accessibility modifiers (#​4117) (81b25c1)
  • eslint-plugin: [no-implied-eval] ignore locally declared functions (#​4049) (d97140e)
  • eslint-plugin: check optional chaining for floating promises (#​4096) (d724777)
Features

5.3.1 (2021-11-08)

Note: Version bump only for package @​typescript-eslint/eslint-plugin

v5.3.1

Compare Source

Note: Version bump only for package @​typescript-eslint/eslint-plugin

typescript-eslint/typescript-eslint (@​typescript-eslint/parser)

v5.9.1

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

v5.9.0

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

5.8.1 (2021-12-27)

Note: Version bump only for package @​typescript-eslint/parser

v5.8.1

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

v5.8.0

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

v5.7.0

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

v5.6.0

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

v5.5.0

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

v5.4.0

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

5.3.1 (2021-11-08)

Note: Version bump only for package @​typescript-eslint/parser

v5.3.1

Compare Source

Note: Version bump only for package @​typescript-eslint/parser

evanw/esbuild

v0.14.11

Compare Source

  • Fix a bug with enum inlining (#​1903)

    The new TypeScript enum inlining behavior had a bug where it worked correctly if you used export enum Foo but not if you used enum Foo and then later export { Foo }. This release fixes the bug so enum inlining now works correctly in this case.

  • Warn about module.exports.foo = ... in ESM (#​1907)

    The module variable is treated as a global variable reference instead of as a CommonJS module reference in ESM code, which can cause problems for people that try to use both CommonJS and ESM exports in the same file. There has been a warning about this since version 0.14.9. However, the warning only covered cases like exports.foo = bar and module.exports = bar but not module.exports.foo = bar. This last case is now handled;

    ▲ [WARNING] The CommonJS "module" variable is treated as a global variable in an ECMAScript module and may not work as expected
    
        example.ts:2:0:
          2 │ module.exports.b = 1
            ╵ ~~~~~~
    
      This file is considered to be an ECMAScript module because of the "export" keyword here:
    
        example.ts:1:0:
          1 │ export let a = 1
            ╵ ~~~~~~
    
  • Enable esbuild's CLI with Deno (#​1913)

    This release allows you to use Deno as an esbuild installer, without also needing to use esbuild's JavaScript API. You can now use esbuild's CLI with Deno:

    deno run --allow-all "https://deno.land/x/esbuild@v0.14.11/mod.js" --version
    

v0.14.10

Compare Source

  • Enable tree shaking of classes with lowered static fields (#​175)

    If the configured target environment doesn't support static class fields, they are converted into a call to esbuild's __publicField function instead. However, esbuild's tree-shaking pass treated this call as a side effect, which meant that all classes with static fields were ineligible for tree shaking. This release fixes the problem by explicitly ignoring calls to the __publicField function during tree shaking side-effect determination. Tree shaking is now enabled for these classes:

    // Original code
    class Foo { static foo = 'foo' }
    class Bar { static bar = 'bar' }
    new Bar()
    
    // Old output (with --tree-shaking=true --target=es6)
    class Foo {
    }
    __publicField(Foo, "foo", "foo");
    class Bar {
    }
    __publicField(Bar, "bar", "bar");
    new Bar();
    
    // New output (with --tree-shaking=true --target=es6)
    class Bar {
    }
    __publicField(Bar, "bar", "bar");
    new Bar();
  • Treat --define:foo=undefined as an undefined literal instead of an identifier (#​1407)

    References to the global variable undefined are automatically replaced with the literal value for undefined, which appears as void 0 when printed. This allows for additional optimizations such as collapsing undefined ?? bar into just bar. However, this substitution was not done for values specified via --define:. As a result, esbuild could potentially miss out on certain optimizations in these cases. With this release, it's now possible to use --define: to substitute something with an undefined literal:

    // Original code
    let win = typeof window !== 'undefined' ? window : {}
    
    // Old output (with --define:window=undefined --minify)
    let win=typeof undefined!="undefined"?undefined:{};
    
    // New output (with --define:window=undefined --minify)
    let win={};
  • Add the --drop:debugger flag (#​1809)

    Passing this flag causes all debugger; statements to be removed from the output. This is similar to the drop_debugger: true flag available in the popular UglifyJS and Terser JavaScript minifiers.

  • Add the --drop:console flag (#​28)

    Passing this flag causes all console.xyz() API calls to be removed from the output. This is similar to the drop_console: true flag available in the popular UglifyJS and Terser JavaScript minifiers.

    WARNING: Using this flag can introduce bugs into your code! This flag removes the entire call expression including all call arguments. If any of those arguments had important side effects, using this flag will change the behavior of your code. Be very careful when using this flag. If you want to remove console API calls without removing arguments with side effects (which does not introduce bugs), you should mark the relevant API calls as pure instead like this: --pure:console.log --minify.

  • Inline calls to certain no-op functions when minifying (#​290, #​907)

    This release makes esbuild inline two types of no-op functions: empty functions and identity functions. These most commonly arise when most of the function body is eliminated as dead code. In the examples below, this happens because we use --define:window.DEBUG=false to cause dead code elimination inside the function body of the resulting if (false) statement. This inlining is a small code size and performance win but, more importantly, it allows for people to use these features to add useful abstractions that improve the development experience without needing to worry about the run-time performance impact.

    An identity function is a function that just returns its argument. Here's an example of inlining an identity function:

    // Original code
    function logCalls(fn) {
      if (window.DEBUG) return function(...args) {
        console.log('calling', fn.name, 'with', args)
        return fn.apply(this, args)
      }
      return fn
    }
    export const foo = logCalls(function foo() {})
    
    // Old output (with --minify --define:window.DEBUG=false --tree-shaking=true)
    function o(n){return n}export const foo=o(function(){});
    
    // New output (with --minify --define:window.DEBUG=false --tree-shaking=true)
    export const foo=function(){};

    An empty function is a function with an empty body. Here's an example of inlining an empty function:

    // Original code
    function assertNotNull(val: Object | null): asserts val is Object {
      if (window.DEBUG && val === null) throw new Error('null assertion failed');
    }
    export const val = getFoo();
    assertNotNull(val);
    console.log(val.bar);
    
    // Old output (with --minify --define:window.DEBUG=false --tree-shaking=true)
    function l(o){}export const val=getFoo();l(val);console.log(val.bar);
    
    // New output (with --minify --define:window.DEBUG=false --tree-shaking=true)
    export const val=getFoo();console.log(val.bar);

    To get this behavior you'll need to use the function keyword to define your function since that causes the definition to be hoisted, which eliminates concerns around initialization order. These features also work across modules, so functions are still inlined even if the definition of the function is in a separate module from the call to the function. To get cross-module function inlining to work, you'll need to have bundling enabled and use the import and export keywords to access the function so that esbuild can see which functions are called. And all of this has been added without an observable impact to compile times.

    I previously wasn't able to add this to esbuild easily because of esbuild's low-pass compilation approach. The compiler only does three full passes over the data for speed. The passes are roughly for parsing, binding, and printing. It's only possible to inline something after binding but it needs to be inlined before printing. Also the way module linking was done made it difficult to roll back uses of symbols that were inlined, so the symbol definitions were not tree shaken even when they became unused due to inlining.

    The linking issue was somewhat resolved when I fixed #​128 in the previous release. To implement cross-module inlining of TypeScript enums, I came up with a hack to defer certain symbol uses until the linking phase, which happens after binding but before printing. Another hack is that inlining of TypeScript enums is done directly in the printer to avoid needing another pass.

    The possibility of these two hacks has unblocked these simple function inlining use cases that are now handled. This isn't a fully general approach because optimal inlining is recursive. Inlining something may open up further inlining opportunities, which either requires multiple iterations or a worklist algorithm, both of which don't work when doing late-stage inlining in the printer. But the function inlining that esbuild now implements is still useful even though it's one level deep, and so I believe it's still worth adding.

v0.14.9

Compare Source

  • Implement cross-module tree shaking of TypeScript enum values (#​128)

    If your bundle uses TypeScript enums across multiple files, esbuild is able to inline the enum values as long as you export and import the enum using the ES module export and import keywords. However, this previously still left the definition of the enum in the bundle even when it wasn't used anymore. This was because esbuild's tree shaking (i.e. dead code elimination) is based on information recorded during parsing, and at that point we don't know which imported symbols are inlined enum values and which aren't.

    With this release, esbuild will now remove enum definitions that become unused due to cross-module enum value inlining. Property accesses off of imported symbols are now tracked separately during parsing and then resolved during linking once all inlined enum values are known. This behavior change means esbuild's support for cross-module inlining of TypeScript enums is now finally complete. Here's an example:

    // entry.ts
    import { Foo } from './enum'
    console.log(Foo.Bar)
    
    // enum.ts
    export enum Foo { Bar }

    Bundling the example code above now results in the enum definition being completely removed from the bundle:

    // Old output (with --bundle --minify --format=esm)
    var r=(o=>(o[o.Bar=0]="Bar",o))(r||{});console.log(0);
    
    // New output (with --bundle --minify --format=esm)
    console.log(0);
  • Fix a regression with export {} from and CommonJS (#​1890)

    This release fixes a regression that was introduced by the change in 0.14.7 that avoids calling the __toESM wrapper for import statements that are converted to require calls and that don't use the default or __esModule export names. The previous change was correct for the import {} from syntax but not for the export {} from syntax, which meant that in certain cases with re-exported values, the value of the default import could be different than expected. This release fixes the regression.

  • Warn about using module or exports in ESM code (#​1887)

    CommonJS export variables cannot be referenced in ESM code. If you do this, they are treated as global variables instead. This release includes a warning for people that try to use both CommonJS and ES module export styles in the same file. Here's an example:

    export enum Something {
      a,
      b,
    }
    module.exports = { a: 1, b: 2 }

    Running esbuild on that code now generates a warning that looks like this:

    ▲ [WARNING] The CommonJS "module" variable is treated as a global variable in an ECMAScript module and may not work as expected
    
        example.ts:5:0:
          5 │ module.exports = { a: 1, b: 2 }
            ╵ ~~~~~~
    
      This file is considered to be an ECMAScript module because of the "export" keyword here:
    
        example.ts:1:0:
          1 │ export enum Something {
            ╵ ~~~~~~
    

v0.14.8

Compare Source

  • Add a resolve API for plugins (#​641, #​1652)

    Plugins now have access to a new API called resolve that runs esbuild's path resolution logic and returns the result to the caller. This lets you write plugins that can reuse esbuild's complex built-in path resolution logic to change the inputs and/or adjust the outputs. Here's an example:

    let examplePlugin = {
      name: 'example',
      setup(build) {
        build.onResolve({ filter: /^example$/ }, async () => {
          const result = await build.resolve('./foo', { resolveDir: '/bar' })
          if (result.errors.length > 0) return result
          return { ...result, external: true }
        })
      },
    }

    This plugin intercepts imports to the path example, tells esbuild to resolve the import ./foo in the directory /bar, and then forces whatever path esbuild returns to be considered external. Here are some additional details:

    • If you don't pass the optional resolveDir parameter, esbuild will still run onResolve plugin callbacks but will not attempt any path resolution itself. All of esbuild's path resolution logic depends on the resolveDir parameter including looking for packages in node_modules directories (since it needs to know where those node_modules directories might be).

    • If you want to resolve a file name in a specific directory, make sure the input path starts with ./. Otherwise the input path will be treated as a package path instead of a relative path. This behavior is identical to esbuild's normal path resolution logic.

    • If path resolution fails, the errors property on the returned object will be a non-empty array containing the error information. This function does not always throw an error when it fails. You need to check for errors after calling it.

    • The behavior of this function depends on the build configuration. That's why it's a property of the build object instead of being a top-level API call. This also means you can't call it until all plugin setup functions have finished since these give plugins the opportunity to adjust the build configuration before it's frozen at the start of the build. So the new resolve function is going to be most useful inside your onResolve and/or onLoad callbacks.

    • There is currently no attempt made to detect infinite path resolution loops. Calling resolve from within onResolve with the same parameters is almost certainly a bad idea.

  • Avoid the CJS-to-ESM wrapper in some cases (#​1831)

    Import statements are converted into require() calls when the output format is set to CommonJS. To convert from CommonJS semantics to ES module semantics, esbuild wraps the return value in a call to esbuild's __toESM() helper function. However, the conversion is only needed if it's possible that the exports named default or __esModule could be accessed.

    This release avoids calling this helper function in cases where esbuild knows it's impossible for the default or __esModule exports to be accessed, which results in smaller and faster code. To get this behavior, you have to use the import {} from import syntax:

    // Original code
    import { readFile } from "fs";
    readFile();
    
    // Old output (with --format=cjs)
    var __toESM = (module, isNodeMode) => {
      ...
    };
    var import_fs = __toESM(require("fs"));
    (0, import_fs.readFile)();
    
    // New output (with --format=cjs)
    var import_fs = require("fs");
    (0, import_fs.readFile)();
  • Strip overwritten function declarations when minifying (#​610)

    JavaScript allows functions to be re-declared, with each declaration overwriting the previous declaration. This type of code can sometimes be emitted by automatic code generators. With this release, esbuild now takes this behavior into account when minifying to drop all but the last declaration for a given function:

    // Original code
    function foo() { console.log(1) }
    function foo() { console.log(2) }
    
    // Old output (with --minify)
    function foo(){console.log(1)}function foo(){console.log(2)}
    
    // New output (with --minify)
    function foo(){console.log(2)}
  • Add support for the Linux IBM Z 64-bit Big Endian platform (#​1864)

    With this release, the esbuild package now includes a Linux binary executable for the IBM System/390 64-bit architecture. This new platform was contributed by @​shahidhs-ibm.

  • Allow whitespace around : in JSX elements (#​1877)

    This release allows you to write the JSX <rdf:Description rdf:ID="foo" /> as <rdf : Description rdf : ID="foo" /> instead. Doing this is not forbidden by the JSX specification. While this doesn't work in TypeScript, it does work with other JSX parsers in the ecosystem, so support for this has been added to esbuild.

v0.14.7

Compare Source

  • Cross-module inlining of TypeScript enum constants (#​128)

    This release adds inlining of TypeScript enum constants across separate modules. It activates when bundling is enabled and when the enum is exported via the export keyword and imported via the import keyword:

    // foo.ts
    export enum Foo { Bar }
    
    // bar.ts
    import { Foo } from './foo.ts'
    console.log(Foo.Bar)

    The access to Foo.Bar will now be compiled into 0 /* Bar */ even though the enum is defined in a separate file. This inlining was added without adding another pass (which would have introduced a speed penalty) by splitting the code for the inlining between the existing parsing and printing passes. Enum inlining is active whether or not you use enum or const enum because it improves performance.

    To demonstrate the performance improvement, I compared the performance of the TypeScript compiler built by bundling the TypeScript compiler source code with esbuild before and after this change. The speed of the compiler was measured by using it to type check a small TypeScript code base. Here are the results:

    tsc with esbuild 0.14.6 with esbuild 0.14.7
    Time 2.96s 3.45s 2.95s

    As you can see, enum inlining gives around a 15% speedup, which puts the esbuild-bundled version at the same speed as the offical TypeScript compiler build (the tsc column)!

    The specifics of the benchmark aren't important here since it's just a demonstration of how enum inlining can affect performance. But if you're wondering, I type checked the Rollup code base using a work-in-progress branch of the TypeScript compiler that's part of the ongoing effort to convert their use of namespaces into ES modules.

  • Mark node built-in modules as having no side effects (#​705)

    This release marks node built-in modules such as fs as being side-effect free. That means unused imports to these modules are now removed when bundling, which sometimes results in slightly smaller code. For example:

    // Original code
    import fs from 'fs';
    import path from 'path';
    console.log(path.delimiter);
    
    // Old output (with --bundle --minify --platform=node --format=esm)
    import"fs";import o from"path";console.log(o.delimiter);
    
    // New output (with --bundle --minify --platform=node --format=esm)
    import o from"path";console.log(o.delimiter);

    Note that these modules are only automatically considered side-effect when bundling for node, since they are only known to be side-effect free imports in that environment. However, you can customize this behavior with a plugin by returning external: true and sideEffects: false in an onResolve callback for whatever paths you want to be treated this way.

  • Recover from a stray top-level } in CSS (#​1876)

    This release fixes a bug where a stray } at the top-level of a CSS file would incorrectly truncate the remainder of the file in the output (although not without a warning). With this release, the remainder of the file is now still parsed and printed:

    /* Original code */
    .red {
      color: red;
    }
    }
    .blue {
      color: blue;
    }
    .green {
      color: green;
    }
    
    /* Old output (with --minify) */
    .red{color:red}
    
    /* New output (with --minify) */
    .red{color:red}} .blue{color:#&#8203;00f}.green{color:green}

    This fix was contributed by @​sbfaulkner.

v0.14.6

Compare Source

  • Fix a minifier bug with BigInt literals

    Previously expression simplification optimizations in the minifier incorrectly assumed that numeric operators always return numbers. This used to be true but has no longer been true since the introduction of BigInt literals in ES2020. Now numeric operators can return either a number or a BigInt depending on the arguments. This oversight could potentially have resulted in behavior changes. For example, this code printed false before being minified and true after being minified because esbuild shortened === to == under the false assumption that both operands were numbers:

    var x = 0;
    console.log((x ? 2 : -1n) === -1);

    The type checking logic has been rewritten to take into account BigInt literals in this release, so this incorrect simplification is no longer applied.

  • Enable removal of certain unused template literals (#​1853)

    This release contains improvements to the minification of unused template literals containing primitive values:

    // Original code
    `${1}${2}${3}`;
    `${x ? 1 : 2}${y}`;
    
    // Old output (with --minify)
    ""+1+2+3,""+(x?1:2)+y;
    
    // New output (with --minify)
    x,`${y}`;

    This can arise when the template literals are nested inside of another function call that was determined to be unnecessary such as an unused call to a function marked with the /* @&#8203;__PURE__ */ pragma.

    This release also fixes a bug with this transformation where minifying the unused expression `foo ${bar}` into "" + bar changed the meaning of the expression. Template string interpolation always calls toString while string addition may call valueOf instead. This unused expression is now minified to `${bar}`, which is slightly longer but which avoids the behavior change.

  • Allow keyof/readonly/infer in TypeScript index signatures (#​1859)

    This release fixes a bug that prevented these keywords from being used as names in index signatures. The following TypeScript code was previously rejected, but is now accepted:

    interface Foo {
      [keyof: string]: number
    }

    This fix was contributed by @​magic-akari.

  • Avoid warning about import.meta if it's replaced (#​1868)

    It's possible to replace the import.meta expression using the --define: feature. Previously doing that still warned that the import.meta syntax was not supported when targeting ES5. With this release, there will no longer be a warning in this case.

v0.14.5

Compare Source

  • Fix an issue with the publishing script

    This release fixes a missing dependency issue in the publishing script where it was previously possible for the published binary executable to have an incorrect version number.

v0.14.4

Compare Source

  • Adjust esbuild's handling of default exports and the __esModule marker (#​532, #​1591, #​1719)

    This change requires some background for context. Here's the history to the best of my understanding:

    When the ECMAScript module import/export syntax was being developed, the CommonJS module format (used in Node.js) was already widely in use. Because of this the export name called default was given special a syntax. Instead of writing import { default as foo } from 'bar' you can just write import foo from 'bar'. The idea was that when ECMAScript modules (a.k.a. ES modules) were introduced, you could import existing CommonJS modules using the new import syntax for compatibility. Since CommonJS module exports are dynamic while ES module exports are static, it's not generally possible to determine a CommonJS module's export names at module instantiation time since the code hasn't been evaluated yet. So the value of module.exports is just exported as the default export and the special default import syntax gives you easy access to module.exports (i.e. const foo = require('bar') is the same as import foo from 'bar').

    However, it took a while for ES module syntax to be supported natively by JavaScript runtimes, and people still wanted to start using ES module syntax in the meantime. The Babel JavaScript compiler let you do this. You could transform each ES module file into a CommonJS module file that behaved the same. However, this transformation has a problem: emulating the import syntax accurately as described above means that export default 0 and import foo from 'bar' will no longer line up when transformed to CommonJS. The code export default 0 turns into module.exports.default = 0 and the code import foo from 'bar' turns into const foo = require('bar'), meaning foo is 0 before the transformation but foo is { default: 0 } after the transformation.

    To fix this, Babel sets the property __esModule to true as a signal to itself when it converts an ES module to a CommonJS module. Then, when importing a default export, it can know to use the value of module.exports.default instead of module.exports to make sure the behavior of the CommonJS modules correctly matches the behavior of the original ES modules. This fix has been widely adopted across the ecosystem and has made it into other tools such as TypeScript and even esbuild.

    However, when Node.js finally released their ES module implementation, they went with the original implementation where the default export is always module.exports, which broke compatibility with the existing ecosystem of ES modules that had been cross-compiled into CommonJS modules by Babel. You now have to either add or remove an additional .default property depending on whether your code needs to run in a Node environment or in a Babel environment, which created an interoperability headache. In addition, JavaScript tools such as esbuild now need to guess whether you want Node-style or Babel-style default imports. There's no way for a tool to know with certainty which one a given file is expecting and if your tool guesses wrong, your code will break.

    This release changes esbuild's heuristics around default exports and the __esModule marker to attempt to improve compatibility with Webpack and Node, which is what most packages are tuned for. The behavior changes are as follows:

    Old behavior:

    • If an import statement is used to load a CommonJS file and a) module.exports is an object, b) module.exports.__esModule is truthy, and c) the property default exists in module.exports, then esbuild would set the default export to module.exports.default (like Babel). Otherwise the default export was set to module.exports (like Node).

    • If a require call is used to load an ES module file, the returned module namespace object had the __esModule property set to true. This behaved as if the ES module had been converted to CommonJS via a Babel-compatible transformation.

    • The __esModule marker could inconsistently appear on module namespace objects (i.e. import * as) when writing pure ESM code. Specifically, if a module namespace object was mat


Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by WhiteSource Renovate. View repository job log here.

@renovate renovate bot added the dependencies Pull requests that update a dependency file label Nov 8, 2021
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch from 201b1e4 to 3e33231 Compare November 9, 2021 08:29
@renovate renovate bot changed the title chore(deps): update all non-major dev dependencies to v5.3.1 chore(deps): update all non-major dev dependencies Nov 9, 2021
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 7 times, most recently from 0c7747b to 22df8b5 Compare November 16, 2021 09:36
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 7 times, most recently from 7b6a341 to aee5e07 Compare November 24, 2021 08:41
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 6 times, most recently from 45faa43 to fb6d3e5 Compare November 30, 2021 08:15
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 7 times, most recently from fcb62a0 to 53b005c Compare December 7, 2021 19:52
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 6 times, most recently from b9a95f1 to 32bab1d Compare December 18, 2021 00:43
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 10 times, most recently from aec3745 to 6d5be98 Compare December 25, 2021 21:02
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 4 times, most recently from debb76d to 35390b3 Compare January 1, 2022 00:21
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 4 times, most recently from bf3790a to 716e14f Compare January 10, 2022 18:22
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch 2 times, most recently from cf912e4 to 8ec7172 Compare January 14, 2022 19:56
@renovate renovate bot force-pushed the renovate/all-dev-minor-patch branch from 8ec7172 to 5a56830 Compare January 16, 2022 03:51
@bd82 bd82 merged commit c9f97b0 into master Jan 16, 2022
@bd82 bd82 deleted the renovate/all-dev-minor-patch branch January 16, 2022 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants