github.com/evanw/esbuild@v0.21.4/Makefile (about)

     1  ESBUILD_VERSION = $(shell cat version.txt)
     2  
     3  # Strip debug info
     4  GO_FLAGS += "-ldflags=-s -w"
     5  
     6  # Avoid embedding the build path in the executable for more reproducible builds
     7  GO_FLAGS += -trimpath
     8  
     9  esbuild: version-go cmd/esbuild/*.go pkg/*/*.go internal/*/*.go go.mod
    10  	CGO_ENABLED=0 go build $(GO_FLAGS) ./cmd/esbuild
    11  
    12  test:
    13  	@$(MAKE) --no-print-directory -j6 test-common
    14  
    15  # These tests are for development
    16  test-common: test-go vet-go no-filepath verify-source-map end-to-end-tests js-api-tests plugin-tests register-test node-unref-tests decorator-tests
    17  
    18  # These tests are for release (the extra tests are not included in "test" because they are pretty slow)
    19  test-all:
    20  	@$(MAKE) --no-print-directory -j6 test-common test-deno ts-type-tests test-wasm-node test-wasm-browser lib-typecheck test-yarnpnp
    21  
    22  check-go-version:
    23  	@go version | grep ' go1\.20\.12 ' || (echo 'Please install Go version 1.20.12' && false)
    24  
    25  # Note: Don't add "-race" here by default. The Go race detector is currently
    26  # only supported on the following configurations:
    27  #
    28  #   darwin/amd64
    29  #   darwin/arm64
    30  #   freebsd/amd64,
    31  #   linux/amd64
    32  #   linux/arm64
    33  #   linux/ppc64le
    34  #   netbsd/amd64
    35  #   windows/amd64
    36  #
    37  # Also, it isn't necessarily supported on older OS versions even if the OS/CPU
    38  # combination is supported, such as on macOS 10.9. If you want to test using
    39  # the race detector, you can manually add it using the ESBUILD_RACE environment
    40  # variable like this: "ESBUILD_RACE=-race make test". Or you can permanently
    41  # enable it by adding "export ESBUILD_RACE=-race" to your shell profile.
    42  test-go:
    43  	go test $(ESBUILD_RACE) ./internal/... ./pkg/...
    44  
    45  vet-go:
    46  	go vet ./cmd/... ./internal/... ./pkg/...
    47  
    48  fmt-go:
    49  	test -z "$(shell go fmt ./cmd/... ./internal/... ./pkg/... )"
    50  
    51  no-filepath:
    52  	@! grep --color --include '*.go' -r '"path/filepath"' cmd internal pkg || ( \
    53  		echo 'error: Use of "path/filepath" is disallowed. See http://golang.org/issue/43768.' && false)
    54  
    55  # This uses "env -i" to run in a clean environment with no environment
    56  # variables. It then adds some environment variables back as needed.
    57  # This is a hack to avoid a problem with the WebAssembly support in Go
    58  # 1.17.2, which will crash when run in an environment with over 4096
    59  # bytes of environment variable data such as GitHub Actions.
    60  test-wasm-node: esbuild
    61  	env -i $(shell go env) PATH="$(shell go env GOROOT)/misc/wasm:$(PATH)" GOOS=js GOARCH=wasm go test ./internal/...
    62  	node scripts/wasm-tests.js
    63  
    64  test-wasm-browser: platform-wasm | scripts/browser/node_modules
    65  	cd scripts/browser && node browser-tests.js
    66  
    67  test-deno: esbuild platform-deno
    68  	ESBUILD_BINARY_PATH="$(shell pwd)/esbuild" deno test --allow-run --allow-env --allow-net --allow-read --allow-write --no-check scripts/deno-tests.js
    69  	@echo '✅ deno tests passed' # I couldn't find a Deno API for telling when tests have failed, so I'm doing this here instead
    70  	deno eval 'import { transform, stop } from "file://$(shell pwd)/deno/mod.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;"
    71  	deno eval 'import { transform, stop } from "file://$(shell pwd)/deno/wasm.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;"
    72  
    73  test-deno-windows: esbuild platform-deno
    74  	ESBUILD_BINARY_PATH=./esbuild.exe deno test --allow-run --allow-env --allow-net --allow-read --allow-write --no-check scripts/deno-tests.js
    75  
    76  register-test: version-go | scripts/node_modules
    77  	node scripts/esbuild.js npm/esbuild/package.json --version
    78  	node scripts/register-test.js
    79  
    80  verify-source-map: version-go | scripts/node_modules
    81  	node scripts/esbuild.js npm/esbuild/package.json --version
    82  	node scripts/verify-source-map.js
    83  
    84  end-to-end-tests: version-go
    85  	node scripts/esbuild.js npm/esbuild/package.json --version
    86  	node scripts/end-to-end-tests.js
    87  
    88  # Note: The TypeScript source code for these tests was copied from the repo
    89  # https://github.com/evanw/decorator-tests, which is the official location of
    90  # the source code for these tests. Any changes to these tests should be made
    91  # there first and then copied here afterward.
    92  decorator-tests: esbuild
    93  	./esbuild scripts/decorator-tests.ts --target=es2022 --outfile=scripts/decorator-tests.js
    94  	node scripts/decorator-tests.js
    95  	node scripts/decorator-tests.js | grep -q 'All checks passed'
    96  	git diff --exit-code scripts/decorator-tests.js
    97  
    98  js-api-tests: version-go
    99  	node scripts/esbuild.js npm/esbuild/package.json --version
   100  	node scripts/js-api-tests.js
   101  
   102  plugin-tests: version-go
   103  	node scripts/plugin-tests.js
   104  
   105  ts-type-tests: | scripts/node_modules
   106  	node scripts/ts-type-tests.js
   107  
   108  require/old-ts/node_modules:
   109  	cd require/old-ts && npm ci
   110  
   111  test-old-ts: platform-neutral | require/old-ts/node_modules
   112  	rm -fr scripts/.test-old-ts && mkdir scripts/.test-old-ts
   113  	cp `find npm/esbuild -name '*.d.ts'` scripts/.test-old-ts
   114  	cd scripts/.test-old-ts && ../../require/old-ts/node_modules/.bin/tsc *.d.ts
   115  	rm -fr scripts/.test-old-ts
   116  
   117  node-unref-tests: | scripts/node_modules
   118  	node scripts/node-unref-tests.js
   119  
   120  lib-typecheck: lib-typecheck-node lib-typecheck-node-nolib lib-typecheck-deno
   121  
   122  lib-typecheck-node: | lib/node_modules
   123  	cd lib && node_modules/.bin/tsc -noEmit -p tsconfig.json
   124  
   125  lib-typecheck-node-nolib: | lib/node_modules
   126  	cd lib && node_modules/.bin/tsc -noEmit -p tsconfig-nolib.json
   127  
   128  lib-typecheck-deno: lib/deno/lib.deno.d.ts | lib/node_modules
   129  	cd lib && node_modules/.bin/tsc -noEmit -p tsconfig-deno.json
   130  
   131  lib/deno/lib.deno.d.ts:
   132  	deno types > lib/deno/lib.deno.d.ts
   133  
   134  # End-to-end tests
   135  test-e2e: test-e2e-npm test-e2e-pnpm test-e2e-yarn test-e2e-yarn-berry test-e2e-deno
   136  
   137  test-e2e-npm:
   138  	# Test normal install
   139  	rm -fr e2e-npm && mkdir e2e-npm && cd e2e-npm && echo {} > package.json && npm i esbuild
   140  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   141  	# Test CI reinstall
   142  	cd e2e-npm && npm ci
   143  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   144  	# Test rebuild
   145  	cd e2e-npm && npm rebuild && npm rebuild
   146  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   147  
   148  	# Test install without scripts
   149  	rm -fr e2e-npm && mkdir e2e-npm && cd e2e-npm && echo {} > package.json && npm i --ignore-scripts esbuild
   150  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   151  	# Test CI reinstall
   152  	cd e2e-npm && npm ci
   153  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   154  	# Test rebuild
   155  	cd e2e-npm && npm rebuild && npm rebuild
   156  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   157  
   158  	# Test install without optional dependencies
   159  	rm -fr e2e-npm && mkdir e2e-npm && cd e2e-npm && echo {} > package.json && npm i --no-optional esbuild
   160  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   161  	# Test CI reinstall
   162  	cd e2e-npm && npm ci
   163  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   164  	# Test rebuild
   165  	cd e2e-npm && npm rebuild && npm rebuild
   166  	cd e2e-npm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   167  
   168  	# Clean up
   169  	rm -fr e2e-npm
   170  
   171  test-e2e-pnpm:
   172  	# Test normal install
   173  	rm -fr e2e-pnpm && mkdir e2e-pnpm && cd e2e-pnpm && echo {} > package.json && pnpm i esbuild
   174  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   175  	# Test CI reinstall
   176  	cd e2e-pnpm && pnpm i --frozen-lockfile
   177  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   178  	# Test rebuild
   179  	cd e2e-pnpm && pnpm rebuild && pnpm rebuild
   180  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   181  
   182  	# Test install without scripts
   183  	rm -fr e2e-pnpm && mkdir e2e-pnpm && cd e2e-pnpm && echo {} > package.json && pnpm i --ignore-scripts esbuild
   184  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   185  	# Test CI reinstall
   186  	cd e2e-pnpm && pnpm i --frozen-lockfile
   187  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   188  	# Test rebuild
   189  	cd e2e-pnpm && pnpm rebuild && pnpm rebuild
   190  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   191  
   192  	# Test install without optional dependencies
   193  	rm -fr e2e-pnpm && mkdir e2e-pnpm && cd e2e-pnpm && echo {} > package.json && pnpm i --no-optional esbuild
   194  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   195  	# Test CI reinstall
   196  	cd e2e-pnpm && pnpm i --frozen-lockfile
   197  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   198  	# Test rebuild
   199  	cd e2e-pnpm && pnpm rebuild && pnpm rebuild
   200  	cd e2e-pnpm && echo "1+2" | node_modules/.bin/esbuild | grep "1 + 2;" && node -p "require('esbuild').transformSync('1+2').code" | grep "1 + 2;"
   201  
   202  	# Clean up
   203  	rm -fr e2e-pnpm
   204  
   205  test-e2e-yarn:
   206  	# Test normal install
   207  	rm -fr e2e-yarn && mkdir e2e-yarn && cd e2e-yarn && echo {} > package.json && touch yarn.lock && yarn set version classic && yarn add esbuild
   208  	cd e2e-yarn && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   209  	# Test CI reinstall
   210  	cd e2e-yarn && rm -fr node_modules && yarn install --immutable
   211  	cd e2e-yarn && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   212  
   213  	# Test install without scripts
   214  	rm -fr e2e-yarn && mkdir e2e-yarn && cd e2e-yarn && echo {} > package.json && touch yarn.lock && echo 'enableScripts: false' > .yarnrc.yml && yarn set version classic && yarn add esbuild
   215  	cd e2e-yarn && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   216  	# Test CI reinstall
   217  	cd e2e-yarn && rm -fr node_modules && yarn install --immutable
   218  	cd e2e-yarn && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   219  
   220  	# Test install without optional dependencies
   221  	rm -fr e2e-yarn && mkdir e2e-yarn && cd e2e-yarn && echo {} > package.json && touch yarn.lock && yarn set version classic && yarn add esbuild
   222  	cd e2e-yarn && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   223  	# Test CI reinstall
   224  	cd e2e-yarn && rm -fr node_modules && yarn install --immutable --ignore-optional
   225  	cd e2e-yarn && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   226  
   227  	# Clean up
   228  	rm -fr e2e-yarn
   229  
   230  test-e2e-yarn-berry:
   231  	# Test normal install
   232  	rm -fr e2e-yb && mkdir e2e-yb && cd e2e-yb && echo {} > package.json && touch yarn.lock && yarn set version berry && yarn add esbuild
   233  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   234  	# Test CI reinstall
   235  	cd e2e-yb && yarn install --immutable
   236  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   237  	# Test rebuild
   238  	cd e2e-yb && yarn rebuild && yarn rebuild
   239  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   240  
   241  	# Test install without scripts
   242  	rm -fr e2e-yb && mkdir e2e-yb && cd e2e-yb && echo {} > package.json && touch yarn.lock && echo 'enableScripts: false' > .yarnrc.yml && yarn set version berry && yarn add esbuild
   243  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   244  	# Test CI reinstall
   245  	cd e2e-yb && yarn install --immutable
   246  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   247  	# Test rebuild
   248  	cd e2e-yb && yarn rebuild && yarn rebuild
   249  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   250  
   251  	# Test install without optional dependencies
   252  	rm -fr e2e-yb && mkdir e2e-yb && cd e2e-yb && echo {} > package.json && touch yarn.lock && yarn set version berry && yarn add --no-optional esbuild
   253  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   254  	# Test CI reinstall
   255  	cd e2e-yb && yarn install --immutable
   256  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   257  	# Test rebuild
   258  	cd e2e-yb && yarn rebuild && yarn rebuild
   259  	cd e2e-yb && echo "1+2" | yarn esbuild && yarn node -p "require('esbuild').transformSync('1+2').code"
   260  
   261  	# Clean up
   262  	rm -fr e2e-yb
   263  
   264  test-e2e-deno:
   265  	deno eval 'import { transform, stop } from "https://deno.land/x/esbuild@v$(ESBUILD_VERSION)/mod.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;"
   266  	deno eval 'import { transform, stop } from "https://deno.land/x/esbuild@v$(ESBUILD_VERSION)/wasm.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;"
   267  
   268  test-yarnpnp: platform-wasm
   269  	node scripts/test-yarnpnp.js
   270  
   271  # Note: This used to only be rebuilt when "version.txt" was newer than
   272  # "cmd/esbuild/version.go", but that caused the publishing script to publish
   273  # invalid builds in the case when the publishing script failed once, the change
   274  # to "cmd/esbuild/version.go" was reverted, and then the publishing script was
   275  # run again, since in that case "cmd/esbuild/version.go" has a later mtime than
   276  # "version.txt" but is still outdated.
   277  #
   278  # To avoid this problem, we now always run this step regardless of mtime status.
   279  # This step still avoids writing to "cmd/esbuild/version.go" if it already has
   280  # the correct contents, so it won't unnecessarily invalidate anything that uses
   281  # "cmd/esbuild/version.go" as a dependency.
   282  version-go:
   283  	node scripts/esbuild.js --update-version-go
   284  
   285  platform-all:
   286  	@$(MAKE) --no-print-directory -j4 \
   287  		platform-aix-ppc64 \
   288  		platform-android-arm \
   289  		platform-android-arm64 \
   290  		platform-android-x64 \
   291  		platform-darwin-arm64 \
   292  		platform-darwin-x64 \
   293  		platform-deno \
   294  		platform-freebsd-arm64 \
   295  		platform-freebsd-x64 \
   296  		platform-linux-arm \
   297  		platform-linux-arm64 \
   298  		platform-linux-ia32 \
   299  		platform-linux-loong64 \
   300  		platform-linux-mips64el \
   301  		platform-linux-ppc64 \
   302  		platform-linux-riscv64 \
   303  		platform-linux-s390x \
   304  		platform-linux-x64 \
   305  		platform-netbsd-x64 \
   306  		platform-neutral \
   307  		platform-openbsd-x64 \
   308  		platform-sunos-x64 \
   309  		platform-wasm \
   310  		platform-win32-arm64 \
   311  		platform-win32-ia32 \
   312  		platform-win32-x64
   313  
   314  platform-win32-x64: version-go
   315  	node scripts/esbuild.js npm/@esbuild/win32-x64/package.json --version
   316  	CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(GO_FLAGS) -o npm/@esbuild/win32-x64/esbuild.exe ./cmd/esbuild
   317  
   318  platform-win32-ia32: version-go
   319  	node scripts/esbuild.js npm/@esbuild/win32-ia32/package.json --version
   320  	CGO_ENABLED=0 GOOS=windows GOARCH=386 go build $(GO_FLAGS) -o npm/@esbuild/win32-ia32/esbuild.exe ./cmd/esbuild
   321  
   322  platform-win32-arm64: version-go
   323  	node scripts/esbuild.js npm/@esbuild/win32-arm64/package.json --version
   324  	CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build $(GO_FLAGS) -o npm/@esbuild/win32-arm64/esbuild.exe ./cmd/esbuild
   325  
   326  platform-unixlike: version-go
   327  	@test -n "$(GOOS)" || (echo "The environment variable GOOS must be provided" && false)
   328  	@test -n "$(GOARCH)" || (echo "The environment variable GOARCH must be provided" && false)
   329  	@test -n "$(NPMDIR)" || (echo "The environment variable NPMDIR must be provided" && false)
   330  	node scripts/esbuild.js "$(NPMDIR)/package.json" --version
   331  	CGO_ENABLED=0 GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build $(GO_FLAGS) -o "$(NPMDIR)/bin/esbuild" ./cmd/esbuild
   332  
   333  platform-android-x64: platform-wasm
   334  	node scripts/esbuild.js npm/@esbuild/android-x64/package.json --version
   335  
   336  platform-android-arm: platform-wasm
   337  	node scripts/esbuild.js npm/@esbuild/android-arm/package.json --version
   338  
   339  platform-aix-ppc64:
   340  	@$(MAKE) --no-print-directory GOOS=aix GOARCH=ppc64 NPMDIR=npm/@esbuild/aix-ppc64 platform-unixlike
   341  
   342  platform-android-arm64:
   343  	@$(MAKE) --no-print-directory GOOS=android GOARCH=arm64 NPMDIR=npm/@esbuild/android-arm64 platform-unixlike
   344  
   345  platform-darwin-x64:
   346  	@$(MAKE) --no-print-directory GOOS=darwin GOARCH=amd64 NPMDIR=npm/@esbuild/darwin-x64 platform-unixlike
   347  
   348  platform-darwin-arm64:
   349  	@$(MAKE) --no-print-directory GOOS=darwin GOARCH=arm64 NPMDIR=npm/@esbuild/darwin-arm64 platform-unixlike
   350  
   351  platform-freebsd-x64:
   352  	@$(MAKE) --no-print-directory GOOS=freebsd GOARCH=amd64 NPMDIR=npm/@esbuild/freebsd-x64 platform-unixlike
   353  
   354  platform-freebsd-arm64:
   355  	@$(MAKE) --no-print-directory GOOS=freebsd GOARCH=arm64 NPMDIR=npm/@esbuild/freebsd-arm64 platform-unixlike
   356  
   357  platform-netbsd-x64:
   358  	@$(MAKE) --no-print-directory GOOS=netbsd GOARCH=amd64 NPMDIR=npm/@esbuild/netbsd-x64 platform-unixlike
   359  
   360  platform-openbsd-x64:
   361  	@$(MAKE) --no-print-directory GOOS=openbsd GOARCH=amd64 NPMDIR=npm/@esbuild/openbsd-x64 platform-unixlike
   362  
   363  platform-linux-x64:
   364  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=amd64 NPMDIR=npm/@esbuild/linux-x64 platform-unixlike
   365  
   366  platform-linux-ia32:
   367  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=386 NPMDIR=npm/@esbuild/linux-ia32 platform-unixlike
   368  
   369  platform-linux-arm:
   370  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=arm NPMDIR=npm/@esbuild/linux-arm platform-unixlike
   371  
   372  platform-linux-arm64:
   373  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=arm64 NPMDIR=npm/@esbuild/linux-arm64 platform-unixlike
   374  
   375  platform-linux-loong64:
   376  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=loong64 NPMDIR=npm/@esbuild/linux-loong64 platform-unixlike
   377  
   378  platform-linux-mips64el:
   379  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=mips64le NPMDIR=npm/@esbuild/linux-mips64el platform-unixlike
   380  
   381  platform-linux-ppc64:
   382  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=ppc64le NPMDIR=npm/@esbuild/linux-ppc64 platform-unixlike
   383  
   384  platform-linux-riscv64:
   385  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=riscv64 NPMDIR=npm/@esbuild/linux-riscv64 platform-unixlike
   386  
   387  platform-linux-s390x:
   388  	@$(MAKE) --no-print-directory GOOS=linux GOARCH=s390x NPMDIR=npm/@esbuild/linux-s390x platform-unixlike
   389  
   390  platform-sunos-x64:
   391  	@$(MAKE) --no-print-directory GOOS=illumos GOARCH=amd64 NPMDIR=npm/@esbuild/sunos-x64 platform-unixlike
   392  
   393  platform-wasm: esbuild
   394  	node scripts/esbuild.js npm/esbuild-wasm/package.json --version
   395  	node scripts/esbuild.js ./esbuild --wasm
   396  
   397  platform-neutral: esbuild
   398  	node scripts/esbuild.js npm/esbuild/package.json --version
   399  	node scripts/esbuild.js ./esbuild --neutral
   400  
   401  platform-deno: platform-wasm
   402  	node scripts/esbuild.js ./esbuild --deno
   403  
   404  publish-all: check-go-version
   405  	@npm --version > /dev/null || (echo "The 'npm' command must be in your path to publish" && false)
   406  	@echo "Checking for uncommitted/untracked changes..." && test -z "`git status --porcelain | grep -vE 'M (CHANGELOG\.md|version\.txt)'`" || \
   407  		(echo "Refusing to publish with these uncommitted/untracked changes:" && \
   408  		git status --porcelain | grep -vE 'M (CHANGELOG\.md|version\.txt)' && false)
   409  	@echo "Checking for main branch..." && test main = "`git rev-parse --abbrev-ref HEAD`" || \
   410  		(echo "Refusing to publish from non-main branch `git rev-parse --abbrev-ref HEAD`" && false)
   411  	@echo "Checking for unpushed commits..." && git fetch
   412  	@test "" = "`git cherry`" || (echo "Refusing to publish with unpushed commits" && false)
   413  
   414  	# Prebuild now to prime go's compile cache and avoid timing issues later
   415  	@$(MAKE) --no-print-directory platform-all
   416  
   417  	# Commit now before publishing so git is clean for this: https://github.com/golang/go/issues/37475
   418  	# Note: If this fails, then the version number was likely not incremented before running this command
   419  	git commit -am "publish $(ESBUILD_VERSION) to npm"
   420  	git tag "v$(ESBUILD_VERSION)"
   421  	@test -z "`git status --porcelain`" || (echo "Aborting because git is somehow unclean after a commit" && false)
   422  
   423  	# Make sure the npm directory is pristine (including .gitignored files) since it will be published
   424  	rm -fr npm && git checkout npm
   425  
   426  	@echo Enter one-time password:
   427  	@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
   428  		publish-win32-x64 \
   429  		publish-win32-ia32 \
   430  		publish-win32-arm64 \
   431  		publish-sunos-x64
   432  
   433  	@echo Enter one-time password:
   434  	@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
   435  		publish-freebsd-x64 \
   436  		publish-freebsd-arm64 \
   437  		publish-openbsd-x64 \
   438  		publish-netbsd-x64
   439  
   440  	@echo Enter one-time password:
   441  	@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
   442  		publish-android-x64 \
   443  		publish-android-arm \
   444  		publish-android-arm64 \
   445  		publish-darwin-x64
   446  
   447  	@echo Enter one-time password:
   448  	@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
   449  		publish-darwin-arm64 \
   450  		publish-linux-x64 \
   451  		publish-linux-ia32 \
   452  		publish-linux-arm
   453  
   454  	@echo Enter one-time password:
   455  	@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
   456  		publish-linux-arm64 \
   457  		publish-linux-riscv64 \
   458  		publish-linux-loong64 \
   459  		publish-linux-mips64el
   460  
   461  	@echo Enter one-time password:
   462  	@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
   463  		publish-aix-ppc64 \
   464  		publish-linux-ppc64 \
   465  		publish-linux-s390x
   466  
   467  	# Do these last to avoid race conditions
   468  	@echo Enter one-time password:
   469  	@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
   470  		publish-neutral \
   471  		publish-deno \
   472  		publish-wasm \
   473  		publish-dl
   474  
   475  	git push origin main "v$(ESBUILD_VERSION)"
   476  
   477  publish-win32-x64: platform-win32-x64
   478  	test -n "$(OTP)" && cd npm/@esbuild/win32-x64 && npm publish --otp="$(OTP)"
   479  
   480  publish-win32-ia32: platform-win32-ia32
   481  	test -n "$(OTP)" && cd npm/@esbuild/win32-ia32 && npm publish --otp="$(OTP)"
   482  
   483  publish-win32-arm64: platform-win32-arm64
   484  	test -n "$(OTP)" && cd npm/@esbuild/win32-arm64 && npm publish --otp="$(OTP)"
   485  
   486  publish-aix-ppc64: platform-aix-ppc64
   487  	test -n "$(OTP)" && cd npm/@esbuild/aix-ppc64 && npm publish --otp="$(OTP)"
   488  
   489  publish-android-x64: platform-android-x64
   490  	test -n "$(OTP)" && cd npm/@esbuild/android-x64 && npm publish --otp="$(OTP)"
   491  
   492  publish-android-arm: platform-android-arm
   493  	test -n "$(OTP)" && cd npm/@esbuild/android-arm && npm publish --otp="$(OTP)"
   494  
   495  publish-android-arm64: platform-android-arm64
   496  	test -n "$(OTP)" && cd npm/@esbuild/android-arm64 && npm publish --otp="$(OTP)"
   497  
   498  publish-darwin-x64: platform-darwin-x64
   499  	test -n "$(OTP)" && cd npm/@esbuild/darwin-x64 && npm publish --otp="$(OTP)"
   500  
   501  publish-darwin-arm64: platform-darwin-arm64
   502  	test -n "$(OTP)" && cd npm/@esbuild/darwin-arm64 && npm publish --otp="$(OTP)"
   503  
   504  publish-freebsd-x64: platform-freebsd-x64
   505  	test -n "$(OTP)" && cd npm/@esbuild/freebsd-x64 && npm publish --otp="$(OTP)"
   506  
   507  publish-freebsd-arm64: platform-freebsd-arm64
   508  	test -n "$(OTP)" && cd npm/@esbuild/freebsd-arm64 && npm publish --otp="$(OTP)"
   509  
   510  publish-netbsd-x64: platform-netbsd-x64
   511  	test -n "$(OTP)" && cd npm/@esbuild/netbsd-x64 && npm publish --otp="$(OTP)"
   512  
   513  publish-openbsd-x64: platform-openbsd-x64
   514  	test -n "$(OTP)" && cd npm/@esbuild/openbsd-x64 && npm publish --otp="$(OTP)"
   515  
   516  publish-linux-x64: platform-linux-x64
   517  	test -n "$(OTP)" && cd npm/@esbuild/linux-x64 && npm publish --otp="$(OTP)"
   518  
   519  publish-linux-ia32: platform-linux-ia32
   520  	test -n "$(OTP)" && cd npm/@esbuild/linux-ia32 && npm publish --otp="$(OTP)"
   521  
   522  publish-linux-arm: platform-linux-arm
   523  	test -n "$(OTP)" && cd npm/@esbuild/linux-arm && npm publish --otp="$(OTP)"
   524  
   525  publish-linux-arm64: platform-linux-arm64
   526  	test -n "$(OTP)" && cd npm/@esbuild/linux-arm64 && npm publish --otp="$(OTP)"
   527  
   528  publish-linux-loong64: platform-linux-loong64
   529  	test -n "$(OTP)" && cd npm/@esbuild/linux-loong64 && npm publish --otp="$(OTP)"
   530  
   531  publish-linux-mips64el: platform-linux-mips64el
   532  	test -n "$(OTP)" && cd npm/@esbuild/linux-mips64el && npm publish --otp="$(OTP)"
   533  
   534  publish-linux-ppc64: platform-linux-ppc64
   535  	test -n "$(OTP)" && cd npm/@esbuild/linux-ppc64 && npm publish --otp="$(OTP)"
   536  
   537  publish-linux-riscv64: platform-linux-riscv64
   538  	test -n "$(OTP)" && cd npm/@esbuild/linux-riscv64 && npm publish --otp="$(OTP)"
   539  
   540  publish-linux-s390x: platform-linux-s390x
   541  	test -n "$(OTP)" && cd npm/@esbuild/linux-s390x && npm publish --otp="$(OTP)"
   542  
   543  publish-sunos-x64: platform-sunos-x64
   544  	test -n "$(OTP)" && cd npm/@esbuild/sunos-x64 && npm publish --otp="$(OTP)"
   545  
   546  publish-wasm: platform-wasm
   547  	test -n "$(OTP)" && cd npm/esbuild-wasm && npm publish --otp="$(OTP)"
   548  
   549  publish-neutral: platform-neutral
   550  	test -n "$(OTP)" && cd npm/esbuild && npm publish --otp="$(OTP)"
   551  
   552  publish-deno:
   553  	test -d deno/.git || (rm -fr deno && git clone git@github.com:esbuild/deno-esbuild.git deno)
   554  	cd deno && git fetch && git checkout main && git reset --hard origin/main
   555  	@$(MAKE) --no-print-directory platform-deno
   556  	cd deno && git add mod.js mod.d.ts wasm.js wasm.d.ts esbuild.wasm
   557  	cd deno && git commit -m "publish $(ESBUILD_VERSION) to deno"
   558  	cd deno && git tag "v$(ESBUILD_VERSION)"
   559  	cd deno && git push origin main "v$(ESBUILD_VERSION)"
   560  
   561  publish-dl:
   562  	test -d www/.git || (rm -fr www && git clone git@github.com:esbuild/esbuild.github.io.git www)
   563  	cd www && git fetch && git checkout gh-pages && git reset --hard origin/gh-pages
   564  	cd www && cat ../dl.sh | sed 's/$$ESBUILD_VERSION/$(ESBUILD_VERSION)/' > dl/latest
   565  	cd www && cat ../dl.sh | sed 's/$$ESBUILD_VERSION/$(ESBUILD_VERSION)/' > "dl/v$(ESBUILD_VERSION)"
   566  	cd www && git add dl/latest "dl/v$(ESBUILD_VERSION)"
   567  	cd www && git commit -m "publish download script for $(ESBUILD_VERSION)"
   568  	cd www && git push origin gh-pages
   569  
   570  validate-build:
   571  	@test -n "$(TARGET)" || (echo "The environment variable TARGET must be provided" && false)
   572  	@test -n "$(PACKAGE)" || (echo "The environment variable PACKAGE must be provided" && false)
   573  	@test -n "$(SUBPATH)" || (echo "The environment variable SUBPATH must be provided" && false)
   574  	@echo && echo "🔷 Checking $(SCOPE)$(PACKAGE)"
   575  	@rm -fr validate && mkdir validate
   576  	@$(MAKE) --no-print-directory "$(TARGET)"
   577  	@curl -s "https://registry.npmjs.org/$(SCOPE)$(PACKAGE)/-/$(PACKAGE)-$(ESBUILD_VERSION).tgz" > validate/esbuild.tgz
   578  	@cd validate && tar xf esbuild.tgz
   579  	@ls -l "npm/$(SCOPE)$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)" && \
   580  		shasum "npm/$(SCOPE)$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)" && \
   581  		cmp "npm/$(SCOPE)$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)"
   582  	@rm -fr validate
   583  
   584  # This checks that the published binaries are bitwise-identical to the locally-build binaries
   585  validate-builds:
   586  	git fetch --all --tags && git checkout "v$(ESBUILD_VERSION)"
   587  	@$(MAKE) --no-print-directory TARGET=platform-aix-ppc64      SCOPE=@esbuild/ PACKAGE=aix-ppc64       SUBPATH=bin/esbuild  validate-build
   588  	@$(MAKE) --no-print-directory TARGET=platform-android-arm    SCOPE=@esbuild/ PACKAGE=android-arm     SUBPATH=esbuild.wasm validate-build
   589  	@$(MAKE) --no-print-directory TARGET=platform-android-arm64  SCOPE=@esbuild/ PACKAGE=android-arm64   SUBPATH=bin/esbuild  validate-build
   590  	@$(MAKE) --no-print-directory TARGET=platform-android-x64    SCOPE=@esbuild/ PACKAGE=android-x64     SUBPATH=esbuild.wasm validate-build
   591  	@$(MAKE) --no-print-directory TARGET=platform-darwin-arm64   SCOPE=@esbuild/ PACKAGE=darwin-arm64    SUBPATH=bin/esbuild  validate-build
   592  	@$(MAKE) --no-print-directory TARGET=platform-darwin-x64     SCOPE=@esbuild/ PACKAGE=darwin-x64      SUBPATH=bin/esbuild  validate-build
   593  	@$(MAKE) --no-print-directory TARGET=platform-freebsd-arm64  SCOPE=@esbuild/ PACKAGE=freebsd-arm64   SUBPATH=bin/esbuild  validate-build
   594  	@$(MAKE) --no-print-directory TARGET=platform-freebsd-x64    SCOPE=@esbuild/ PACKAGE=freebsd-x64     SUBPATH=bin/esbuild  validate-build
   595  	@$(MAKE) --no-print-directory TARGET=platform-linux-arm      SCOPE=@esbuild/ PACKAGE=linux-arm       SUBPATH=bin/esbuild  validate-build
   596  	@$(MAKE) --no-print-directory TARGET=platform-linux-arm64    SCOPE=@esbuild/ PACKAGE=linux-arm64     SUBPATH=bin/esbuild  validate-build
   597  	@$(MAKE) --no-print-directory TARGET=platform-linux-ia32     SCOPE=@esbuild/ PACKAGE=linux-ia32      SUBPATH=bin/esbuild  validate-build
   598  	@$(MAKE) --no-print-directory TARGET=platform-linux-loong64  SCOPE=@esbuild/ PACKAGE=linux-loong64   SUBPATH=bin/esbuild  validate-build
   599  	@$(MAKE) --no-print-directory TARGET=platform-linux-mips64el SCOPE=@esbuild/ PACKAGE=linux-mips64el  SUBPATH=bin/esbuild  validate-build
   600  	@$(MAKE) --no-print-directory TARGET=platform-linux-ppc64    SCOPE=@esbuild/ PACKAGE=linux-ppc64     SUBPATH=bin/esbuild  validate-build
   601  	@$(MAKE) --no-print-directory TARGET=platform-linux-riscv64  SCOPE=@esbuild/ PACKAGE=linux-riscv64   SUBPATH=bin/esbuild  validate-build
   602  	@$(MAKE) --no-print-directory TARGET=platform-linux-s390x    SCOPE=@esbuild/ PACKAGE=linux-s390x     SUBPATH=bin/esbuild  validate-build
   603  	@$(MAKE) --no-print-directory TARGET=platform-linux-x64      SCOPE=@esbuild/ PACKAGE=linux-x64       SUBPATH=bin/esbuild  validate-build
   604  	@$(MAKE) --no-print-directory TARGET=platform-netbsd-x64     SCOPE=@esbuild/ PACKAGE=netbsd-x64      SUBPATH=bin/esbuild  validate-build
   605  	@$(MAKE) --no-print-directory TARGET=platform-openbsd-x64    SCOPE=@esbuild/ PACKAGE=openbsd-x64     SUBPATH=bin/esbuild  validate-build
   606  	@$(MAKE) --no-print-directory TARGET=platform-sunos-x64      SCOPE=@esbuild/ PACKAGE=sunos-x64       SUBPATH=bin/esbuild  validate-build
   607  	@$(MAKE) --no-print-directory TARGET=platform-wasm                           PACKAGE=esbuild-wasm    SUBPATH=esbuild.wasm validate-build
   608  	@$(MAKE) --no-print-directory TARGET=platform-win32-arm64    SCOPE=@esbuild/ PACKAGE=win32-arm64     SUBPATH=esbuild.exe  validate-build
   609  	@$(MAKE) --no-print-directory TARGET=platform-win32-ia32     SCOPE=@esbuild/ PACKAGE=win32-ia32      SUBPATH=esbuild.exe  validate-build
   610  	@$(MAKE) --no-print-directory TARGET=platform-win32-x64      SCOPE=@esbuild/ PACKAGE=win32-x64       SUBPATH=esbuild.exe  validate-build
   611  
   612  clean:
   613  	go clean -cache
   614  	go clean -testcache
   615  	rm -f esbuild
   616  	rm -f npm/@esbuild/win32-arm64/esbuild.exe
   617  	rm -f npm/@esbuild/win32-ia32/esbuild.exe
   618  	rm -f npm/@esbuild/win32-x64/esbuild.exe
   619  	rm -f npm/esbuild-wasm/esbuild.wasm npm/esbuild-wasm/wasm_exec*.js
   620  	rm -rf npm/@esbuild/aix-ppc64/bin
   621  	rm -rf npm/@esbuild/android-arm/bin npm/@esbuild/android-arm/esbuild.wasm npm/@esbuild/android-arm/wasm_exec*.js
   622  	rm -rf npm/@esbuild/android-arm64/bin
   623  	rm -rf npm/@esbuild/android-x64/bin npm/@esbuild/android-x64/esbuild.wasm npm/@esbuild/android-x64/wasm_exec*.js
   624  	rm -rf npm/@esbuild/darwin-arm64/bin
   625  	rm -rf npm/@esbuild/darwin-x64/bin
   626  	rm -rf npm/@esbuild/freebsd-arm64/bin
   627  	rm -rf npm/@esbuild/freebsd-x64/bin
   628  	rm -rf npm/@esbuild/linux-arm/bin
   629  	rm -rf npm/@esbuild/linux-arm64/bin
   630  	rm -rf npm/@esbuild/linux-ia32/bin
   631  	rm -rf npm/@esbuild/linux-loong64/bin
   632  	rm -rf npm/@esbuild/linux-mips64el/bin
   633  	rm -rf npm/@esbuild/linux-ppc64/bin
   634  	rm -rf npm/@esbuild/linux-riscv64/bin
   635  	rm -rf npm/@esbuild/linux-s390x/bin
   636  	rm -rf npm/@esbuild/linux-x64/bin
   637  	rm -rf npm/@esbuild/netbsd-x64/bin
   638  	rm -rf npm/@esbuild/openbsd-x64/bin
   639  	rm -rf npm/@esbuild/sunos-x64/bin
   640  	rm -rf npm/esbuild-wasm/esm
   641  	rm -rf npm/esbuild-wasm/lib
   642  	rm -rf npm/esbuild/bin npm/esbuild/lib npm/esbuild/install.js
   643  	rm -rf require/*/bench/
   644  	rm -rf require/*/demo/
   645  	rm -rf require/*/node_modules/
   646  	rm -rf require/yarnpnp/.pnp* require/yarnpnp/.yarn* require/yarnpnp/out*.js
   647  	rm -rf validate
   648  
   649  # This also cleans directories containing cached code from other projects
   650  clean-all: clean
   651  	rm -fr github demo bench
   652  
   653  ################################################################################
   654  # These npm packages are used for benchmarks. Install them in subdirectories
   655  # because we want to install the same package name at multiple versions
   656  
   657  require/webpack5/node_modules:
   658  	cd require/webpack5 && npm ci
   659  
   660  require/rollup/node_modules:
   661  	cd require/rollup && npm ci
   662  
   663  require/parcel2/node_modules:
   664  	cd require/parcel2 && npm ci
   665  
   666  lib/node_modules:
   667  	cd lib && npm ci
   668  
   669  scripts/node_modules:
   670  	cd scripts && npm ci
   671  
   672  scripts/browser/node_modules:
   673  	cd scripts/browser && npm ci
   674  
   675  ################################################################################
   676  # This generates browser support mappings
   677  
   678  compat-table: esbuild
   679  	./esbuild compat-table/src/index.ts --bundle --platform=node --external:./compat-table/repos/* --outfile=compat-table/out.js --log-level=warning --sourcemap
   680  	node --enable-source-maps compat-table/out.js
   681  
   682  update-compat-table: esbuild
   683  	cd compat-table && npm i @mdn/browser-compat-data@latest caniuse-lite@latest --silent
   684  	./esbuild compat-table/src/index.ts --bundle --platform=node --external:./compat-table/repos/* --outfile=compat-table/out.js --log-level=warning --sourcemap
   685  	node --enable-source-maps compat-table/out.js --update
   686  
   687  ################################################################################
   688  # This runs the test262 official JavaScript test suite through esbuild
   689  
   690  github/test262:
   691  	mkdir -p github
   692  	git clone --depth 1 https://github.com/tc39/test262.git github/test262
   693  
   694  demo/test262: | github/test262
   695  	mkdir -p demo/test262
   696  	cp -r github/test262/harness demo/test262/harness
   697  	cp -r github/test262/test demo/test262/test
   698  
   699  test262: esbuild | demo/test262
   700  	node --experimental-vm-modules scripts/test262.js
   701  
   702  test262-async: esbuild | demo/test262
   703  	node --experimental-vm-modules scripts/test262-async.js
   704  
   705  ################################################################################
   706  # This runs UglifyJS's test suite through esbuild
   707  
   708  github/uglify:
   709  	mkdir -p github/uglify
   710  	cd github/uglify && git init && git remote add origin https://github.com/mishoo/uglifyjs.git
   711  	cd github/uglify && git fetch --depth 1 origin 860aa9531b2ce660ace8379c335bb092034b6e82 && git checkout FETCH_HEAD
   712  
   713  demo/uglify: | github/uglify
   714  	mkdir -p demo
   715  	cp -r github/uglify/ demo/uglify
   716  	cd demo/uglify && npm i
   717  
   718  uglify: esbuild | demo/uglify
   719  	node scripts/uglify-tests.js
   720  
   721  ################################################################################
   722  # This builds the TypeScript compiler, then uses it to type check tsc itself
   723  
   724  github/tsc:
   725  	mkdir -p github/tsc
   726  	cd github/tsc && git init && git remote add origin https://github.com/Microsoft/TypeScript.git
   727  	cd github/tsc && git fetch --depth 1 origin e6ceba084147bd00045c573a1ba9843c0bb5c721 && git checkout FETCH_HEAD
   728  
   729  test-tsc: esbuild | github/tsc
   730  	rm -fr demo/tsc
   731  	mkdir -p demo/tsc/built/local
   732  	cp -r github/tsc/src github/tsc/scripts demo/tsc
   733  	cp github/tsc/lib/*.d.ts demo/tsc/built/local
   734  	cd demo/tsc && node scripts/processDiagnosticMessages.mjs src/compiler/diagnosticMessages.json
   735  	./esbuild --bundle demo/tsc/src/tsc/tsc.ts --outfile=demo/tsc/built/local/tsc.js --platform=node --target=es2018 --packages=external
   736  	echo '{"dependencies":{"@types/node":"20.2.5","@types/microsoft__typescript-etw":"0.1.1","@types/source-map-support":"0.5.6"}}' > demo/tsc/package.json
   737  	cd demo/tsc && npm i --silent && echo 'Type checking tsc using tsc...' && time -p node ./built/local/tsc.js -p src/compiler
   738  
   739  ################################################################################
   740  # This builds Rollup using esbuild and then uses it to run Rollup's test suite
   741  
   742  TEST_ROLLUP_FIND = "compilerOptions": {
   743  
   744  TEST_ROLLUP_REPLACE += "compilerOptions": {
   745  TEST_ROLLUP_REPLACE += "baseUrl": ".",
   746  TEST_ROLLUP_REPLACE += "paths": { "package.json": [".\/package.json"] },
   747  
   748  TEST_ROLLUP_FLAGS += --bundle
   749  TEST_ROLLUP_FLAGS += --external:fsevents
   750  TEST_ROLLUP_FLAGS += --outfile=dist/rollup.js
   751  TEST_ROLLUP_FLAGS += --platform=node
   752  TEST_ROLLUP_FLAGS += --target=es6
   753  TEST_ROLLUP_FLAGS += src/node-entry.ts
   754  
   755  github/rollup:
   756  	mkdir -p github
   757  	git clone --depth 1 --branch v2.60.2 https://github.com/rollup/rollup.git github/rollup
   758  
   759  demo/rollup: | github/rollup
   760  	mkdir -p demo
   761  	cp -RP github/rollup/ demo/rollup
   762  	cd demo/rollup && npm ci
   763  
   764  	# Patch over Rollup's custom "package.json" alias using "tsconfig.json"
   765  	cat demo/rollup/tsconfig.json | sed 's/$(TEST_ROLLUP_FIND)/$(TEST_ROLLUP_REPLACE)/' > demo/rollup/tsconfig2.json
   766  	mv demo/rollup/tsconfig2.json demo/rollup/tsconfig.json
   767  
   768  test-rollup: esbuild | demo/rollup
   769  	# Skip watch tests to avoid flakes
   770  	cd demo/rollup && ../../esbuild $(TEST_ROLLUP_FLAGS) && npm run test:only -- --fgrep watch --invert
   771  	cd demo/rollup && ../../esbuild $(TEST_ROLLUP_FLAGS) --minify && npm run test:only -- --fgrep watch --invert
   772  
   773  ################################################################################
   774  # This builds Preact using esbuild with splitting enabled, which had a bug at one point
   775  
   776  PREACT_SPLITTING += import { h } from 'preact';
   777  PREACT_SPLITTING += import { USE as use } from 'preact/hooks';
   778  PREACT_SPLITTING += import { renderToString } from 'preact-render-to-string';
   779  PREACT_SPLITTING += let Component = () => (use(() => {}), h('div'));
   780  PREACT_SPLITTING += if (renderToString(h(Component)) !== '<div></div>') throw 'fail';
   781  
   782  PREACT_HOOKS += useCallback
   783  PREACT_HOOKS += useContext
   784  PREACT_HOOKS += useDebugValue
   785  PREACT_HOOKS += useEffect
   786  PREACT_HOOKS += useErrorBoundary
   787  PREACT_HOOKS += useImperativeHandle
   788  PREACT_HOOKS += useLayoutEffect
   789  PREACT_HOOKS += useMemo
   790  PREACT_HOOKS += useReducer
   791  PREACT_HOOKS += useRef
   792  PREACT_HOOKS += useState
   793  
   794  demo/preact-splitting:
   795  	mkdir -p demo/preact-splitting/src
   796  	cd demo/preact-splitting && echo '{}' > package.json && npm i preact@10.4.6 preact-render-to-string@5.1.10
   797  	cd demo/preact-splitting && for h in $(PREACT_HOOKS); do echo "$(PREACT_SPLITTING)" | sed s/USE/$$h/ > src/$$h.js; done
   798  
   799  test-preact-splitting: esbuild | demo/preact-splitting
   800  	cd demo/preact-splitting && rm -fr out && ../../esbuild --bundle --splitting --format=esm src/*.js --outdir=out --out-extension:.js=.mjs
   801  	cd demo/preact-splitting && for h in $(PREACT_HOOKS); do set -e && node --experimental-modules out/$$h.mjs; done
   802  	cd demo/preact-splitting && rm -fr out && ../../esbuild --bundle --splitting --format=esm src/*.js --outdir=out --out-extension:.js=.mjs --minify --target=node12
   803  	cd demo/preact-splitting && for h in $(PREACT_HOOKS); do set -e && node --experimental-modules out/$$h.mjs; done
   804  
   805  ################################################################################
   806  # This builds Sucrase using esbuild and then uses it to run Sucrase's test suite
   807  
   808  github/sucrase:
   809  	mkdir -p github/sucrase
   810  	cd github/sucrase && git init && git remote add origin https://github.com/alangpierce/sucrase.git
   811  	cd github/sucrase && git fetch --depth 1 origin a4a596e5cdd57362f309ae50cc32a235d7817d34 && git checkout FETCH_HEAD
   812  
   813  demo/sucrase: | github/sucrase
   814  	mkdir -p demo
   815  	cp -r github/sucrase/ demo/sucrase
   816  	cd demo/sucrase && npm i
   817  	cd demo/sucrase && find test -name '*.ts' | sed 's/\(.*\)\.ts/import ".\/\1"/g' > all-tests.ts
   818  	echo '{"compilerOptions":{"useDefineForClassFields":false}}' > demo/sucrase/tsconfig.json # Sucrase tests fail if tsconfig.json is respected due to useDefineForClassFields
   819  
   820  test-sucrase: esbuild | demo/sucrase
   821  	cd demo/sucrase && ../../esbuild --bundle all-tests.ts --target=es6 --platform=node > out.js && npx mocha out.js
   822  	cd demo/sucrase && ../../esbuild --bundle all-tests.ts --target=es6 --platform=node --minify > out.js && npx mocha out.js
   823  
   824  ################################################################################
   825  # This builds Esprima using esbuild and then uses it to run Esprima's test suite
   826  
   827  github/esprima:
   828  	mkdir -p github/esprima
   829  	cd github/esprima && git init && git remote add origin https://github.com/jquery/esprima.git
   830  	cd github/esprima && git fetch --depth 1 origin fa49b2edc288452eb49441054ce6f7ff4b891eb4 && git checkout FETCH_HEAD
   831  
   832  demo/esprima: | github/esprima
   833  	mkdir -p demo
   834  	cp -r github/esprima/ demo/esprima
   835  	cd demo/esprima && npm ci
   836  
   837  test-esprima: esbuild | demo/esprima
   838  	cd demo/esprima && ../../esbuild --bundle src/esprima.ts --outfile=dist/esprima.js --target=es6 --platform=node && npm run all-tests
   839  	cd demo/esprima && ../../esbuild --bundle src/esprima.ts --outfile=dist/esprima.js --target=es6 --platform=node --minify && npm run all-tests
   840  
   841  ################################################################################
   842  # This runs terser's test suite through esbuild
   843  
   844  github/terser:
   845  	mkdir -p github/terser
   846  	cd github/terser && git init && git remote add origin https://github.com/terser/terser.git
   847  	cd github/terser && git fetch --depth 1 origin 056623c20dbbc42d2f5a34926c07133981519326 && git checkout FETCH_HEAD
   848  
   849  demo/terser: | github/terser
   850  	mkdir -p demo
   851  	cp -r github/terser/ demo/terser
   852  	cd demo/terser && npm ci && npm run build
   853  
   854  terser: esbuild | demo/terser
   855  	node scripts/terser-tests.js
   856  
   857  ################################################################################
   858  # three.js demo
   859  
   860  github/three:
   861  	mkdir -p github
   862  	git clone --depth 1 --branch r108 https://github.com/mrdoob/three.js.git github/three
   863  
   864  demo/three: | github/three
   865  	mkdir -p demo/three
   866  	cp -r github/three/src demo/three/src
   867  
   868  demo-three: demo-three-esbuild demo-three-rollup demo-three-webpack5 demo-three-parcel2
   869  
   870  demo-three-esbuild: esbuild | demo/three
   871  	rm -fr demo/three/esbuild
   872  	time -p ./esbuild --bundle --global-name=THREE --sourcemap --minify demo/three/src/Three.js --outfile=demo/three/esbuild/Three.esbuild.js
   873  	du -h demo/three/esbuild/Three.esbuild.js*
   874  	shasum demo/three/esbuild/Three.esbuild.js*
   875  
   876  demo-three-eswasm: platform-wasm | demo/three
   877  	rm -fr demo/three/eswasm
   878  	time -p ./npm/esbuild-wasm/bin/esbuild --bundle --global-name=THREE \
   879  		--sourcemap --minify demo/three/src/Three.js --outfile=demo/three/eswasm/Three.eswasm.js
   880  	du -h demo/three/eswasm/Three.eswasm.js*
   881  	shasum demo/three/eswasm/Three.eswasm.js*
   882  
   883  THREE_ROLLUP_CONFIG += import terser from '@rollup/plugin-terser';
   884  THREE_ROLLUP_CONFIG += export default {
   885  THREE_ROLLUP_CONFIG +=   output: { format: 'iife', name: 'THREE', sourcemap: true },
   886  THREE_ROLLUP_CONFIG +=   plugins: [terser()],
   887  THREE_ROLLUP_CONFIG += }
   888  
   889  demo-three-rollup: | require/rollup/node_modules demo/three
   890  	rm -fr require/rollup/demo/three demo/three/rollup
   891  	mkdir -p require/rollup/demo/three demo/three/rollup
   892  	echo "$(THREE_ROLLUP_CONFIG)" > require/rollup/demo/three/config.mjs
   893  	ln -s ../../../../demo/three/src require/rollup/demo/three/src
   894  	ln -s ../../../../demo/three/rollup require/rollup/demo/three/out
   895  	cd require/rollup/demo/three && time -p ../../node_modules/.bin/rollup src/Three.js -o out/Three.rollup.js -c config.mjs
   896  	du -h demo/three/rollup/Three.rollup.js*
   897  
   898  THREE_WEBPACK5_FLAGS += --devtool=source-map
   899  THREE_WEBPACK5_FLAGS += --mode=production
   900  THREE_WEBPACK5_FLAGS += --output-library THREE
   901  
   902  demo-three-webpack5: | require/webpack5/node_modules demo/three
   903  	rm -fr require/webpack5/demo/three demo/three/webpack5
   904  	mkdir -p require/webpack5/demo/three demo/three/webpack5
   905  	ln -s ../../../../demo/three/src require/webpack5/demo/three/src
   906  	ln -s ../../../../demo/three/webpack5 require/webpack5/demo/three/out
   907  	cd require/webpack5/demo/three && time -p ../../node_modules/.bin/webpack --entry ./src/Three.js $(THREE_WEBPACK5_FLAGS) -o out/Three.webpack5.js
   908  	du -h demo/three/webpack5/Three.webpack5.js*
   909  
   910  demo-three-parcel2: | require/parcel2/node_modules demo/three
   911  	rm -fr require/parcel2/demo/three demo/three/parcel2
   912  	mkdir -p require/parcel2/demo/three demo/three/parcel2
   913  
   914  	# Copy the whole source tree since symlinks mess up Parcel's internal package lookup for "@babel/core"
   915  	cp -r demo/three/src require/parcel2/demo/three/src
   916  
   917  	echo 'import * as THREE from "./src/Three.js"; window.THREE = THREE' > require/parcel2/demo/three/Three.parcel2.js
   918  	cd require/parcel2/demo/three && time -p ../../node_modules/.bin/parcel build \
   919  		Three.parcel2.js --dist-dir ../../../../demo/three/parcel2 --cache-dir .cache
   920  	du -h demo/three/parcel2/Three.parcel2.js*
   921  
   922  ################################################################################
   923  # three.js benchmark (measures JavaScript performance, same as three.js demo but 10x bigger)
   924  
   925  bench/three: | github/three
   926  	mkdir -p bench/three/src
   927  	echo > bench/three/src/entry.js
   928  	for i in 1 2 3 4 5 6 7 8 9 10; do test -d "bench/three/src/copy$$i" || cp -r github/three/src "bench/three/src/copy$$i"; done
   929  	for i in 1 2 3 4 5 6 7 8 9 10; do echo "import * as copy$$i from './copy$$i/Three.js'; export {copy$$i}" >> bench/three/src/entry.js; done
   930  	echo 'Line count:' && find bench/three/src -name '*.js' | xargs wc -l | tail -n 1
   931  
   932  bench-three: bench-three-esbuild bench-three-rollup bench-three-webpack5 bench-three-parcel2
   933  
   934  bench-three-esbuild: esbuild | bench/three
   935  	rm -fr bench/three/esbuild
   936  	time -p ./esbuild --bundle --global-name=THREE --sourcemap --minify bench/three/src/entry.js --outfile=bench/three/esbuild/entry.esbuild.js --timing
   937  	du -h bench/three/esbuild/entry.esbuild.js*
   938  	shasum bench/three/esbuild/entry.esbuild.js*
   939  
   940  bench-three-eswasm: platform-wasm | bench/three
   941  	rm -fr bench/three/eswasm
   942  	time -p ./npm/esbuild-wasm/bin/esbuild --bundle --global-name=THREE \
   943  		--sourcemap --minify bench/three/src/entry.js --outfile=bench/three/eswasm/entry.eswasm.js
   944  	du -h bench/three/eswasm/entry.eswasm.js*
   945  	shasum bench/three/eswasm/entry.eswasm.js*
   946  
   947  bench-three-rollup: | require/rollup/node_modules bench/three
   948  	rm -fr require/rollup/bench/three bench/three/rollup
   949  	mkdir -p require/rollup/bench/three bench/three/rollup
   950  	echo "$(THREE_ROLLUP_CONFIG)" > require/rollup/bench/three/config.mjs
   951  	ln -s ../../../../bench/three/src require/rollup/bench/three/src
   952  	ln -s ../../../../bench/three/rollup require/rollup/bench/three/out
   953  	cd require/rollup/bench/three && time -p ../../node_modules/.bin/rollup src/entry.js -o out/entry.rollup.js -c config.mjs
   954  	du -h bench/three/rollup/entry.rollup.js*
   955  
   956  bench-three-webpack5: | require/webpack5/node_modules bench/three
   957  	rm -fr require/webpack5/bench/three bench/three/webpack5
   958  	mkdir -p require/webpack5/bench/three bench/three/webpack5
   959  	ln -s ../../../../bench/three/src require/webpack5/bench/three/src
   960  	ln -s ../../../../bench/three/webpack5 require/webpack5/bench/three/out
   961  	cd require/webpack5/bench/three && time -p ../../node_modules/.bin/webpack --entry ./src/entry.js $(THREE_WEBPACK5_FLAGS) -o out/entry.webpack5.js
   962  	du -h bench/three/webpack5/entry.webpack5.js*
   963  
   964  bench-three-parcel2: | require/parcel2/node_modules bench/three
   965  	rm -fr require/parcel2/bench/three bench/three/parcel2
   966  	mkdir -p require/parcel2/bench/three bench/three/parcel2
   967  
   968  	# Copy the whole source tree since symlinks mess up Parcel's internal package lookup for "@babel/core"
   969  	cp -r bench/three/src require/parcel2/bench/three/src
   970  
   971  	echo 'import * as THREE from "./src/entry.js"; window.THREE = THREE' > require/parcel2/bench/three/entry.parcel2.js
   972  	cd require/parcel2/bench/three && time -p node ../../node_modules/.bin/parcel build \
   973  		entry.parcel2.js --dist-dir ../../../../bench/three/parcel2 --cache-dir .cache
   974  	du -h bench/three/parcel2/entry.parcel2.js*
   975  
   976  ################################################################################
   977  # Rome benchmark (measures TypeScript performance)
   978  
   979  ROME_TSCONFIG += {
   980  ROME_TSCONFIG +=   \"compilerOptions\": {
   981  ROME_TSCONFIG +=     \"sourceMap\": true,
   982  ROME_TSCONFIG +=     \"esModuleInterop\": true,
   983  ROME_TSCONFIG +=     \"resolveJsonModule\": true,
   984  ROME_TSCONFIG +=     \"moduleResolution\": \"node\",
   985  ROME_TSCONFIG +=     \"target\": \"es2019\",
   986  ROME_TSCONFIG +=     \"module\": \"commonjs\",
   987  ROME_TSCONFIG +=     \"baseUrl\": \".\"
   988  ROME_TSCONFIG +=   }
   989  ROME_TSCONFIG += }
   990  
   991  github/rome:
   992  	mkdir -p github/rome
   993  	cd github/rome && git init && git remote add origin https://github.com/romejs/rome.git
   994  	cd github/rome && git fetch --depth 1 origin d95a3a7aab90773c9b36d9c82a08c8c4c6b68aa5 && git checkout FETCH_HEAD
   995  
   996  bench/rome: | github/rome
   997  	mkdir -p bench/rome
   998  	cp -r github/rome/packages bench/rome/src
   999  	echo "$(ROME_TSCONFIG)" > bench/rome/src/tsconfig.json
  1000  	echo 'import "rome/bin/rome"' > bench/rome/src/entry.ts
  1001  
  1002  	# Patch a cyclic import ordering issue that affects commonjs-style bundlers (webpack and parcel)
  1003  	echo "export { default as createHook } from './api/createHook';" > .temp
  1004  	sed "/createHook/d" bench/rome/src/@romejs/js-compiler/index.ts >> .temp
  1005  	mv .temp bench/rome/src/@romejs/js-compiler/index.ts
  1006  
  1007  	# Replace "import fs = require('fs')" with "const fs = require('fs')" because
  1008  	# the TypeScript compiler strips these statements when targeting "esnext",
  1009  	# which breaks Parcel 2 when scope hoisting is enabled.
  1010  	find bench/rome/src -name '*.ts' -type f -print0 | xargs -L1 -0 sed -i '' 's/import \([A-Za-z0-9_]*\) =/const \1 =/g'
  1011  	find bench/rome/src -name '*.tsx' -type f -print0 | xargs -L1 -0 sed -i '' 's/import \([A-Za-z0-9_]*\) =/const \1 =/g'
  1012  
  1013  	# Get an approximate line count
  1014  	rm -r bench/rome/src/@romejs/js-parser/test-fixtures
  1015  	echo 'Line count:' && (find bench/rome/src -name '*.ts' && find bench/rome/src -name '*.js') | xargs wc -l | tail -n 1
  1016  
  1017  # This target provides an easy way to verify that the build is correct. Since
  1018  # Rome is self-hosted, we can just run the bundle to build Rome. This makes sure
  1019  # the bundle doesn't crash when run and is a good test of a non-trivial workload.
  1020  bench/rome-verify: | github/rome
  1021  	mkdir -p bench/rome-verify
  1022  	cp -r github/rome/packages bench/rome-verify/packages
  1023  	cp github/rome/package.json bench/rome-verify/package.json
  1024  
  1025  bench-rome: bench-rome-esbuild bench-rome-webpack5 bench-rome-parcel2
  1026  
  1027  bench-rome-esbuild: esbuild | bench/rome bench/rome-verify
  1028  	rm -fr bench/rome/esbuild
  1029  	time -p ./esbuild --bundle --sourcemap --minify bench/rome/src/entry.ts --outfile=bench/rome/esbuild/rome.esbuild.js --platform=node --timing
  1030  	time -p ./esbuild --bundle --sourcemap --minify bench/rome/src/entry.ts --outfile=bench/rome/esbuild/rome.esbuild.js --platform=node --timing
  1031  	time -p ./esbuild --bundle --sourcemap --minify bench/rome/src/entry.ts --outfile=bench/rome/esbuild/rome.esbuild.js --platform=node --timing
  1032  	du -h bench/rome/esbuild/rome.esbuild.js*
  1033  	shasum bench/rome/esbuild/rome.esbuild.js*
  1034  	cd bench/rome-verify && rm -fr esbuild && ROME_CACHE=0 node ../rome/esbuild/rome.esbuild.js bundle packages/rome esbuild
  1035  
  1036  ROME_WEBPACK5_CONFIG += module.exports = {
  1037  ROME_WEBPACK5_CONFIG +=   entry: './src/entry.ts',
  1038  ROME_WEBPACK5_CONFIG +=   mode: 'production',
  1039  ROME_WEBPACK5_CONFIG +=   target: 'node',
  1040  ROME_WEBPACK5_CONFIG +=   devtool: 'source-map',
  1041  ROME_WEBPACK5_CONFIG +=   module: { rules: [{ test: /\.ts$$/, loader: 'ts-loader', options: { transpileOnly: true } }] },
  1042  ROME_WEBPACK5_CONFIG +=   resolve: {
  1043  ROME_WEBPACK5_CONFIG +=     extensions: ['.ts', '.js'],
  1044  ROME_WEBPACK5_CONFIG +=     alias: { rome: __dirname + '/src/rome', '@romejs': __dirname + '/src/@romejs' },
  1045  ROME_WEBPACK5_CONFIG +=   },
  1046  ROME_WEBPACK5_CONFIG +=   output: { filename: 'rome.webpack.js', path: __dirname + '/out' },
  1047  ROME_WEBPACK5_CONFIG += };
  1048  
  1049  bench-rome-webpack5: | require/webpack5/node_modules bench/rome bench/rome-verify
  1050  	rm -fr require/webpack5/bench/rome bench/rome/webpack5
  1051  	mkdir -p require/webpack5/bench/rome bench/rome/webpack5
  1052  	echo "$(ROME_WEBPACK5_CONFIG)" > require/webpack5/bench/rome/webpack.config.js
  1053  	ln -s ../../../../bench/rome/src require/webpack5/bench/rome/src
  1054  	ln -s ../../../../bench/rome/webpack5 require/webpack5/bench/rome/out
  1055  	cd require/webpack5/bench/rome && time -p ../../node_modules/.bin/webpack
  1056  	du -h bench/rome/webpack5/rome.webpack.js*
  1057  	cd bench/rome-verify && rm -fr webpack5 && ROME_CACHE=0 node ../rome/webpack5/rome.webpack.js bundle packages/rome webpack5
  1058  
  1059  ROME_PARCEL_ALIASES += "alias": {
  1060  ROME_PARCEL_ALIASES +=   $(shell ls bench/rome/src/@romejs | sed 's/.*/"\@romejs\/&": ".\/@romejs\/&",/g')
  1061  ROME_PARCEL_ALIASES +=   "rome": "./rome"
  1062  ROME_PARCEL_ALIASES += }
  1063  
  1064  bench-rome-parcel2: | require/parcel2/node_modules bench/rome bench/rome-verify
  1065  	rm -fr bench/rome/parcel2
  1066  	cp -r bench/rome/src bench/rome/parcel2
  1067  	rm -fr bench/rome/parcel2/node_modules
  1068  	cp -RP require/parcel2/node_modules bench/rome/parcel2/node_modules
  1069  
  1070  	# Inject aliases into "package.json" to fix Parcel 2 ignoring "tsconfig.json".
  1071  	# Also inject "engines": "node" to avoid Parcel 2 mangling node globals.
  1072  	# Also inject "includeNodeModules": true or the aliases will be ignored.
  1073  	cat require/parcel2/package.json | sed '/^\}/d' > bench/rome/parcel2/package.json
  1074  	echo ', "engines": { "node": "14.0.0" }' >> bench/rome/parcel2/package.json
  1075  	echo ', "targets": { "main": { "includeNodeModules": true, "optimize": true } }' >> bench/rome/parcel2/package.json
  1076  	echo ', $(ROME_PARCEL_ALIASES) }' >> bench/rome/parcel2/package.json
  1077  
  1078  	# Parcel's minifier preserves all comments in the source code by default.
  1079  	# Removing comments in the minified output requires a config file.
  1080  	echo '{ "format": { "comments": false } }' > bench/rome/parcel2/.terserrc
  1081  
  1082  	cd bench/rome/parcel2 && time -p node_modules/.bin/parcel build entry.ts --dist-dir . --cache-dir .cache
  1083  	du -h bench/rome/parcel2/entry.js*
  1084  	cd bench/rome-verify && rm -fr parcel2 && ROME_CACHE=0 node ../rome/parcel2/entry.js bundle packages/rome parcel2
  1085  
  1086  ################################################################################
  1087  # React admin benchmark (measures performance of an application-like setup)
  1088  
  1089  READMIN_HTML = <meta charset=utf8><div id=root></div><script src=index.js type=module></script>
  1090  
  1091  github/react-admin:
  1092  	mkdir -p github
  1093  	git clone --depth 1 --branch v4.6.1 https://github.com/marmelab/react-admin.git github/react-admin
  1094  
  1095  bench/readmin: | github/react-admin
  1096  	mkdir -p bench/readmin
  1097  	cp -r github/react-admin bench/readmin/repo
  1098  	cd bench/readmin/repo && yarn # This takes approximately forever
  1099  
  1100  bench-readmin: bench-readmin-esbuild
  1101  
  1102  READMIN_ESBUILD_FLAGS += --alias:data-generator-retail=./bench/readmin/repo/examples/data-generator/src
  1103  READMIN_ESBUILD_FLAGS += --alias:ra-core=./bench/readmin/repo/packages/ra-core/src
  1104  READMIN_ESBUILD_FLAGS += --alias:ra-data-fakerest=./bench/readmin/repo/packages/ra-data-fakerest/src
  1105  READMIN_ESBUILD_FLAGS += --alias:ra-data-graphql-simple=./bench/readmin/repo/packages/ra-data-graphql-simple/src
  1106  READMIN_ESBUILD_FLAGS += --alias:ra-data-graphql=./bench/readmin/repo/packages/ra-data-graphql/src
  1107  READMIN_ESBUILD_FLAGS += --alias:ra-data-simple-rest=./bench/readmin/repo/packages/ra-data-simple-rest/src
  1108  READMIN_ESBUILD_FLAGS += --alias:ra-i18n-polyglot=./bench/readmin/repo/packages/ra-i18n-polyglot/src
  1109  READMIN_ESBUILD_FLAGS += --alias:ra-input-rich-text=./bench/readmin/repo/packages/ra-input-rich-text/src
  1110  READMIN_ESBUILD_FLAGS += --alias:ra-language-english=./bench/readmin/repo/packages/ra-language-english/src
  1111  READMIN_ESBUILD_FLAGS += --alias:ra-language-french=./bench/readmin/repo/packages/ra-language-french/src
  1112  READMIN_ESBUILD_FLAGS += --alias:ra-ui-materialui=./bench/readmin/repo/packages/ra-ui-materialui/src
  1113  READMIN_ESBUILD_FLAGS += --alias:react-admin=./bench/readmin/repo/packages/react-admin/src
  1114  READMIN_ESBUILD_FLAGS += --bundle
  1115  READMIN_ESBUILD_FLAGS += --define:process.env.REACT_APP_DATA_PROVIDER=null
  1116  READMIN_ESBUILD_FLAGS += --format=esm
  1117  READMIN_ESBUILD_FLAGS += --loader:.png=file
  1118  READMIN_ESBUILD_FLAGS += --loader:.svg=file
  1119  READMIN_ESBUILD_FLAGS += --minify
  1120  READMIN_ESBUILD_FLAGS += --sourcemap
  1121  READMIN_ESBUILD_FLAGS += --splitting
  1122  READMIN_ESBUILD_FLAGS += --target=esnext
  1123  READMIN_ESBUILD_FLAGS += --timing
  1124  READMIN_ESBUILD_FLAGS += bench/readmin/repo/examples/demo/src/index.tsx
  1125  
  1126  bench-readmin-esbuild: esbuild | bench/readmin
  1127  	rm -fr bench/readmin/esbuild
  1128  	time -p ./esbuild $(READMIN_ESBUILD_FLAGS) --outdir=bench/readmin/esbuild
  1129  	echo "$(READMIN_HTML)" > bench/readmin/esbuild/index.html
  1130  	du -h bench/readmin/esbuild/index.js*
  1131  	shasum bench/readmin/esbuild/index.js*
  1132  
  1133  bench-readmin-eswasm: platform-wasm | bench/readmin
  1134  	rm -fr bench/readmin/eswasm
  1135  	time -p ./npm/esbuild-wasm/bin/esbuild $(READMIN_ESBUILD_FLAGS) --outdir=bench/readmin/eswasm
  1136  	echo "$(READMIN_HTML)" > bench/readmin/eswasm/index.html
  1137  	du -h bench/readmin/eswasm/index.js*
  1138  	shasum bench/readmin/eswasm/index.js*