From aee263d05004344b924ff75947adc74f50992382 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sun, 3 Oct 2021 21:21:54 -0700 Subject: [PATCH] Update linux build instructions --- Dockerfile | 8 -- Makefile | 82 +++++++++---------- README.md | 39 ++++++++- .../array-args-with-default-values.hmr.js | 2 +- .../snapshots/bundled-entry-point.hmr.js | 4 +- integration/snapshots/bundled-entry-point.js | 2 +- .../code-simplification-neql-define.hmr.js | 2 +- integration/snapshots/export.hmr.js | 2 +- .../snapshots/forbid-in-is-correct.hmr.js | 2 +- .../global-is-remapped-to-globalThis.hmr.js | 2 +- integration/snapshots/lodash-regexp.hmr.js | 6 +- integration/snapshots/lodash-regexp.js | 4 +- integration/snapshots/multiple-imports.hmr.js | 10 +-- integration/snapshots/multiple-imports.js | 8 +- .../package-json-exports/index.hmr.js | 14 ++-- .../snapshots/package-json-exports/index.js | 12 +-- integration/snapshots/spread_with_key.hmr.tsx | 8 +- integration/snapshots/spread_with_key.tsx | 6 +- integration/snapshots/string-escapes.hmr.js | 2 +- .../snapshots/styledcomponents-output.hmr.js | 14 ++-- .../snapshots/styledcomponents-output.js | 12 +-- .../ts-fallback-rewrite-works.hmr.js | 2 +- .../tsx-fallback-rewrite-works.hmr.js | 2 +- .../snapshots/type-only-imports.hmr.ts | 2 +- .../snapshots/unicode-identifiers.hmr.js | 2 +- ...id-shouldnt-delete-call-expressions.hmr.js | 32 ++++++++ .../void-shouldnt-delete-call-expressions.js | 10 +++ packages/bun-cli-darwin-x64/package.json | 2 +- packages/bun-cli/package.json | 2 +- src/javascript/jsc/WebKit | 2 +- 30 files changed, 182 insertions(+), 115 deletions(-) delete mode 100644 Dockerfile create mode 100644 integration/snapshots/void-shouldnt-delete-call-expressions.hmr.js create mode 100644 integration/snapshots/void-shouldnt-delete-call-expressions.js diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 16ee6dc40f..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM bun-zig:latest - -COPY . /home/ubuntu/bun -WORKDIR /home/ubuntu/bun - -RUN make vendor-without-check - - diff --git a/Makefile b/Makefile index d15093da21..cbe5e661c3 100644 --- a/Makefile +++ b/Makefile @@ -22,12 +22,42 @@ BUN_BUILD_TAG := bun-v$(PACKAGE_JSON_VERSION) CC := clang CXX := clang++ +DEFAULT_USE_BMALLOC := 1 +# ifeq ($(OS_NAME),linux) +# DEFAULT_USE_BMALLOC = 0 +# endif + +USE_BMALLOC ?= DEFAULT_USE_BMALLOC + +JSC_BASE_DIR ?= ${HOME}/webkit-build + +DEFAULT_JSC_LIB := + +ifeq ($(OS_NAME),linux) +DEFAULT_JSC_LIB = $(JSC_BASE_DIR)/lib +endif + +ifeq ($(OS_NAME),darwin) +DEFAULT_JSC_LIB = src/deps +endif + +JSC_LIB ?= $(DEFAULT_JSC_LIB) + +JSC_INCLUDE_DIR ?= $(JSC_BASE_DIR)/include + +JSC_FILES := $(JSC_LIB)/libJavaScriptCore.a $(JSC_LIB)/libWTF.a $(JSC_LIB)/libbmalloc.a + +JSC_BUILD_STEPS := +ifeq ($(OS_NAME),linux) + JSC_BUILD_STEPS += jsc-check +endif +ifeq ($(OS_NAME),darwin) + JSC_BUILD_STEPS += jsc-build-mac jsc-copy-headers +endif STRIP ?= $(shell which llvm-strip || which llvm-strip-12 || echo "Missing llvm-strip. Please pass it in the STRIP environment var"; exit 1;) - - ifeq ($(OS_NAME),darwin) HOMEBREW_PREFIX := $(shell brew --prefix)/ endif @@ -60,9 +90,10 @@ sign-macos-aarch64: release: all-js build-obj jsc-bindings-mac bun-link-lld-release -release-linux: release strip-debug - - +jsc-check: + @ls $(JSC_BASE_DIR) >/dev/null 2>&1 || (echo "Failed to access WebKit build. Please compile the WebKit submodule using the Dockerfile at $(shell pwd)/src/javascript/WebKit/Dockerfile and then copy from /output in the Docker container to $(JSC_BASE_DIR). You can override the directory via JSC_BASE_DIR. \n\n DOCKER_BUILDKIT=1 docker build -t bun-webkit $(shell pwd)/src/javascript/jsc/WebKit -f $(shell pwd)/src/javascript/jsc/WebKit/Dockerfile --progress=plain\n\n docker container create bun-webkit\n\n # Get the container ID\n docker container ls\n\n docker cp DOCKER_CONTAINER_ID_YOU_JUST_FOUND:/output $(JSC_BASE_DIR)" && exit 1) + @ls $(JSC_INCLUDE_DIR) >/dev/null 2>&1 || (echo "Failed to access WebKit include directory at $(JSC_INCLUDE_DIR)." && exit 1) + @ls $(JSC_LIB) >/dev/null 2>&1 || (echo "Failed to access WebKit lib directory at $(JSC_LIB)." && exit 1) all-js: runtime_js fallback_decoder bun_error node-fallbacks @@ -85,40 +116,6 @@ bun_error: @cd packages/bun-error; npm install; npm run --silent build -DEFAULT_USE_BMALLOC := 1 -# ifeq ($(OS_NAME),linux) -# DEFAULT_USE_BMALLOC = 0 -# endif - -USE_BMALLOC ?= DEFAULT_USE_BMALLOC - -DEFAULT_JSC_LIB := - -ifeq ($(OS_NAME),linux) -DEFAULT_JSC_LIB = ${HOME}/webkit-build/lib -endif - -ifeq ($(OS_NAME),darwin) -DEFAULT_JSC_LIB = src/deps -endif - -JSC_LIB ?= $(DEFAULT_JSC_LIB) - -JSC_INCLUDE_DIR ?= ${HOME}/webkit-build/include - -JSC_FILES := $(JSC_LIB)/libJavaScriptCore.a $(JSC_LIB)/libWTF.a - -JSC_BUILD_STEPS := -ifeq ($(OS_NAME),linux) - JSC_BUILD_STEPS += jsc-build-linux jsc-copy-headers -endif -ifeq ($(OS_NAME),darwin) - JSC_BUILD_STEPS += jsc-build-mac jsc-copy-headers -endif - -# ifeq ($(USE_BMALLOC),1) -JSC_FILES += $(JSC_LIB)/libbmalloc.a -# endif jsc: jsc-build jsc-bindings @@ -156,12 +153,12 @@ release-create: release-cli-push: cd packages/bun-cli && npm pack --pack-destination /tmp/ gh release upload $(BUN_BUILD_TAG) --clobber /tmp/bun-cli-$(PACKAGE_JSON_VERSION).tgz - npm publish /tmp/bun-cli-$(PACKAGE_JSON_VERSION).tgz + npm publish /tmp/bun-cli-$(PACKAGE_JSON_VERSION).tgz --access=public -release-mac-push: write-package-json-version +release-bin-push: write-package-json-version cd $(PACKAGE_DIR) && npm pack --pack-destination /tmp/ gh release upload $(BUN_BUILD_TAG) --clobber /tmp/bun-cli-$(TRIPLET)-$(PACKAGE_JSON_VERSION).tgz - npm publish /tmp/bun-cli-$(TRIPLET)-$(PACKAGE_JSON_VERSION).tgz + npm publish /tmp/bun-cli-$(TRIPLET)-$(PACKAGE_JSON_VERSION).tgz --access=public dev-obj: zig build obj @@ -289,7 +286,6 @@ MACOS_ICU_INCLUDE := $(HOMEBREW_PREFIX)opt/icu4c/include ICU_FLAGS := ifeq ($(OS_NAME),linux) - JSC_BUILD_STEPS += jsc-build-linux jsc-copy-headers ICU_FLAGS += -licuuc -licudata -licui18n endif ifeq ($(OS_NAME),darwin) diff --git a/README.md b/README.md index a59526523a..0207b3c608 100644 --- a/README.md +++ b/README.md @@ -600,4 +600,41 @@ Additionally, you'll need `cmake`, `npm` and `esbuild` installed globally. ## Linux -Compile Zig: \ No newline at end of file +A Dockerfile with the exact version of Zig used is availble at `Dockerfile.zig`. This installs all the system dependencies you'll need excluding JavaScriptCore, but doesn't currently compile Bun in one command. If you're having trouble compiling Zig, it might be helpful to look at. + +Compile Zig: + +```bash +git clone https://github.com/jarred-sumner/zig --depth=1 +cd zig +git checkout jarred/zig-sloppy-with-small-structs +cmake . -DCMAKE_BUILD_TYPE=Release && make -j $(nproc) +``` + +Compile JavaScriptCore: + +```bash +# This will take a few minutes, depending on how fast your internet is +git submodule update --init --recursive --progress --depth=1 + +# This will take 10-30 minutes, depending on how many cores your CPU has +DOCKER_BUILDKIT=1 docker build -t bun-webkit $(pwd)/src/javascript/jsc/WebKit -f $(pwd)/src/javascript/jsc/WebKit/Dockerfile --progress=plain +docker container create bun-webkit + +# Find the docker container ID manually. If you know a better way, please submit a PR! +docker container ls + +docker cp DOCKER_CONTAINER_ID_YOU_JUST_FOUND:/output $HOME/webkit-build +``` + +Compile Bun: + +```bash +make vendor dev +``` + +Run bun: + +```bash +packages/debug-bun-cli-darwin-x64/bin/bun-debug +``` diff --git a/integration/snapshots/array-args-with-default-values.hmr.js b/integration/snapshots/array-args-with-default-values.hmr.js index f7b40203e7..aae356eedc 100644 --- a/integration/snapshots/array-args-with-default-values.hmr.js +++ b/integration/snapshots/array-args-with-default-values.hmr.js @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(186686614, "array-args-with-default-values.js"), exports = hmr.exports; +var hmr = new HMR(3474597122, "array-args-with-default-values.js"), exports = hmr.exports; (hmr._load = function() { var lines; const data = () => lines.map(([a = null, b = null, c = null, d = null]) => ({ diff --git a/integration/snapshots/bundled-entry-point.hmr.js b/integration/snapshots/bundled-entry-point.hmr.js index 828236c191..f3008327aa 100644 --- a/integration/snapshots/bundled-entry-point.hmr.js +++ b/integration/snapshots/bundled-entry-point.hmr.js @@ -7,10 +7,10 @@ __HMRModule as HMR import { __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; -import * as $2ed51059 from "http://localhost:8080/node_modules/react/index.js"; +import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; Bun.activate(false); -var hmr = new HMR(2355916096, "bundled-entry-point.js"), exports = hmr.exports; +var hmr = new HMR(3012834585, "bundled-entry-point.js"), exports = hmr.exports; (hmr._load = function() { var hello = null ?? "world"; function test() { diff --git a/integration/snapshots/bundled-entry-point.js b/integration/snapshots/bundled-entry-point.js index e7816245ba..04f92d63a5 100644 --- a/integration/snapshots/bundled-entry-point.js +++ b/integration/snapshots/bundled-entry-point.js @@ -1,7 +1,7 @@ import { __require as require } from "http://localhost:8080/__runtime.js"; -import * as $2ed51059 from "http://localhost:8080/node_modules/react/index.js"; +import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var hello = null ?? "world"; export function test() { diff --git a/integration/snapshots/code-simplification-neql-define.hmr.js b/integration/snapshots/code-simplification-neql-define.hmr.js index 7a1c66be52..1e517c5331 100644 --- a/integration/snapshots/code-simplification-neql-define.hmr.js +++ b/integration/snapshots/code-simplification-neql-define.hmr.js @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(1142302163, "code-simplification-neql-define.js"), exports = hmr.exports; +var hmr = new HMR(726376257, "code-simplification-neql-define.js"), exports = hmr.exports; (hmr._load = function() { var testFailed = false; const invariant = () => { diff --git a/integration/snapshots/export.hmr.js b/integration/snapshots/export.hmr.js index 04821c18e0..6088ffd774 100644 --- a/integration/snapshots/export.hmr.js +++ b/integration/snapshots/export.hmr.js @@ -8,7 +8,7 @@ import what from "http://localhost:8080/_auth.js"; import * as where from "http://localhost:8080/_auth.js"; Bun.activate(false); -var hmr = new HMR(4033101122, "export.js"), exports = hmr.exports; +var hmr = new HMR(1879780259, "export.js"), exports = hmr.exports; (hmr._load = function() { var yoyoyo = "yoyoyo"; function hey() { diff --git a/integration/snapshots/forbid-in-is-correct.hmr.js b/integration/snapshots/forbid-in-is-correct.hmr.js index 979a6be646..bd20b7b424 100644 --- a/integration/snapshots/forbid-in-is-correct.hmr.js +++ b/integration/snapshots/forbid-in-is-correct.hmr.js @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(2952402969, "forbid-in-is-correct.js"), exports = hmr.exports; +var hmr = new HMR(346837007, "forbid-in-is-correct.js"), exports = hmr.exports; (hmr._load = function() { var foo = () => { var D = (i, r) => () => (r || i((r = {exports: {} }).exports, r), r.exports); diff --git a/integration/snapshots/global-is-remapped-to-globalThis.hmr.js b/integration/snapshots/global-is-remapped-to-globalThis.hmr.js index aa9e9d8b56..a5a3723a6c 100644 --- a/integration/snapshots/global-is-remapped-to-globalThis.hmr.js +++ b/integration/snapshots/global-is-remapped-to-globalThis.hmr.js @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(2277846108, "global-is-remapped-to-globalThis.js"), exports = hmr.exports; +var hmr = new HMR(713665787, "global-is-remapped-to-globalThis.js"), exports = hmr.exports; (hmr._load = function() { function test() { console.assert(globalThis === globalThis); diff --git a/integration/snapshots/lodash-regexp.hmr.js b/integration/snapshots/lodash-regexp.hmr.js index 768ad9b0de..cd9ca40f72 100644 --- a/integration/snapshots/lodash-regexp.hmr.js +++ b/integration/snapshots/lodash-regexp.hmr.js @@ -7,11 +7,11 @@ __HMRModule as HMR import { __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; -import * as $cbd4e379 from "http://localhost:8080/node_modules/lodash/lodash.js"; -var { shuffle} = require($cbd4e379); +import * as $60f52dc2 from "http://localhost:8080/node_modules/lodash/lodash.js"; +var { shuffle} = require($60f52dc2); Bun.activate(false); -var hmr = new HMR(1678450382, "lodash-regexp.js"), exports = hmr.exports; +var hmr = new HMR(2158065009, "lodash-regexp.js"), exports = hmr.exports; (hmr._load = function() { function test() { const foo = [1, 2, 3, 4, 6]; diff --git a/integration/snapshots/lodash-regexp.js b/integration/snapshots/lodash-regexp.js index 30dcab4e5a..6e0e6190a7 100644 --- a/integration/snapshots/lodash-regexp.js +++ b/integration/snapshots/lodash-regexp.js @@ -1,8 +1,8 @@ import { __require as require } from "http://localhost:8080/__runtime.js"; -import * as $cbd4e379 from "http://localhost:8080/node_modules/lodash/lodash.js"; -var { shuffle} = require($cbd4e379); +import * as $60f52dc2 from "http://localhost:8080/node_modules/lodash/lodash.js"; +var { shuffle} = require($60f52dc2); export function test() { const foo = [1, 2, 3, 4, 6]; diff --git a/integration/snapshots/multiple-imports.hmr.js b/integration/snapshots/multiple-imports.hmr.js index df44a70df2..022f3e6663 100644 --- a/integration/snapshots/multiple-imports.hmr.js +++ b/integration/snapshots/multiple-imports.hmr.js @@ -8,15 +8,15 @@ import { __HMRModule as HMR } from "http://localhost:8080/__runtime.js"; import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; -import * as $2ed51059 from "http://localhost:8080/node_modules/react/index.js"; -var JSXClassic = require($2ed51059); +import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, JSXFrag = require(JSXClassic).Fragment; -var { default: React} = require($2ed51059); -var { default: React2} = require($2ed51059); +var { default: React} = require($bbcd215f); +var { default: React2} = require($bbcd215f); Bun.activate(false); -var hmr = new HMR(1572769260, "multiple-imports.js"), exports = hmr.exports; +var hmr = new HMR(2165509932, "multiple-imports.js"), exports = hmr.exports; (hmr._load = function() { const bacon = React; const bacon2 = jsx(JSXFrag, { diff --git a/integration/snapshots/multiple-imports.js b/integration/snapshots/multiple-imports.js index f4c2745671..1bc6eb7470 100644 --- a/integration/snapshots/multiple-imports.js +++ b/integration/snapshots/multiple-imports.js @@ -2,12 +2,12 @@ import { __require as require } from "http://localhost:8080/__runtime.js"; import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; -import * as $2ed51059 from "http://localhost:8080/node_modules/react/index.js"; -var JSXClassic = require($2ed51059); +import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, JSXFrag = require(JSXClassic).Fragment; -var { default: React} = require($2ed51059); -var { default: React2} = require($2ed51059); +var { default: React} = require($bbcd215f); +var { default: React2} = require($bbcd215f); const bacon = React; const bacon2 = jsx(JSXFrag, { diff --git a/integration/snapshots/package-json-exports/index.hmr.js b/integration/snapshots/package-json-exports/index.hmr.js index 26c6c05921..508dd63eef 100644 --- a/integration/snapshots/package-json-exports/index.hmr.js +++ b/integration/snapshots/package-json-exports/index.hmr.js @@ -7,15 +7,15 @@ __HMRModule as HMR import { __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; -import * as $cc5b5b4d from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/index.js"; -var InexactRoot = require($cc5b5b4d); -import * as $3a1d0f08 from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/dir/file.js"; -var InexactFile = require($3a1d0f08); -import * as $6b803e42 from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/foo.js"; -var ExactFile = require($6b803e42); +import * as $4068f25b from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/index.js"; +var InexactRoot = require($4068f25b); +import * as $d2a171d2 from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/dir/file.js"; +var InexactFile = require($d2a171d2); +import * as $522c6d1f from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/foo.js"; +var ExactFile = require($522c6d1f); Bun.activate(false); -var hmr = new HMR(3722745821, "package-json-exports/index.js"), exports = hmr.exports; +var hmr = new HMR(1953708113, "package-json-exports/index.js"), exports = hmr.exports; (hmr._load = function() { async function test() { console.assert(InexactRoot.target === "browser"); diff --git a/integration/snapshots/package-json-exports/index.js b/integration/snapshots/package-json-exports/index.js index 45e3dcaf5b..1b260c7ead 100644 --- a/integration/snapshots/package-json-exports/index.js +++ b/integration/snapshots/package-json-exports/index.js @@ -1,12 +1,12 @@ import { __require as require } from "http://localhost:8080/__runtime.js"; -import * as $cc5b5b4d from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/index.js"; -var InexactRoot = require($cc5b5b4d); -import * as $3a1d0f08 from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/dir/file.js"; -var InexactFile = require($3a1d0f08); -import * as $6b803e42 from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/foo.js"; -var ExactFile = require($6b803e42); +import * as $4068f25b from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/index.js"; +var InexactRoot = require($4068f25b); +import * as $d2a171d2 from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/dir/file.js"; +var InexactFile = require($d2a171d2); +import * as $522c6d1f from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/foo.js"; +var ExactFile = require($522c6d1f); export async function test() { console.assert(InexactRoot.target === "browser"); diff --git a/integration/snapshots/spread_with_key.hmr.tsx b/integration/snapshots/spread_with_key.hmr.tsx index 457d61a799..9176e2ef74 100644 --- a/integration/snapshots/spread_with_key.hmr.tsx +++ b/integration/snapshots/spread_with_key.hmr.tsx @@ -8,14 +8,14 @@ import { __HMRModule as HMR } from "http://localhost:8080/__runtime.js"; import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; -import * as $2ed51059 from "http://localhost:8080/node_modules/react/index.js"; -var JSXClassic = require($2ed51059); +import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, jsxEl = require(JSXClassic).createElement; -var { default: React} = require($2ed51059); +var { default: React} = require($bbcd215f); Bun.activate(false); -var hmr = new HMR(263168651, "spread_with_key.tsx"), exports = hmr.exports; +var hmr = new HMR(2717584935, "spread_with_key.tsx"), exports = hmr.exports; (hmr._load = function() { function SpreadWithTheKey({ className diff --git a/integration/snapshots/spread_with_key.tsx b/integration/snapshots/spread_with_key.tsx index b57a92a00c..052e3f4ba1 100644 --- a/integration/snapshots/spread_with_key.tsx +++ b/integration/snapshots/spread_with_key.tsx @@ -2,11 +2,11 @@ import { __require as require } from "http://localhost:8080/__runtime.js"; import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; -import * as $2ed51059 from "http://localhost:8080/node_modules/react/index.js"; -var JSXClassic = require($2ed51059); +import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, jsxEl = require(JSXClassic).createElement; -var { default: React} = require($2ed51059); +var { default: React} = require($bbcd215f); export function SpreadWithTheKey({ className }) { diff --git a/integration/snapshots/string-escapes.hmr.js b/integration/snapshots/string-escapes.hmr.js index bebb379234..9231cb6cf5 100644 --- a/integration/snapshots/string-escapes.hmr.js +++ b/integration/snapshots/string-escapes.hmr.js @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(2657253006, "string-escapes.js"), exports = hmr.exports; +var hmr = new HMR(2482749838, "string-escapes.js"), exports = hmr.exports; (hmr._load = function() { var tab = "\t"; var シ = "wow"; diff --git a/integration/snapshots/styledcomponents-output.hmr.js b/integration/snapshots/styledcomponents-output.hmr.js index c50113fd4f..5d0dee8250 100644 --- a/integration/snapshots/styledcomponents-output.hmr.js +++ b/integration/snapshots/styledcomponents-output.hmr.js @@ -10,15 +10,15 @@ __HMRModule as HMR import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; var jsx = require(JSX).jsxDEV; -import * as $ab83b9cf from "http://localhost:8080/node_modules/styled-components/dist/styled-components.browser.esm.js"; -var { default: styled} = require($ab83b9cf); -import * as $2ed51059 from "http://localhost:8080/node_modules/react/index.js"; -var { default: React} = require($2ed51059); -import * as $a259fa9b from "http://localhost:8080/node_modules/react-dom/index.js"; -var { default: ReactDOM} = require($a259fa9b); +import * as $d4051a2e from "http://localhost:8080/node_modules/styled-components/dist/styled-components.browser.esm.js"; +var { default: styled} = require($d4051a2e); +import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +var { default: React} = require($bbcd215f); +import * as $5b3cea55 from "http://localhost:8080/node_modules/react-dom/index.js"; +var { default: ReactDOM} = require($5b3cea55); Bun.activate(false); -var hmr = new HMR(2744898121, "styledcomponents-output.js"), exports = hmr.exports; +var hmr = new HMR(1290604342, "styledcomponents-output.js"), exports = hmr.exports; (hmr._load = function() { const ErrorScreenRoot = styled.div` font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, diff --git a/integration/snapshots/styledcomponents-output.js b/integration/snapshots/styledcomponents-output.js index 8a0e252803..df45ce11e8 100644 --- a/integration/snapshots/styledcomponents-output.js +++ b/integration/snapshots/styledcomponents-output.js @@ -4,12 +4,12 @@ __require as require import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; var jsx = require(JSX).jsxDEV; -import * as $ab83b9cf from "http://localhost:8080/node_modules/styled-components/dist/styled-components.browser.esm.js"; -var { default: styled} = require($ab83b9cf); -import * as $2ed51059 from "http://localhost:8080/node_modules/react/index.js"; -var { default: React} = require($2ed51059); -import * as $a259fa9b from "http://localhost:8080/node_modules/react-dom/index.js"; -var { default: ReactDOM} = require($a259fa9b); +import * as $d4051a2e from "http://localhost:8080/node_modules/styled-components/dist/styled-components.browser.esm.js"; +var { default: styled} = require($d4051a2e); +import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +var { default: React} = require($bbcd215f); +import * as $5b3cea55 from "http://localhost:8080/node_modules/react-dom/index.js"; +var { default: ReactDOM} = require($5b3cea55); const ErrorScreenRoot = styled.div` font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; diff --git a/integration/snapshots/ts-fallback-rewrite-works.hmr.js b/integration/snapshots/ts-fallback-rewrite-works.hmr.js index 6703d08a17..e728c5f143 100644 --- a/integration/snapshots/ts-fallback-rewrite-works.hmr.js +++ b/integration/snapshots/ts-fallback-rewrite-works.hmr.js @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(631080924, "ts-fallback-rewrite-works.ts"), exports = hmr.exports; +var hmr = new HMR(421762902, "ts-fallback-rewrite-works.ts"), exports = hmr.exports; (hmr._load = function() { function test() { return testDone(import.meta.url); diff --git a/integration/snapshots/tsx-fallback-rewrite-works.hmr.js b/integration/snapshots/tsx-fallback-rewrite-works.hmr.js index 85b864563a..3f2f754e26 100644 --- a/integration/snapshots/tsx-fallback-rewrite-works.hmr.js +++ b/integration/snapshots/tsx-fallback-rewrite-works.hmr.js @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(2958250497, "tsx-fallback-rewrite-works.tsx"), exports = hmr.exports; +var hmr = new HMR(2117426367, "tsx-fallback-rewrite-works.tsx"), exports = hmr.exports; (hmr._load = function() { function test() { return testDone(import.meta.url); diff --git a/integration/snapshots/type-only-imports.hmr.ts b/integration/snapshots/type-only-imports.hmr.ts index e36667ddf8..84740d0d9e 100644 --- a/integration/snapshots/type-only-imports.hmr.ts +++ b/integration/snapshots/type-only-imports.hmr.ts @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(2365801153, "type-only-imports.ts"), exports = hmr.exports; +var hmr = new HMR(650094581, "type-only-imports.ts"), exports = hmr.exports; (hmr._load = function() { var baconator = true; var SilentSymbolCollisionsAreOkayInTypeScript = true; diff --git a/integration/snapshots/unicode-identifiers.hmr.js b/integration/snapshots/unicode-identifiers.hmr.js index 0452d68492..5d465d559c 100644 --- a/integration/snapshots/unicode-identifiers.hmr.js +++ b/integration/snapshots/unicode-identifiers.hmr.js @@ -6,7 +6,7 @@ __HMRClient as Bun } from "http://localhost:8080/__runtime.js"; Bun.activate(false); -var hmr = new HMR(2975064322, "unicode-identifiers.js"), exports = hmr.exports; +var hmr = new HMR(1398361736, "unicode-identifiers.js"), exports = hmr.exports; (hmr._load = function() { var ε = 1.0e-06, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π; function test() { diff --git a/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.js b/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.js new file mode 100644 index 0000000000..239b40fbd7 --- /dev/null +++ b/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.js @@ -0,0 +1,32 @@ +import { +__HMRModule as HMR +} from "http://localhost:8080/__runtime.js"; +import { +__HMRClient as Bun +} from "http://localhost:8080/__runtime.js"; +Bun.activate(false); + +var hmr = new HMR(635901064, "void-shouldnt-delete-call-expressions.js"), exports = hmr.exports; +(hmr._load = function() { + var was_called = false; + function thisShouldBeCalled() { + was_called = true; + } + thisShouldBeCalled(); + function test() { + if (!was_called) + throw new Error("Expected thisShouldBeCalled to be called"); + return testDone(import.meta.url); + } + hmr.exportAll({ + test: () => test + }); +})(); +var $$hmr_test = hmr.exports.test; +hmr._update = function(exports) { + $$hmr_test = exports.test; +}; + +export { + $$hmr_test as test +}; diff --git a/integration/snapshots/void-shouldnt-delete-call-expressions.js b/integration/snapshots/void-shouldnt-delete-call-expressions.js new file mode 100644 index 0000000000..3e088c5a77 --- /dev/null +++ b/integration/snapshots/void-shouldnt-delete-call-expressions.js @@ -0,0 +1,10 @@ +var was_called = false; +function thisShouldBeCalled() { + was_called = true; +} +thisShouldBeCalled(); +export function test() { + if (!was_called) + throw new Error("Expected thisShouldBeCalled to be called"); + return testDone(import.meta.url); +} diff --git a/packages/bun-cli-darwin-x64/package.json b/packages/bun-cli-darwin-x64/package.json index a3c9d23799..7d6868061e 100644 --- a/packages/bun-cli-darwin-x64/package.json +++ b/packages/bun-cli-darwin-x64/package.json @@ -4,5 +4,5 @@ }, "name": "bun-cli-darwin-x64", "repository": "https://github.com/jarred-sumner/bun", - "version": "0.0.27" + "version": "0.0.28" } diff --git a/packages/bun-cli/package.json b/packages/bun-cli/package.json index 609dcdc6e2..d65a6ed649 100644 --- a/packages/bun-cli/package.json +++ b/packages/bun-cli/package.json @@ -9,5 +9,5 @@ "postinstall": "node postinstall.js", "prepublishOnly": "rm -rf ./bin/bun; chmod +x ./reset-bin.js; cp ./reset-bin.js ./bin/bun" }, - "version": "0.0.27" + "version": "0.0.28" } diff --git a/src/javascript/jsc/WebKit b/src/javascript/jsc/WebKit index 487a7b31de..58007798f3 160000 --- a/src/javascript/jsc/WebKit +++ b/src/javascript/jsc/WebKit @@ -1 +1 @@ -Subproject commit 487a7b31de9fa54dab1611799db26907c14dc5a8 +Subproject commit 58007798f366ae8bb7487ca5256a6db860c6da41