diff --git a/.gitignore b/.gitignore index aaaa685c469..f6615b09de5 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ /npm/@esbuild/android-x64/esbuild.wasm /npm/@esbuild/android-x64/wasm_exec_node.js /npm/@esbuild/android-x64/wasm_exec.js +/npm/@esbuild/wasi-preview1/esbuild.wasm /npm/esbuild-wasm/browser.js /npm/esbuild-wasm/esbuild.wasm /npm/esbuild-wasm/esm/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 581145a28cc..d3a9e4f3ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,14 @@ The ECMAScript 2024 specification was just approved, so it has been added to esbuild as a possible compilation target. You can read more about the features that it adds here: [https://2ality.com/2024/06/ecmascript-2024.html](https://2ality.com/2024/06/ecmascript-2024.html). The only addition that's relevant for esbuild is the regular expression `/v` flag. With `--target=es2024`, regular expressions that use the `/v` flag will now be passed through untransformed instead of being transformed into a call to `new RegExp`. +* Publish binaries for WASI (WebAssembly System Interface) preview 1 ([#3300](https://github.com/evanw/esbuild/issues/3300), [#3779](https://github.com/evanw/esbuild/pull/3779)) + + The upcoming WASI (WebAssembly System Interface) standard is going to be a way to run WebAssembly outside of a JavaScript host environment. In this scenario you only need a `.wasm` file without any supporting JavaScript code. Instead of JavaScript providing the APIs for the host environment, the WASI standard specifies a "system interface" that WebAssembly code can access directly (e.g. for file system access). + + Development versions of the WASI specification are being released using preview numbers. The people behind WASI are currently working on preview 2 but the Go compiler has [released support for preview 1](https://go.dev/blog/wasi), which from what I understand is now considered an unsupported legacy release. However, some people have requested that esbuild publish binary executables that support WASI preview 1 so they can experiment with them. + + This release publishes esbuild precompiled for WASI preview 1 to the `@esbuild/wasi-preview1` package on npm (specifically the file `@esbuild/wasi-preview1/esbuild.wasm`). This binary executable has not been tested and won't be officially supported, as it's for an old preview release of a specification that has since moved in another direction. If it works for you, great! If not, then you'll likely have to wait for the ecosystem to evolve before using esbuild with WASI. For example, it sounds like perhaps WASI preview 1 doesn't include support for opening network sockets so esbuild's local development server is unlikely to work with WASI preview 1. + * Warn about `onResolve` plugins not setting a path ([#3790](https://github.com/evanw/esbuild/issues/3790)) Plugins that return values from `onResolve` without resolving the path (i.e. without setting either `path` or `external: true`) will now cause a warning. This is because esbuild only uses return values from `onResolve` if it successfully resolves the path, and it's not good for invalid input to be silently ignored. diff --git a/Makefile b/Makefile index 6e2f4354bd2..1d25584f648 100644 --- a/Makefile +++ b/Makefile @@ -306,6 +306,7 @@ platform-all: platform-neutral \ platform-openbsd-x64 \ platform-sunos-x64 \ + platform-wasi-preview1 \ platform-wasm \ platform-win32-arm64 \ platform-win32-ia32 \ @@ -323,6 +324,10 @@ platform-win32-arm64: version-go node scripts/esbuild.js npm/@esbuild/win32-arm64/package.json --version CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(GO_FLAGS) -o npm/@esbuild/win32-arm64/esbuild.exe ./cmd/esbuild +platform-wasi-preview1: version-go + node scripts/esbuild.js npm/@esbuild/wasi-preview1/package.json --version + CGO_ENABLED=0 GOOS=wasip1 GOARCH=wasm go build $(GO_FLAGS) -o npm/@esbuild/wasi-preview1/esbuild.wasm ./cmd/esbuild + platform-unixlike: version-go @test -n "$(GOOS)" || (echo "The environment variable GOOS must be provided" && false) @test -n "$(GOARCH)" || (echo "The environment variable GOARCH must be provided" && false) @@ -428,7 +433,7 @@ publish-all: check-go-version publish-win32-x64 \ publish-win32-ia32 \ publish-win32-arm64 \ - publish-sunos-x64 + publish-wasi-preview1 @echo Enter one-time password: @read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \ @@ -462,7 +467,8 @@ publish-all: check-go-version @read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \ publish-aix-ppc64 \ publish-linux-ppc64 \ - publish-linux-s390x + publish-linux-s390x \ + publish-sunos-x64 # Do these last to avoid race conditions @echo Enter one-time password: @@ -483,6 +489,9 @@ publish-win32-ia32: platform-win32-ia32 publish-win32-arm64: platform-win32-arm64 test -n "$(OTP)" && cd npm/@esbuild/win32-arm64 && npm publish --otp="$(OTP)" +publish-wasi-preview1: platform-wasi-preview1 + test -n "$(OTP)" && cd npm/@esbuild/wasi-preview1 && npm publish --otp="$(OTP)" + publish-aix-ppc64: platform-aix-ppc64 test -n "$(OTP)" && cd npm/@esbuild/aix-ppc64 && npm publish --otp="$(OTP)" @@ -604,6 +613,7 @@ validate-builds: @$(MAKE) --no-print-directory TARGET=platform-netbsd-x64 SCOPE=@esbuild/ PACKAGE=netbsd-x64 SUBPATH=bin/esbuild validate-build @$(MAKE) --no-print-directory TARGET=platform-openbsd-x64 SCOPE=@esbuild/ PACKAGE=openbsd-x64 SUBPATH=bin/esbuild validate-build @$(MAKE) --no-print-directory TARGET=platform-sunos-x64 SCOPE=@esbuild/ PACKAGE=sunos-x64 SUBPATH=bin/esbuild validate-build + @$(MAKE) --no-print-directory TARGET=platform-wasi-preview1 SCOPE=@esbuild/ PACKAGE=wasi-preview1 SUBPATH=esbuild.wasm validate-build @$(MAKE) --no-print-directory TARGET=platform-wasm PACKAGE=esbuild-wasm SUBPATH=esbuild.wasm validate-build @$(MAKE) --no-print-directory TARGET=platform-win32-arm64 SCOPE=@esbuild/ PACKAGE=win32-arm64 SUBPATH=esbuild.exe validate-build @$(MAKE) --no-print-directory TARGET=platform-win32-ia32 SCOPE=@esbuild/ PACKAGE=win32-ia32 SUBPATH=esbuild.exe validate-build @@ -613,6 +623,7 @@ clean: go clean -cache go clean -testcache rm -f esbuild + rm -f npm/@esbuild/wasi-preview1/esbuild.wasm rm -f npm/@esbuild/win32-arm64/esbuild.exe rm -f npm/@esbuild/win32-ia32/esbuild.exe rm -f npm/@esbuild/win32-x64/esbuild.exe diff --git a/npm/@esbuild/wasi-preview1/README.md b/npm/@esbuild/wasi-preview1/README.md new file mode 100644 index 00000000000..5cb51d5a507 --- /dev/null +++ b/npm/@esbuild/wasi-preview1/README.md @@ -0,0 +1,3 @@ +# esbuild + +This is the WASI (WebAssembly System Interface) preview 1 binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/npm/@esbuild/wasi-preview1/package.json b/npm/@esbuild/wasi-preview1/package.json new file mode 100644 index 00000000000..e82ec08ffb8 --- /dev/null +++ b/npm/@esbuild/wasi-preview1/package.json @@ -0,0 +1,10 @@ +{ + "name": "@esbuild/wasi-preview1", + "version": "0.21.5", + "description": "The WASI (WebAssembly System Interface) preview 1 binary for esbuild, a JavaScript bundler.", + "repository": { + "type": "git", + "url": "git+https://github.com/evanw/esbuild.git" + }, + "license": "MIT" +}