diff --git a/examples/esbuild/WORKSPACE b/examples/esbuild/WORKSPACE index 92e689924f..a958bb88b6 100644 --- a/examples/esbuild/WORKSPACE +++ b/examples/esbuild/WORKSPACE @@ -25,12 +25,12 @@ http_archive( urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.2.3/rules_nodejs-3.2.3.tar.gz"], ) -_ESBUILD_VERSION = "0.8.48" +_ESBUILD_VERSION = "0.11.5" http_archive( name = "esbuild_darwin", build_file_content = """exports_files(["bin/esbuild"])""", - sha256 = "d21a722873ed24586f071973b77223553fca466946f3d7e3976eeaccb14424e6", + sha256 = "98436890727bdb0d4beddd9c9e07d0aeff0e8dfe0169f85e568eca0dd43f665e", strip_prefix = "package", urls = [ "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-%s.tgz" % _ESBUILD_VERSION, @@ -40,7 +40,7 @@ http_archive( http_archive( name = "esbuild_windows", build_file_content = """exports_files(["esbuild.exe"])""", - sha256 = "fe5dcb97b4c47f9567012f0a45c19c655f3d2e0d76932f6dd12715dbebbd6eb0", + sha256 = "589c8ff97210bd41de106e6317ce88f9e88d2cacfd8178ae1217f2b857ff6c3a", strip_prefix = "package", urls = [ "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-%s.tgz" % _ESBUILD_VERSION, @@ -50,7 +50,7 @@ http_archive( http_archive( name = "esbuild_linux", build_file_content = """exports_files(["bin/esbuild"])""", - sha256 = "60dabe141e5dfcf99e7113bded6012868132068a582a102b258fb7b1cfdac14b", + sha256 = "113c2e84895f4422a3676db4e15d9f01b2b4fac041edab25284fdb9574ba58a0", strip_prefix = "package", urls = [ "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-%s.tgz" % _ESBUILD_VERSION, diff --git a/packages/esbuild/_README.md b/packages/esbuild/_README.md index 59135f1805..05e0f6e19e 100644 --- a/packages/esbuild/_README.md +++ b/packages/esbuild/_README.md @@ -18,7 +18,7 @@ yarn add -D @bazel/esbuild Add an `http_archive` fetching the esbuild binary for each platform that you need to support. ```python -_ESBUILD_VERSION = "0.8.48" # reminder: update SHAs below when changing this value +_ESBUILD_VERSION = "0.11.5" # reminder: update SHAs below when changing this value http_archive( name = "esbuild_darwin", urls = [ @@ -26,7 +26,7 @@ http_archive( ], strip_prefix = "package", build_file_content = """exports_files(["bin/esbuild"])""", - sha256 = "d21a722873ed24586f071973b77223553fca466946f3d7e3976eeaccb14424e6", + sha256 = "98436890727bdb0d4beddd9c9e07d0aeff0e8dfe0169f85e568eca0dd43f665e", ) http_archive( @@ -36,7 +36,7 @@ http_archive( ], strip_prefix = "package", build_file_content = """exports_files(["esbuild.exe"])""", - sha256 = "fe5dcb97b4c47f9567012f0a45c19c655f3d2e0d76932f6dd12715dbebbd6eb0", + sha256 = "589c8ff97210bd41de106e6317ce88f9e88d2cacfd8178ae1217f2b857ff6c3a", ) http_archive( @@ -46,7 +46,7 @@ http_archive( ], strip_prefix = "package", build_file_content = """exports_files(["bin/esbuild"])""", - sha256 = "60dabe141e5dfcf99e7113bded6012868132068a582a102b258fb7b1cfdac14b", + sha256 = "113c2e84895f4422a3676db4e15d9f01b2b4fac041edab25284fdb9574ba58a0", ) ``` diff --git a/packages/esbuild/esbuild.bzl b/packages/esbuild/esbuild.bzl index b3a8220ca8..41218731ec 100644 --- a/packages/esbuild/esbuild.bzl +++ b/packages/esbuild/esbuild.bzl @@ -68,8 +68,8 @@ def _esbuild_impl(ctx): args.add_all(ctx.attr.define, format_each = "--define:%s") args.add_all(ctx.attr.external, format_each = "--external:%s") - # disable the error limit and show all errors - args.add_joined(["--error-limit", "0"], join_with = "=") + # disable the log limit and show all logs + args.add_joined(["--log-limit", "0"], join_with = "=") if ctx.attr.minify: args.add("--minify") diff --git a/packages/esbuild/esbuild_repo.bzl b/packages/esbuild/esbuild_repo.bzl index 2b9cbcba21..c89f6bf001 100644 --- a/packages/esbuild/esbuild_repo.bzl +++ b/packages/esbuild/esbuild_repo.bzl @@ -6,7 +6,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # IMPORTANT: Keep this file in sync with the documentation in _README.md -_VERSION = "0.8.48" # reminder: update SHAs below when changing this version +_VERSION = "0.11.5" # reminder: update SHAs below when changing this version def esbuild_dependencies(): """Helper to install required dependencies for the esbuild rules""" @@ -20,7 +20,7 @@ def esbuild_dependencies(): ], strip_prefix = "package", build_file_content = """exports_files(["bin/esbuild"])""", - sha256 = "d21a722873ed24586f071973b77223553fca466946f3d7e3976eeaccb14424e6", + sha256 = "98436890727bdb0d4beddd9c9e07d0aeff0e8dfe0169f85e568eca0dd43f665e", ) http_archive( @@ -30,7 +30,7 @@ def esbuild_dependencies(): ], strip_prefix = "package", build_file_content = """exports_files(["esbuild.exe"])""", - sha256 = "fe5dcb97b4c47f9567012f0a45c19c655f3d2e0d76932f6dd12715dbebbd6eb0", + sha256 = "589c8ff97210bd41de106e6317ce88f9e88d2cacfd8178ae1217f2b857ff6c3a", ) http_archive( @@ -40,5 +40,5 @@ def esbuild_dependencies(): ], strip_prefix = "package", build_file_content = """exports_files(["bin/esbuild"])""", - sha256 = "60dabe141e5dfcf99e7113bded6012868132068a582a102b258fb7b1cfdac14b", + sha256 = "113c2e84895f4422a3676db4e15d9f01b2b4fac041edab25284fdb9574ba58a0", ) diff --git a/packages/esbuild/test/splitting/bundle.spec.js b/packages/esbuild/test/splitting/bundle.spec.js index fe78b0957a..4cfcd59e69 100644 --- a/packages/esbuild/test/splitting/bundle.spec.js +++ b/packages/esbuild/test/splitting/bundle.spec.js @@ -5,13 +5,13 @@ const helper = require(process.env.BAZEL_NODE_RUNFILES_HELPER); const location = helper.resolve('build_bazel_rules_nodejs/packages/esbuild/test/splitting/bundle'); const main = readFileSync(join(location, 'main.js'), {encoding: 'utf8'}); -const hasImportOfCore = main.indexOf(`import("./other.js")`) > -1; +const hasImportOfCore = main.match(/import\(".\/(other-[a-zA-Z0-9]+\.js)"\)/); if (!hasImportOfCore) { - console.error(`Expected entry_point 'main.js' to have an import of './other.js'`); + console.error(`Expected entry_point 'main.js' to have an import of './other-[hash].js'`); } // throws if file does not exist -lstatSync(join(location, 'other.js')); +lstatSync(join(location, hasImportOfCore && hasImportOfCore[1])); process.exit(hasImportOfCore ? 0 : 1); diff --git a/packages/esbuild/test/typescript/BUILD.bazel b/packages/esbuild/test/typescript/BUILD.bazel index 16ca26eab4..7ac2d609eb 100644 --- a/packages/esbuild/test/typescript/BUILD.bazel +++ b/packages/esbuild/test/typescript/BUILD.bazel @@ -19,7 +19,10 @@ ts_library( esbuild( name = "bundle", - args = ["--keep-names"], + args = [ + "--keep-names", + "--resolve-extensions=.mjs,.js", + ], entry_point = "main.ts", format = "esm", deps = [":main"], diff --git a/packages/esbuild/test/typescript/bundle.golden.txt b/packages/esbuild/test/typescript/bundle.golden.txt index 9039c1c4c2..45a73a0baf 100644 --- a/packages/esbuild/test/typescript/bundle.golden.txt +++ b/packages/esbuild/test/typescript/bundle.golden.txt @@ -6,14 +6,8 @@ var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __markAsModule = (target) => __defProp(target, "__esModule", {value: true}); var __name = (target, value) => __defProp(target, "name", {value, configurable: true}); -var __commonJS = (callback, module) => () => { - if (!module) { - module = {exports: {}}; - callback(module.exports, module); - } - return module.exports; -}; -var __exportStar = (target, module, desc) => { +var __commonJS = (cb, mod) => () => (mod || cb((mod = {exports: {}}).exports, mod), mod.exports); +var __reExport = (target, module, desc) => { if (module && typeof module === "object" || typeof module === "function") { for (let key of __getOwnPropNames(module)) if (!__hasOwnProp.call(target, key) && key !== "default") @@ -22,9 +16,7 @@ var __exportStar = (target, module, desc) => { return target; }; var __toModule = (module) => { - if (module && module.__esModule) - return module; - return __exportStar(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", {value: module, enumerable: true})), module); + return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: () => module.default, enumerable: true} : {value: module, enumerable: true})), module); }; @@ -60,7 +52,7 @@ var getId3 = /* @__PURE__ */ __name(() => `generated-module`, "getId"); var getId4 = /* @__PURE__ */ __name(() => "relative-module", "getId"); -var ID = `Full ID: ${getId()} - ${getId2()} - ${import_module_dynamic.getId()} - ${getId4()} - ${getId3()}`; +var ID = `Full ID: ${getId()} - ${getId2()} - ${(0, import_module_dynamic.getId)()} - ${getId4()} - ${getId3()}`; console.log(ID); export { ID