aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.devcontainer/devcontainer.json6
-rw-r--r--.docker/chromium.pref14
-rw-r--r--.docker/debian.list3
-rw-r--r--.github/workflows/bun.yml28
-rw-r--r--Dockerfile205
-rw-r--r--Dockerfile.musl139
-rw-r--r--Makefile44
-rw-r--r--integration/scripts/browser.js20
-rw-r--r--integration/scripts/package.json5
-rw-r--r--integration/snippets/package.json2
-rw-r--r--package.json8
11 files changed, 392 insertions, 82 deletions
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 401c7c088..c9797da83 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -32,8 +32,10 @@
"postCreateCommand": "cd /workspaces/bun; bash /workspaces/getting-started.sh; zsh",
"build": {
- "target": "dev",
- "cacheFrom": "dev:latest",
+ "target": "bun.devcontainer",
+ "cacheFrom": [
+ "bun.devcontainer:latest",
+ ],
"args": {}
},
"runArgs": [
diff --git a/.docker/chromium.pref b/.docker/chromium.pref
new file mode 100644
index 000000000..fc8e464bd
--- /dev/null
+++ b/.docker/chromium.pref
@@ -0,0 +1,14 @@
+# Note: 2 blank lines are required between entries
+ Package: *
+ Pin: release a=eoan
+ Pin-Priority: 500
+
+ Package: *
+ Pin: origin "ftp.debian.org"
+ Pin-Priority: 300
+
+ # Pattern includes 'chromium', 'chromium-browser' and similarly
+ # named dependencies:
+ Package: chromium*
+ Pin: origin "ftp.debian.org"
+ Pin-Priority: 700 \ No newline at end of file
diff --git a/.docker/debian.list b/.docker/debian.list
new file mode 100644
index 000000000..4954b36f3
--- /dev/null
+++ b/.docker/debian.list
@@ -0,0 +1,3 @@
+ deb http://deb.debian.org/debian buster main
+ deb http://deb.debian.org/debian buster-updates main
+ deb http://deb.debian.org/debian-security buster/updates main \ No newline at end of file
diff --git a/.github/workflows/bun.yml b/.github/workflows/bun.yml
new file mode 100644
index 000000000..2c97bd913
--- /dev/null
+++ b/.github/workflows/bun.yml
@@ -0,0 +1,28 @@
+name: CI workflow for bun
+on:
+ push:
+ branches: [main, bun-actions]
+ pull_request:
+ branches: [main]
+
+jobs:
+ release:
+ runs-on: ubuntu:20.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v1
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
+ - name: Build and push
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: jarred-sumner/bun:${{steps.vars.outputs.tag}}
+ target: release
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+ ulimit: "memlock=-1:-1 core=-1:-1"
diff --git a/Dockerfile b/Dockerfile
index a91619c84..a37a78d90 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:20.04 as ubuntu-base
+FROM ubuntu:20.04 as base
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install --no-install-recommends -y wget gnupg2 curl lsb-release wget software-properties-common
@@ -59,11 +59,22 @@ ENV WEBKIT_OUT_DIR /home/ubuntu/bun-webkit
WORKDIR /home/ubuntu
+ENV PATH "/home/ubuntu/zig:$PATH"
+ENV JSC_BASE_DIR $WEBKIT_OUT_DIR
+ENV LIB_ICU_PATH /home/ubuntu/icu/source/lib
+ENV BUN_RELEASE_DIR /home/ubuntu/bun-release
+ENV BUN_DEPS_OUT_DIR /home/ubuntu/bun-deps
+
+RUN mkdir -p $BUN_RELEASE_DIR $BUN_DEPS_OUT_DIR /home/ubuntu/bun
+
+FROM base as base_with_zig_and_webkit
+
+WORKDIR /home/ubuntu
+
RUN curl -L https://github.com/Jarred-Sumner/WebKit/releases/download/Bun-v0/bun-webkit-linux-$BUILDARCH.tar.gz > bun-webkit-linux-$BUILDARCH.tar.gz; \
tar -xzf bun-webkit-linux-$BUILDARCH.tar.gz; \
rm bun-webkit-linux-$BUILDARCH.tar.gz && cat $WEBKIT_OUT_DIR/include/cmakeconfig.h > /dev/null
-WORKDIR /home/ubuntu
RUN curl -L https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.tgz > icu4c-66_1-src.tgz && \
tar -xzf icu4c-66_1-src.tgz && \
rm icu4c-66_1-src.tgz && \
@@ -72,48 +83,89 @@ RUN curl -L https://github.com/unicode-org/icu/releases/download/release-66-1/ic
make -j$(nproc)
-ENV PATH "/home/ubuntu/zig:$PATH"
-ENV JSC_BASE_DIR $WEBKIT_OUT_DIR
-ENV LIB_ICU_PATH /home/ubuntu/icu/source/lib
-ENV BUN_RELEASE_DIR /home/ubuntu/bun-release
+WORKDIR /home/ubuntu/bun
+
+FROM base as mimalloc
+
+WORKDIR /home/ubuntu/bun
+COPY Makefile /home/ubuntu/bun/Makefile
+COPY src/deps/mimalloc /home/ubuntu/bun/src/deps/mimalloc
+
+RUN make mimalloc
+
+FROM base as zlib
+
+WORKDIR /home/ubuntu/bun
+COPY Makefile /home/ubuntu/bun/Makefile
+COPY src/deps/zlib /home/ubuntu/bun/src/deps/zlib
+RUN make zlib
-FROM ubuntu-base as build_dependencies
+FROM base as libarchive
WORKDIR /home/ubuntu/bun
+COPY Makefile /home/ubuntu/bun/Makefile
+COPY src/deps/libarchive /home/ubuntu/bun/src/deps/libarchive
+
+RUN make libarchive
+FROM base as boringssl
+
+WORKDIR /home/ubuntu/bun
COPY Makefile /home/ubuntu/bun/Makefile
-COPY src/deps /home/ubuntu/bun/src/deps
-COPY src/js_lexer/identifier_data.zig /home/ubuntu/bun/src/js_lexer/identifier_data.zig
-COPY src/js_lexer/identifier_cache.zig /home/ubuntu/bun/src/js_lexer/identifier_cache.zig
-COPY src/node-fallbacks /home/ubuntu/bun/src/node-fallbacks
+COPY src/deps/boringssl /home/ubuntu/bun/src/deps/boringssl
+
+RUN make boringssl
+
+FROM base as picohttp
WORKDIR /home/ubuntu/bun
+COPY Makefile /home/ubuntu/bun/Makefile
+COPY src/deps/picohttpparser /home/ubuntu/bun/src/deps/picohttpparser
+COPY src/deps/*.c /home/ubuntu/bun/src/deps
+COPY src/deps/*.h /home/ubuntu/bun/src/deps
-ENV BUN_DEPS_OUT_DIR /home/ubuntu/bun-deps
+RUN make picohttp
+FROM base_with_zig_and_webkit as identifier_cache
-RUN mkdir -p $BUN_DEPS_OUT_DIR; make \
- mimalloc \
- zlib \
- libarchive \
- boringssl \
- picohttp \
- identifier-cache \
- node-fallbacks
+WORKDIR /home/ubuntu/bun
+COPY Makefile /home/ubuntu/bun/Makefile
+COPY src/js_lexer/identifier_data.zig /home/ubuntu/bun/src/js_lexer/identifier_data.zig
+COPY src/js_lexer/identifier_cache.zig /home/ubuntu/bun/src/js_lexer/identifier_cache.zig
-FROM ubuntu-base as prebuild
+RUN make identifier-cache
-ENV BUN_DEPS_OUT_DIR /home/ubuntu/bun-deps
+FROM base as node_fallbacks
+WORKDIR /home/ubuntu/bun
+COPY Makefile /home/ubuntu/bun/Makefile
+COPY src/node-fallbacks /home/ubuntu/bun/src/node-fallbacks
+RUN make node-fallbacks
-ADD . /home/ubuntu/bun
-COPY --from=build_dependencies /home/ubuntu/bun-deps /home/ubuntu/bun-deps
-COPY --from=build_dependencies /home/ubuntu/bun/src/node-fallbacks /home/ubuntu/bun/src/node-fallbacks
-COPY --from=build_dependencies /home/ubuntu/bun/src/js_lexer/*.blob /home/ubuntu/bun/src/js_lexer
+FROM base_with_zig_and_webkit as build_dependencies
WORKDIR /home/ubuntu/bun
+ENV BUN_DEPS_OUT_DIR /home/ubuntu/bun-deps
+
+COPY ./src /home/ubuntu/bun/src
+COPY ./build.zig /home/ubuntu/bun/build.zig
+COPY ./completions /home/ubuntu/bun/completions
+COPY ./packages /home/ubuntu/bun/packages
+COPY ./build-id /home/ubuntu/bun/build-id
+COPY ./package.json /home/ubuntu/bun/package.json
+COPY ./misctools /home/ubuntu/bun/misctools
+COPY Makefile /home/ubuntu/bun/Makefile
+
+COPY --from=mimalloc /home/ubuntu/bun-deps/*.o /home/ubuntu/bun-deps
+COPY --from=libarchive /home/ubuntu/bun-deps/*.a /home/ubuntu/bun-deps
+COPY --from=picohttp /home/ubuntu/bun-deps/*.o /home/ubuntu/bun-deps
+COPY --from=boringssl /home/ubuntu/bun-deps/*.a /home/ubuntu/bun-deps
+COPY --from=zlib /home/ubuntu/bun-deps/*.a /home/ubuntu/bun-deps
+COPY --from=node_fallbacks /home/ubuntu/bun/src/node-fallbacks /home/ubuntu/bun/src/node-fallbacks
+COPY --from=identifier_cache /home/ubuntu/bun/src/js_lexer/*.blob /home/ubuntu/bun/src/js_lexer/
+
RUN make \
jsc-bindings-headers \
api \
@@ -121,7 +173,7 @@ RUN make \
bun_error \
fallback_decoder
-FROM prebuild as build_release
+FROM build_dependencies as build_release
WORKDIR /home/ubuntu/bun
@@ -130,23 +182,14 @@ ENV BUN_RELEASE_DIR /home/ubuntu/bun-release
RUN mkdir -p $BUN_RELEASE_DIR; make release \
copy-to-bun-release-dir
-
-FROM ubuntu:20.04 as release
-
-COPY --from=build_release /home/ubuntu/bun-release/bun /opt/bun/bin/bun
-COPY .devcontainer/limits.conf /etc/security/limits.conf
-
-ENV BUN_INSTALL /opt/bun
-ENV PATH "/opt/bun/bin:$PATH"
-
-FROM ubuntu-base as dev
+FROM base_with_zig_and_webkit as bun.devcontainer
ENV WEBKIT_OUT_DIR /home/ubuntu/bun-webkit
ENV PATH "/home/ubuntu/zig:$PATH"
ENV JSC_BASE_DIR $WEBKIT_OUT_DIR
ENV LIB_ICU_PATH /home/ubuntu/icu/source/lib
ENV BUN_RELEASE_DIR /home/ubuntu/bun-release
-ENV PATH "/workspaces/bun/packages/bun-linux-amd64:/workspaces/bun/packages/bun-linux-aarch64:/workspaces/bun/packages/debug-bun-linux-x64:/workspaces/bun/packages/debug-bun-linux-aarch64:$PATH"
+ENV PATH "/workspaces/bun/packages/bun-linux-x64:/workspaces/bun/packages/bun-linux-aarch64:/workspaces/bun/packages/debug-bun-linux-x64:/workspaces/bun/packages/debug-bun-linux-aarch64:$PATH"
ENV PATH "/home/ubuntu/zls/zig-out/bin:$PATH"
ENV BUN_INSTALL /home/ubuntu/.bun
@@ -162,4 +205,88 @@ COPY ".devcontainer/scripts/getting-started.sh" /workspaces/getting-started.sh
RUN mkdir -p /home/ubuntu/.bun /home/ubuntu/.config /workspaces/bun && bash /scripts/common-debian.sh && bash /scripts/github.sh && bash /scripts/nice.sh && bash /scripts/zig-env.sh
COPY .devcontainer/zls.json /home/ubuntu/.config/zls.json
-FROM release \ No newline at end of file
+FROM ubuntu:20.04 as test_base
+
+ARG DEBIAN_FRONTEND=noninteractive
+ENV DEBIAN_FRONTEND=noninteractive
+
+ENV CI 1
+ENV NPM_CLIENT bun
+ENV PATH "/home/ubuntu/bun/packages/bun-linux-x64:/home/ubuntu/bun/packages/bun-linux-aarch64:$PATH"
+
+# All this is necessary because Ubuntu decided to use snap for their Chromium packages
+# Which breaks using Chrome in the container on aarch64
+RUN apt-get update && \
+ apt-get install -y wget gnupg2 curl make git unzip nodejs npm psmisc && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DCC9EFBF77E11517 && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA8E81B4331F7F50 && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 112695A0E562B32A
+
+COPY ./integration /home/ubuntu/bun/integration
+COPY Makefile /home/ubuntu/bun/Makefile
+COPY package.json /home/ubuntu/bun/package.json
+
+# We don't want to worry about architecture differences in this image
+COPY --from=release /opt/bun/bin/bun /home/ubuntu/bun/packages/bun-linux-aarch64/bun
+COPY --from=release /opt/bun/bin/bun /home/ubuntu/bun/packages/bun-linux-x64/bun
+
+FROM test_base as test_create_next
+
+WORKDIR /home/ubuntu/bun
+CMD make test-create-next
+
+FROM test_base as test_create_react
+
+WORKDIR /home/ubuntu/bun
+CMD make test-create-react
+
+
+FROM test_base as test_bun_run
+
+WORKDIR /home/ubuntu/bun
+CMD make test-bun-run
+
+FROM test_base as browser_test_base
+
+COPY .docker/chromium.pref /etc/apt/preferences.d/chromium.pref
+COPY .docker/debian.list /etc/apt/sources.list.d/debian.list
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends chromium
+
+
+WORKDIR /home/ubuntu/bun
+
+RUN mkdir -p /var/run/dbus && ln -s /usr/bin/chromium /usr/bin/chromium-browser
+RUN apt-get install -y make fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 xvfb ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils --no-install-recommends
+
+
+FROM browser_test_base as test_hmr
+
+WORKDIR /home/ubuntu/bun
+CMD dbus-daemon --system &> /dev/null && \
+ bun install --cwd /home/ubuntu/bun/integration/snippets && \
+ bun install --cwd /home/ubuntu/bun/integration/scripts && \
+ bun install && \
+ make test-hmr-hmr
+
+FROM browser_test_base as test_no_hmr
+
+WORKDIR /home/ubuntu/bun
+CMD dbus-daemon --system &> /dev/null && \
+ bun install --cwd /home/ubuntu/bun/integration/snippets && \
+ bun install --cwd /home/ubuntu/bun/integration/scripts && \
+ bun install && \
+ make test-no-hmr
+
+FROM ubuntu:20.04 as release
+
+COPY --from=build_release /home/ubuntu/bun-release/bun /opt/bun/bin/bun
+COPY .devcontainer/limits.conf /etc/security/limits.conf
+
+ENV BUN_INSTALL /opt/bun
+ENV PATH "/opt/bun/bin:$PATH"
+
+LABEL org.opencontainers.image.title="Bun ${BUILDARCH} (glibc)"
+LABEL org.opencontainers.image.source=https://github.com/jarred-sumner/bun \ No newline at end of file
diff --git a/Dockerfile.musl b/Dockerfile.musl
new file mode 100644
index 000000000..146f3f8a9
--- /dev/null
+++ b/Dockerfile.musl
@@ -0,0 +1,139 @@
+
+# This doesn't work
+# Specifically: there are a number of crashes and segfaults when using musl
+# The cause is likely related to differences in pthreads implementations
+# It is not just the stack size thing. It's something more complicated and importantly
+# There was no meaningful file size difference between musl and glibc
+
+
+# ARG BUILDARCH=aarch64
+# ARG zig_base_image=ghcr.io/jarred-sumner/zig-linux-musl-${BUILDARCH}
+# ARG webkit_base_image=ghcr.io/jarred-sumner/bun-webkit-musl-${BUILDARCH}
+# FROM ${zig_base_image}:latest AS zig
+# FROM ${webkit_base_image}:latest AS webkit
+
+# FROM zig as bun_base
+
+# COPY --from=webkit /webkit /webkit
+
+# ENV PATH "/zig/bin:$PATH"
+# ENV JSC_BASE_DIR=/webkit
+# ENV LIB_ICU_PATH=/webkit/lib
+# ENV BUN_DEPS_OUT_DIR /bun-deps
+# ENV STATIC_MUSL_FLAG=-static
+# ENV MIMALLOC_OVERRIDE_FLAG="-DMI_OVERRIDE=OFF"
+
+# RUN apk add --no-cache nodejs npm go libtool autoconf pkgconfig automake ninja
+# RUN mkdir -p $BUN_DEPS_OUT_DIR;
+
+# WORKDIR /bun
+# COPY Makefile /bun/Makefile
+
+# FROM bun_base as mimalloc
+
+# COPY src/deps/mimalloc /bun/src/deps/mimalloc
+
+# RUN make mimalloc;
+
+# FROM bun_base as zlib
+
+# COPY src/deps/zlib /bun/src/deps/zlib
+
+# RUN make zlib;
+
+# FROM bun_base as libarchive
+
+# COPY src/deps/libarchive /bun/src/deps/libarchive
+
+# RUN make libarchive;
+
+# FROM bun_base as boringssl
+
+# COPY src/deps/boringssl /bun/src/deps/boringssl
+
+# RUN make boringssl;
+
+# FROM bun_base as picohttp
+
+# COPY src/deps/picohttpparser /bun/src/deps/picohttpparser
+# COPY src/deps/*.c /bun/src/deps
+# COPY src/deps/*.h /bun/src/deps
+
+# RUN make picohttp
+
+# FROM bun_base as identifier_cache
+
+# COPY src/js_lexer/identifier_data.zig /bun/src/js_lexer/identifier_data.zig
+# COPY src/js_lexer/identifier_cache.zig /bun/src/js_lexer/identifier_cache.zig
+
+# RUN make identifier-cache
+
+# FROM bun_base as node_fallbacks
+
+# COPY src/node-fallbacks /bun/src/node-fallbacks
+# RUN make node-fallbacks
+
+# FROM bun_base as prebuild
+
+# WORKDIR /bun
+
+# COPY ./src /bun/src
+# COPY ./build.zig /bun/build.zig
+# COPY ./completions /bun/completions
+# COPY ./packages /bun/packages
+# COPY ./build-id /bun/build-id
+# COPY ./package.json /bun/package.json
+# COPY ./misctools /bun/misctools
+
+# COPY --from=mimalloc /bun-deps/*.o /bun-deps
+# COPY --from=libarchive /bun-deps/*.a /bun-deps
+# COPY --from=picohttp /bun-deps/*.o /bun-deps
+# COPY --from=boringssl /bun-deps/*.a /bun-deps
+# COPY --from=zlib /bun-deps/*.a /bun-deps
+# COPY --from=node_fallbacks /bun/src/node-fallbacks /bun/src/node-fallbacks
+# COPY --from=identifier_cache /bun/src/js_lexer/*.blob /bun/src/js_lexer/
+
+# ENV ICU_FLAGS="-I/webkit/include/wtf $ICU_FLAGS"
+
+# RUN apk add --no-cache chromium && npm install -g esbuild && make \
+# jsc-bindings-headers \
+# api \
+# analytics \
+# bun_error \
+# fallback_decoder
+
+
+
+# FROM prebuild as release
+
+# ENV BUN_RELEASE_DIR /opt/bun
+
+# ENV LIB_ICU_PATH /usr/lib
+
+# RUN apk add icu-static icu-dev && mkdir -p $BUN_RELEASE_DIR; make release \
+# copy-to-bun-release-dir
+
+# FROM alpine:3.15 as bun
+
+# COPY --from=release /opt/bun/bun /opt/bun/bin/bun
+# ENV BUN_INSTALL /opt/bun
+# ENV PATH /opt/bun/bin:$PATH
+
+# LABEL org.opencontainers.image.title="Bun - Linux ${BUILDARCH} (musl)"
+# LABEL org.opencontainers.image.source=https://github.com/jarred-sumner/bun
+
+# FROM release as test
+
+# ENV PATH /opt/bun/bin:$PATH
+# ENV PATH /bun/packages/bun-linux-aarch64:/bun/packages/bun-linux-x64:$PATH
+# ENV BUN_INSTALL /opt/bun
+
+# WORKDIR /bun
+
+# COPY ./integration /bun/integration
+# COPY ./integration/snippets/package-json-exports/_node_modules_copy /bun/integration/snippets/package-json-exports/_node_modules_copy
+# CMD [ "bash", "-c", "npm install && cd /bun/integration/snippets && npm install && cd /bun && make copy-test-node-modules test-all"]
+
+
+# # FROM bun
+
diff --git a/Makefile b/Makefile
index 23c3c8f57..657bb68ee 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ PRETTIER ?= $(shell which prettier || echo "./node_modules/.bin/prettier")
WEBKIT_DIR ?= $(realpath src/javascript/jsc/WebKit)
WEBKIT_RELEASE_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Release
-NPM_CLIENT = $(shell which npm)
+NPM_CLIENT ?= $(shell which npm)
ZIG ?= $(shell which zig || echo -e "error: Missing zig. Please make sure zig is in PATH. Or set ZIG=/path/to-zig-executable")
# We must use the same compiler version for the JavaScriptCore bindings and JavaScriptCore
@@ -164,7 +164,7 @@ MACOS_ICU_FILES = $(HOMEBREW_PREFIX)/opt/icu4c/lib/libicudata.a \
MACOS_ICU_INCLUDE = $(HOMEBREW_PREFIX)/opt/icu4c/include
-ICU_FLAGS :=
+ICU_FLAGS ?=
# TODO: find a way to make this more resilient
# Ideally, we could just look up the linker search paths
@@ -207,7 +207,7 @@ endif
-ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(BUN_DEPS_OUT_DIR)/libmimalloc.a \
+ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(BUN_DEPS_OUT_DIR)/libmimalloc.o \
$(BUN_DEPS_OUT_DIR)/libz.a \
$(BUN_DEPS_OUT_DIR)/libarchive.a \
$(BUN_DEPS_OUT_DIR)/libssl.a \
@@ -217,6 +217,8 @@ ARCHIVE_FILES = $(ARCHIVE_FILES_WITHOUT_LIBCRYPTO) $(BUN_DEPS_OUT_DIR)/libcrypto
PLATFORM_LINKER_FLAGS =
+STATIC_MUSL_FLAG ?=
+
ifeq ($(OS_NAME), linux)
PLATFORM_LINKER_FLAGS = \
-fuse-ld=lld \
@@ -227,7 +229,9 @@ PLATFORM_LINKER_FLAGS = \
-Wl,-z,stack-size=12800000 \
-ffunction-sections \
-fdata-sections \
- -static-libstdc++
+ -static-libstdc++ \
+ -static-libgcc \
+ ${STATIC_MUSL_FLAG}
endif
@@ -316,13 +320,14 @@ all-js: runtime_js fallback_decoder bun_error node-fallbacks
api:
- $(NPM_CLIENT) install; ./node_modules/.bin/peechy --schema src/api/schema.peechy --esm src/api/schema.js --ts src/api/schema.d.ts --zig src/api/schema.zig
+ $(NPM_CLIENT) install
+ ./node_modules/.bin/peechy --schema src/api/schema.peechy --esm src/api/schema.js --ts src/api/schema.d.ts --zig src/api/schema.zig
$(ZIG) fmt src/api/schema.zig
$(PRETTIER) --write src/api/schema.js
$(PRETTIER) --write src/api/schema.d.ts
node-fallbacks:
- @cd src/node-fallbacks; $(NPM_CLIENT) install; npm run --silent build
+ @cd src/node-fallbacks; $(NPM_CLIENT) install; $(NPM_CLIENT) --silent build
fallback_decoder:
@esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.js
@@ -334,7 +339,7 @@ runtime_js_dev:
@NODE_ENV=development esbuild --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
bun_error:
- @cd packages/bun-error; $(NPM_CLIENT) install; npm run --silent build
+ @cd packages/bun-error; $(NPM_CLIENT) install; $(NPM_CLIENT) --silent build
generate-install-script:
@rm -f $(PACKAGES_REALPATH)/bun/install.js
@@ -411,6 +416,9 @@ jsc-bindings-headers:
$(ZIG) fmt src/javascript/jsc/bindings/headers.zig
+MIMALLOC_OVERRIDE_FLAG ?=
+
+
bump:
expr $(BUILD_ID) + 1 > build-id
@@ -514,7 +522,6 @@ test-install:
cd integration/scripts && $(NPM_CLIENT) install
test-all: test-install test-with-hmr test-no-hmr test-create-next test-create-react test-bun-run
-test-all-mac: test-install test-with-hmr-mac test-no-hmr-mac test-create-next-mac test-create-react-mac test-bun-run-mac
copy-test-node-modules:
rm -rf integration/snippets/package-json-exports/node_modules || echo "";
@@ -544,22 +551,6 @@ test-no-hmr: kill-bun copy-test-node-modules
-killall bun -9;
DISABLE_HMR="DISABLE_HMR" BUN_BIN=$(RELEASE_BUN) node integration/scripts/browser.js
-test-create-next-mac:
- BUN_BIN=$(MAC_BUN) bash integration/apps/bun-create-next.sh
-
-test-bun-run-mac:
- cd integration/apps && BUN_BIN=$(MAC_BUN) bash ./bun-run-check.sh
-
-test-create-react-mac:
- BUN_BIN=$(MAC_BUN) bash integration/apps/bun-create-react.sh
-
-test-with-hmr-mac: kill-bun copy-test-node-modules
- BUN_BIN=$(MAC_BUN) node integration/scripts/browser.js
-
-test-no-hmr-mac: kill-bun copy-test-node-modules
- -killall bun -9;
- DISABLE_HMR="DISABLE_HMR" BUN_BIN=$(MAC_BUN) node integration/scripts/browser.js
-
test-dev-with-hmr: copy-test-node-modules
-killall bun-debug -9;
BUN_BIN=$(DEBUG_BUN) node integration/scripts/browser.js
@@ -630,9 +621,10 @@ clean: clean-bindings
jsc-bindings-mac: $(OBJ_FILES)
+# mimalloc is built as object files so that it can overload the system malloc
mimalloc:
- cd $(BUN_DEPS_DIR)/mimalloc; cmake $(CMAKE_FLAGS) .; make;
- cp $(BUN_DEPS_DIR)/mimalloc/libmimalloc.a $(BUN_DEPS_OUT_DIR)/libmimalloc.a
+ cd $(BUN_DEPS_DIR)/mimalloc; cmake $(CMAKE_FLAGS) -DMI_BUILD_SHARED=OFF -DMI_BUILD_STATIC=OFF -DMI_BUILD_TESTS=OFF -DMI_BUILD_OBJECT=ON ${MIMALLOC_OVERRIDE_FLAG} .; make;
+ cp $(BUN_DEPS_DIR)/mimalloc/CMakeFiles/mimalloc-obj.dir/src/static.c.o $(BUN_DEPS_OUT_DIR)/libmimalloc.o
bun-link-lld-debug:
$(CXX) $(BUN_LLD_FLAGS) \
diff --git a/integration/scripts/browser.js b/integration/scripts/browser.js
index 3a69a857d..986e96c7f 100644
--- a/integration/scripts/browser.js
+++ b/integration/scripts/browser.js
@@ -35,12 +35,14 @@ if (!USE_EXISTING_PROCESS) {
console.error("❌ bun error", err);
process.exit(1);
});
- waitSpawn = new Promise((resolve, reject) => {
- bunProcess.once("spawn", (code) => {
- console.log("Spawned");
- resolve();
+ if (!process.env.CI) {
+ waitSpawn = new Promise((resolve, reject) => {
+ bunProcess.once("spawn", (code) => {
+ console.log("Spawned");
+ resolve();
+ });
});
- });
+ }
process.on("beforeExit", () => {
bunProcess && bunProcess.kill(0);
});
@@ -72,17 +74,23 @@ function writeSnapshot(name, code) {
}
const baseOptions = {
+ dumpio: !!process.env.CI_DEBUG,
args: [
"--disable-gpu",
"--disable-dev-shm-usage",
"--disable-setuid-sandbox",
"--no-sandbox",
+ "--ignore-certificate-errors",
+ "--use-fake-ui-for-media-stream",
+ "--use-fake-device-for-media-stream",
+ "--disable-sync",
],
+ headless: true,
};
async function main() {
const launchOptions = USE_EXISTING_PROCESS
- ? { ...baseOptions, devtools: true }
+ ? { ...baseOptions, devtools: !process.env.CI }
: baseOptions;
const browser = await puppeteer.launch(launchOptions);
const promises = [];
diff --git a/integration/scripts/package.json b/integration/scripts/package.json
new file mode 100644
index 000000000..b4637138b
--- /dev/null
+++ b/integration/scripts/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "puppeteer": "^10.2.0"
+ }
+}
diff --git a/integration/snippets/package.json b/integration/snippets/package.json
index 0f5dce714..07b349f86 100644
--- a/integration/snippets/package.json
+++ b/integration/snippets/package.json
@@ -1,7 +1,5 @@
{
"name": "snippets",
- "version": "1.0.0",
- "main": "index.js",
"license": "MIT",
"dependencies": {
"@emotion/core": "^11.0.0",
diff --git a/package.json b/package.json
index 8955f7ef2..7542e8529 100644
--- a/package.json
+++ b/package.json
@@ -1,12 +1,6 @@
{
"dependencies": {
- "cli-highlight": "^2.1.11",
- "highlight.js": "^11.3.1",
- "moment": "^2.29.1",
- "peechy": "0.4.20",
- "puppeteer": "^10.2.0",
- "react": "^17.0.2",
- "react-dom": "^17.0.2"
+ "peechy": "0.4.20"
},
"scripts": {
"build-runtime": "esbuild --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js",