An esbuild plugin to inject your application's version number or today's date into your files

Overview

esbuild-plugin-version-injector

An esbuild plugin to inject your application's version number or today's date into your files

GitHub npm

This plugin was inspired by rollup-plugin-version-injector

Table of Contents

Description

There are many ways to export a constant that holds your package variable, from loading your own package.json through a fs.readFile, importing the package.json directly, or manually updating a constant on every bump. However all of these have their downsides, and this plugin aims to solve that.

  • fs.readFile is an addition file operation that the end-user's system has to deal with and causes slow downs.
  • importing the package.json directly can cause issues with interoperability between CJS and ESM as the latter requires JSON assertions.
    • Alternatively when using a bundler that inlines the package.json code that means the bundle ends up increasing in size unnecessarily for only having to include the version field
  • Manually updating a constant on every bump is a chore and can be easily forgotten.

This plugin aims to solve all of these issues by injecting the version number and/or today's date directly into your built JavaScript files during the bundling step provided by esbuild. This plugin can therefore work with many of the famous bundlers such as esbuild directly, tsup, vite, or other bundlers that also use esbuild under the hood.

Installation

You can use the following command to install this package, or replace npm install -D with your package manager of choice.

npm install -D esbuild-plugin-version-injector

Usage

With esbuild

Add the plugin to your esbuild options, i.e.:

const esbuild = require('esbuild');
const { resolve } = require('path');
const {
  esbuildPluginVersionInjector
} = require('esbuild-plugin-version-injector');

await esbuild.build({
  format: 'cjs',
  entryPoints: [resolve(__dirname, './src/index.ts')],
  outdir: resolve(__dirname, './dist'),
  plugins: [esbuildPluginVersionInjector()]
});

With tsup

Add the plugin to your tsup.config.ts, i.e.:

import { defineConfig } from 'tsup';
import { resolve } from 'path';
import { esbuildPluginVersionInjector } from 'esbuild-plugin-version-injector';

await defineConfig({
  format: ['cjs'],
  entry: ['./src/index.ts'],
  outDir: './dist',
  esbuildPlugins: [esbuildPluginVersionInjector()]
});

File Injection examples

JavaScript / TypeScript

/**
 * The current version that you are currently using.
 *
 * Note to developers: This needs to explicitly be `string` so it is not typed as a "const string" that gets injected by esbuild
 */
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
export const version: string = '[VI]{{inject}}[/VI]';

JSON

{
  "version": "[VI]{{inject}}[/VI]"
}

CSS

.myClass {
  content: '[VI]{{inject}}[/VI]';
}

Text

This document is for version [VI]{{inject}}[/VI]

Options

The plugin accepts the following options:

  • versionOrCurrentDate: One of 'version', 'current-date' or one of the entries of the VersionOrCurrentDate enum. Defaults to 'version'. This determines what format to inject into your built files. If this is set to current-date then the current date in the ISO 8601 will be inserted instead of the package.json version.

  • injectTag: The tag that should be searched for and replaced across your code. Defaults to '[VI]{{inject}}[/VI]'. This can be any string, but it is recommended to use something that is unlikely to be used in your code.

  • packageJsonPath The relative path to your package.json file. Defaults to './package.json'. This is used to read the version number from your package.json file.

  • filter: This is an advanced use-case option with which you can filter which files esbuild should apply this plugin on

  • namespace: This is an advanced use-case option through which the esbuild namespace can be configured

Buy us some doughnuts

Favware projects are and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!

We accept donations through Ko-fi, Paypal, Patreon, GitHub Sponsorships, and various cryptocurrencies. You can use the buttons below to donate through your method of choice.

Donate With Address
Ko-fi Click Here
Patreon Click Here
PayPal Click Here
GitHub Sponsors Click Here
Bitcoin 1E643TNif2MTh75rugepmXuq35Tck4TnE5
Ethereum 0xF653F666903cd8739030D2721bF01095896F5D6E
LiteCoin LZHvBkaJqKJRa8N7Dyu41Jd1PDBAofCik6

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Comments
  • bug: String.prototype.replaceAll does not exist in Node.js v14

    bug: String.prototype.replaceAll does not exist in Node.js v14

    Is there an existing issue for this?

    • [X] I have searched the existing issues

    Description of the bug

    String.prototype.replaceAll is used on L87 of dist/index.js, and that function does not exist in Node.js v14. Node.js v14 is not run in CI, so I'm not surprised this wasn't caught.

    Steps To Reproduce

    Here's an example of a build failing in Node.js v14:

    https://github.com/boneskull/unexpected-eventemitter/actions/runs/3517048877/jobs/5894364630

    Expected behavior

    well... not fail with a TypeError, I guess

    Screenshots

    No response

    Additional context

    No response

    bug:unverified 
    opened by boneskull 4
  • chore(deps): update all non-major dependencies

    chore(deps): update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @types/node (source) | ^18.11.17 -> ^18.11.18 | age | adoption | passing | confidence | | @typescript-eslint/eslint-plugin | ^5.46.1 -> ^5.47.1 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.46.1 -> ^5.47.1 | age | adoption | passing | confidence | | @vitest/coverage-c8 | ^0.25.8 -> ^0.26.2 | age | adoption | passing | confidence | | esbuild | ^0.16.9 -> ^0.16.10 | age | adoption | passing | confidence | | vite (source) | ^4.0.1 -> ^4.0.3 | age | adoption | passing | confidence | | vitest | ^0.25.8 -> ^0.26.2 | age | adoption | passing | confidence | | yarn | 3.3.0 -> 3.3.1 | age | adoption | passing | confidence |


    Release Notes

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

    v5.47.1

    Compare Source

    Bug Fixes
    • ast-spec: correct some incorrect ast types (#​6257) (0f3f645)
    • eslint-plugin: [member-ordering] correctly invert optionalityOrder (#​6256) (ccd45d4)

    v5.47.0

    Compare Source

    Features
    • eslint-plugin: [no-floating-promises] add suggestion fixer to add an 'await' (#​5943) (9e35ef9)

    5.46.1 (2022-12-12)

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

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

    v5.47.1

    Compare Source

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

    v5.47.0

    Compare Source

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

    5.46.1 (2022-12-12)

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

    vitest-dev/vitest

    v0.26.2

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub

    v0.26.0

    Compare Source

       🚨 Breaking Changes
       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub
    evanw/esbuild

    v0.16.10

    Compare Source

    • Change the default "legal comment" behavior again (#​2745)

      The legal comments feature automatically gathers comments containing @license or @preserve and puts the comments somewhere (either in the generated code or in a separate file). This behavior used to be on by default but was disabled by default in version 0.16.0 because automatically inserting comments is potentially confusing and misleading. These comments can appear to be assigning the copyright of your code to another entity. And this behavior can be especially problematic if it happens automatically by default since you may not even be aware of it happening. For example, if you bundle the TypeScript compiler the preserving legal comments means your source code would contain this comment, which appears to be assigning the copyright of all of your code to Microsoft:

      /*! *****************************************************************************
      Copyright (c) Microsoft Corporation. All rights reserved.
      Licensed under the Apache License, Version 2.0 (the "License"); you may not use
      this file except in compliance with the License. You may obtain a copy of the
      License at http://www.apache.org/licenses/LICENSE-2.0
      
      THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
      WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
      MERCHANTABLITY OR NON-INFRINGEMENT.
      
      See the Apache Version 2.0 License for specific language governing permissions
      and limitations under the License.
      ***************************************************************************** */
      

      However, people have asked for this feature to be re-enabled by default. To resolve the confusion about what these comments are applying to, esbuild's default behavior will now be to attempt to describe which package the comments are coming from. So while this feature has been re-enabled by default, the output will now look something like this instead:

      /*! Bundled license information:
      
      typescript/lib/typescript.js:
        (*! *****************************************************************************
        Copyright (c) Microsoft Corporation. All rights reserved.
        Licensed under the Apache License, Version 2.0 (the "License"); you may not use
        this file except in compliance with the License. You may obtain a copy of the
        License at http://www.apache.org/licenses/LICENSE-2.0
      
        THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
        KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
        WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
        MERCHANTABLITY OR NON-INFRINGEMENT.
      
        See the Apache Version 2.0 License for specific language governing permissions
        and limitations under the License.
        ***************************************************************************** *)
      */
      

      Note that you can still customize this behavior with the --legal-comments= flag. For example, you can use --legal-comments=none to turn this off, or you can use --legal-comments=linked to put these comments in a separate .LEGAL.txt file instead.

    • Enable external legal comments with the transform API (#​2390)

      Previously esbuild's transform API only supported none, inline, or eof legal comments. With this release, external legal comments are now also supported with the transform API. This only applies to the JS and Go APIs, not to the CLI, and looks like this:

      • JS:

        const { code, legalComments } = await esbuild.transform(input, {
          legalComments: 'external',
        })
        
      • Go:

        result := api.Transform(input, api.TransformOptions{
          LegalComments: api.LegalCommentsEndOfFile,
        })
        code := result.Code
        legalComments := result.LegalComments
        
    • Fix duplicate function declaration edge cases (#​2757)

      The change in the previous release to forbid duplicate function declarations in certain cases accidentally forbid some edge cases that should have been allowed. Specifically duplicate function declarations are forbidden in nested blocks in strict mode and at the top level of modules, but are allowed when they are declared at the top level of function bodies. This release fixes the regression by re-allowing the last case.

    • Allow package subpaths with alias (#​2715)

      Previously the names passed to the alias feature had to be the name of a package (with or without a package scope). With this release, you can now also use the alias feature with package subpaths. So for example you can now create an alias that substitutes @org/pkg/lib with something else.

    vitejs/vite

    v4.0.3

    Compare Source

    v4.0.2

    Compare Source

    yarnpkg/berry

    v3.3.1

    Compare Source


    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 1
  • Update all non-major dependencies

    Update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @types/node (source) | ^18.11.10 -> ^18.11.13 | age | adoption | passing | confidence | | @typescript-eslint/eslint-plugin | ^5.45.0 -> ^5.46.0 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.45.0 -> ^5.46.0 | age | adoption | passing | confidence | | @vitest/coverage-c8 | ^0.25.3 -> ^0.25.7 | age | adoption | passing | confidence | | esbuild | ^0.15.17 -> ^0.16.4 | age | adoption | passing | confidence | | prettier (source) | ^2.8.0 -> ^2.8.1 | age | adoption | passing | confidence | | typescript (source) | ^4.9.3 -> ^4.9.4 | age | adoption | passing | confidence | | vitest | ^0.25.3 -> ^0.25.7 | age | adoption | passing | confidence |


    Release Notes

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

    v5.46.0

    Compare Source

    Bug Fixes
    • eslint-plugin: [ban-types] update message to suggest object instead of Record<string, unknown> (#​6079) (d91a5fc)
    Features
    • eslint-plugin: [prefer-nullish-coalescing] logic and test for strict null checks (#​6174) (8a91cbd)

    5.45.1 (2022-12-05)

    Bug Fixes
    • eslint-plugin: [keyword-spacing] unexpected space before/after in import type (#​6095) (98caa92)
    • eslint-plugin: [no-shadow] add call and method signatures to ignoreFunctionTypeParameterNameValueShadow (#​6129) (9d58b6b)
    • eslint-plugin: [prefer-optional-chain] collect MetaProperty type (#​6083) (d7114d3)
    • eslint-plugin: [sort-type-constituents, sort-type-union-intersection-members] handle some required parentheses cases in the fixer (#​6118) (5d49d5d)

    v5.45.1

    Compare Source

    Bug Fixes
    • eslint-plugin: [keyword-spacing] unexpected space before/after in import type (#​6095) (98caa92)
    • eslint-plugin: [no-shadow] add call and method signatures to ignoreFunctionTypeParameterNameValueShadow (#​6129) (9d58b6b)
    • eslint-plugin: [prefer-optional-chain] collect MetaProperty type (#​6083) (d7114d3)
    • eslint-plugin: [sort-type-constituents, sort-type-union-intersection-members] handle some required parentheses cases in the fixer (#​6118) (5d49d5d)
    typescript-eslint/typescript-eslint (@​typescript-eslint/parser)

    v5.46.0

    Compare Source

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

    5.45.1 (2022-12-05)

    Bug Fixes
    • parser: remove the jsx option requirement for automatic jsx pragma resolution (#​6134) (e777f5e)

    v5.45.1

    Compare Source

    Bug Fixes
    • parser: remove the jsx option requirement for automatic jsx pragma resolution (#​6134) (e777f5e)
    vitest-dev/vitest

    v0.25.7

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub

    v0.25.6

    Compare Source

       🐞 Bug Fixes
        View changes on GitHub

    v0.25.5

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub

    v0.25.4

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub
    evanw/esbuild

    v0.16.4

    Compare Source

    • Fix binary downloads from the @esbuild/ scope for Deno (#​2729)

      Version 0.16.0 of esbuild moved esbuild's binary executables into npm packages under the @esbuild/ scope, which accidentally broke the binary downloader script for Deno. This release fixes this script so it should now be possible to use esbuild version 0.16.4+ with Deno.

    v0.16.3

    Compare Source

    • Fix a hang with the JS API in certain cases (#​2727)

      A change that was made in version 0.15.13 accidentally introduced a case when using esbuild's JS API could cause the node process to fail to exit. The change broke esbuild's watchdog timer, which detects if the parent process no longer exists and then automatically exits esbuild. This hang happened when you ran node as a child process with the stderr stream set to pipe instead of inherit, in the child process you call esbuild's JS API and pass incremental: true but do not call dispose() on the returned rebuild object, and then call process.exit(). In that case the parent node process was still waiting for the esbuild process that was created by the child node process to exit. The change made in version 0.15.13 was trying to avoid using Go's sync.WaitGroup API incorrectly because the API is not thread-safe. Instead of doing this, I have now reverted that change and implemented a thread-safe version of the sync.WaitGroup API for esbuild to use instead.

    v0.16.2

    Compare Source

    • Fix process.env.NODE_ENV substitution when transforming (#​2718)

      Version 0.16.0 introduced an unintentional regression that caused process.env.NODE_ENV to be automatically substituted with either "development" or "production" when using esbuild's transform API. This substitution is a necessary feature of esbuild's build API because the React framework crashes when you bundle it without doing this. But the transform API is typically used as part of a larger build pipeline so the benefit of esbuild doing this automatically is not as clear, and esbuild previously didn't do this.

      However, version 0.16.0 switched the default value of the platform setting for the transform API from neutral to browser, both to align it with esbuild's documentation (which says browser is the default value) and because escaping the </script> character sequence is now tied to the browser platform (see the release notes for version 0.16.0 for details). That accidentally enabled automatic substitution of process.env.NODE_ENV because esbuild always did that for code meant for the browser. To fix this regression, esbuild will now only automatically substitute process.env.NODE_ENV when using the build API.

    • Prevent define from substituting constants into assignment position (#​2719)

      The define feature lets you replace certain expressions with constants. For example, you could use it to replace references to the global property reference window.DEBUG with false at compile time, which can then potentially help esbuild remove unused code from your bundle. It's similar to DefinePlugin in Webpack.

      However, if you write code such as window.DEBUG = true and then defined window.DEBUG to false, esbuild previously generated the output false = true which is a syntax error in JavaScript. This behavior is not typically a problem because it doesn't make sense to substitute window.DEBUG with a constant if its value changes at run-time (Webpack's DefinePlugin also generates false = true in this case). But it can be alarming to have esbuild generate code with a syntax error.

      So with this release, esbuild will no longer substitute define constants into assignment position to avoid generating code with a syntax error. Instead esbuild will generate a warning, which currently looks like this:

      ▲ [WARNING] Suspicious assignment to defined constant "window.DEBUG" [assign-to-define]
      
          example.js:1:0:
            1 │ window.DEBUG = true
              ╵ ~~~~~~~~~~~~
      
        The expression "window.DEBUG" has been configured to be replaced with a constant using the
        "define" feature. If this expression is supposed to be a compile-time constant, then it doesn't
        make sense to assign to it here. Or if this expression is supposed to change at run-time, this
        "define" substitution should be removed.
      
    • Fix a regression with npm install --no-optional (#​2720)

      Normally when you install esbuild with npm install, npm itself is the tool that downloads the correct binary executable for the current platform. This happens because of how esbuild's primary package uses npm's optionalDependencies feature. However, if you deliberately disable this with npm install --no-optional then esbuild's install script will attempt to repair the installation by manually downloading and extracting the binary executable from the package that was supposed to be installed.

      The change in version 0.16.0 to move esbuild's nested packages into the @esbuild/ scope unintentionally broke this logic because of how npm's URL structure is different for scoped packages vs. normal packages. It was actually already broken for a few platforms earlier because esbuild already had packages for some platforms in the @esbuild/ scope, but I didn't discover this then because esbuild's integration tests aren't run on all platforms. Anyway, this release contains some changes to the install script that should hopefully get this scenario working again.

    v0.16.1

    Compare Source

    This is a hotfix for the previous release.

    • Re-allow importing JSON with the copy loader using an import assertion

      The previous release made it so when assert { type: 'json' } is present on an import statement, esbuild validated that the json loader was used. This is what an import assertion is supposed to do. However, I forgot about the relatively new copy loader, which sort of behaves as if the import path was marked as external (and thus not loaded at all) except that the file is copied to the output directory and the import path is rewritten to point to the copy. In this case whatever JavaScript runtime ends up running the code is the one to evaluate the import assertion. So esbuild should really allow this case as well. With this release, esbuild now allows both the json and copy loaders when an assert { type: 'json' } import assertion is present.

    v0.16.0

    Compare Source

    This release deliberately contains backwards-incompatible changes. To avoid automatically picking up releases like this, you should either be pinning the exact version of esbuild in your package.json file (recommended) or be using a version range syntax that only accepts patch upgrades such as ^0.15.0 or ~0.15.0. See npm's documentation about semver for more information.

    • Move all binary executable packages to the @esbuild/ scope

      Binary package executables for esbuild are published as individual packages separate from the main esbuild package so you only have to download the relevant one for the current platform when you install esbuild. This release moves all of these packages under the @esbuild/ scope to avoid collisions with 3rd-party packages. It also changes them to a consistent naming scheme that uses the os and cpu names from node.

      The package name changes are as follows:

      • @esbuild/linux-loong64 => @esbuild/linux-loong64 (no change)
      • esbuild-android-64 => @esbuild/android-x64
      • esbuild-android-arm64 => @esbuild/android-arm64
      • esbuild-darwin-64 => @esbuild/darwin-x64
      • esbuild-darwin-arm64 => @esbuild/darwin-arm64
      • esbuild-freebsd-64 => @esbuild/freebsd-x64
      • esbuild-freebsd-arm64 => @esbuild/freebsd-arm64
      • esbuild-linux-32 => @esbuild/linux-ia32
      • esbuild-linux-64 => @esbuild/linux-x64
      • esbuild-linux-arm => @esbuild/linux-arm
      • esbuild-linux-arm64 => @esbuild/linux-arm64
      • esbuild-linux-mips64le => @esbuild/linux-mips64el
      • esbuild-linux-ppc64le => @esbuild/linux-ppc64
      • esbuild-linux-riscv64 => @esbuild/linux-riscv64
      • esbuild-linux-s390x => @esbuild/linux-s390x
      • esbuild-netbsd-64 => @esbuild/netbsd-x64
      • esbuild-openbsd-64 => @esbuild/openbsd-x64
      • esbuild-sunos-64 => @esbuild/sunos-x64
      • esbuild-wasm => esbuild-wasm (no change)
      • esbuild-windows-32 => @esbuild/win32-ia32
      • esbuild-windows-64 => @esbuild/win32-x64
      • esbuild-windows-arm64 => @esbuild/win32-arm64
      • esbuild => esbuild (no change)

      Normal usage of the esbuild and esbuild-wasm packages should not be affected. These name changes should only affect tools that hard-coded the individual binary executable package names into custom esbuild downloader scripts.

      This change was not made with performance in mind. But as a bonus, installing esbuild with npm may potentially happen faster now. This is because npm's package installation protocol is inefficient: it always downloads metadata for all past versions of each package even when it only needs metadata about a single version. This makes npm package downloads O(n) in the number of published versions, which penalizes packages like esbuild that are updated regularly. Since most of esbuild's package names have now changed, npm will now need to download much less data when installing esbuild (8.72mb of package manifests before this change → 0.06mb of package manifests after this change). However, this is only a temporary improvement. Installing esbuild will gradually get slower again as further versions of esbuild are published.

    • Publish a shell script that downloads esbuild directly

      In addition to all of the existing ways to install esbuild, you can now also download esbuild directly like this:

      curl -fsSL https://esbuild.github.io/dl/latest | sh
      

      This runs a small shell script that downloads the latest esbuild binary executable to the current directory. This can be convenient on systems that don't have npm installed or when you just want to get a copy of esbuild quickly without any extra steps. If you want a specific version of esbuild (starting with this version onward), you can provide that version in the URL instead of latest:

      curl -fsSL https://esbuild.github.io/dl/v0.16.0 | sh
      

      Note that the download script needs to be able to access registry.npmjs.org to be able to complete the download. This download script doesn't yet support all of the platforms that esbuild supports because I lack the necessary testing environments. If the download script doesn't work for you because you're on an unsupported platform, please file an issue on the esbuild repo so we can add support for it.

    • Fix some parameter names for the Go API

      This release changes some parameter names for the Go API to be consistent with the JavaScript and CLI APIs:

      • OutExtensions => OutExtension
      • JSXMode => JSX
    • Add additional validation of API parameters

      The JavaScript API now does some additional validation of API parameters to catch incorrect uses of esbuild's API. The biggest impact of this is likely that esbuild now strictly only accepts strings with the define parameter. This would already have been a type error with esbuild's TypeScript type definitions, but it was previously not enforced for people using esbuild's API JavaScript without TypeScript.

      The define parameter appears at first glance to take a JSON object if you aren't paying close attention, but this actually isn't true. Values for define are instead strings of JavaScript code. This means you have to use define: { foo: '"bar"' } to replace foo with the string "bar". Using define: { foo: 'bar' } actually replaces foo with the identifier bar. Previously esbuild allowed you to pass define: { foo: false } and false was automatically converted into a string, which made it more confusing to understand what define actually represents. Starting with this release, passing non-string values such as with define: { foo: false } will no longer be allowed. You will now have to write define: { foo: 'false' } instead.

    • Generate shorter data URLs if possible (#​1843)

      Loading a file with esbuild's dataurl loader generates a JavaScript module with a data URL for that file in a string as a single default export. Previously the data URLs generated by esbuild all used base64 encoding. However, this is unnecessarily long for most textual data (e.g. SVG images). So with this release, esbuild's dataurl loader will now use percent encoding instead of base64 encoding if the result will be shorter. This can result in ~25% smaller data URLs for large SVGs. If you want the old behavior, you can use the base64 loader instead and then construct the data URL yourself.

    • Avoid marking entry points as external (#​2382)

      Previously you couldn't specify --external:* to mark all import paths as external because that also ended up making the entry point itself external, which caused the build to fail. With this release, esbuild's external API parameter no longer applies to entry points so using --external:* is now possible.

      One additional consequence of this change is that the kind parameter is now required when calling the resolve() function in esbuild's plugin API. Previously the kind parameter defaulted to entry-point, but that no longer interacts with external so it didn't seem wise for this to continue to be the default. You now have to specify kind so that the path resolution mode is explicit.

    • Disallow non-default imports when assert { type: 'json' } is present

      There is now standard behavior for importing a JSON file into an ES module using an import statement. However, it requires you to place the assert { type: 'json' } import assertion after the import path. This import assertion tells the JavaScript runtime to throw an error if the import does not end up resolving to a JSON file. On the web, the type of a file is determined by the Content-Type HTTP header instead of by the file extension. The import assertion prevents security problems on the web where a .json file may actually resolve to a JavaScript file containing malicious code, which is likely not expected for an import that is supposed to only contain pure side-effect free data.

      By default, esbuild uses the file extension to determine the type of a file, so this import assertion is unnecessary with esbuild. However, esbuild's JSON import feature has a non-standard extension that allows you to import top-level properties of the JSON object as named imports. For example, esbuild lets you do this:

      import { version } from './package.json'
      

      This is useful for tree-shaking when bundling because it means esbuild will only include the the version field of package.json in your bundle. This is non-standard behavior though and doesn't match the behavior of what happens when you import JSON in a real JavaScript runtime (after adding assert { type: 'json' }). In a real JavaScript runtime the only thing you can import is the default import. So with this release, esbuild will now prevent you from importing non-default import names if assert { type: 'json' } is present. This ensures that code containing assert { type: 'json' } isn't relying on non-standard behavior that won't work everywhere. So the following code is now an error with esbuild when bundling:

      import { version } from './package.json' assert { type: 'json' }
      

      In addition, adding assert { type: 'json' } to an import statement now means esbuild will generate an error if the loader for the file is anything other than json, which is required by the import assertion specification.

    • Provide a way to disable automatic escaping of </script> (#​2649)

      If you inject esbuild's output into a script tag in an HTML file, code containing the literal characters </script> will cause the tag to be ended early which will break the code:

      <script>
        console.log("</script>");
      </script>
      

      To avoid this, esbuild automatically escapes these strings in generated JavaScript files (e.g. "</script>" becomes "<\/script>" instead). This also applies to </style> in generated CSS files. Previously this always happened and there wasn't a way to turn this off.

      With this release, esbuild will now only do this if the platform setting is set to browser (the default value). Setting platform to node or neutral will disable this behavior. This behavior can also now be disabled with --supported:inline-script=false (for JS) and --supported:inline-style=false (for CSS).

    • Throw an early error if decoded UTF-8 text isn't a Uint8Array (#​2532)

      If you run esbuild's JavaScript API in a broken JavaScript environment where new TextEncoder().encode("") instanceof Uint8Array is false, then esbuild's API will fail with a confusing serialization error message that makes it seem like esbuild has a bug even though the real problem is that the JavaScript environment itself is broken. This can happen when using the test framework called Jest. With this release, esbuild's API will now throw earlier when it detects that the environment is unable to encode UTF-8 text correctly with an error message that makes it more clear that this is not a problem with esbuild.

    • Change the default "legal comment" behavior

      The legal comments feature automatically gathers comments containing @license or @preserve and puts the comments somewhere (either in the generated code or in a separate file). People sometimes want this to happen so that the their dependencies' software licenses are retained in the generated output code. By default esbuild puts these comments at the end of the file when bundling. However, people sometimes find this confusing because these comments can be very generic and may not mention which library they come from. So with this release, esbuild will now discard legal comments by default. You now have to opt-in to preserving them if you want this behavior.

    • Enable the module condition by default (#​2417)

      Package authors want to be able to use the new exports field in package.json to provide tree-shakable ESM code for ESM-aware bundlers while simultaneously providing fallback CommonJS code for other cases.

      Node's proposed way to do this involves using the import and require export conditions so that you get the ESM code if you use an import statement and the CommonJS code if you use a require call. However, this has a major drawback: if some code in the bundle uses an import statement and other code in the bundle uses a require call, then you'll get two copies of the same package in the bundle. This is known as the dual package hazard and can lead to bloated bundles or even worse to subtle logic bugs.

      Webpack supports an alternate solution: an export condition called module that takes effect regardless of whether the package was imported using an import statement or a require call. This works because bundlers such as Webpack support importing a ESM using a require call (something node doesn't support). You could already do this with esbuild using --conditions=module but you previously had to explicitly enable this. Package authors are concerned that esbuild users won't know to do this and will get suboptimal output with their package, so they have requested for esbuild to do this automatically.

      So with this release, esbuild will now automatically add the module condition when there aren't any custom conditions already configured. You can disable this with --conditions= or conditions: [] (i.e. explicitly clearing all custom conditions).

    • Rename the master branch to main

      The primary branch for this repository was previously called master but is now called main. This change mirrors a similar change in many other projects.

    • Remove esbuild's _exit(0) hack for WebAssembly (#​714)

      Node had an unfortunate bug where the node process is unnecessarily kept open while a WebAssembly module is being optimized: https://github.com/nodejs/node/issues/36616. This means cases where running esbuild should take a few milliseconds can end up taking many seconds instead.

      The workaround was to force node to exit by ending the process early. This was done by esbuild in one of two ways depending on the exit code. For non-zero exit codes (i.e. when there is a build error), the esbuild command could just call process.kill(process.pid) to avoid the hang. But for zero exit codes, esbuild had to load a N-API native node extension that calls the operating system's exit(0) function.

      However, this problem has essentially been fixed in node starting with version 18.3.0. So I have removed this hack from esbuild. If you are using an earlier version of node with esbuild-wasm and you don't want the esbuild command to hang for a while when exiting, you can upgrade to node 18.3.0 or higher to remove the hang.

      The fix came from a V8 upgrade: this commit enabled dynamic tiering for WebAssembly by default for all projects that use V8's WebAssembly implementation. Previously all functions in the WebAssembly module were optimized in a single batch job but with dynamic tiering, V8 now optimizes individual WebAssembly functions as needed. This avoids unnecessary WebAssembly compilation which allows node to exit on time.

    v0.15.18

    Compare Source

    • Performance improvements for both JS and CSS

      This release brings noticeable performance improvements for JS parsing and for CSS parsing and printing. Here's an example benchmark for using esbuild to pretty-print a single large minified CSS file and JS file:

      | Test case | Previous release | This release | |----------------|------------------|--------------------| | 4.8mb CSS file | 19ms | 11ms (1.7x faster) | | 5.8mb JS file | 36ms | 32ms (1.1x faster) |

      The performance improvements were very straightforward:

      • Identifiers were being scanned using a generic character advancement function instead of using custom inline code. Advancing past each character involved UTF-8 decoding as well as updating multiple member variables. This was sped up using loop that skips UTF-8 decoding entirely and that only updates member variables once at the end. This is faster because identifiers are plain ASCII in the vast majority of cases, so Unicode decoding is almost always unnecessary.

      • CSS identifiers and CSS strings were still being printed one character at a time. Apparently I forgot to move this part of esbuild's CSS infrastructure beyond the proof-of-concept stage. These were both very obvious in the profiler, so I think maybe I have just never profiled esbuild's CSS printing before?

      • There was unnecessary work being done that was related to source maps when source map output was disabled. I likely haven't observed this before because esbuild's benchmarks always have source maps enabled. This work is now disabled when it's not going to be used.

      I definitely should have caught these performance issues earlier. Better late than never I suppose.

    prettier/prettier

    v2.8.1

    Compare Source

    diff

    Fix SCSS map in arguments (#​9184 by @​agamkrbit)
    // Input
    $display-breakpoints: map-deep-merge(
      (
        "print-only": "only print",
        "screen-only": "only screen",
        "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})",
      ),
      $display-breakpoints
    );
    
    // Prettier 2.8.0
    $display-breakpoints: map-deep-merge(
      (
        "print-only": "only print",
        "screen-only": "only screen",
        "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, " sm
          ")-1})",
      ),
      $display-breakpoints
    );
    
    // Prettier 2.8.1
    $display-breakpoints: map-deep-merge(
      (
        "print-only": "only print",
        "screen-only": "only screen",
        "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})",
      ),
      $display-breakpoints
    );
    
    Support auto accessors syntax (#​13919 by @​sosukesuzuki)

    Support for Auto Accessors Syntax landed in TypeScript 4.9.

    (Doesn't work well with babel-ts parser)

    class Foo {
      accessor foo: number = 3;
    }
    
    Microsoft/TypeScript

    v4.9.4: TypeScript 4.9.4

    Compare Source

    For release notes, check out the release announcement.

    For the complete list of fixed issues, check out the

    Downloads are available on:

    Changes:

    This list of changes was auto generated.


    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 1
  • Update all non-major dependencies

    Update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @types/node (source) | ^18.11.9 -> ^18.11.10 | age | adoption | passing | confidence | | @typescript-eslint/eslint-plugin | ^5.44.0 -> ^5.45.0 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.44.0 -> ^5.45.0 | age | adoption | passing | confidence | | esbuild | ^0.15.15 -> ^0.15.17 | age | adoption | passing | confidence | | eslint (source) | ^8.28.0 -> ^8.29.0 | age | adoption | passing | confidence | | lint-staged | ^13.0.4 -> ^13.1.0 | age | adoption | passing | confidence |


    Release Notes

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

    v5.45.0

    Compare Source

    Bug Fixes
    • eslint-plugin: [array-type] --fix flag removes parentheses from type (#​5997) (42b33af)
    • eslint-plugin: [keyword-spacing] prevent crash on no options (#​6073) (1f19998)
    • eslint-plugin: [member-ordering] support private fields (#​5859) (f02761a)
    • eslint-plugin: [prefer-readonly] report if a member's property is reassigned (#​6043) (6e079eb)
    Features
    • eslint-plugin: [member-ordering] add a required option for required vs. optional member ordering (#​5965) (2abadc6)
    typescript-eslint/typescript-eslint (@​typescript-eslint/parser)

    v5.45.0

    Compare Source

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

    evanw/esbuild

    v0.15.17

    Compare Source

    • Search for missing source map code on the file system (#​2711)

      Source maps are JSON files that map from compiled code back to the original code. They provide the original source code using two arrays: sources (required) and sourcesContent (optional). When bundling is enabled, esbuild is able to bundle code with source maps that was compiled by other tools (e.g. with Webpack) and emit source maps that map all the way back to the original code (e.g. before Webpack compiled it).

      Previously if the input source maps omitted the optional sourcesContent array, esbuild would use null for the source content in the source map that it generates (since the source content isn't available). However, sometimes the original source code is actually still present on the file system. With this release, esbuild will now try to find the original source code using the path in the sources array and will use that instead of null if it was found.

    • Fix parsing bug with TypeScript infer and extends (#​2712)

      This release fixes a bug where esbuild incorrectly failed to parse valid TypeScript code that nests extends inside infer inside extends, such as in the example below:

      type A<T> = {};
      type B = {} extends infer T extends {} ? A<T> : never;
      

      TypeScript code that does this should now be parsed correctly.

    • Use WebAssembly.instantiateStreaming if available (#​1036, #​1900)

      Currently the WebAssembly version of esbuild uses fetch to download esbuild.wasm and then WebAssembly.instantiate to compile it. There is a newer API called WebAssembly.instantiateStreaming that both downloads and compiles at the same time, which can be a performance improvement if both downloading and compiling are slow. With this release, esbuild now attempts to use WebAssembly.instantiateStreaming and falls back to the original approach if that fails.

      The implementation for this builds on a PR by @​lbwa.

    • Preserve Webpack comments inside constructor calls (#​2439)

      This improves the use of esbuild as a faster TypeScript-to-JavaScript frontend for Webpack, which has special magic comments inside new Worker() expressions that affect Webpack's behavior.

    v0.15.16

    Compare Source

    • Add a package alias feature (#​2191)

      With this release, you can now easily substitute one package for another at build time with the new alias feature. For example, --alias:oldpkg=newpkg replaces all imports of oldpkg with newpkg. One use case for this is easily replacing a node-only package with a browser-friendly package in 3rd-party code that you don't control. These new substitutions happen first before all of esbuild's existing path resolution logic.

      Note that when an import path is substituted using an alias, the resulting import path is resolved in the working directory instead of in the directory containing the source file with the import path. If needed, the working directory can be set with the cd command when using the CLI or with the absWorkingDir setting when using the JS or Go APIs.

    • Fix crash when pretty-printing minified JSX with object spread of object literal with computed property (#​2697)

      JSX elements are translated to JavaScript function calls and JSX element attributes are translated to properties on a JavaScript object literal. These properties are always either strings (e.g. in <x y />, y is a string) or an object spread (e.g. in <x {...y} />, y is an object spread) because JSX doesn't provide syntax for directly passing a computed property as a JSX attribute. However, esbuild's minifier has a rule that tries to inline object spread with an inline object literal in JavaScript. For example, x = { ...{ y } } is minified to x={y} when minification is enabled. This means that there is a way to generate a non-string non-spread JSX attribute in esbuild's internal representation. One example is with <x {...{ [y]: z }} />. When minification is enabled, esbuild's internal representation of this is something like <x [y]={z} /> due to object spread inlining, which is not valid JSX syntax. If this internal representation is then pretty-printed as JSX using --minify --jsx=preserve, esbuild previously crashed when trying to print this invalid syntax. With this release, esbuild will now print <x {...{[y]:z}}/> in this scenario instead of crashing.

    eslint/eslint

    v8.29.0

    Compare Source

    Features

    • 49a07c5 feat: add allowParensAfterCommentPattern option to no-extra-parens (#​16561) (Nitin Kumar)
    • e6a865d feat: prefer-named-capture-group add suggestions (#​16544) (Josh Goldberg)
    • a91332b feat: In no-invalid-regexp validate flags also for non-literal patterns (#​16583) (trosos)

    Documentation

    Chores

    okonet/lint-staged

    v13.1.0

    Compare Source

    Features

    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 1
  • chore(deps): update all non-major dependencies

    chore(deps): update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | esbuild | ^0.16.10 -> ^0.16.12 | age | adoption | passing | confidence | | eslint (source) | ^8.30.0 -> ^8.31.0 | age | adoption | passing | confidence |


    Release Notes

    evanw/esbuild

    v0.16.12

    Compare Source

    • Loader defaults to js for extensionless files (#​2776)

      Certain packages contain files without an extension. For example, the yargs package contains the file yargs/yargs which has no extension. Node, Webpack, and Parcel can all understand code that imports yargs/yargs because they assume that the file is JavaScript. However, esbuild was previously unable to understand this code because it relies on the file extension to tell it how to interpret the file. With this release, esbuild will now assume files without an extension are JavaScript files. This can be customized by setting the loader for "" (the empty string, representing files without an extension) to another loader. For example, if you want files without an extension to be treated as CSS instead, you can do that like this:

      • CLI:

        esbuild --bundle --loader:=css
        
      • JS:

        esbuild.build({
          bundle: true,
          loader: { '': 'css' },
        })
        
      • Go:

        api.Build(api.BuildOptions{
          Bundle: true,
          Loader: map[string]api.Loader{"": api.LoaderCSS},
        })
        

      In addition, the "type" field in package.json files now only applies to files with an explicit .js, .jsx, .ts, or .tsx extension. Previously it was incorrectly applied by esbuild to all files that had an extension other than .mjs, .mts, .cjs, or .cts including extensionless files. So for example an extensionless file in a "type": "module" package is now treated as CommonJS instead of ESM.

    v0.16.11

    Compare Source

    • Avoid a syntax error in the presence of direct eval (#​2761)

      The behavior of nested function declarations in JavaScript depends on whether the code is run in strict mode or not. It would be problematic if esbuild preserved nested function declarations in its output because then the behavior would depend on whether the output was run in strict mode or not instead of respecting the strict mode behavior of the original source code. To avoid this, esbuild transforms nested function declarations to preserve the intended behavior of the original source code regardless of whether the output is run in strict mode or not:

      // Original code
      if (true) {
        function foo() {}
        console.log(!!foo)
        foo = null
        console.log(!!foo)
      }
      console.log(!!foo)
      
      // Transformed code
      if (true) {
        let foo2 = function() {
        };
        var foo = foo2;
        console.log(!!foo2);
        foo2 = null;
        console.log(!!foo2);
      }
      console.log(!!foo);
      

      In the above example, the original code should print true false true because it's not run in strict mode (it doesn't contain "use strict" and is not an ES module). The code that esbuild generates has been transformed such that it prints true false true regardless of whether it's run in strict mode or not.

      However, this transformation is impossible if the code contains direct eval because direct eval "poisons" all containing scopes by preventing anything in those scopes from being renamed. That prevents esbuild from splitting up accesses to foo into two separate variables with different names. Previously esbuild still did this transformation but with two variables both named foo, which is a syntax error. With this release esbuild will now skip doing this transformation when direct eval is present to avoid generating code with a syntax error. This means that the generated code may no longer behave as intended since the behavior depends on the run-time strict mode setting instead of the strict mode setting present in the original source code. To fix this problem, you will need to remove the use of direct eval.

    • Fix a bundling scenario involving multiple symlinks (#​2773, #​2774)

      This release contains a fix for a bundling scenario involving an import path where multiple path segments are symlinks. Previously esbuild was unable to resolve certain import paths in this scenario, but these import paths should now work starting with this release. This fix was contributed by @​onebytegone.

    eslint/eslint

    v8.31.0

    Compare Source

    Features

    • 52c7c73 feat: check assignment patterns in no-underscore-dangle (#​16693) (Milos Djermanovic)
    • b401cde feat: add options to check destructuring in no-underscore-dangle (#​16006) (Morten Kaltoft)
    • 30d0daf feat: group properties with values in parentheses in key-spacing (#​16677) (Francesco Trotta)

    Bug Fixes

    • 35439f1 fix: correct syntax error in prefer-arrow-callback autofix (#​16722) (Francesco Trotta)
    • 87b2470 fix: new instance of FlatESLint should load latest config file version (#​16608) (Milos Djermanovic)

    Documentation

    Chores


    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 0
  • chore(deps): update all non-major dependencies

    chore(deps): update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @types/node (source) | ^18.11.13 -> ^18.11.17 | age | adoption | passing | confidence | | @typescript-eslint/eslint-plugin | ^5.46.0 -> ^5.46.1 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.46.0 -> ^5.46.1 | age | adoption | passing | confidence | | @vitest/coverage-c8 | ^0.25.7 -> ^0.25.8 | age | adoption | passing | confidence | | esbuild | ^0.16.4 -> ^0.16.9 | age | adoption | passing | confidence | | eslint (source) | ^8.29.0 -> ^8.30.0 | age | adoption | passing | confidence | | vite (source) | ^4.0.0 -> ^4.0.1 | age | adoption | passing | confidence | | vitest | ^0.25.7 -> ^0.25.8 | age | adoption | passing | confidence |


    Release Notes

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

    v5.46.1

    Compare Source

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

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

    v5.46.1

    Compare Source

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

    vitest-dev/vitest

    v0.25.8

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub
    evanw/esbuild

    v0.16.9

    Compare Source

    • Update to Unicode 15.0.0

      The character tables that determine which characters form valid JavaScript identifiers have been updated from Unicode version 14.0.0 to the newly-released Unicode version 15.0.0. I'm not putting an example in the release notes because all of the new characters will likely just show up as little squares since fonts haven't been updated yet. But you can read https://www.unicode.org/versions/Unicode15.0.0/#Summary for more information about the changes.

    • Disallow duplicate lexically-declared names in nested blocks and in strict mode

      In strict mode or in a nested block, it's supposed to be a syntax error to declare two symbols with the same name unless all duplicate entries are either function declarations or all var declarations. However, esbuild was overly permissive and allowed this when duplicate entries were either function declarations or var declarations (even if they were mixed). This check has now been made more restrictive to match the JavaScript specification:

      // JavaScript allows this
      var a
      function a() {}
      {
        var b
        var b
        function c() {}
        function c() {}
      }
      
      // JavaScript doesn't allow this
      {
        var d
        function d() {}
      }
      
    • Add a type declaration for the new empty loader (#​2755)

      I forgot to add this in the previous release. It has now been added.

      This fix was contributed by @​fz6m.

    • Add support for the v flag in regular expression literals

      People are currently working on adding a v flag to JavaScript regular expresions. You can read more about this flag here: https://v8.dev/features/regexp-v-flag. This release adds support for parsing this flag, so esbuild will now no longer consider regular expression literals with this flag to be a syntax error. If the target is set to something other than esnext, esbuild will transform regular expression literals containing this flag into a new RegExp() constructor call so the resulting code doesn't have a syntax error. This enables you to provide a polyfill for RegExp that implements the v flag to get your code to work at run-time. While esbuild doesn't typically adopt proposals until they're already shipping in a real JavaScript run-time, I'm adding it now because a) esbuild's implementation doesn't need to change as the proposal evolves, b) this isn't really new syntax since regular expression literals already have flags, and c) esbuild's implementation is a trivial pass-through anyway.

    • Avoid keeping the name of classes with static name properties

      The --keep-names property attempts to preserve the original value of the name property for functions and classes even when identifiers are renamed by the minifier or to avoid a name collision. This is currently done by generating code to assign a string to the name property on the function or class object. However, this should not be done for classes with a static name property since in that case the explicitly-defined name property overwrites the automatically-generated class name. With this release, esbuild will now no longer attempt to preserve the name property for classes with a static name property.

    v0.16.8

    Compare Source

    • Allow plugins to resolve injected files (#​2754)

      Previously paths passed to the inject feature were always interpreted as file system paths. This meant that onResolve plugins would not be run for them and esbuild's default path resolver would always be used. This meant that the inject feature couldn't be used in the browser since the browser doesn't have access to a file system. This release runs paths passed to inject through esbuild's full path resolution pipeline so plugins now have a chance to handle them using onResolve callbacks. This makes it possible to write a plugin that makes esbuild's inject work in the browser.

    • Add the empty loader (#​1541, #​2753)

      The new empty loader tells esbuild to pretend that a file is empty. So for example --loader:.css=empty effectively skips all imports of .css files in JavaScript so that they aren't included in the bundle, since import "./some-empty-file" in JavaScript doesn't bundle anything. You can also use the empty loader to remove asset references in CSS files. For example --loader:.png=empty causes esbuild to replace asset references such as url(image.png) with url() so that they are no longer included in the resulting style sheet.

    • Fix </script> and </style> escaping for non-default targets (#​2748)

      The change in version 0.16.0 to give control over </script> escaping via --supported:inline-script=false or --supported:inline-script=true accidentally broke automatic escaping of </script> when an explicit target setting is specified. This release restores the correct automatic escaping of </script> (which should not depend on what target is set to).

    • Enable the exports field with NODE_PATHS (#​2752)

      Node has a rarely-used feature where you can extend the set of directories that node searches for packages using the NODE_PATHS environment variable. While esbuild supports this too, previously it only supported the old main field path resolution but did not support the new exports field package resolution. This release makes the path resolution rules the same again for both node_modules directories and NODE_PATHS directories.

    v0.16.7

    Compare Source

    • Include file loader strings in metafile imports (#​2731)

      Bundling a file with the file loader copies that file to the output directory and imports a module with the path to the copied file in the default export. Previously when bundling with the file loader, there was no reference in the metafile from the JavaScript file containing the path string to the copied file. With this release, there will now be a reference in the metafile in the imports array with the kind file-loader:

       {
         ...
         "outputs": {
           "out/image-55CCFTCE.svg": {
             ...
           },
           "out/entry.js": {
             "imports": [
      +        {
      +          "path": "out/image-55CCFTCE.svg",
      +          "kind": "file-loader"
      +        }
             ],
             ...
           }
         }
       }
      
    • Fix byte counts in metafile regarding references to other output files (#​2071)

      Previously files that contained references to other output files had slightly incorrect metadata for the byte counts of input files which contributed to that output file. So for example if app.js imports image.png using the file loader and esbuild generates out.js and image-LSAMBFUD.png, the metadata for how many bytes of out.js are from app.js was slightly off (the metadata for the byte count of out.js was still correct). The reason is because esbuild substitutes the final paths for references between output files toward the end of the build to handle cyclic references, and the byte counts needed to be adjusted as well during the path substitution. This release fixes these byte counts (specifically the bytesInOutput values).

    • The alias feature now strips a trailing slash (#​2730)

      People sometimes add a trailing slash to the name of one of node's built-in modules to force node to import from the file system instead of importing the built-in module. For example, importing util imports node's built-in module called util but importing util/ tries to find a package called util on the file system. Previously attempting to use esbuild's package alias feature to replace imports to util with a specific file would fail because the file path would also gain a trailing slash (e.g. mapping util to ./file.js turned util/ into ./file.js/). With this release, esbuild will now omit the path suffix if it's a single trailing slash, which should now allow you to successfully apply aliases to these import paths.

    v0.16.6

    Compare Source

    • Do not mark subpath imports as external with --packages=external (#​2741)

      Node has a feature called subpath imports where special import paths that start with # are resolved using the imports field in the package.json file of the enclosing package. The intent of the newly-added --packages=external setting is to exclude a package's dependencies from the bundle. Since a package's subpath imports are only accessible within that package, it's wrong for them to be affected by --packages=external. This release changes esbuild so that --packages=external no longer affects subpath imports.

    • Forbid invalid numbers in JSON files

      Previously esbuild parsed numbers in JSON files using the same syntax as JavaScript. But starting from this release, esbuild will now parse them with JSON syntax instead. This means the following numbers are no longer allowed by esbuild in JSON files:

      • Legacy octal literals (non-zero integers starting with 0)
      • The 0b, 0o, and 0x numeric prefixes
      • Numbers containing _ such as 1_000
      • Leading and trailing . such as 0. and .0
      • Numbers with a space after the - such as - 1
    • Add external imports to metafile (#​905, #​1768, #​1933, #​1939)

      External imports now appear in imports arrays in the metafile (which is present when bundling with metafile: true) next to normal imports, but additionally have external: true to set them apart. This applies both to files in the inputs section and the outputs section. Here's an example:

       {
         "inputs": {
           "style.css": {
             "bytes": 83,
             "imports": [
      +        {
      +          "path": "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
      +          "kind": "import-rule",
      +          "external": true
      +        }
             ]
           },
           "app.js": {
             "bytes": 100,
             "imports": [
      +        {
      +          "path": "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js",
      +          "kind": "import-statement",
      +          "external": true
      +        },
               {
                 "path": "style.css",
                 "kind": "import-statement"
               }
             ]
           }
         },
         "outputs": {
           "out/app.js": {
             "imports": [
      +        {
      +          "path": "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js",
      +          "kind": "require-call",
      +          "external": true
      +        }
             ],
             "exports": [],
             "entryPoint": "app.js",
             "cssBundle": "out/app.css",
             "inputs": {
               "app.js": {
                 "bytesInOutput": 113
               },
               "style.css": {
                 "bytesInOutput": 0
               }
             },
             "bytes": 528
           },
           "out/app.css": {
             "imports": [
      +        {
      +          "path": "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
      +          "kind": "import-rule",
      +          "external": true
      +        }
             ],
             "inputs": {
               "style.css": {
                 "bytesInOutput": 0
               }
             },
             "bytes": 100
           }
         }
       }
      

      One additional useful consequence of this is that the imports array is now populated when bundling is disabled. So you can now use esbuild with bundling disabled to inspect a file's imports.

    v0.16.5

    Compare Source

    • Make it easy to exclude all packages from a bundle (#​1958, #​1975, #​2164, #​2246, #​2542)

      When bundling for node, it's often necessary to exclude npm packages from the bundle since they weren't designed with esbuild bundling in mind and don't work correctly after being bundled. For example, they may use __dirname and run-time file system calls to load files, which doesn't work after bundling with esbuild. Or they may compile a native .node extension that has similar expectations about the layout of the file system that are no longer true after bundling (even if the .node extension is copied next to the bundle).

      The way to get this to work with esbuild is to use the --external: flag. For example, the fsevents package contains a native .node extension and shouldn't be bundled. To bundle code that uses it, you can pass --external:fsevents to esbuild to exclude it from your bundle. You will then need to ensure that the fsevents package is still present when you run your bundle (e.g. by publishing your bundle to npm as a package with a dependency on fsevents).

      It was possible to automatically do this for all of your dependencies, but it was inconvenient. You had to write some code that read your package.json file and passed the keys of the dependencies, devDependencies, peerDependencies, and/or optionalDependencies maps to esbuild as external packages (either that or write a plugin to mark all package paths as external). Previously esbuild's recommendation for making this easier was to do --external:./node_modules/* (added in version 0.14.13). However, this was a bad idea because it caused compatibility problems with many node packages as it caused esbuild to mark the post-resolve path as external instead of the pre-resolve path. Doing that could break packages that are published as both CommonJS and ESM if esbuild's bundler is also used to do a module format conversion.

      With this release, you can now do the following to automatically exclude all packages from your bundle:

      • CLI:

        esbuild --bundle --packages=external
        
      • JS:

        esbuild.build({
          bundle: true,
          packages: 'external',
        })
        
      • Go:

        api.Build(api.BuildOptions{
          Bundle:   true,
          Packages: api.PackagesExternal,
        })
        

      Doing --external:./node_modules/* is still possible and still has the same behavior, but is no longer recommended. I recommend that you use the new packages feature instead.

    • Fix some subtle bugs with tagged template literals

      This release fixes a bug where minification could incorrectly change the value of this within tagged template literal function calls:

      // Original code
      function f(x) {
        let z = y.z
        return z``
      }
      
      // Old output (with --minify)
      function f(n){return y.z``}
      
      // New output (with --minify)
      function f(n){return(0,y.z)``}
      

      This release also fixes a bug where using optional chaining with --target=es2019 or earlier could incorrectly change the value of this within tagged template literal function calls:

      // Original code
      var obj = {
        foo: function() {
          console.log(this === obj);
        }
      };
      (obj?.foo)``;
      
      // Old output (with --target=es6)
      var obj = {
        foo: function() {
          console.log(this === obj);
        }
      };
      (obj == null ? void 0 : obj.foo)``;
      
      // New output (with --target=es6)
      var __freeze = Object.freeze;
      var __defProp = Object.defineProperty;
      var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
      var _a;
      var obj = {
        foo: function() {
          console.log(this === obj);
        }
      };
      (obj == null ? void 0 : obj.foo).call(obj, _a || (_a = __template([""])));
      
    • Some slight minification improvements

      The following minification improvements were implemented:

      • if (~a !== 0) throw x; => if (~a) throw x;
      • if ((a | b) !== 0) throw x; => if (a | b) throw x;
      • if ((a & b) !== 0) throw x; => if (a & b) throw x;
      • if ((a ^ b) !== 0) throw x; => if (a ^ b) throw x;
      • if ((a << b) !== 0) throw x; => if (a << b) throw x;
      • if ((a >> b) !== 0) throw x; => if (a >> b) throw x;
      • if ((a >>> b) !== 0) throw x; => if (a >>> b) throw x;
      • if (!!a || !!b) throw x; => if (a || b) throw x;
      • if (!!a && !!b) throw x; => if (a && b) throw x;
      • if (a ? !!b : !!c) throw x; => if (a ? b : c) throw x;
    eslint/eslint

    v8.30.0

    Compare Source

    Features
    Bug Fixes
    • 1a327aa fix: Ensure flat config unignores work consistently like eslintrc (#​16579) (Nicholas C. Zakas)
    • 9b8bb72 fix: autofix recursive functions in no-var (#​16611) (Milos Djermanovic)
    Documentation
    Chores
    vitejs/vite

    v4.0.1

    Compare Source


    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 0
  • Update all non-major dependencies

    Update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @commitlint/cli (source) | ^17.2.0 -> ^17.3.0 | age | adoption | passing | confidence | | @commitlint/config-conventional (source) | ^17.2.0 -> ^17.3.0 | age | adoption | passing | confidence | | @typescript-eslint/eslint-plugin | ^5.43.0 -> ^5.44.0 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.43.0 -> ^5.44.0 | age | adoption | passing | confidence | | @vitest/coverage-c8 | ^0.25.2 -> ^0.25.3 | age | adoption | passing | confidence | | esbuild | ^0.15.14 -> ^0.15.15 | age | adoption | passing | confidence | | lint-staged | ^13.0.3 -> ^13.0.4 | age | adoption | passing | confidence | | prettier (source) | ^2.7.1 -> ^2.8.0 | age | adoption | passing | confidence | | vitest | ^0.25.2 -> ^0.25.3 | age | adoption | passing | confidence |


    Release Notes

    conventional-changelog/commitlint (@​commitlint/cli)

    v17.3.0

    Compare Source

    Note: Version bump only for package @​commitlint/cli

    conventional-changelog/commitlint (@​commitlint/config-conventional)

    v17.3.0

    Compare Source

    Note: Version bump only for package @​commitlint/config-conventional

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

    v5.44.0

    Compare Source

    Bug Fixes
    • eslint-plugin: [no-empty-interface] disable autofix for declaration merging with class (#​5920) (a4f85b8)
    • eslint-plugin: [no-unnecessary-condition] handle index signature type (#​5912) (5baad08)
    • eslint-plugin: [prefer-optional-chain] handle binary expressions in negated or (#​5992) (2778ff0)
    • typescript-estree: don't consider a cached program unless it's specified in the current parserOptions.project config (#​5999) (530e0e6)
    Features
    • eslint-plugin: [adjacent-overload-signatures] check BlockStatement nodes (#​5998) (97d3e56)
    • eslint-plugin: [keyword-spacing] Support spacing in import-type syntax (#​5977) (6a735e1)
    typescript-eslint/typescript-eslint (@​typescript-eslint/parser)

    v5.44.0

    Compare Source

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

    vitest-dev/vitest

    v0.25.3

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub
    evanw/esbuild

    v0.15.15

    Compare Source

    • Remove duplicate CSS rules across files (#​2688)

      When two or more CSS rules are exactly the same (even if they are not adjacent), all but the last one can safely be removed:

      /* Before */
      a { color: red; }
      span { font-weight: bold; }
      a { color: red; }
      
      /* After */
      span { font-weight: bold; }
      a { color: red; }
      

      Previously esbuild only did this transformation within a single source file. But with this release, esbuild will now do this transformation across source files, which may lead to smaller CSS output if the same rules are repeated across multiple CSS source files in the same bundle. This transformation is only enabled when minifying (specifically when syntax minification is enabled).

    • Add deno as a valid value for target (#​2686)

      The target setting in esbuild allows you to enable or disable JavaScript syntax features for a given version of a set of target JavaScript VMs. Previously Deno was not one of the JavaScript VMs that esbuild supported with target, but it will now be supported starting from this release. For example, versions of Deno older than v1.2 don't support the new ||= operator, so adding e.g. --target=deno1.0 to esbuild now lets you tell esbuild to transpile ||= to older JavaScript.

    • Fix the esbuild-wasm package in Node v19 (#​2683)

      A recent change to Node v19 added a non-writable crypto property to the global object: https://github.com/nodejs/node/pull/44897. This conflicts with Go's WebAssembly shim code, which overwrites the global crypto property. As a result, all Go-based WebAssembly code that uses the built-in shim (including esbuild) is now broken on Node v19. This release of esbuild fixes the issue by reconfiguring the global crypto property to be writable before invoking Go's WebAssembly shim code.

    • Fix CSS dimension printing exponent confusion edge case (#​2677)

      In CSS, a dimension token has a numeric "value" part and an identifier "unit" part. For example, the dimension token 32px has a value of 32 and a unit of px. The unit can be any valid CSS identifier. The value can be any number in floating-point format including an optional exponent (e.g. -3.14e-0 has an exponent of e-0). The full details of this syntax are here: https://www.w3.org/TR/css-syntax-3/.

      To maintain the integrity of the dimension token through the printing process, esbuild must handle the edge case where the unit looks like an exponent. One such case is the dimension 1e\32 which has the value 1 and the unit e2. It would be bad if this dimension token was printed such that a CSS parser would parse it as a number token with the value 1e2 instead of a dimension token. The way esbuild currently does this is to escape the leading e in the dimension unit, so esbuild would parse 1e\32 but print 1\65 2 (both 1e\32 and 1\65 2 represent a dimension token with a value of 1 and a unit of e2).

      However, there is an even narrower edge case regarding this edge case. If the value part of the dimension token itself has an e, then it's not necessary to escape the e in the dimension unit because a CSS parser won't confuse the unit with the exponent even though it looks like one (since a number can only have at most one exponent). This came up because the grammar for the CSS unicode-range property uses a hack that lets you specify a hexadecimal range without quotes even though CSS has no token for a hexadecimal range. The hack is to allow the hexadecimal range to be parsed as a dimension token and optionally also a number token. Here is the grammar for unicode-range:

      unicode-range =
        <urange>#
      
      <urange> =
        u '+' <ident-token> '?'*            |
        u <dimension-token> '?'*            |
        u <number-token> '?'*               |
        u <number-token> <dimension-token>  |
        u <number-token> <number-token>     |
        u '+' '?'+
      

      and here is an example unicode-range declaration that was problematic for esbuild:

      @&#8203;font-face {
        unicode-range: U+0e2e-0e2f;
      }
      

      This is parsed as a dimension with a value of +0e2 and a unit of e-0e2f. This was problematic for esbuild because the unit starts with e-0 which could be confused with an exponent when appended after a number, so esbuild was escaping the e character in the unit. However, this escaping is unnecessary because in this case the dimension value already has an exponent in it. With this release, esbuild will no longer unnecessarily escape the e in the dimension unit in these cases, which should fix the printing of unicode-range declarations.

      An aside: You may be wondering why esbuild is trying to escape the e at all and why it doesn't just pass through the original source code unmodified. The reason why esbuild does this is that, for robustness, esbuild's AST generally tries to omit semantically-unrelated information and esbuild's code printers always try to preserve the semantics of the underlying AST. That way the rest of esbuild's internals can just deal with semantics instead of presentation. They don't have to think about how the AST will be printed when changing the AST. This is the same reason that esbuild's JavaScript AST doesn't have a "parentheses" node (e.g. a * (b + c) is represented by the AST multiply(a, add(b, c)) instead of multiply(a, parentheses(add(b, c)))). Instead, the printer automatically inserts parentheses as necessary to maintain the semantics of the AST, which means all of the optimizations that run over the AST don't have to worry about keeping the parentheses up to date. Similarly, the CSS AST for the dimension token stores the actual unit and the printer makes sure the unit is properly escaped depending on what value it's placed after. All of the other code operating on CSS ASTs doesn't have to worry about parsing escapes to compare units or about keeping escapes up to date when the AST is modified. Hopefully that makes sense.

    • Attempt to avoid creating the node_modules/.cache directory for people that use Yarn 2+ in Plug'n'Play mode (#​2685)

      When Yarn's PnP mode is enabled, packages installed by Yarn may or may not be put inside .zip files. The specific heuristics for when this happens change over time in between Yarn versions. This is problematic for esbuild because esbuild's JavaScript package needs to execute a binary file inside the package. Yarn makes extensive modifications to Node's file system APIs at run time to pretend that .zip files are normal directories and to make it hard to tell whether a file is real or not (since in theory it doesn't matter). But they haven't modified Node's child_process.execFileSync API so attempting to execute a file inside a zip file fails. To get around this, esbuild previously used Node's file system APIs to copy the binary executable to another location before invoking execFileSync. Under the hood this caused Yarn to extract the file from the zip file into a real file that can then be run.

      However, esbuild copied its executable into node_modules/.cache/esbuild. This is the official recommendation from the Yarn team for where packages are supposed to put these types of files when Yarn PnP is being used. However, users of Yarn PnP with esbuild find this really annoying because they don't like looking at the node_modules directory. With this release, esbuild now sets "preferUnplugged": true in its package.json files, which tells newer versions of Yarn to not put esbuild's packages in a zip file. There may exist older versions of Yarn that don't support preferUnplugged. In that case esbuild should still copy the executable to a cache directory, so it should still run (hopefully, since I haven't tested this myself). Note that esbuild setting "preferUnplugged": true may have the side effect of esbuild taking up more space on the file system in the event that multiple platforms are installed simultaneously, or that you're using an older version of Yarn that always installs packages for all platforms. In that case you may want to update to a newer version of Yarn since Yarn has recently changed to only install packages for the current platform.

    okonet/lint-staged

    v13.0.4

    Compare Source

    Bug Fixes
    • deps: update all dependencies (336f3b5)
    • deps: update all dependencies (ec995e5)
    prettier/prettier

    v2.8.0

    Compare Source

    diff

    🔗 Release Notes


    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 0
  • Update all non-major dependencies

    Update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @favware/cliff-jumper | 1.8.8 -> 1.9.0 | age | adoption | passing | confidence | | @typescript-eslint/eslint-plugin | ^5.42.1 -> ^5.43.0 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.42.1 -> ^5.43.0 | age | adoption | passing | confidence | | @vitest/coverage-c8 | ^0.25.1 -> ^0.25.2 | age | adoption | passing | confidence | | esbuild | ^0.15.13 -> ^0.15.14 | age | adoption | passing | confidence | | eslint (source) | ^8.27.0 -> ^8.28.0 | age | adoption | passing | confidence | | tsup | ^6.4.0 -> ^6.5.0 | age | adoption | passing | confidence | | typescript (source) | ^4.8.4 -> ^4.9.3 | age | adoption | passing | confidence | | vitest | ^0.25.1 -> ^0.25.2 | age | adoption | passing | confidence | | yarn | 3.2.4 -> 3.3.0 | age | adoption | passing | confidence |


    Release Notes

    favware/cliff-jumper

    v1.9.0

    Compare Source

    🐛 Bug Fixes

    📝 Documentation

    • Add imranbarbhuiya as a contributor for code (#​54) (00e8c2f)
    • readme: Add configuration examples (5e891b0)

    🚀 Features

    • Create an empty changelog file when it does not yet exist and first release was provided (#​31) (90acb2a)
    typescript-eslint/typescript-eslint (@​typescript-eslint/eslint-plugin)

    v5.43.0

    Compare Source

    Bug Fixes
    • eslint-plugin: [no-shadow] handle false positives on generics and parameters (#​5902) (769e8c8)
    • eslint-plugin: [promise-function-async] handle keyword token (#​5907) (f25a94f)
    Features
    • eslint-plugin: [consistent-type-imports] support fixing to inline types (#​5050) (75dcdf1)
    • eslint-plugin: [naming-convention] add support for "override" and "async" modifiers (#​5310) (#​5610) (c759da1)
    • eslint-plugin: [prefer-optional-chain] support suggesting !foo || !foo.bar as a valid match for the rule (#​5594) (923d486)

    5.42.1 (2022-11-07)

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

    v5.43.0

    Compare Source

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

    5.42.1 (2022-11-07)

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

    vitest-dev/vitest

    v0.25.2

    Compare Source

       🐞 Bug Fixes
        View changes on GitHub
    evanw/esbuild

    v0.15.14

    Compare Source

    • Fix parsing of TypeScript infer inside a conditional extends (#​2675)

      Unlike JavaScript, parsing TypeScript sometimes requires backtracking. The infer A type operator can take an optional constraint of the form infer A extends B. However, this syntax conflicts with the similar conditional type operator A extends B ? C : D in cases where the syntax is combined, such as infer A extends B ? C : D. This is supposed to be parsed as (infer A) extends B ? C : D. Previously esbuild incorrectly parsed this as (infer A extends B) ? C : D instead, which is a parse error since the ?: conditional operator requires the extends keyword as part of the conditional type. TypeScript disambiguates by speculatively parsing the extends after the infer, but backtracking if a ? token is encountered afterward. With this release, esbuild should now do the same thing, so esbuild should now correctly parse these types. Here's a real-world example of such a type:

      type Normalized<T> = T extends Array<infer A extends object ? infer A : never>
        ? Dictionary<Normalized<A>>
        : {
            [P in keyof T]: T[P] extends Array<infer A extends object ? infer A : never>
              ? Dictionary<Normalized<A>>
              : Normalized<T[P]>
          }
      
    • Avoid unnecessary watch mode rebuilds when debug logging is enabled (#​2661)

      When debug-level logs are enabled (such as with --log-level=debug), esbuild's path resolution subsystem generates debug log messages that say something like "Read 20 entries for directory /home/user" to help you debug what esbuild's path resolution is doing. This caused esbuild's watch mode subsystem to add a dependency on the full list of entries in that directory since if that changes, the generated log message would also have to be updated. However, meant that on systems where a parent directory undergoes constant directory entry churn, esbuild's watch mode would continue to rebuild if --log-level=debug was passed.

      With this release, these debug log messages are now generated by "peeking" at the file system state while bypassing esbuild's watch mode dependency tracking. So now watch mode doesn't consider the count of directory entries in these debug log messages to be a part of the build that needs to be kept up to date when the file system state changes.

    eslint/eslint

    v8.28.0

    Compare Source

    Features

    • 63bce44 feat: add ignoreClassFieldInitialValues option to no-magic-numbers (#​16539) (Milos Djermanovic)
    • 8385ecd feat: multiline properties in rule key-spacing with option align (#​16532) (Francesco Trotta)
    • a4e89db feat: no-obj-calls support Intl (#​16543) (Sosuke Suzuki)

    Bug Fixes

    • c50ae4f fix: Ensure that dot files are found with globs. (#​16550) (Nicholas C. Zakas)
    • 9432b67 fix: throw error for first unmatched pattern (#​16533) (Milos Djermanovic)
    • e76c382 fix: allow * 1 when followed by / in no-implicit-coercion (#​16522) (Milos Djermanovic)

    Documentation

    Chores

    egoist/tsup

    v6.5.0

    Compare Source

    Bug Fixes
    Features
    • add --publicDir [dir] flag (3da1c00)
    Microsoft/TypeScript

    v4.9.3: TypeScript 4.9

    Compare Source

    For release notes, check out the release announcement.

    Downloads are available on:

    Changes:
    See More

    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 0
  • Update all non-major dependencies

    Update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @typescript-eslint/eslint-plugin | ^5.42.0 -> ^5.42.1 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.42.0 -> ^5.42.1 | age | adoption | passing | confidence | | @vitest/coverage-c8 | ^0.24.5 -> ^0.25.1 | age | adoption | passing | confidence | | husky (source) | ^8.0.1 -> ^8.0.2 | age | adoption | passing | confidence | | vitest | ^0.24.5 -> ^0.25.1 | age | adoption | passing | confidence |


    Release Notes

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

    v5.42.1

    Compare Source

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

    v5.42.1

    Compare Source

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

    vitest-dev/vitest

    v0.25.1

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub

    v0.25.0

    Compare Source

       ✅ Builtin TypeChecking

    In v0.25.0, Vitest allows you to write tests for your types, using expectTypeOf or assertType syntaxes. By default all tests inside *.test-d.ts files are considered type tests. Run vitest typecheck to run type tests.

    // my.test-d.ts
    import { assertType, expectTypeOf } from 'vitest'
    import { mount } from './mount.js'
    
    test('my types work properly', () => {
      expectTypeOf(mount).toBeFunction()
      expectTypeOf(mount).parameter(0).toMatchTypeOf<{ name: string }>()
    
      // @&#8203;ts-expect-error name is a string
      assertType(mount({ name: 42 }))
    })
    

    Learn more at the documentation and this RFC

       🚨 Breaking Changes
       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub
    typicode/husky

    v8.0.2

    Compare Source

    • docs: remove deprecated npm set-script

    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 0
  • Update all non-major dependencies

    Update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @commitlint/cli (source) | ^17.1.2 -> ^17.2.0 | age | adoption | passing | confidence | | @commitlint/config-conventional (source) | ^17.1.0 -> ^17.2.0 | age | adoption | passing | confidence | | @types/node (source) | ^18.11.7 -> ^18.11.9 | age | adoption | passing | confidence | | @typescript-eslint/eslint-plugin | ^5.41.0 -> ^5.42.0 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.41.0 -> ^5.42.0 | age | adoption | passing | confidence | | @vitest/coverage-c8 | ^0.24.3 -> ^0.24.5 | age | adoption | passing | confidence | | esbuild | ^0.15.12 -> ^0.15.13 | age | adoption | passing | confidence | | eslint (source) | ^8.26.0 -> ^8.27.0 | age | adoption | passing | confidence | | tsup | ^6.3.0 -> ^6.4.0 | age | adoption | passing | confidence | | vitest | ^0.24.3 -> ^0.24.5 | age | adoption | passing | confidence |


    Release Notes

    conventional-changelog/commitlint (@​commitlint/cli)

    v17.2.0

    Compare Source

    Features

    17.1.2 (2022-08-29)

    Note: Version bump only for package @​commitlint/cli

    17.1.1 (2022-08-27)

    Note: Version bump only for package @​commitlint/cli

    conventional-changelog/commitlint (@​commitlint/config-conventional)

    v17.2.0

    Compare Source

    Note: Version bump only for package @​commitlint/config-conventional

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

    v5.42.0

    Compare Source

    Bug Fixes
    • ast-spec: add TSQualifiedName to TypeNode union (#​5906) (5c316c1)
    • eslint-plugin: [no-extra-parens] handle type assertion in extends clause (#​5901) (8ed7219)
    Features
    • eslint-plugin: [member-ordering] add natural sort order (#​5662) (1eaae09)
    • eslint-plugin: [no-invalid-void-type] better report message for void used as a constituent inside a function return type (#​5274) (d806bda)
    typescript-eslint/typescript-eslint (@​typescript-eslint/parser)

    v5.42.0

    Compare Source

    Features
    Reverts
    vitest-dev/vitest

    v0.24.5

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub

    v0.24.4

    Compare Source

       🚀 Features
       🐞 Bug Fixes
        View changes on GitHub
    evanw/esbuild

    v0.15.13

    Compare Source

    • Add support for the TypeScript 4.9 satisfies operator (#​2509)

      TypeScript 4.9 introduces a new operator called satisfies that lets you check that a given value satisfies a less specific type without casting it to that less specific type and without generating any additional code at run-time. It looks like this:

      const value = { foo: 1, bar: false } satisfies Record<string, number | boolean>
      console.log(value.foo.toFixed(1)) // TypeScript knows that "foo" is a number here
      

      Before this existed, you could use a cast with as to check that a value satisfies a less specific type, but that removes any additional knowledge that TypeScript has about that specific value:

      const value = { foo: 1, bar: false } as Record<string, number | boolean>
      console.log(value.foo.toFixed(1)) // TypeScript no longer knows that "foo" is a number
      

      You can read more about this feature in TypeScript's blog post for 4.9 as well as the associated TypeScript issue for this feature.

      This feature was implemented in esbuild by @​magic-akari.

    • Fix watch mode constantly rebuilding if the parent directory is inaccessible (#​2640)

      Android is unusual in that it has an inaccessible directory in the path to the root, which esbuild was not originally built to handle. To handle cases like this, the path resolution layer in esbuild has a hack where it treats inaccessible directories as empty. However, esbuild's watch implementation currently triggers a rebuild if a directory previously encountered an error but the directory now exists. The assumption is that the previous error was caused by the directory not existing. Although that's usually the case, it's not the case for this particular parent directory on Android. Instead the error is that the directory previously existed but was inaccessible.

      This discrepancy between esbuild's path resolution layer and its watch mode was causing watch mode to rebuild continuously on Android. With this release, esbuild's watch mode instead checks for an error status change in the readdir file system call, so watch mode should no longer rebuild continuously on Android.

    • Apply a fix for a rare deadlock with the JavaScript API (#​1842, #​2485)

      There have been reports of esbuild sometimes exiting with an "all goroutines are asleep" deadlock message from the Go language runtime. This issue hasn't made much progress until recently, where a possible cause was discovered (thanks to @​jfirebaugh for the investigation). This release contains a possible fix for that possible cause, so this deadlock may have been fixed. The fix cannot be easily verified because the deadlock is non-deterministic and rare. If this was indeed the cause, then this issue only affected the JavaScript API in situations where esbuild was already in the process of exiting.

      In detail: The underlying cause is that Go's sync.WaitGroup API for waiting for a set of goroutines to finish is not fully thread-safe. Specifically it's not safe to call Add() concurrently with Wait() when the wait group counter is zero due to a data race. This situation could come up with esbuild's JavaScript API when the host JavaScript process closes the child process's stdin and the child process (with no active tasks) calls Wait() to check that there are no active tasks, at the same time as esbuild's watchdog timer calls Add() to add an active task (that pings the host to see if it's still there). The fix in this release is to avoid calling Add() once we learn that stdin has been closed but before we call Wait().

    eslint/eslint

    v8.27.0

    Compare Source

    Features
    • f14587c feat: new no-new-native-nonconstructor rule (#​16368) (Sosuke Suzuki)
    • 978799b feat: add new rule no-empty-static-block (#​16325) (Sosuke Suzuki)
    • 69216ee feat: no-empty suggest to add comment in empty BlockStatement (#​16470) (Nitin Kumar)
    • 319f0a5 feat: use context.languageOptions.ecmaVersion in core rules (#​16458) (Milos Djermanovic)
    Bug Fixes
    • c3ce521 fix: Ensure unmatched glob patterns throw an error (#​16462) (Nicholas C. Zakas)
    • 886a038 fix: handle files with unspecified path in getRulesMetaForResults (#​16437) (Francesco Trotta)
    Documentation
    • ce93b42 docs: Stylelint property-no-unknown (#​16497) (Nick Schonning)
    • d2cecb4 docs: Stylelint declaration-block-no-shorthand-property-overrides (#​16498) (Nick Schonning)
    • 0a92805 docs: stylelint color-hex-case (#​16496) (Nick Schonning)
    • 74a5af4 docs: fix stylelint error (#​16491) (Milos Djermanovic)
    • 324db1a docs: explicit stylelint color related rules (#​16465) (Nick Schonning)
    • 94dc4f1 docs: use Stylelint for HTML files (#​16468) (Nick Schonning)
    • cc6128d docs: enable stylelint declaration-block-no-duplicate-properties (#​16466) (Nick Schonning)
    • d03a8bf docs: Add heading to justification explanation (#​16430) (Maritaria)
    • 8a15968 docs: add Stylelint configuration and cleanup (#​16379) (Nick Schonning)
    • 9b0a469 docs: note commit messages don't support scope (#​16435) (Andy Edwards)
    • 1581405 docs: improve context.getScope() docs (#​16417) (Ben Perlmutter)
    • b797149 docs: update formatters template (#​16454) (Milos Djermanovic)
    • 5ac4de9 docs: fix link to formatters on the Core Concepts page (#​16455) (Vladislav)
    • 33313ef docs: core-concepts: fix link to semi rule (#​16453) (coderaiser)
    egoist/tsup

    v6.4.0

    Compare Source

    Bug Fixes
    Features

    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - 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, check this box

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

    dependencies 
    opened by renovate[bot] 0
  • Update all non-major dependencies

    Update all non-major dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @types/node (source) | ^18.8.3 -> ^18.11.7 | age | adoption | passing | confidence | | @typescript-eslint/eslint-plugin | ^5.40.1 -> ^5.41.0 | age | adoption | passing | confidence | | @typescript-eslint/parser | ^5.40.1 -> ^5.41.0 | age | adoption | passing | confidence |


    Release Notes

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

    v5.41.0

    Compare Source

    Bug Fixes
    • eslint-plugin: [no-base-to-string] ignore Error, URL, and URLSearchParams by default (#​5839) (96e1c6c)
    • type-utils: prevent stack overflow in isTypeReadonly (#​5860) (a6d8f7e), closes #​4476
    Features
    • eslint-plugin: [no-unsafe-declaration-merging] switch to use scope analysis instead of type information (#​5865) (e70a10a)
    • eslint-plugin: add no-unsafe-declaration-merging (#​5840) (3728031)

    5.40.1 (2022-10-17)

    Bug Fixes
    • eslint-plugin: Skip missing 'rest' tuple type arguments in no-misused-promises (#​5809) (c5beaa2), closes #​5807
    typescript-eslint/typescript-eslint (@​typescript-eslint/parser)

    v5.41.0

    Compare Source

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

    5.40.1 (2022-10-17)

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


    Configuration

    📅 Schedule: Branch creation - "before 12pm on Sunday" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Enabled.

    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 Mend Renovate. View repository job log here.

    dependencies 
    opened by renovate[bot] 0
  • Dependency Dashboard

    Dependency Dashboard

    This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

    Awaiting Schedule

    These updates are awaiting their schedule. Click on a checkbox to get an update now.

    • [ ] chore(deps): update all non-major dependencies (@typescript-eslint/eslint-plugin, @typescript-eslint/parser, @vitest/coverage-c8, esbuild, eslint-config-prettier, husky, vite, vitest)

    Detected dependencies

    npm
    package.json
    • @sapphire/result ^2.6.0
    • @commitlint/cli ^17.3.0
    • @commitlint/config-conventional ^17.3.0
    • @favware/cliff-jumper 1.9.0
    • @sapphire/eslint-config ^4.3.8
    • @sapphire/prettier-config ^1.4.4
    • @sapphire/ts-config ^3.3.4
    • @types/node ^18.11.18
    • @typescript-eslint/eslint-plugin ^5.47.1
    • @typescript-eslint/parser ^5.47.1
    • @vitest/coverage-c8 ^0.26.2
    • cz-conventional-changelog ^3.3.0
    • esbuild ^0.16.12
    • eslint ^8.31.0
    • eslint-config-prettier ^8.5.0
    • eslint-plugin-prettier ^4.2.1
    • husky ^8.0.2
    • lint-staged ^13.1.0
    • pinst ^3.0.0
    • prettier ^2.8.1
    • pretty-quick ^3.1.3
    • tsup ^6.5.0
    • typescript ^4.9.4
    • vite ^4.0.3
    • vitest ^0.26.2
    • ansi-regex ^5.0.1
    • minimist ^1.2.7
    • yarn 3.3.1

    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
Releases(v1.0.2)
Owner
Favware
Favware Open Source Projects
Favware
Nepali Multi Date Picker for jQuery. Supports both single date selections and multiple date selection.

Nepali Multi Date Picker A simple yet powerful date picker based in Nepali calendar. Supports both single date selections and multiple date selection.

Sanil Shakya 4 May 23, 2022
Multiplies a number by zero. Useful for when you need to multiply a number by zero

multiply-by-zero Multiplies a number by zero. Useful for when you need to multiply a number by zero Please consider checking out the links of this pro

Dheirya Tyagi 2 Jul 3, 2022
jquery-input-mask-phone-number.js - A simple, easy jquery format phone number mask library

jquery-input-mask-phone-number A jQuery Plugin to make masks on input field to US phone format. Quick start 1. Add latest jQuery and jquery-input-mask

Raja Rama Mohan Thavalam 12 Aug 25, 2022
Formats message strings with number, date, plural, and select placeholders to create localized messages

Formats message strings with number, date, plural, and select placeholders to create localized messages. Small. Between 700 bytes and 1.3 kilobytes (m

Marcis Bergmanis 35 Oct 30, 2022
esbuild plugin to generate mix-manifest.json file compatible with Laravel Mix.

esbuild-mix-manifest-plugin An esbuild plugin to generate a mix-manifest.json compatible with Laravel Mix. Installation You can install the plugin via

Stefan Zweifel 6 Dec 25, 2022
An esbuild plugin for simplifying global API calls.

esbuild-plugin-global-api This plugin is still experimental, not recommended for production. It may break your code in some cases. An esbuild plugin f

null 4 Nov 15, 2022
jquery plugin to convert number inputs into knobs that can be adjusted by dragging with mouse or fingers

jquery-knobby is a jquery plugin to convert number input elements into turnable knobs that can be adjusted by cyclic dragging with mouse or fingers -

null 4 Oct 2, 2020
this is a single-page web application. we built a book website where the user can add , remove and display books. we used modules to implement these functionalities. also, we used the Date class to display the date and time.

Awsome Books In this Project, we have built A Books websites. Built With ?? HTML CSS javascript Git & Github Live Demo Here you can find the live Demo

Nedjwa Bouraiou 10 Aug 3, 2022
This is just a script I put together to check and notify me via email (MailGun) when there's an earlier date before my initial appointment date. It doesn't handle rescheduling.

US-visa-appointment-notifier This is just a script I put together to check and notify me via email (MailGun) when there's an earlier date before my in

Theophilus Omoregbee 13 Jan 4, 2023
Lightweight and versatile build tool based on the esbuild compiler

Estrella is a lightweight and versatile build tool based on the fantastic esbuild TypeScript and JavaScript compiler. Rebuild automatically when sourc

Rasmus 1.1k Jan 2, 2023
⚡️ Fast, lightweight and powerful development server for esbuild ⚡️

esbuild-server ⚡️ Fast, lightweight and powerful development server for esbuild ⚡️ Zero dependencies besides esbuild API proxy support Live reload SPA

Joel Arvidsson 22 Sep 14, 2022
This is a library that makes it possible to change the configuration values of the Remix compiler (esbuild).

?? remix-esbuild-override ⚠️ While I believe you will most likely get a lot of benefit from using this library, it can sometimes destroy your product.

AijiUejima 73 Dec 22, 2022
🚀 Using top-level await in AWS Lambda with TypeScript, esbuild and Serverless Framework

?? Top-level await in AWS Lamba with TypeScript Articles https://dev.to/oieduardorabelo/top-level-await-in-aws-lamba-with-typescript-1bf0 https://medi

Eduardo Rabelo 17 Nov 23, 2022
Obsidian plugin that allows user to create a glossary of files, an index of files or both.

Obsidian Auto Glossary Auto Glossary is an Obsidian plugin to create a glossary, an index or a glossary with an index from the files you want. Feature

Ennio Italiano 29 Dec 30, 2022
An Obsidian plugin to grab all yaml fields from all files into a dataframe

Metadataframe Metadataframe allows you to get all metadata from your vault into CSV file. With CSV in-hand, you can do any data analysis you want with

null 7 Sep 15, 2022
The Remix version of the fakebooks app demonstrated on https://remix.run. Check out the CRA version: https://github.com/kentcdodds/fakebooks-cra

Remix Fakebooks App This is a (very) simple implementation of the fakebooks mock app demonstrated on remix.run. There is no database, but there is an

Kent C. Dodds 61 Dec 22, 2022
A Bootstrap plugin to create input spinner elements for number input

bootstrap-input-spinner A Bootstrap / jQuery plugin to create input spinner elements for number input. Demo page with examples Examples with floating-

Stefan Haack 220 Nov 7, 2022
A solid create-remix app, that applies best practices into a clean, batteries included template. SQLite version. Deploys to Fly.io

Remix Barebones Stack npx create-remix --template dev-xo/barebones-stack A solid create-remix app, that follows community guidelines and applies best

Dev XO 97 Dec 30, 2022
Bys is an npm/yarn library to merge your js and ts files into one file.

Bundle your scripts (bys) Bys is an npm/yarn library to merge your js and ts files into one file. Installation Use the npm or yarn package manager to

FlamesX128 3 Dec 8, 2022