@cloudflare/sandbox 0.0.0-211d237 → 0.0.0-215ab49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -0
- package/Dockerfile +72 -9
- package/README.md +522 -22
- package/container_src/handler/exec.ts +338 -0
- package/container_src/handler/file.ts +844 -0
- package/container_src/handler/git.ts +182 -0
- package/container_src/handler/ports.ts +314 -0
- package/container_src/handler/process.ts +640 -0
- package/container_src/index.ts +115 -2374
- package/container_src/types.ts +108 -0
- package/package.json +6 -8
- package/src/client.ts +385 -1071
- package/src/index.ts +20 -79
- package/src/request-handler.ts +144 -0
- package/src/sandbox.ts +650 -0
- package/src/security.ts +113 -0
- package/src/sse-parser.ts +147 -0
- package/src/types.ts +386 -0
- package/tsconfig.json +1 -1
- package/tests/client.example.ts +0 -308
- package/tests/connection-test.ts +0 -81
- package/tests/simple-test.ts +0 -81
- package/tests/test1.ts +0 -281
- package/tests/test2.ts +0 -710
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @cloudflare/sandbox
|
|
2
|
+
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#32](https://github.com/cloudflare/sandbox-sdk/pull/32) [`1a42464`](https://github.com/cloudflare/sandbox-sdk/commit/1a4246479369c5d0160705caf192aa1816540d52) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Bring back package README
|
|
8
|
+
|
|
9
|
+
## 0.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#30](https://github.com/cloudflare/sandbox-sdk/pull/30) [`30e5c25`](https://github.com/cloudflare/sandbox-sdk/commit/30e5c25cf7d4b07f9049724206c531e2d5d29d5c) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Remove actions timeout
|
|
14
|
+
|
|
15
|
+
- [#29](https://github.com/cloudflare/sandbox-sdk/pull/29) [`d78508f`](https://github.com/cloudflare/sandbox-sdk/commit/d78508f7287a59e0423edd2999c2c83e9e34ccfd) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Create multi-platform Docker image and switch to Cloudflare official repo
|
|
16
|
+
|
|
17
|
+
## 0.1.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`157dde9`](https://github.com/cloudflare/sandbox-sdk/commit/157dde9b1f23e9bb6f3e9c3f0514b639a8813897) Thanks [@threepointone](https://github.com/threepointone)! - update deps
|
|
22
|
+
|
|
23
|
+
- [`a04f6b6`](https://github.com/cloudflare/sandbox-sdk/commit/a04f6b6c0b2ef9e3ce0851b53769f1c10d8c6de6) Thanks [@threepointone](https://github.com/threepointone)! - trigger a build with updated deps
|
|
24
|
+
|
|
25
|
+
## 0.1.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- [#24](https://github.com/cloudflare/sandbox-sdk/pull/24) [`cecde0a`](https://github.com/cloudflare/sandbox-sdk/commit/cecde0a7530a87deffd8562fb8b01d66ee80ee19) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Redesign command execution API
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- [#22](https://github.com/cloudflare/sandbox-sdk/pull/22) [`f5fcd52`](https://github.com/cloudflare/sandbox-sdk/commit/f5fcd52025d1f7958a374e69d75e3fc590275f3f) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Allow setting env variables dynamically and remove command restrictions
|
|
34
|
+
|
|
35
|
+
## 0.0.9
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- [#20](https://github.com/cloudflare/sandbox-sdk/pull/20) [`f106fda`](https://github.com/cloudflare/sandbox-sdk/commit/f106fdac98e7ef35677326290d45cbf3af88982c) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - add preview URLs and dynamic port forwarding
|
|
40
|
+
|
|
41
|
+
## 0.0.8
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- [`60af265`](https://github.com/cloudflare/sandbox-sdk/commit/60af265d834e83fd30a921a3e1be232f13fe24da) Thanks [@threepointone](https://github.com/threepointone)! - update dependencies
|
|
46
|
+
|
|
47
|
+
## 0.0.7
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- [`d1c7c99`](https://github.com/cloudflare/sandbox-sdk/commit/d1c7c99df6555eff71bcd59852e4b8eed2ad8cb6) Thanks [@threepointone](https://github.com/threepointone)! - fix file operations
|
|
52
|
+
|
|
53
|
+
## 0.0.6
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- [#9](https://github.com/cloudflare/sandbox-sdk/pull/9) [`24f5470`](https://github.com/cloudflare/sandbox-sdk/commit/24f547048d5a26137de4656cea13d83ad2cc0b43) Thanks [@ItsWendell](https://github.com/ItsWendell)! - fix baseUrl for stub and stub forwarding
|
|
58
|
+
|
|
59
|
+
## 0.0.5
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- [#5](https://github.com/cloudflare/sandbox-sdk/pull/5) [`7c15b81`](https://github.com/cloudflare/sandbox-sdk/commit/7c15b817899e4d9e1f25747aaf439e5e9e880d15) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Make package ready for deployment
|
|
64
|
+
|
|
65
|
+
## 0.0.4
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- [`c0d9d33`](https://github.com/cloudflare/sandbox-sdk/commit/c0d9d3396badee1eab45e6b4a73d48957f31409b) Thanks [@threepointone](https://github.com/threepointone)! - actually work
|
|
70
|
+
|
|
71
|
+
- [`444d2da`](https://github.com/cloudflare/sandbox-sdk/commit/444d2dafde9a0f190e50c879b0e768da1b289b51) Thanks [@threepointone](https://github.com/threepointone)! - add experimental label
|
|
72
|
+
|
|
73
|
+
## 0.0.3
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- [`2b087c4`](https://github.com/cloudflare/sandbox-sdk/commit/2b087c40a29697c20dad19b4e3b8512f5d404bd3) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - Fix worker unable to find container port
|
|
78
|
+
|
|
79
|
+
## 0.0.2
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- [`52f02f0`](https://github.com/cloudflare/sandbox-sdk/commit/52f02f0625ef9f8eac695e51f93fa79651c0206d) Thanks [@threepointone](https://github.com/threepointone)! - readFile
|
|
84
|
+
|
|
85
|
+
## 0.0.1
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- [`f786c3c`](https://github.com/cloudflare/sandbox-sdk/commit/f786c3cee6bd9777bd74918ae9fdf381aa99f913) Thanks [@threepointone](https://github.com/threepointone)! - Release!
|
package/Dockerfile
CHANGED
|
@@ -1,16 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Sandbox base image with development tools, Python, Node.js, and Bun
|
|
2
|
+
FROM oven/bun:latest AS bun-source
|
|
3
|
+
FROM ubuntu:22.04
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
# Prevent interactive prompts during package installation
|
|
6
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
7
|
+
|
|
8
|
+
# Install essential system packages and development tools
|
|
9
|
+
RUN apt-get update && apt-get install -y \
|
|
10
|
+
# Basic utilities
|
|
11
|
+
curl \
|
|
12
|
+
wget \
|
|
13
|
+
git \
|
|
14
|
+
unzip \
|
|
15
|
+
zip \
|
|
16
|
+
# Process management
|
|
17
|
+
procps \
|
|
18
|
+
htop \
|
|
19
|
+
# Build tools
|
|
20
|
+
build-essential \
|
|
21
|
+
pkg-config \
|
|
22
|
+
# Network tools
|
|
23
|
+
net-tools \
|
|
24
|
+
iputils-ping \
|
|
25
|
+
dnsutils \
|
|
26
|
+
# Text processing
|
|
27
|
+
jq \
|
|
28
|
+
vim \
|
|
29
|
+
nano \
|
|
30
|
+
# Python dependencies
|
|
31
|
+
python3.11 \
|
|
32
|
+
python3.11-dev \
|
|
33
|
+
python3-pip \
|
|
34
|
+
# Other useful tools
|
|
35
|
+
sudo \
|
|
36
|
+
ca-certificates \
|
|
37
|
+
gnupg \
|
|
38
|
+
lsb-release \
|
|
39
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
40
|
+
|
|
41
|
+
# Set Python 3.11 as default python3
|
|
42
|
+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
|
|
43
|
+
|
|
44
|
+
# Install Node.js 22 LTS
|
|
45
|
+
# Using the official NodeSource repository setup script
|
|
46
|
+
RUN apt-get update && apt-get install -y ca-certificates curl gnupg \
|
|
47
|
+
&& mkdir -p /etc/apt/keyrings \
|
|
48
|
+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
|
|
49
|
+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
|
|
50
|
+
&& apt-get update \
|
|
51
|
+
&& apt-get install -y nodejs \
|
|
52
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
53
|
+
|
|
54
|
+
# Install Bun from official image (avoids architecture compatibility issues)
|
|
55
|
+
COPY --from=bun-source /usr/local/bin/bun /usr/local/bin/bun
|
|
56
|
+
COPY --from=bun-source /usr/local/bin/bunx /usr/local/bin/bunx
|
|
57
|
+
|
|
58
|
+
# Install global npm packages as root
|
|
59
|
+
RUN npm install -g yarn pnpm
|
|
60
|
+
|
|
61
|
+
# Set up working directory
|
|
5
62
|
WORKDIR /app
|
|
6
63
|
|
|
7
|
-
#
|
|
8
|
-
RUN
|
|
64
|
+
# Verify installations
|
|
65
|
+
RUN python3 --version && \
|
|
66
|
+
node --version && \
|
|
67
|
+
npm --version && \
|
|
68
|
+
bun --version && \
|
|
69
|
+
yarn --version && \
|
|
70
|
+
pnpm --version
|
|
9
71
|
|
|
10
|
-
|
|
11
|
-
|
|
72
|
+
# Copy container source files
|
|
73
|
+
COPY container_src/ ./
|
|
12
74
|
|
|
75
|
+
# Expose the application port
|
|
13
76
|
EXPOSE 3000
|
|
14
|
-
# Run
|
|
15
|
-
CMD ["bun", "index.ts"]
|
|
16
77
|
|
|
78
|
+
# Run the application
|
|
79
|
+
CMD ["bun", "index.ts"]
|