mirror of
https://github.com/oven-sh/bun
synced 2026-02-17 14:22:01 +00:00
Compare commits
150 Commits
v0.0.0-19
...
bun-v0.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
940570af59 | ||
|
|
bdfb5a91b1 | ||
|
|
29b986684d | ||
|
|
e48a0877ef | ||
|
|
22837d69b7 | ||
|
|
af306b523b | ||
|
|
ba20fd7566 | ||
|
|
6d1330d601 | ||
|
|
f3be0c79c2 | ||
|
|
10c01af692 | ||
|
|
a68a1983cf | ||
|
|
90a647fb72 | ||
|
|
3cbf209d5b | ||
|
|
bee45c4fdc | ||
|
|
61202cb464 | ||
|
|
0091944161 | ||
|
|
78cd857bf6 | ||
|
|
4fe1b4df1c | ||
|
|
2a1235c9db | ||
|
|
4bb41b95a8 | ||
|
|
f78f4854a4 | ||
|
|
ff01dfa03d | ||
|
|
638b204d1e | ||
|
|
58e88c4aed | ||
|
|
8433919342 | ||
|
|
8150b9aeba | ||
|
|
01601fc8a7 | ||
|
|
7b24042d5f | ||
|
|
2177dda242 | ||
|
|
0585c86390 | ||
|
|
528caab47c | ||
|
|
b150df34e0 | ||
|
|
da80c3b309 | ||
|
|
e8804bd80f | ||
|
|
2300886008 | ||
|
|
57ed3c89a2 | ||
|
|
1a284a1c94 | ||
|
|
f12dd51c00 | ||
|
|
e00c1e99d6 | ||
|
|
39323b46ba | ||
|
|
9dff80aeee | ||
|
|
9f7d05bab4 | ||
|
|
53c0a4b568 | ||
|
|
8f460a9be3 | ||
|
|
204b07f46b | ||
|
|
a48a02bade | ||
|
|
2326a1e105 | ||
|
|
c4dc6d9bff | ||
|
|
6213a73e6f | ||
|
|
9c109b744f | ||
|
|
42c1d54b3f | ||
|
|
5e634cd612 | ||
|
|
79c7fe0f7a | ||
|
|
8e86d2cf1d | ||
|
|
4e12a4c013 | ||
|
|
e869cdca9f | ||
|
|
ab565f1a3c | ||
|
|
90cd3bf4cb | ||
|
|
9752ee8819 | ||
|
|
9f1e0660dd | ||
|
|
7c05bb7d1d | ||
|
|
bb0faacf06 | ||
|
|
9ae35ec581 | ||
|
|
b1ca1eb228 | ||
|
|
832502555c | ||
|
|
1176a07c93 | ||
|
|
3770102843 | ||
|
|
cf7c80d42d | ||
|
|
84632571c7 | ||
|
|
af1061e47a | ||
|
|
e1ce0e8467 | ||
|
|
468c475359 | ||
|
|
8902a19bb4 | ||
|
|
f4e72be58f | ||
|
|
c20b5414c4 | ||
|
|
1a0438b3b1 | ||
|
|
da2f85ba4b | ||
|
|
bc65e40313 | ||
|
|
a188c7d791 | ||
|
|
f2cccdd1fb | ||
|
|
6621de709e | ||
|
|
98e9b93b7e | ||
|
|
3aef65597b | ||
|
|
c98e007ff7 | ||
|
|
3350e63004 | ||
|
|
d71b37e292 | ||
|
|
1c7485e58c | ||
|
|
872428de89 | ||
|
|
93441babd8 | ||
|
|
1328285bbc | ||
|
|
9912a4ce98 | ||
|
|
d5186ee663 | ||
|
|
9e2910365a | ||
|
|
3be2571a31 | ||
|
|
6352e95d0f | ||
|
|
b6a72f7d72 | ||
|
|
b923134023 | ||
|
|
6e82fa0dab | ||
|
|
9511bf94d5 | ||
|
|
03983ac24e | ||
|
|
347dbc6237 | ||
|
|
b2a6f3f81c | ||
|
|
5a89f30841 | ||
|
|
244585b82a | ||
|
|
bc727e8d79 | ||
|
|
472589aa14 | ||
|
|
ba9825eca9 | ||
|
|
f4d1a3c33d | ||
|
|
be05f65339 | ||
|
|
dcabe86ea8 | ||
|
|
2a98c323c1 | ||
|
|
be5ed44580 | ||
|
|
93010b71b4 | ||
|
|
62d9a18ec6 | ||
|
|
b0bb65f494 | ||
|
|
09ab634d32 | ||
|
|
bba102c076 | ||
|
|
9719ae096d | ||
|
|
0854188f3c | ||
|
|
0cfcb96e5c | ||
|
|
39bbb7b9cd | ||
|
|
e3d828648e | ||
|
|
ed8f381b5c | ||
|
|
516369d748 | ||
|
|
dff9fd8ae1 | ||
|
|
3f3dc56da5 | ||
|
|
5dbbad5cc4 | ||
|
|
24522f7d74 | ||
|
|
4173b03f54 | ||
|
|
bdd5502aef | ||
|
|
2f301e39d7 | ||
|
|
c75ae828bc | ||
|
|
b0598f64ea | ||
|
|
8721ba7474 | ||
|
|
d7a5b60405 | ||
|
|
4f0d4cee0b | ||
|
|
a0b6892c09 | ||
|
|
359df89fe3 | ||
|
|
dca47a565e | ||
|
|
19922287aa | ||
|
|
5944c91de4 | ||
|
|
350569655b | ||
|
|
092f9ac766 | ||
|
|
dfb65ef1ca | ||
|
|
57ca04444b | ||
|
|
125d88bd65 | ||
|
|
6f2554b13a | ||
|
|
b66ef23167 | ||
|
|
812f641ee3 | ||
|
|
4bd9cccbc9 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -62,4 +62,9 @@ src/node-fallbacks/node_modules
|
||||
sign.json
|
||||
release/
|
||||
*.dmg
|
||||
sign.*.json
|
||||
sign.*.json
|
||||
packages/debug-*
|
||||
packages/bun-cli/postinstall.js
|
||||
packages/bun-*/bin/*
|
||||
|
||||
packages/bun-cli/bin/*
|
||||
100
.vscode/launch.json
vendored
100
.vscode/launch.json
vendored
@@ -5,7 +5,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Transpile small",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
// "/Users/jarred/Desktop/webpack4.js"
|
||||
// "/Users/jarred/Code/bun/examples/css-stress-test/nexty/node_modules/next/dist/build/utils.js"
|
||||
@@ -32,7 +32,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": ".bun",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"./examples/hello-next/node_modules.server.bun"
|
||||
// "--origin=https://localhost:9000/"
|
||||
@@ -44,7 +44,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Discord",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"discord"
|
||||
// "--origin=https://localhost:9000/"
|
||||
@@ -69,7 +69,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Dev Launch",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"./simple.css",
|
||||
"--resolve=dev",
|
||||
@@ -94,11 +94,11 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Serve",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "args": ["--serve", "--origin=http://localhost:3000"],
|
||||
"args": ["dev", "--origin=http://localhost:3000"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next",
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -114,7 +114,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Lazy Build",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"./src/index.tsx",
|
||||
"--resolve=lazy",
|
||||
@@ -128,7 +128,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Build",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"./src/index.tsx",
|
||||
"--resolve=dev",
|
||||
@@ -143,7 +143,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Fixture serve",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
@@ -153,7 +153,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo .bun",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "--use=bun-framework-next"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next",
|
||||
"console": "internalConsole"
|
||||
@@ -162,7 +162,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "PNPM .bun",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "./pages/index.js"],
|
||||
"cwd": "/Users/jarred/Build/pnpm-bun/packages/app",
|
||||
"console": "internalConsole"
|
||||
@@ -172,7 +172,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "PNPM serve",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "/Users/jarred/Build/pnpm-bun/packages/app",
|
||||
"console": "internalConsole"
|
||||
@@ -181,7 +181,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Mixed case resolve",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"build",
|
||||
"./index.js",
|
||||
@@ -196,7 +196,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Build .bun lotta-modules",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "./index.js", "--platform=browser"],
|
||||
"cwd": "${workspaceFolder}/examples/lotta-modules/",
|
||||
"console": "internalConsole"
|
||||
@@ -205,7 +205,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Dev CRA",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["dev", "--platform=browser"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-create-react-app/",
|
||||
"console": "internalConsole"
|
||||
@@ -214,7 +214,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Fragment",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
@@ -223,7 +223,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Context Bun Bug",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "./code.js"],
|
||||
"cwd": "/Users/jarred/Build/context/www",
|
||||
"console": "internalConsole"
|
||||
@@ -232,22 +232,49 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Context Bun",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "--use=next"],
|
||||
"cwd": "/Users/jarred/Build/context/www",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Bun-hello",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/packages/bun-hello",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Integration Test Dev",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/integration/snippets",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Integration Test Dev (no hmr)",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["--disable-hmr"],
|
||||
"cwd": "${workspaceFolder}/integration/snippets",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Fixtures Dev",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "a",
|
||||
"args": ["dev"],
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "Fixtures Rel",
|
||||
"program": "${workspaceFolder}/build/macos-x86_64/bun",
|
||||
@@ -257,9 +284,10 @@
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
|
||||
"request": "launch",
|
||||
"name": "Context Dev",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "/Users/jarred/Build/context/www",
|
||||
"console": "internalConsole"
|
||||
@@ -278,16 +306,16 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug Dev",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["dev"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next/bun-framework-next",
|
||||
"cwd": "${workspaceFolder}/examples/hello-next",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Type-only import",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"bun",
|
||||
"./src/test/fixtures/type-only-import.ts",
|
||||
@@ -300,7 +328,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Dev lotta-modules",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["dev", "./index.js", "--platform=browser"],
|
||||
"cwd": "${workspaceFolder}/examples/lotta-modules/",
|
||||
"console": "internalConsole"
|
||||
@@ -309,7 +337,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Build .bun",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"bun",
|
||||
// "./index.js",
|
||||
@@ -324,7 +352,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "PNPM Resolve symlink",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["--resolve=dev", "test-pnpm.js", "--platform=browser"],
|
||||
"cwd": "${workspaceFolder}/examples/css-stress-test",
|
||||
"console": "internalConsole"
|
||||
@@ -333,7 +361,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Print .bun",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["./node_modules.bun"],
|
||||
"cwd": "${workspaceFolder}/examples/simple-react",
|
||||
"console": "internalConsole"
|
||||
@@ -362,7 +390,7 @@
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch (other)",
|
||||
// "program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "args": ["./simple.jsx", "--resolve=disable"],
|
||||
// "cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
// "console": "internalConsole"
|
||||
@@ -371,7 +399,7 @@
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=disable",
|
||||
@@ -386,7 +414,7 @@
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=dev",
|
||||
@@ -403,7 +431,7 @@
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=dev",
|
||||
@@ -420,7 +448,7 @@
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// // "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=dev",
|
||||
@@ -439,7 +467,7 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Rome",
|
||||
// "program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"program": "${workspaceFolder}/build/macos-x86_64/bun",
|
||||
// "preLaunchTask": "build",
|
||||
"args": [
|
||||
@@ -461,8 +489,8 @@
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Rome Dev",
|
||||
// "program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "preLaunchTask": "build",
|
||||
"args": [
|
||||
"--resolve=dev",
|
||||
|
||||
14
.vscode/settings.json
vendored
14
.vscode/settings.json
vendored
@@ -12,6 +12,16 @@
|
||||
"[zig]": {
|
||||
"editor.defaultFormatter": "tiehuis.zig"
|
||||
},
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.svn": true,
|
||||
"**/.hg": true,
|
||||
"**/CVS": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/Thumbs.db": true,
|
||||
"integration/snapshots": true,
|
||||
"integration/snapshots-no-hmr": true
|
||||
},
|
||||
"C_Cpp.files.exclude": {
|
||||
"**/.vscode": true,
|
||||
"src/javascript/jsc/WebKit/JSTests": true,
|
||||
@@ -118,5 +128,7 @@
|
||||
"set": "cpp",
|
||||
"__memory": "cpp",
|
||||
"memory_resource": "cpp"
|
||||
}
|
||||
},
|
||||
"go.logging.level": "off",
|
||||
"cmake.configureOnOpen": false
|
||||
}
|
||||
|
||||
167
Makefile
167
Makefile
@@ -1,64 +1,171 @@
|
||||
OS_NAME := $(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH_NAME_DENORAMLZIED_1 := $(shell uname -m)
|
||||
ARCH_NAME_DENORAMLZIED_2 := $(shell tr '[_]' '[--]' <<< $(ARCH_NAME_DENORAMLZIED_1))
|
||||
ARCH_NAME_DENORAMLZIED_3 := $(shell sed s/x86-64/x64/ <<< $(ARCH_NAME_DENORAMLZIED_2))
|
||||
ARCH_NAME := $(shell sed s/arm64/aarch64/ <<< $(ARCH_NAME_DENORAMLZIED_3))
|
||||
TRIPLET := $(OS_NAME)-$(ARCH_NAME)
|
||||
PACKAGE_DIR := packages/bun-cli-$(TRIPLET)
|
||||
DEBUG_PACKAGE_DIR := packages/debug-bun-cli-$(TRIPLET)
|
||||
BIN_DIR := $(PACKAGE_DIR)/bin
|
||||
RELEASE_BUN := $(shell realpath $(PACKAGE_DIR)/bin/bun)
|
||||
DEBUG_BIN := $(DEBUG_PACKAGE_DIR)/bin
|
||||
DEBUG_BIN_REALPATH := $(shell realpath $(DEBUG_PACKAGE_DIR)/bin)
|
||||
DEBUG_BUN := $(shell realpath $(DEBUG_BIN)/bun-debug)
|
||||
BUILD_ID := $(shell cat ./build-id)
|
||||
PACKAGE_JSON_VERSION := 0.0.$(BUILD_ID)
|
||||
BUN_BUILD_TAG := bun-v$(PACKAGE_JSON_VERSION)
|
||||
CC := clang
|
||||
CXX := clang++
|
||||
|
||||
bun: vendor bun-prod-native bun-prod-wasi bun-prod-wasm
|
||||
bun: vendor build-obj bun-link-lld-release
|
||||
|
||||
vendor: api node-fallbacks runtime_js fallback_decoder mimalloc picohttp jsc
|
||||
vendor: api node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp jsc
|
||||
|
||||
build-obj:
|
||||
zig build obj -Drelease-fast
|
||||
|
||||
sign-macos-x64:
|
||||
codesign -s 417F1E55D8BDFB5DE25DA3126EDF238ED1F45B7E -f -v --timestamp --entitlements entitlements.plist ./build/macos-aarch64/bun
|
||||
gon sign.macos-x64.json
|
||||
|
||||
sign-macos-aarch64:
|
||||
gon sign.macos-aarch64.json
|
||||
|
||||
release-macos-x64: build-obj bun-link-lld-release sign-macos-x64
|
||||
release-macos-aarch64: build-obj bun-link-lld-release sign-macos-aarch64
|
||||
release-macos: all-js build-obj jsc-bindings-mac bun-link-lld-release
|
||||
|
||||
all-js: runtime_js fallback_decoder bun_error node-fallbacks
|
||||
|
||||
bin-dir:
|
||||
@echo $(BIN_DIR)
|
||||
|
||||
api:
|
||||
npm 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
|
||||
|
||||
node-fallbacks:
|
||||
cd src/node-fallbacks; npm install; npm run --silent build
|
||||
@cd src/node-fallbacks; npm install; npm run --silent build
|
||||
|
||||
fallback_decoder:
|
||||
esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.js
|
||||
@esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.js
|
||||
|
||||
runtime_js:
|
||||
esbuild --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
|
||||
@NODE_ENV=production esbuild --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
|
||||
|
||||
bun_error:
|
||||
@cd packages/bun-error; npm install; npm run --silent build
|
||||
|
||||
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
|
||||
|
||||
jsc: jsc-build jsc-bindings
|
||||
jsc-build: jsc-build-mac jsc-copy-headers
|
||||
jsc-build: $(JSC_BUILD_STEPS)
|
||||
jsc-bindings: jsc-bindings-headers jsc-bindings-mac
|
||||
|
||||
|
||||
|
||||
jsc-bindings-headers:
|
||||
mkdir -p src/JavaScript/jsc/bindings-obj/
|
||||
mkdir -p src/javascript/jsc/bindings-obj/
|
||||
zig build headers
|
||||
|
||||
bump:
|
||||
expr $(BUILD_ID) + 1 > build-id
|
||||
|
||||
|
||||
build_postinstall:
|
||||
@esbuild --bundle --format=cjs --platform=node --define:BUN_VERSION="\"$(PACKAGE_JSON_VERSION)\"" packages/bun-cli/scripts/postinstall.ts > packages/bun-cli/postinstall.js
|
||||
|
||||
write-package-json-version-cli: build_postinstall
|
||||
jq -S --raw-output '.version = "${PACKAGE_JSON_VERSION}"' packages/bun-cli/package.json > packages/bun-cli/package.json.new
|
||||
mv packages/bun-cli/package.json.new packages/bun-cli/package.json
|
||||
|
||||
write-package-json-version:
|
||||
jq -S --raw-output '.version = "${PACKAGE_JSON_VERSION}"' $(PACKAGE_DIR)/package.json > $(PACKAGE_DIR)/package.json.new
|
||||
mv $(PACKAGE_DIR)/package.json.new $(PACKAGE_DIR)/package.json
|
||||
|
||||
tag:
|
||||
git tag $(BUN_BUILD_TAG)
|
||||
git push --tags
|
||||
|
||||
prepare-release: tag release-create write-package-json-version-cli write-package-json-version
|
||||
|
||||
release-create:
|
||||
gh release create --title "Bun v$(PACKAGE_JSON_VERSION)" "$(BUN_BUILD_TAG)"
|
||||
|
||||
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
|
||||
|
||||
release-mac-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
|
||||
|
||||
dev-obj:
|
||||
zig build obj
|
||||
|
||||
dev: mkdir-dev dev-obj bun-link-lld-debug
|
||||
|
||||
mkdir-dev:
|
||||
mkdir -p $(DEBUG_PACKAGE_DIR)/bin
|
||||
|
||||
test-install:
|
||||
cd integration/scripts && npm install
|
||||
|
||||
test-all: test-install test-with-hmr test-no-hmr
|
||||
|
||||
copy-test-node-modules:
|
||||
rm -rf integration/snippets/package-json-exports/node_modules
|
||||
cp -r integration/snippets/package-json-exports/_node_modules_copy integration/snippets/package-json-exports/node_modules
|
||||
kill-bun:
|
||||
-killall -9 bun bun-debug
|
||||
|
||||
test-with-hmr: kill-bun copy-test-node-modules
|
||||
BUN_BIN=$(RELEASE_BUN) node integration/scripts/browser.js
|
||||
|
||||
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-dev-with-hmr: copy-test-node-modules
|
||||
-killall bun-debug -9;
|
||||
BUN_BIN=$(DEBUG_BUN) node integration/scripts/browser.js
|
||||
|
||||
test-dev-no-hmr: copy-test-node-modules
|
||||
-killall bun-debug -9;
|
||||
DISABLE_HMR="DISABLE_HMR" BUN_BIN=$(DEBUG_BUN) node integration/scripts/browser.js
|
||||
|
||||
test-dev-all: test-dev-with-hmr test-dev-no-hmr
|
||||
|
||||
test-dev: test-dev-with-hmr
|
||||
|
||||
jsc-copy-headers:
|
||||
find src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/Headers/JavaScriptCore/ -name "*.h" -exec cp {} src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/JavaScriptCore \;
|
||||
find src/javascript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/Headers/JavaScriptCore/ -name "*.h" -exec cp {} src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/JavaScriptCore \;
|
||||
|
||||
jsc-build-mac-compile:
|
||||
cd src/javascript/jsc/WebKit && ICU_INCLUDE_DIRS="$(HOMEBREW_PREFIX)opt/icu4c/include" ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo"
|
||||
|
||||
jsc-build-linux-compile:
|
||||
cd src/javascript/jsc/WebKit && ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo
|
||||
|
||||
CC=$(CC) CXX=$(CXX) cd src/javascript/jsc/WebKit && ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo"
|
||||
|
||||
jsc-build-mac: jsc-build-mac-compile jsc-build-mac-copy
|
||||
|
||||
jsc-build-linux: jsc-build-linux-compile jsc-build-mac-copy
|
||||
|
||||
jsc-build-mac-copy:
|
||||
cp src/JavaScript/jsc/WebKit/WebKitBuild/Release/lib/libJavaScriptCore.a src/deps/libJavaScriptCore.a
|
||||
cp src/JavaScript/jsc/WebKit/WebKitBuild/Release/lib/libWTF.a src/deps/libWTF.a
|
||||
cp src/JavaScript/jsc/WebKit/WebKitBuild/Release/lib/libbmalloc.a src/deps/libbmalloc.a
|
||||
cp src/javascript/jsc/WebKit/WebKitBuild/Release/lib/libJavaScriptCore.a src/deps/libJavaScriptCore.a
|
||||
cp src/javascript/jsc/WebKit/WebKitBuild/Release/lib/libWTF.a src/deps/libWTF.a
|
||||
cp src/javascript/jsc/WebKit/WebKitBuild/Release/lib/libbmalloc.a src/deps/libbmalloc.a
|
||||
|
||||
JSC_FILES := src/deps/libJavaScriptCore.a \
|
||||
src/deps/libWTF.a \
|
||||
src/deps/libbmalloc.a
|
||||
|
||||
HOMEBREW_PREFIX := $(shell brew --prefix)/
|
||||
|
||||
ifeq ($(OS_NAME),darwin)
|
||||
HOMEBREW_PREFIX := $(shell brew --prefix)/
|
||||
endif
|
||||
|
||||
SRC_DIR := src/javascript/jsc/bindings
|
||||
OBJ_DIR := src/javascript/jsc/bindings-obj
|
||||
@@ -111,24 +218,25 @@ mimalloc:
|
||||
cd src/deps/mimalloc; cmake .; make;
|
||||
|
||||
bun-link-lld-debug:
|
||||
clang++ $(BUN_LLD_FLAGS) \
|
||||
build/debug/macos-x86_64/bun.o \
|
||||
$(CXX) $(BUN_LLD_FLAGS) \
|
||||
$(DEBUG_BIN)/bun-debug.o \
|
||||
-Wl,-dead_strip \
|
||||
-ftls-model=local-exec \
|
||||
-flto \
|
||||
-o build/debug/macos-x86_64/bun
|
||||
-o $(DEBUG_BIN)/bun-debug
|
||||
|
||||
bun-link-lld-release:
|
||||
clang++ $(BUN_LLD_FLAGS) \
|
||||
build/macos-x86_64/bun.o \
|
||||
-o build/macos-x86_64/bun \
|
||||
$(CXX) $(BUN_LLD_FLAGS) \
|
||||
$(BIN_DIR)/bun.o \
|
||||
-o $(BIN_DIR)/bun \
|
||||
-Wl,-dead_strip \
|
||||
-ftls-model=local-exec \
|
||||
-flto \
|
||||
-O3
|
||||
rm $(BIN_DIR)/bun.o
|
||||
|
||||
bun-link-lld-release-aarch64:
|
||||
clang++ $(BUN_LLD_FLAGS) \
|
||||
$(CXX) $(BUN_LLD_FLAGS) \
|
||||
build/macos-aarch64/bun.o \
|
||||
-o build/macos-aarch64/bun \
|
||||
-Wl,-dead_strip \
|
||||
@@ -139,13 +247,14 @@ bun-link-lld-release-aarch64:
|
||||
# We do this outside of build.zig for performance reasons
|
||||
# The C compilation stuff with build.zig is really slow and we don't need to run this as often as the rest
|
||||
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
|
||||
clang++ -c -o $@ $< \
|
||||
$(CXX) -c -o $@ $< \
|
||||
$(CLANG_FLAGS) \
|
||||
-O1
|
||||
|
||||
sizegen:
|
||||
clang++ src/javascript/jsc/headergen/sizegen.cpp -o /tmp/sizegen $(CLANG_FLAGS) -O1
|
||||
$(CXX) src/javascript/jsc/headergen/sizegen.cpp -o /tmp/sizegen $(CLANG_FLAGS) -O1
|
||||
/tmp/sizegen > src/javascript/jsc/bindings/sizes.zig
|
||||
|
||||
picohttp:
|
||||
clang -O3 -g -c src/deps/picohttpparser.c -Isrc/deps -o src/deps/picohttpparser.o; cd ../../
|
||||
$(CC) -O3 -g -c src/deps/picohttpparser.c -Isrc/deps -o src/deps/picohttpparser.o; cd ../../
|
||||
|
||||
|
||||
193
README.md
193
README.md
@@ -1,4 +1,4 @@
|
||||
# Bun: a fast bundler & transpiler for developing web software
|
||||
# Bun
|
||||
|
||||
Bun is a new:
|
||||
|
||||
@@ -30,51 +30,83 @@ bun bun --use next
|
||||
bun
|
||||
```
|
||||
|
||||
Here are some features of Next.js that **aren't supported** yet:
|
||||
Many of Next.js' features are supported, but not all.
|
||||
|
||||
Here's what doesn't work yet:
|
||||
|
||||
- `getStaticPaths`
|
||||
- `fetch` inside of `getStaticProps` or `getServerSideProps`
|
||||
- same-origin `fetch` inside of `getStaticProps` or `getServerSideProps`
|
||||
- locales, zones, `assetPrefix` (workaround: change `--origin \"http://localhsot:3000/assetPrefixInhere\"`)
|
||||
- `next/image` - `<Image />` component
|
||||
- `next/image` is polyfilled to a regular `<img src>` tag.
|
||||
- `proxy` and anything else in `next.config.js`
|
||||
- API, catch-all & catch-all fallback routes. Dynamic routes _are_ supported.
|
||||
|
||||
When using Next.js, Bun automatically reads configuration from `.env.local`, `.env.development` and `.env` (in that order). `process.env.NEXT_PUBLIC_` and `process.env.NEXT_` automatically are replaced via `--define`.
|
||||
|
||||
Currently, any time you import new dependencies from `node_modules`, you will need to re-run `bun bun --use next`. This will eventually be automatic.
|
||||
|
||||
## Using Bun without a framework or with Create React App
|
||||
## Using Bun with single page apps
|
||||
|
||||
In your project folder root (where `package.json` is):
|
||||
|
||||
```bash
|
||||
bun bun ./entry-point-1.js ./entry-point-2.jsx
|
||||
bun dev ./entry-point-1.js ./entry-point-2.jsx --origin https://localhost:3000
|
||||
bun
|
||||
```
|
||||
|
||||
By default, `bun dev` will look for any HTML files in the `public` directory and serve that. For browsers navigating to the page, the `.html` file extension is optional in the URL, and `index.html` will automatically rewrite for the directory.
|
||||
By default, `bun` will look for any HTML files in the `public` directory and serve that. For browsers navigating to the page, the `.html` file extension is optional in the URL, and `index.html` will automatically rewrite for the directory.
|
||||
|
||||
Here are examples of routing from `public/` and how they're matched:
|
||||
| File Path | Dev Server URL |
|
||||
| --------- | ------------- |
|
||||
| public/dir/index.html | /dir |
|
||||
| public/index.html | / |
|
||||
| public/hi.html | /hi |
|
||||
| public/file.html | /file |
|
||||
| public/font/Inter.woff2 | /font/Inter.woff2 |
|
||||
| Dev Server URL | File Path |
|
||||
|----------------|-----------|
|
||||
| /dir | public/dir/index.html |
|
||||
| / | public/index.html |
|
||||
| /index | public/index.html |
|
||||
| /hi | public/hi.html |
|
||||
| /file | public/file.html |
|
||||
| /font/Inter.woff2 | public/font/Inter.woff2 |
|
||||
| /hello | public/index.html |
|
||||
|
||||
For **Create React App** users, note that Bun does not transpile HTML yet, so `%PUBLIC_URL%` will need to be replaced with '/'`.
|
||||
If `public/index.html` exists, it becomes the default page instead of a 404 page, unless that pathname has a file extension.
|
||||
|
||||
From there, Bun relies on the filesystem for mapping dev server paths to source files. All URL paths are relative to the project root (where `package.json` is).
|
||||
#### Using Bun with Create React App
|
||||
|
||||
To use Bun with `create-react-app`, there are two changes you will need to make in `public/index.html`:
|
||||
|
||||
1. Replace `%PUBLIC_URL%` with `/`
|
||||
2. Insert `<script type="module" async src="/src/index.js">` just before `</body>`
|
||||
|
||||
These changes are (sadly) necessary until Bun supports parsing & transpiling HTML.
|
||||
|
||||
In your project folder root (where `package.json` is):
|
||||
|
||||
```bash
|
||||
bun bun ./src/index.js
|
||||
bun
|
||||
```
|
||||
|
||||
From there, Bun relies on the filesystem for mapping dev server paths to source files. All URL paths are relative to the project root (where `package.json` is located).
|
||||
|
||||
Here are examples of routing source code file paths:
|
||||
|
||||
| File Path (relative to cwd) | Dev Server URL |
|
||||
| --------------------------- | -------------------------- |
|
||||
| src/components/Button.tsx | /src/components/Button.tsx |
|
||||
| src/index.tsx | /src/index.tsx |
|
||||
| pages/index.js | /pages/index.js |
|
||||
| Dev Server URL | File Path (relative to cwd) |
|
||||
| -------------------------- | --------------------------- |
|
||||
| /src/components/Button.tsx | src/components/Button.tsx |
|
||||
| /src/index.tsx | src/index.tsx |
|
||||
| /pages/index.js | pages/index.js |
|
||||
|
||||
You do not need to include file extensions in `import` paths. CommonJS-style import paths without the file extension works.
|
||||
|
||||
You can override the public directory by passing `--public-dir="path-to-folder"`.
|
||||
|
||||
If no directory is specified and `./public/` doesn't exist, Bun will try `./static/`. If `./static/` does not exist, but won't serve from a public directory. If you pass `--public-dir=./` Bun will serve from the current directory, but it will check the current directory last instead of first.
|
||||
|
||||
## Using Bun with TypeScript
|
||||
|
||||
TypeScript just works. There's nothing to configure and nothing extra to install. If you import a `.ts` or `.tsx` file, Bun will transpile it into JavaScript. Bun also transpiles `node_modules` containing `.ts` or `.tsx` files. This is powered by Bun's TypeScript transpiler, so it's fast.
|
||||
|
||||
Bun also reads `tsconfig.json`, including `baseUrl` and `paths`.
|
||||
|
||||
## Using Tailwind with Bun
|
||||
|
||||
[Tailwind](https://tailwindcss.com/) is a popular CSS utility framework. Currently, the easiest way to use Tailwind with Bun is through Tailwind's CLI. That means running both `bun` and `tailwind`, and importing the file `tailwind`'s CLI outputs.
|
||||
@@ -93,7 +125,7 @@ Bun is a project with incredibly large scope, and it's early days.
|
||||
|
||||
| Feature | In |
|
||||
| ---------------------------------------------------------------------------------------------------------------------- | -------------- |
|
||||
| Symlinks | Resolver |
|
||||
| ~Symlinks~ | Resolver |
|
||||
| [Finish Fast Refresh](https://github.com/Jarred-Sumner/bun/issues/18) | JSX Transpiler |
|
||||
| Source Maps | JavaScript |
|
||||
| Source Maps | CSS |
|
||||
@@ -105,7 +137,7 @@ Bun is a project with incredibly large scope, and it's early days.
|
||||
| `@jsxPragma` comments | JS Transpiler |
|
||||
| JSX source file name | JS Transpiler |
|
||||
| Sharing `.bun` files | Bun |
|
||||
| [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | Bun.js |
|
||||
| [Finish fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | Bun.js |
|
||||
| [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) | Bun.js |
|
||||
| `bun run` command | Bun.js |
|
||||
|
||||
@@ -117,13 +149,15 @@ Bun is a project with incredibly large scope, and it's early days.
|
||||
|
||||
Bun is great for building websites & webapps. For libraries, consider using Rollup or esbuild instead. Bun currently doesn't minify code and Bun's dead code elimination doesn't look beyond the current file.
|
||||
|
||||
Bun is focused on:
|
||||
Today, Bun is focused on:
|
||||
|
||||
- Development, not production
|
||||
- Compatibility with existing frameworks & tooling
|
||||
|
||||
Ideally, most projects can use Bun with their existing tooling while making few changes to their codebase. That means using Bun in development, and continuing to use Webpack, esbuild, or another bundler in production. Using two bundlers might sound strange at first, but after all the production-only AST transforms, minification, and special development/production-only imported files...it's not far from the status quo.
|
||||
|
||||
Longer-term, Bun intends to replace Node.js, Webpack, Babel, and PostCSS (in production).
|
||||
|
||||
# Configuration
|
||||
|
||||
### Loaders
|
||||
@@ -377,6 +411,111 @@ For developing frameworks, you can also do `bun bun --use ./relative-path-to-fra
|
||||
|
||||
If you're interested in adding a framework integration, please reach out. There's a lot here and it's not entirely documented yet.
|
||||
|
||||
# Reference
|
||||
|
||||
### `bun bun`
|
||||
|
||||
Run `bun bun ./path-to.js` to generate a `node_modules.bun` file containing all imported dependencies (recursively).
|
||||
|
||||
**Why bundle?**
|
||||
|
||||
- For browsers, loading entire apps without bundling dependencies is typically slow. With a fast bundler & transpiler, the bottleneck eventually becomes the web browser's ability to run many network requests concurrently. There are many workarounds for this. `<link rel="modulepreload">`, HTTP/3, etc but none are more effective than bundling. If you have reproducible evidence to the contrary, feel free to submit an issue. It would be better if bundling wasn't necessary.
|
||||
- On the server, bundling reduces the number of filesystem lookups to load JavaScript. While filesystem lookups are faster than HTTP requests, there's still overhead.
|
||||
|
||||
**What is `.bun`?**
|
||||
|
||||
The `.bun` file contains:
|
||||
|
||||
- all the bundled source code
|
||||
- all the bundled source code metadata
|
||||
- project metadata & configuration
|
||||
|
||||
Here are some of the questions `.bun` files answer:
|
||||
|
||||
- when I import `react/index.js`, where in the `.bun` is the code for that? (not resolving, just the code)
|
||||
- what modules of a package are used?
|
||||
- what framework is used? (e.g. Next.js)
|
||||
- where is the routes directory?
|
||||
- how big is each imported dependency?
|
||||
- what is the hash of the bundle's contents? (for etags)
|
||||
- what is the name & version of every npm package exported in this bundle?
|
||||
- what modules from which packages are used in this project? ("project" defined as all the entry points used to generate the .bun)
|
||||
|
||||
All in one file.
|
||||
|
||||
It's a little like a build cache, but designed for reuse. I hope people will eventually check it into version control so their coworkers don't have to run `npm install` as often.
|
||||
|
||||
##### Position-independent code
|
||||
|
||||
From a design perspective, the most important part of the `.bun` format is how code is organized. Each module is exported by a hash like this:
|
||||
|
||||
```js
|
||||
// preact/dist/preact.module.js
|
||||
export var $eb6819b = $$m({
|
||||
"preact/dist/preact.module.js": (module, exports) => {
|
||||
var n, l, u, i, t, o, r, f, e = {}, c = [], s = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
||||
// ... rest of code
|
||||
```
|
||||
|
||||
This makes bundled modules [position-independent](https://en.wikipedia.org/wiki/Position-independent_code). In theory, one could import only the exact modules in-use without reparsing code and without generating a new bundle. One bundle can dynamically become many bundles comprising only the modules in use on the webpage. Thanks to the metadata with the byte offsets, a web server can send each module to browsers [zero-copy](https://en.wikipedia.org/wiki/Zero-copy) using [sendfile](https://man7.org/linux/man-pages/man2/sendfile.2.html). Bun itself is not quite this smart yet, but these optimizations would be useful in production and potentially very useful for React Server Components.
|
||||
|
||||
To see the schema inside, have a look at [`JavascriptBundleContainer`](./src/api/schema.d.ts#:~:text=export%20interface-,JavascriptBundleContainer,-%7B). You can find JavaScript bindings to read the metadata in [src/api/schema.js](./src/api/schema.js). This is not really an API yet. It's missing the part where it gets the binary data from the bottom of the file. Someday, I want this to be usable by other tools too.
|
||||
|
||||
**Where is the code?**
|
||||
|
||||
`.bun` files are marked as executable.
|
||||
|
||||
To print out the code, run `./node_modules.bun` in your terminal or run `bun ./path-to-node_modules.bun`.
|
||||
|
||||
Here is a copy-pastable example:
|
||||
|
||||
```bash
|
||||
./node_modules.bun > node_modules.js
|
||||
```
|
||||
|
||||
This works because every `.bun` file starts with this:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bun
|
||||
```
|
||||
|
||||
To deploy to production with Bun, you'll want to get the code from the `.bun` file and stick that somewhere your web server can find it (or if you're using Vercel or a Rails app, in a `public` folder).
|
||||
|
||||
Note that `.bun` is a binary file format, so just opening it in VSCode or vim might render strangely.
|
||||
|
||||
**Advanced**
|
||||
|
||||
By default, `bun bun` only bundles external dependencies that are `import`ed or `require`d in either app code or another external dependency. An "external depenendency" is defined as, "A JavaScript-like file that has `/node_modules/` in the resolved file path and a corresponding `package.json`".
|
||||
|
||||
To force bun to bundle packages which are not located in a `node_modules` folder (i.e. the final, resolved path following all symlinks), add a `bun` section to the root project's `package.json` with `alwaysBundle` set to an array of package names to always bundle. Here's an example:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-package-name-in-here",
|
||||
"bun": {
|
||||
"alwaysBundle": ["@mybigcompany/my-workspace-package"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Bundled dependencies are not eligible for Hot Module Reloading. The code is served to browsers & Bun.js verbatim. But, in the future, it may be sectioned off into only parts of the bundle being used. That's possible in the current version of the `.bun` file (so long as you know which files are necessary), but it's not implemented yet. Longer-term, it will include all `import` and `export` of each module inside.
|
||||
|
||||
**What is the module ID hash?**
|
||||
|
||||
The `$eb6819b` hash used here:
|
||||
|
||||
```js
|
||||
export var $eb6819b = $$m({
|
||||
```
|
||||
|
||||
Is generated like this:
|
||||
|
||||
1. Murmur3 32 bit hash of `package.name@package.version`. This is the hash uniquely identifying the npm package.
|
||||
2. Wyhash 64 of the `package.hash` + `package_path`. `package_path` means "relative to the root of the npm package, where is the module imported?". For example, if you imported `react/jsx-dev-runtime.js`, the `package_path` is `jsx-dev-runtime.js`. `react-dom/cjs/react-dom.development.js` would be `cjs/react-dom.development.js`
|
||||
3. Truncate the hash generated above to a `u32`
|
||||
|
||||
The implementation details of this module ID hash will vary between versions of Bun. The important part is the metadata contains the module IDs, the package paths, and the package hashes so it shouldn't really matter in practice if other tooling wants to make use of any of this.
|
||||
|
||||
# Credits
|
||||
|
||||
- While written in Zig instead of Go, Bun's JS transpiler, CSS lexer, and node module resolver source code is based off of @evanw's esbuild project. @evanw did a fantastic job with esbuild.
|
||||
@@ -444,8 +583,6 @@ git checkout jarred/zig-sloppy-with-small-structs
|
||||
cmake . -DCMAKE_PREFIX_PATH=$(brew --prefix llvm) -DZIG_STATIC_LLVM=ON -DCMAKE_BUILD_TYPE=Release && make -j 16
|
||||
```
|
||||
|
||||
Note that `brew install zig` won't work. Bun uses a build of Zig with a couple patches.
|
||||
|
||||
You'll want to make sure `zig` is in `$PATH`. The `zig` binary wil be in the same folder as the newly-cloned `zig` repo. If you use fish, you can run `fish_add_path (pwd)`.
|
||||
|
||||
In `bun`:
|
||||
@@ -457,3 +594,7 @@ zig build headers
|
||||
make jsc-bindings-mac
|
||||
zig build -Drelease-fast
|
||||
```
|
||||
|
||||
Note that `brew install zig` won't work. Bun uses a build of Zig with a couple patches.
|
||||
|
||||
Additionally, you'll need `cmake`, `npm` and `esbuild` installed globally.
|
||||
|
||||
45
build.zig
45
build.zig
@@ -24,8 +24,8 @@ pub fn addPicoHTTP(step: *std.build.LibExeObjStep, comptime with_obj: bool) void
|
||||
// set -gx ICU_INCLUDE_DIRS "/usr/local/opt/icu4c/include"
|
||||
// homebrew-provided icu4c
|
||||
}
|
||||
|
||||
pub fn build(b: *std.build.Builder) void {
|
||||
var x64 = "x64";
|
||||
pub fn build(b: *std.build.Builder) !void {
|
||||
// Standard target options allows the person running `zig build` to choose
|
||||
// what target to build for. Here we do not override the defaults, which
|
||||
// means any target is allowed, and the default is native. Other options
|
||||
@@ -39,12 +39,39 @@ pub fn build(b: *std.build.Builder) void {
|
||||
const cwd: []const u8 = b.pathFromRoot(".");
|
||||
var exe: *std.build.LibExeObjStep = undefined;
|
||||
var output_dir_buf = std.mem.zeroes([4096]u8);
|
||||
var bin_label = if (mode == std.builtin.Mode.Debug) "/debug/" else "/";
|
||||
const output_dir = b.pathFromRoot(std.fmt.bufPrint(&output_dir_buf, "build{s}{s}-{s}", .{ bin_label, @tagName(target.getOs().tag), @tagName(target.getCpuArch()) }) catch unreachable);
|
||||
var bin_label = if (mode == std.builtin.Mode.Debug) "packages/debug-bun-cli-" else "packages/bun-cli-";
|
||||
|
||||
var triplet_buf: [64]u8 = undefined;
|
||||
var os_tagname = @tagName(target.getOs().tag);
|
||||
if (std.mem.eql(u8, os_tagname, "macos")) {
|
||||
os_tagname = "darwin";
|
||||
}
|
||||
|
||||
std.mem.copy(
|
||||
u8,
|
||||
&triplet_buf,
|
||||
os_tagname,
|
||||
);
|
||||
var osname = triplet_buf[0..os_tagname.len];
|
||||
triplet_buf[osname.len] = '-';
|
||||
|
||||
std.mem.copy(u8, triplet_buf[osname.len + 1 ..], @tagName(target.getCpuArch()));
|
||||
var cpuArchName = triplet_buf[osname.len + 1 ..][0..@tagName(target.getCpuArch()).len];
|
||||
std.mem.replaceScalar(u8, cpuArchName, '_', '-');
|
||||
if (std.mem.eql(u8, cpuArchName, "x86-64")) {
|
||||
std.mem.copy(u8, cpuArchName, "x64");
|
||||
cpuArchName = cpuArchName[0..3];
|
||||
}
|
||||
|
||||
var triplet = triplet_buf[0 .. osname.len + cpuArchName.len + 1];
|
||||
|
||||
const output_dir_base = try std.fmt.bufPrint(&output_dir_buf, "{s}{s}/bin", .{ bin_label, triplet });
|
||||
const output_dir = b.pathFromRoot(output_dir_base);
|
||||
const bun_executable_name = if (mode == std.builtin.Mode.Debug) "bun-debug" else "bun";
|
||||
|
||||
if (target.getOsTag() == .wasi) {
|
||||
exe.enable_wasmtime = true;
|
||||
exe = b.addExecutable("bun", "src/main_wasi.zig");
|
||||
exe = b.addExecutable(bun_executable_name, "src/main_wasi.zig");
|
||||
exe.linkage = .dynamic;
|
||||
exe.setOutputDir(output_dir);
|
||||
} else if (target.getCpuArch().isWasm()) {
|
||||
@@ -54,7 +81,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||
// );
|
||||
// exe.is_linking_libc = false;
|
||||
// exe.is_dynamic = true;
|
||||
var lib = b.addExecutable("bun", "src/main_wasm.zig");
|
||||
var lib = b.addExecutable(bun_executable_name, "src/main_wasm.zig");
|
||||
lib.single_threaded = true;
|
||||
// exe.want_lto = true;
|
||||
// exe.linkLibrary(lib);
|
||||
@@ -94,7 +121,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||
|
||||
return;
|
||||
} else {
|
||||
exe = b.addExecutable("bun", "src/main.zig");
|
||||
exe = b.addExecutable(bun_executable_name, "src/main.zig");
|
||||
}
|
||||
// exe.setLibCFile("libc.txt");
|
||||
exe.linkLibC();
|
||||
@@ -244,7 +271,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||
}
|
||||
|
||||
var obj_step = b.step("obj", "Build Bun as a .o file");
|
||||
var obj = b.addObject("bun", exe.root_src.?.path);
|
||||
var obj = b.addObject(bun_executable_name, exe.root_src.?.path);
|
||||
obj.bundle_compiler_rt = true;
|
||||
addPicoHTTP(obj, false);
|
||||
obj.addPackage(.{
|
||||
@@ -275,7 +302,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||
const run_step = b.step("run", "Run the app");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
|
||||
var log_step = b.addLog("Destination: {s}/{s}\n", .{ output_dir, "bun" });
|
||||
var log_step = b.addLog("Destination: {s}/{s}\n", .{ output_dir, bun_executable_name });
|
||||
log_step.step.dependOn(&exe.step);
|
||||
|
||||
var typings_cmd: *std.build.RunStep = typings_exe.run();
|
||||
|
||||
@@ -1,417 +0,0 @@
|
||||
globalThis.global = globalThis;
|
||||
globalThis.Bun_disableCSSImports = true;
|
||||
|
||||
import "./bun-error";
|
||||
|
||||
import * as React from "react";
|
||||
var onlyChildPolyfill = React.Children.only;
|
||||
React.Children.only = function (children) {
|
||||
if (children && typeof children === "object" && children.length == 1) {
|
||||
return onlyChildPolyfill(children[0]);
|
||||
}
|
||||
|
||||
return onlyChildPolyfill(children);
|
||||
};
|
||||
|
||||
import * as ReactDOM from "react-dom";
|
||||
import App from "next/app";
|
||||
import mitt, { MittEmitter } from "next/dist/shared/lib/mitt";
|
||||
import { RouterContext } from "next/dist/shared/lib/router-context";
|
||||
import Router, {
|
||||
AppComponent,
|
||||
AppProps,
|
||||
delBasePath,
|
||||
hasBasePath,
|
||||
PrivateRouteInfo,
|
||||
} from "next/dist/shared/lib/router/router";
|
||||
|
||||
import * as NextRouteLoader from "next/dist/client/route-loader";
|
||||
import { isDynamicRoute } from "next/dist/shared/lib/router/utils/is-dynamic";
|
||||
import {
|
||||
urlQueryToSearchParams,
|
||||
assign,
|
||||
} from "next/dist/shared/lib/router/utils/querystring";
|
||||
import { setConfig } from "next/dist/shared/lib/runtime-config";
|
||||
import {
|
||||
getURL,
|
||||
loadGetInitialProps,
|
||||
NEXT_DATA,
|
||||
ST,
|
||||
} from "next/dist/shared/lib/utils";
|
||||
// import { Portal } from "next/dist/client/portal";
|
||||
import initHeadManager from "next/dist/client/head-manager";
|
||||
import { HeadManagerContext } from "next/dist/shared/lib/head-manager-context";
|
||||
import PageLoader from "./page-loader";
|
||||
import measureWebVitals from "next/dist/client/performance-relayer";
|
||||
import { RouteAnnouncer } from "next/dist/client/route-announcer";
|
||||
import {
|
||||
createRouter,
|
||||
makePublicRouterInstance,
|
||||
} from "next/dist/client/router";
|
||||
export const emitter: MittEmitter<string> = mitt();
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
/* test fns */
|
||||
__NEXT_HYDRATED?: boolean;
|
||||
__NEXT_HYDRATED_CB?: () => void;
|
||||
|
||||
/* prod */
|
||||
__NEXT_PRELOADREADY?: (ids?: (string | number)[]) => void;
|
||||
__NEXT_DATA__: NEXT_DATA;
|
||||
__NEXT_P: any[];
|
||||
}
|
||||
}
|
||||
|
||||
function nextDataFromBunData() {
|
||||
const {
|
||||
router: { routes, route, params: paramsList },
|
||||
problems,
|
||||
} = globalThis.__BUN_DATA__;
|
||||
|
||||
const paramsMap = new Map();
|
||||
for (let i = 0; i < paramsList.keys.length; i++) {
|
||||
paramsMap.set(
|
||||
decodeURIComponent(paramsList.keys[i]),
|
||||
decodeURIComponent(paramsList.values[i])
|
||||
);
|
||||
}
|
||||
|
||||
const params = {};
|
||||
var url = new URL(location.href);
|
||||
Object.assign(params, Object.fromEntries(url.searchParams.entries()));
|
||||
Object.assign(params, Object.fromEntries(paramsMap.entries()));
|
||||
|
||||
const pages = routes.reduce((acc, route) => {
|
||||
var name = route.substring(route.indexOf("_next") + "_next/".length);
|
||||
|
||||
while (name.startsWith("/")) {
|
||||
name = name.substring(1);
|
||||
}
|
||||
|
||||
if (name.startsWith("pages")) {
|
||||
name = name.substring("pages".length);
|
||||
}
|
||||
|
||||
while (name.startsWith("/")) {
|
||||
name = name.substring(1);
|
||||
}
|
||||
|
||||
if (name.endsWith(".jsx")) {
|
||||
name = name.substring(0, name.length - ".jsx".length);
|
||||
}
|
||||
|
||||
if (name.endsWith(".tsx")) {
|
||||
name = name.substring(0, name.length - ".tsx".length);
|
||||
}
|
||||
|
||||
if (name.endsWith(".ts")) {
|
||||
name = name.substring(0, name.length - ".ts".length);
|
||||
}
|
||||
|
||||
if (name.endsWith(".js")) {
|
||||
name = name.substring(0, name.length - ".js".length);
|
||||
}
|
||||
|
||||
acc["/" + name] = [route];
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return {
|
||||
page: routes[route],
|
||||
buildId: "1234",
|
||||
assetPrefix: "",
|
||||
isPreview: false,
|
||||
locale: null,
|
||||
locales: [],
|
||||
isFallback: false,
|
||||
err: null,
|
||||
props: {},
|
||||
query: params,
|
||||
pages,
|
||||
};
|
||||
}
|
||||
|
||||
type RenderRouteInfo = PrivateRouteInfo & {
|
||||
App: AppComponent;
|
||||
scroll?: { x: number; y: number } | null;
|
||||
};
|
||||
type RenderErrorProps = Omit<RenderRouteInfo, "Component" | "styleSheets">;
|
||||
|
||||
const nextDataTag = document.getElementById("__NEXT_DATA__");
|
||||
|
||||
const data: typeof window["__NEXT_DATA__"] = nextDataTag
|
||||
? JSON.parse(document.getElementById("__NEXT_DATA__")!.textContent!)
|
||||
: nextDataFromBunData();
|
||||
window.__NEXT_DATA__ = data;
|
||||
|
||||
const {
|
||||
props: hydrateProps,
|
||||
err: hydrateErr,
|
||||
page,
|
||||
query,
|
||||
buildId,
|
||||
assetPrefix,
|
||||
runtimeConfig,
|
||||
dynamicIds,
|
||||
isFallback,
|
||||
locale,
|
||||
locales,
|
||||
domainLocales,
|
||||
isPreview,
|
||||
} = data;
|
||||
|
||||
const prefix: string = assetPrefix || "";
|
||||
|
||||
setConfig({
|
||||
serverRuntimeConfig: {},
|
||||
publicRuntimeConfig: runtimeConfig || {},
|
||||
});
|
||||
|
||||
let asPath: string = getURL();
|
||||
|
||||
// make sure not to attempt stripping basePath for 404s
|
||||
if (hasBasePath(asPath)) {
|
||||
asPath = delBasePath(asPath);
|
||||
}
|
||||
|
||||
export const pageLoader: PageLoader = new PageLoader(
|
||||
buildId,
|
||||
prefix,
|
||||
data.pages
|
||||
);
|
||||
|
||||
const headManager: {
|
||||
mountedInstances: Set<unknown>;
|
||||
updateHead: (head: JSX.Element[]) => void;
|
||||
} = initHeadManager();
|
||||
const appElement: HTMLElement | null = document.getElementById("__next");
|
||||
|
||||
let lastRenderReject: (() => void) | null;
|
||||
let webpackHMR: any;
|
||||
export let router: Router;
|
||||
let CachedApp: AppComponent, onPerfEntry: (metric: any) => void;
|
||||
|
||||
export default function boot(EntryPointNamespace, loader) {
|
||||
_boot(EntryPointNamespace).then(() => {}, false);
|
||||
}
|
||||
|
||||
class Container extends React.Component<{
|
||||
fn: (err: Error, info?: any) => void;
|
||||
}> {
|
||||
componentDidCatch(componentErr: Error, info: any) {
|
||||
this.props.fn(componentErr, info);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.scrollToHash();
|
||||
|
||||
// We need to replace the router state if:
|
||||
// - the page was (auto) exported and has a query string or search (hash)
|
||||
// - it was auto exported and is a dynamic route (to provide params)
|
||||
// - if it is a client-side skeleton (fallback render)
|
||||
if (
|
||||
router.isSsr &&
|
||||
// We don't update for 404 requests as this can modify
|
||||
// the asPath unexpectedly e.g. adding basePath when
|
||||
// it wasn't originally present
|
||||
page !== "/404" &&
|
||||
page !== "/_error" &&
|
||||
(isFallback ||
|
||||
(data.nextExport &&
|
||||
(isDynamicRoute(router.pathname) ||
|
||||
location.search ||
|
||||
process.env.__NEXT_HAS_REWRITES)) ||
|
||||
(hydrateProps &&
|
||||
hydrateProps.__N_SSG &&
|
||||
(location.search || process.env.__NEXT_HAS_REWRITES)))
|
||||
) {
|
||||
// update query on mount for exported pages
|
||||
router.replace(
|
||||
router.pathname +
|
||||
"?" +
|
||||
String(
|
||||
assign(
|
||||
urlQueryToSearchParams(router.query),
|
||||
new URLSearchParams(location.search)
|
||||
)
|
||||
),
|
||||
asPath,
|
||||
{
|
||||
// @ts-ignore
|
||||
// WARNING: `_h` is an internal option for handing Next.js
|
||||
// client-side hydration. Your app should _never_ use this property.
|
||||
// It may change at any time without notice.
|
||||
_h: 1,
|
||||
// Fallback pages must trigger the data fetch, so the transition is
|
||||
// not shallow.
|
||||
// Other pages (strictly updating query) happens shallowly, as data
|
||||
// requirements would already be present.
|
||||
shallow: !isFallback,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.scrollToHash();
|
||||
}
|
||||
|
||||
scrollToHash() {
|
||||
let { hash } = location;
|
||||
hash = hash && hash.substring(1);
|
||||
if (!hash) return;
|
||||
|
||||
const el: HTMLElement | null = document.getElementById(hash);
|
||||
if (!el) return;
|
||||
|
||||
// If we call scrollIntoView() in here without a setTimeout
|
||||
// it won't scroll properly.
|
||||
setTimeout(() => el.scrollIntoView(), 0);
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
let CachedComponent: React.ComponentType;
|
||||
|
||||
const wrapApp =
|
||||
(App: AppComponent) =>
|
||||
(wrappedAppProps: Record<string, any>): JSX.Element => {
|
||||
const appProps: AppProps = {
|
||||
...wrappedAppProps,
|
||||
Component: CachedComponent,
|
||||
err: hydrateErr,
|
||||
router,
|
||||
};
|
||||
return (
|
||||
<AppContainer>
|
||||
<App {...appProps} />
|
||||
</AppContainer>
|
||||
);
|
||||
};
|
||||
|
||||
function AppContainer({
|
||||
children,
|
||||
}: React.PropsWithChildren<{}>): React.ReactElement {
|
||||
return (
|
||||
<Container fn={(error) => <div>{JSON.stringify(error)}</div>}>
|
||||
<RouterContext.Provider value={makePublicRouterInstance(router)}>
|
||||
<HeadManagerContext.Provider value={headManager}>
|
||||
{children}
|
||||
</HeadManagerContext.Provider>
|
||||
</RouterContext.Provider>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
export async function _boot(EntryPointNamespace, isError) {
|
||||
NextRouteLoader.default.getClientBuildManifest = () => Promise.resolve({});
|
||||
|
||||
const PageComponent = EntryPointNamespace.default;
|
||||
|
||||
const appScripts = globalThis.__NEXT_DATA__.pages["/_app"];
|
||||
if (appScripts && appScripts.length > 0) {
|
||||
let appSrc;
|
||||
for (let asset of appScripts) {
|
||||
if (!asset.endsWith(".css")) {
|
||||
appSrc = asset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (appSrc) {
|
||||
const AppModule = await import(appSrc);
|
||||
console.assert(
|
||||
AppModule.default,
|
||||
appSrc + " must have a default export'd React component"
|
||||
);
|
||||
|
||||
CachedApp = AppModule.default;
|
||||
} else {
|
||||
CachedApp = App;
|
||||
}
|
||||
}
|
||||
|
||||
router = createRouter(page, query, asPath, {
|
||||
initialProps: hydrateProps,
|
||||
pageLoader,
|
||||
App: CachedApp,
|
||||
Component: CachedComponent,
|
||||
wrapApp,
|
||||
err: null,
|
||||
isFallback: Boolean(isFallback),
|
||||
subscription: async (info, App, scroll) => {
|
||||
return render(
|
||||
Object.assign<
|
||||
{},
|
||||
Omit<RenderRouteInfo, "App" | "scroll">,
|
||||
Pick<RenderRouteInfo, "App" | "scroll">
|
||||
>({}, info, {
|
||||
App,
|
||||
scroll,
|
||||
})
|
||||
);
|
||||
},
|
||||
locale,
|
||||
locales,
|
||||
defaultLocale: "",
|
||||
domainLocales,
|
||||
isPreview,
|
||||
});
|
||||
|
||||
globalThis.next.router = router;
|
||||
|
||||
if (isError) {
|
||||
ReactDOM.render(
|
||||
<TopLevelRender
|
||||
App={CachedApp}
|
||||
Component={PageComponent}
|
||||
props={{ pageProps: hydrateProps }}
|
||||
/>,
|
||||
document.querySelector("#__next")
|
||||
);
|
||||
} else {
|
||||
ReactDOM.hydrate(
|
||||
<TopLevelRender
|
||||
App={CachedApp}
|
||||
Component={PageComponent}
|
||||
props={{ pageProps: hydrateProps }}
|
||||
/>,
|
||||
document.querySelector("#__next")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function TopLevelRender({ App, Component, props, scroll }) {
|
||||
return (
|
||||
<AppContainer scroll={scroll}>
|
||||
<App Component={Component} {...props}></App>
|
||||
</AppContainer>
|
||||
);
|
||||
}
|
||||
|
||||
export function render(props) {
|
||||
ReactDOM.render(
|
||||
<TopLevelRender {...props} />,
|
||||
document.querySelector("#__next")
|
||||
);
|
||||
}
|
||||
|
||||
export function renderError(e) {
|
||||
ReactDOM.render(
|
||||
<AppContainer>
|
||||
<App Component={<div>UH OH!!!!</div>} pageProps={data.props}></App>
|
||||
</AppContainer>,
|
||||
document.querySelector("#__next")
|
||||
);
|
||||
}
|
||||
|
||||
globalThis.next = {
|
||||
version: "11.1.0",
|
||||
emitter,
|
||||
render,
|
||||
renderError,
|
||||
};
|
||||
Binary file not shown.
3773
examples/hello-next/package-lock.json
generated
3773
examples/hello-next/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/standalone": "^7.15.3",
|
||||
"@types/react": "^17.0.19",
|
||||
"bun-framework-next": "^0.0.0-18",
|
||||
"bun-framework-next": "^0.0.0-21",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,105 +1,82 @@
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import React from "react";
|
||||
import {
|
||||
Tweet,
|
||||
TwitterContextProvider,
|
||||
} from "@jarred/react-static-tweets/src/index";
|
||||
import "@jarred/react-static-tweets/styles.css";
|
||||
import { fetchTweetAst } from "@jarred/static-tweets/src/fetchTweetAst";
|
||||
import { SWRConfig } from "swr";
|
||||
import styles from "../styles/Home.module.css";
|
||||
|
||||
export async function getStaticProps(ctx) {
|
||||
return {
|
||||
props: {
|
||||
tweetAst: await fetchTweetAst("1390084458724741121"),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function Home({ tweetAst }) {
|
||||
export default function Home({ }) {
|
||||
return (
|
||||
<SWRConfig value={{ fallback: { [tweetAst[0].data.id]: tweetAst } }}>
|
||||
<TwitterContextProvider
|
||||
value={{
|
||||
tweetAstMap: { [tweetAst[0].data.id]: tweetAst },
|
||||
}}
|
||||
>
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<title>Fo</title>
|
||||
<meta name="description" content="Generated by create next app" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<title>Fo</title>
|
||||
<meta name="description" content="Generated by create next app" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
|
||||
<main className={styles.main}>
|
||||
|
||||
{/* <h1 className={styles.title}>
|
||||
Welcome to <a href="https://nextjs.org">Next.js!</a>
|
||||
</h1>
|
||||
<main className={styles.main}>
|
||||
<h1 className={styles.title}>
|
||||
Welcome to <a href="https://nextjs.org">Next.js!</a>
|
||||
</h1>
|
||||
|
||||
<p className={styles.description}>
|
||||
Get started by editing{" "}
|
||||
<code className={styles.code}>pages/index.js</code>
|
||||
<p className={styles.description}>
|
||||
Get started by editing{" "}
|
||||
<code className={styles.code}>pages/index.js</code>
|
||||
</p>
|
||||
|
||||
<div className={styles.grid}>
|
||||
<Link href="/second">
|
||||
<div className={styles.card}>
|
||||
<h2>Second Page →</h2>
|
||||
<p>Link</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
<a
|
||||
onClick={() => router.push("/foo/bar/third")}
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Third Page →</h2>
|
||||
<p>button, router.push()</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://github.com/vercel/next.js/tree/master/examples"
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Examples →</h2>
|
||||
<p>Discover and deploy boilerplate example Next.js projects.</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Deploy →</h2>
|
||||
<p>
|
||||
Instantly deploy your Next.js site to a public URL with Vercel.
|
||||
</p>
|
||||
|
||||
<div className={styles.grid}>
|
||||
<Link href="/second">
|
||||
<div className={styles.card}>
|
||||
<h2>Second Page →</h2>
|
||||
<p>Link</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
<a
|
||||
onClick={() => router.push("/foo/bar/third")}
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Third Page →</h2>
|
||||
<p>button, router.push()</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://github.com/vercel/next.js/tree/master/examples"
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Examples →</h2>
|
||||
<p>Discover and deploy boilerplate example Next.js projects.</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Deploy →</h2>
|
||||
<p>
|
||||
Instantly deploy your Next.js site to a public URL with
|
||||
Vercel.
|
||||
</p>
|
||||
</a>
|
||||
</div> */}
|
||||
</main>
|
||||
|
||||
{/* <footer className={styles.footer}>
|
||||
<a
|
||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Powered by{" "}
|
||||
<span className={styles.logo}>
|
||||
<img
|
||||
src="/vercel.svg"
|
||||
alt="Vercel Logo"
|
||||
width={72}
|
||||
height={16}
|
||||
/>
|
||||
</span>
|
||||
</a>
|
||||
</footer> */}
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer className={styles.footer}>
|
||||
<a
|
||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Powered by{" "}
|
||||
<span className={styles.logo}>
|
||||
<img src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
|
||||
</span>
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
144
integration/scripts/browser.js
Normal file
144
integration/scripts/browser.js
Normal file
@@ -0,0 +1,144 @@
|
||||
const puppeteer = require("puppeteer");
|
||||
const http = require("http");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
const fs = require("fs");
|
||||
const child_process = require("child_process");
|
||||
const snippetsDir = path.resolve(__dirname, "../snippets");
|
||||
const serverURL = process.env.TEST_SERVER_URL || "http://localhost:8080";
|
||||
|
||||
const DISABLE_HMR = !!process.env.DISABLE_HMR;
|
||||
const bunFlags = [
|
||||
`--origin=${serverURL}`,
|
||||
DISABLE_HMR && "--disable-hmr",
|
||||
].filter(Boolean);
|
||||
const bunExec = process.env.BUN_BIN || "bun";
|
||||
const bunProcess = child_process.spawn(bunExec, bunFlags, {
|
||||
cwd: snippetsDir,
|
||||
stdio: "pipe",
|
||||
|
||||
shell: false,
|
||||
});
|
||||
console.log("$", bunExec, bunFlags.join(" "));
|
||||
const isDebug = bunExec.endsWith("-debug");
|
||||
|
||||
bunProcess.stderr.pipe(process.stderr);
|
||||
bunProcess.stdout.pipe(process.stdout);
|
||||
bunProcess.once("error", (err) => {
|
||||
console.error("❌ bun error", err);
|
||||
process.exit(1);
|
||||
});
|
||||
process.on("beforeExit", () => {
|
||||
bunProcess?.kill(0);
|
||||
});
|
||||
|
||||
function writeSnapshot(name, code) {
|
||||
let file = path.join(__dirname, "../snapshots", name);
|
||||
|
||||
if (!DISABLE_HMR) {
|
||||
file =
|
||||
file.substring(0, file.length - path.extname(file).length) +
|
||||
".hmr" +
|
||||
path.extname(file);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(path.dirname(file))) {
|
||||
fs.mkdirSync(path.dirname(file), { recursive: true });
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
isDebug
|
||||
? file.substring(0, file.length - path.extname(file).length) +
|
||||
".debug" +
|
||||
path.extname(file)
|
||||
: file,
|
||||
code
|
||||
);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const browser = await puppeteer.launch();
|
||||
const promises = [];
|
||||
let allTestsPassed = true;
|
||||
|
||||
async function runPage(key) {
|
||||
var page;
|
||||
try {
|
||||
page = await browser.newPage();
|
||||
page.on("console", (obj) =>
|
||||
console.log(`[console.${obj.type()}] ${obj.text()}`)
|
||||
);
|
||||
page.exposeFunction("testFail", (error) => {
|
||||
console.log(`❌ ${error}`);
|
||||
allTestsPassed = false;
|
||||
});
|
||||
let testDone = new Promise((resolve) => {
|
||||
page.exposeFunction("testDone", resolve);
|
||||
});
|
||||
await page.goto(`${serverURL}/`, {
|
||||
waitUntil: "domcontentloaded",
|
||||
});
|
||||
await page.evaluate(`
|
||||
globalThis.runTest("${key}");
|
||||
`);
|
||||
await testDone;
|
||||
|
||||
console.log(`✅ ${key}`);
|
||||
} catch (e) {
|
||||
allTestsPassed = false;
|
||||
console.log(`❌ ${key}: ${(e && e.message) || e}`);
|
||||
} finally {
|
||||
try {
|
||||
const code = await page.evaluate(`
|
||||
globalThis.getModuleScriptSrc("${key}");
|
||||
`);
|
||||
writeSnapshot(key, code);
|
||||
} catch (exception) {
|
||||
console.warn(`Failed to update snapshot: ${key}`, exception);
|
||||
}
|
||||
}
|
||||
|
||||
await page.close();
|
||||
}
|
||||
|
||||
const tests = [
|
||||
"/cjs-transform-shouldnt-have-static-imports-in-cjs-function.js",
|
||||
"/bundled-entry-point.js",
|
||||
"/export.js",
|
||||
"/type-only-imports.ts",
|
||||
"/global-is-remapped-to-globalThis.js",
|
||||
"/multiple-imports.js",
|
||||
"/ts-fallback-rewrite-works.js",
|
||||
"/tsx-fallback-rewrite-works.js",
|
||||
"/lodash-regexp.js",
|
||||
"/unicode-identifiers.js",
|
||||
"/string-escapes.js",
|
||||
"/package-json-exports/index.js",
|
||||
"/array-args-with-default-values.js",
|
||||
"/forbid-in-is-correct.js",
|
||||
"/code-simplification-neql-define.js",
|
||||
];
|
||||
tests.reverse();
|
||||
|
||||
for (let test of tests) {
|
||||
await runPage(test);
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
bunProcess.kill(0);
|
||||
|
||||
if (!allTestsPassed) {
|
||||
console.error(`❌ browser test failed`);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log(`✅ browser test passed`);
|
||||
bunProcess.kill(0);
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch((error) =>
|
||||
setTimeout(() => {
|
||||
throw error;
|
||||
})
|
||||
);
|
||||
1
integration/snapshots/.prettierignore
Normal file
1
integration/snapshots/.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
*.js
|
||||
@@ -0,0 +1,25 @@
|
||||
var lines;
|
||||
const data = () => lines.map(([a = null, b = null, c = null, d = null]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}));
|
||||
export function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined]
|
||||
];
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
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]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}));
|
||||
function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined]
|
||||
];
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
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
|
||||
};
|
||||
47
integration/snapshots/array-args-with-default-values.hmr.js
Normal file
47
integration/snapshots/array-args-with-default-values.hmr.js
Normal file
@@ -0,0 +1,47 @@
|
||||
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(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]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}));
|
||||
function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined]
|
||||
];
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
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
|
||||
};
|
||||
25
integration/snapshots/array-args-with-default-values.js
Normal file
25
integration/snapshots/array-args-with-default-values.js
Normal file
@@ -0,0 +1,25 @@
|
||||
var lines;
|
||||
const data = () => lines.map(([a = null, b = null, c = null, d = null]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}));
|
||||
export function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined]
|
||||
];
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
9
integration/snapshots/bundled-entry-point.debug.js
Normal file
9
integration/snapshots/bundled-entry-point.debug.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
var hello = null ?? "world";
|
||||
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
30
integration/snapshots/bundled-entry-point.hmr.debug.js
Normal file
30
integration/snapshots/bundled-entry-point.hmr.debug.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(3012834585, "bundled-entry-point.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var hello = null ?? "world";
|
||||
function test() {
|
||||
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
|
||||
};
|
||||
30
integration/snapshots/bundled-entry-point.hmr.js
Normal file
30
integration/snapshots/bundled-entry-point.hmr.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
Bun.activate(false);
|
||||
|
||||
var hmr = new HMR(3012834585, "bundled-entry-point.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var hello = null ?? "world";
|
||||
function test() {
|
||||
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
|
||||
};
|
||||
9
integration/snapshots/bundled-entry-point.js
Normal file
9
integration/snapshots/bundled-entry-point.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
var hello = null ?? "world";
|
||||
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__cJS2eSM
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as _login_b977_0 from "http://localhost:8080/_login.js";
|
||||
import * as _login_b977_1 from "http://localhost:8080/_login.js";
|
||||
import _login from "http://localhost:8080/_login.js";
|
||||
import _auth from "http://localhost:8080/_auth.js";
|
||||
import * as _loginReally from "http://localhost:8080/_login.js";
|
||||
import * as _loginReally2 from "http://localhost:8080/_login.js";
|
||||
import * as _authReally from "http://localhost:8080/_auth.js";
|
||||
|
||||
export default __cJS2eSM(function(module, exports) {
|
||||
;
|
||||
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
module.exports.iAmCommonJs = true;
|
||||
exports.YouAreCommonJS = true;
|
||||
require(_login_b977_0);
|
||||
require(_login_b977_1);
|
||||
Object.defineProperty(module.exports,"login",{get: () => _login, enumerable: true, configurable: true});
|
||||
var test = function test() {
|
||||
return testDone(import.meta.url);
|
||||
};
|
||||
Object.defineProperty(module.exports,"test",{get: () => test, enumerable: true, configurable: true});
|
||||
let foo, bar;
|
||||
Object.defineProperties(module.exports,{'foo': {get: () => foo, set: ($_newValue) => {foo = $_newValue;}, enumerable: true, configurable: true},
|
||||
'bar': {get: () => bar, set: ($_newValue) => {bar = $_newValue;}, enumerable: true, configurable: true}});
|
||||
}, "cjs-transform-shouldnt-have-static-imports-in-cjs-function.js");
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__cJS2eSM
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as _login_b977_0 from "http://localhost:8080/_login.js";
|
||||
import * as _login_b977_1 from "http://localhost:8080/_login.js";
|
||||
import _login from "http://localhost:8080/_login.js";
|
||||
import _auth from "http://localhost:8080/_auth.js";
|
||||
import * as _loginReally from "http://localhost:8080/_login.js";
|
||||
import * as _loginReally2 from "http://localhost:8080/_login.js";
|
||||
import * as _authReally from "http://localhost:8080/_auth.js";
|
||||
|
||||
export default __cJS2eSM(function(module, exports) {
|
||||
;
|
||||
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
module.exports.iAmCommonJs = true;
|
||||
exports.YouAreCommonJS = true;
|
||||
require(_login_b977_0);
|
||||
require(_login_b977_1);
|
||||
Object.defineProperty(module.exports,"login",{get: () => _login, enumerable: true, configurable: true});
|
||||
var test = function test() {
|
||||
return testDone(import.meta.url);
|
||||
};
|
||||
Object.defineProperty(module.exports,"test",{get: () => test, enumerable: true, configurable: true});
|
||||
var foo, bar;
|
||||
Object.defineProperties(module.exports,{'foo': {get: () => foo, set: ($_newValue) => {foo = $_newValue;}, enumerable: true, configurable: true},
|
||||
'bar': {get: () => bar, set: ($_newValue) => {bar = $_newValue;}, enumerable: true, configurable: true}});
|
||||
}, "cjs-transform-shouldnt-have-static-imports-in-cjs-function.js");
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__cJS2eSM
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as _login_b977_0 from "http://localhost:8080/_login.js";
|
||||
import * as _login_b977_1 from "http://localhost:8080/_login.js";
|
||||
import _login from "http://localhost:8080/_login.js";
|
||||
import _auth from "http://localhost:8080/_auth.js";
|
||||
import * as _loginReally from "http://localhost:8080/_login.js";
|
||||
import * as _loginReally2 from "http://localhost:8080/_login.js";
|
||||
import * as _authReally from "http://localhost:8080/_auth.js";
|
||||
|
||||
export default __cJS2eSM(function(module, exports) {
|
||||
;
|
||||
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
module.exports.iAmCommonJs = true;
|
||||
exports.YouAreCommonJS = true;
|
||||
require(_login_b977_0);
|
||||
require(_login_b977_1);
|
||||
Object.defineProperty(module.exports,"login",{get: () => _login, enumerable: true, configurable: true});
|
||||
var test = function test() {
|
||||
return testDone(import.meta.url);
|
||||
};
|
||||
Object.defineProperty(module.exports,"test",{get: () => test, enumerable: true, configurable: true});
|
||||
var foo, bar;
|
||||
Object.defineProperties(module.exports,{'foo': {get: () => foo, set: ($_newValue) => {foo = $_newValue;}, enumerable: true, configurable: true},
|
||||
'bar': {get: () => bar, set: ($_newValue) => {bar = $_newValue;}, enumerable: true, configurable: true}});
|
||||
}, "cjs-transform-shouldnt-have-static-imports-in-cjs-function.js");
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__cJS2eSM
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as _login_b977_0 from "http://localhost:8080/_login.js";
|
||||
import * as _login_b977_1 from "http://localhost:8080/_login.js";
|
||||
import _login from "http://localhost:8080/_login.js";
|
||||
import _auth from "http://localhost:8080/_auth.js";
|
||||
import * as _loginReally from "http://localhost:8080/_login.js";
|
||||
import * as _loginReally2 from "http://localhost:8080/_login.js";
|
||||
import * as _authReally from "http://localhost:8080/_auth.js";
|
||||
|
||||
export default __cJS2eSM(function(module, exports) {
|
||||
;
|
||||
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
module.exports.iAmCommonJs = true;
|
||||
exports.YouAreCommonJS = true;
|
||||
require(_login_b977_0);
|
||||
require(_login_b977_1);
|
||||
Object.defineProperty(module.exports,"login",{get: () => _login, enumerable: true, configurable: true});
|
||||
var test = function test() {
|
||||
return testDone(import.meta.url);
|
||||
};
|
||||
Object.defineProperty(module.exports,"test",{get: () => test, enumerable: true, configurable: true});
|
||||
let foo, bar;
|
||||
Object.defineProperties(module.exports,{'foo': {get: () => foo, set: ($_newValue) => {foo = $_newValue;}, enumerable: true, configurable: true},
|
||||
'bar': {get: () => bar, set: ($_newValue) => {bar = $_newValue;}, enumerable: true, configurable: true}});
|
||||
}, "cjs-transform-shouldnt-have-static-imports-in-cjs-function.js");
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
var testFailed = false;
|
||||
const invariant = () => {
|
||||
testFailed = true;
|
||||
};
|
||||
var $$m = (arg) => {
|
||||
var module = {exports: {} }, exports = module.exports;
|
||||
return arg(module, exports);
|
||||
};
|
||||
var size = 100, ttl = 3600;
|
||||
export var $f332019d = $$m({
|
||||
"relay-runtime/lib/network/RelayQueryResponseCache.js": (module, exports) => {
|
||||
var RelayQueryResponseCache = function() {
|
||||
var foo = function RelayQueryResponseCache(_ref) {
|
||||
var size = _ref.size, ttl = _ref.ttl;
|
||||
!(size > 0) && invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + "`%s`.", size);
|
||||
!(ttl > 0) && invariant(false, "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", ttl);
|
||||
};
|
||||
foo({size: 100, ttl: 3600 });
|
||||
};
|
||||
RelayQueryResponseCache();
|
||||
}
|
||||
}["relay-runtime/lib/network/RelayQueryResponseCache.js"]);
|
||||
export function test() {
|
||||
var foo = () => result;
|
||||
if (testFailed)
|
||||
throw new Error("invariant should not be called");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(726376257, "code-simplification-neql-define.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var testFailed = false;
|
||||
const invariant = () => {
|
||||
testFailed = true;
|
||||
};
|
||||
var $$m = (arg) => {
|
||||
var module = {exports: {} }, exports = module.exports;
|
||||
return arg(module, exports);
|
||||
};
|
||||
var size = 100, ttl = 3600;
|
||||
var $f332019d = $$m({
|
||||
"relay-runtime/lib/network/RelayQueryResponseCache.js": (module, exports) => {
|
||||
var RelayQueryResponseCache = function() {
|
||||
var foo = function RelayQueryResponseCache(_ref) {
|
||||
var size = _ref.size, ttl = _ref.ttl;
|
||||
!(size > 0) && invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + "`%s`.", size);
|
||||
!(ttl > 0) && invariant(false, "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", ttl);
|
||||
};
|
||||
foo({size: 100, ttl: 3600 });
|
||||
};
|
||||
RelayQueryResponseCache();
|
||||
}
|
||||
}["relay-runtime/lib/network/RelayQueryResponseCache.js"]);
|
||||
function test() {
|
||||
var foo = () => result;
|
||||
if (testFailed)
|
||||
throw new Error("invariant should not be called");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
$f332019d: () => $f332019d,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_$f332019d = hmr.exports.$f332019d, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_$f332019d = exports.$f332019d;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_$f332019d as $f332019d,
|
||||
$$hmr_test as test
|
||||
};
|
||||
53
integration/snapshots/code-simplification-neql-define.hmr.js
Normal file
53
integration/snapshots/code-simplification-neql-define.hmr.js
Normal file
@@ -0,0 +1,53 @@
|
||||
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(726376257, "code-simplification-neql-define.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var testFailed = false;
|
||||
const invariant = () => {
|
||||
testFailed = true;
|
||||
};
|
||||
var $$m = (arg) => {
|
||||
var module = {exports: {} }, exports = module.exports;
|
||||
return arg(module, exports);
|
||||
};
|
||||
var size = 100, ttl = 3600;
|
||||
var $f332019d = $$m({
|
||||
"relay-runtime/lib/network/RelayQueryResponseCache.js": (module, exports) => {
|
||||
var RelayQueryResponseCache = function() {
|
||||
var foo = function RelayQueryResponseCache(_ref) {
|
||||
var size = _ref.size, ttl = _ref.ttl;
|
||||
!(size > 0) && invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + "`%s`.", size);
|
||||
!(ttl > 0) && invariant(false, "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", ttl);
|
||||
};
|
||||
foo({size: 100, ttl: 3600 });
|
||||
};
|
||||
RelayQueryResponseCache();
|
||||
}
|
||||
}["relay-runtime/lib/network/RelayQueryResponseCache.js"]);
|
||||
function test() {
|
||||
var foo = () => result;
|
||||
if (testFailed)
|
||||
throw new Error("invariant should not be called");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
$f332019d: () => $f332019d,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_$f332019d = hmr.exports.$f332019d, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_$f332019d = exports.$f332019d;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_$f332019d as $f332019d,
|
||||
$$hmr_test as test
|
||||
};
|
||||
28
integration/snapshots/code-simplification-neql-define.js
Normal file
28
integration/snapshots/code-simplification-neql-define.js
Normal file
@@ -0,0 +1,28 @@
|
||||
var testFailed = false;
|
||||
const invariant = () => {
|
||||
testFailed = true;
|
||||
};
|
||||
var $$m = (arg) => {
|
||||
var module = {exports: {} }, exports = module.exports;
|
||||
return arg(module, exports);
|
||||
};
|
||||
var size = 100, ttl = 3600;
|
||||
export var $f332019d = $$m({
|
||||
"relay-runtime/lib/network/RelayQueryResponseCache.js": (module, exports) => {
|
||||
var RelayQueryResponseCache = function() {
|
||||
var foo = function RelayQueryResponseCache(_ref) {
|
||||
var size = _ref.size, ttl = _ref.ttl;
|
||||
!(size > 0) && invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + "`%s`.", size);
|
||||
!(ttl > 0) && invariant(false, "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", ttl);
|
||||
};
|
||||
foo({size: 100, ttl: 3600 });
|
||||
};
|
||||
RelayQueryResponseCache();
|
||||
}
|
||||
}["relay-runtime/lib/network/RelayQueryResponseCache.js"]);
|
||||
export function test() {
|
||||
var foo = () => result;
|
||||
if (testFailed)
|
||||
throw new Error("invariant should not be called");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
31
integration/snapshots/export.debug.js
Normal file
31
integration/snapshots/export.debug.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import what from "http://localhost:8080/_auth.js";
|
||||
export {default as auth} from "http://localhost:8080/_auth.js";
|
||||
|
||||
export {default as login} from "http://localhost:8080/_login.js";
|
||||
export * from "http://localhost:8080/_bacon.js";
|
||||
export let yoyoyo = "yoyoyo";
|
||||
|
||||
export default function hey() {
|
||||
return true;
|
||||
}
|
||||
export const foo = () => {
|
||||
};
|
||||
export var bar = 100;
|
||||
export let powerLevel = Symbol("9001");
|
||||
|
||||
export {what};
|
||||
export {what as when, what as whence};
|
||||
export {} from "http://localhost:8080/_bacon.js";
|
||||
import * as where from "http://localhost:8080/_auth.js";
|
||||
|
||||
export {where};
|
||||
|
||||
export {bar as booop};
|
||||
export function test() {
|
||||
hey();
|
||||
foo();
|
||||
if (where.default !== "hi")
|
||||
throw new Error(`_auth import is incorrect.`);
|
||||
console.assert(powerLevel.description === "9001", "Symbol is not exported correctly");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
74
integration/snapshots/export.hmr.debug.js
Normal file
74
integration/snapshots/export.hmr.debug.js
Normal file
@@ -0,0 +1,74 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import what from "http://localhost:8080/_auth.js";
|
||||
import * as where from "http://localhost:8080/_auth.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(1879780259, "export.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var yoyoyo = "yoyoyo";
|
||||
function hey() {
|
||||
return true;
|
||||
}
|
||||
var foo = () => {
|
||||
};
|
||||
var bar = 100;
|
||||
var powerLevel = Symbol("9001");
|
||||
function test() {
|
||||
hey();
|
||||
foo();
|
||||
if (where.default !== "hi")
|
||||
throw new Error(`_auth import is incorrect.`);
|
||||
console.assert(powerLevel.description === "9001", "Symbol is not exported correctly");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
yoyoyo: () => yoyoyo,
|
||||
default: () => hey,
|
||||
foo: () => foo,
|
||||
bar: () => bar,
|
||||
powerLevel: () => powerLevel,
|
||||
what: () => what,
|
||||
when: () => what,
|
||||
whence: () => what,
|
||||
where: () => where,
|
||||
booop: () => bar,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_yoyoyo = hmr.exports.yoyoyo, $$hmr_default = hmr.exports.default, $$hmr_foo = hmr.exports.foo, $$hmr_bar = hmr.exports.bar, $$hmr_powerLevel = hmr.exports.powerLevel, $$hmr_what = hmr.exports.what, $$hmr_when = hmr.exports.when, $$hmr_whence = hmr.exports.whence, $$hmr_where = hmr.exports.where, $$hmr_booop = hmr.exports.booop, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_yoyoyo = exports.yoyoyo;
|
||||
$$hmr_default = exports.default;
|
||||
$$hmr_foo = exports.foo;
|
||||
$$hmr_bar = exports.bar;
|
||||
$$hmr_powerLevel = exports.powerLevel;
|
||||
$$hmr_what = exports.what;
|
||||
$$hmr_when = exports.when;
|
||||
$$hmr_whence = exports.whence;
|
||||
$$hmr_where = exports.where;
|
||||
$$hmr_booop = exports.booop;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_yoyoyo as yoyoyo,
|
||||
$$hmr_default as default,
|
||||
$$hmr_foo as foo,
|
||||
$$hmr_bar as bar,
|
||||
$$hmr_powerLevel as powerLevel,
|
||||
$$hmr_what as what,
|
||||
$$hmr_when as when,
|
||||
$$hmr_whence as whence,
|
||||
$$hmr_where as where,
|
||||
$$hmr_booop as booop,
|
||||
$$hmr_test as test
|
||||
};
|
||||
export {default as auth} from "http://localhost:8080/_auth.js";
|
||||
export {default as login} from "http://localhost:8080/_login.js";
|
||||
export * from "http://localhost:8080/_bacon.js";
|
||||
export {} from "http://localhost:8080/_bacon.js";
|
||||
74
integration/snapshots/export.hmr.js
Normal file
74
integration/snapshots/export.hmr.js
Normal file
@@ -0,0 +1,74 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import what from "http://localhost:8080/_auth.js";
|
||||
import * as where from "http://localhost:8080/_auth.js";
|
||||
Bun.activate(false);
|
||||
|
||||
var hmr = new HMR(1879780259, "export.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var yoyoyo = "yoyoyo";
|
||||
function hey() {
|
||||
return true;
|
||||
}
|
||||
var foo = () => {
|
||||
};
|
||||
var bar = 100;
|
||||
var powerLevel = Symbol("9001");
|
||||
function test() {
|
||||
hey();
|
||||
foo();
|
||||
if (where.default !== "hi")
|
||||
throw new Error(`_auth import is incorrect.`);
|
||||
console.assert(powerLevel.description === "9001", "Symbol is not exported correctly");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
yoyoyo: () => yoyoyo,
|
||||
default: () => hey,
|
||||
foo: () => foo,
|
||||
bar: () => bar,
|
||||
powerLevel: () => powerLevel,
|
||||
what: () => what,
|
||||
when: () => what,
|
||||
whence: () => what,
|
||||
where: () => where,
|
||||
booop: () => bar,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_yoyoyo = hmr.exports.yoyoyo, $$hmr_default = hmr.exports.default, $$hmr_foo = hmr.exports.foo, $$hmr_bar = hmr.exports.bar, $$hmr_powerLevel = hmr.exports.powerLevel, $$hmr_what = hmr.exports.what, $$hmr_when = hmr.exports.when, $$hmr_whence = hmr.exports.whence, $$hmr_where = hmr.exports.where, $$hmr_booop = hmr.exports.booop, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_yoyoyo = exports.yoyoyo;
|
||||
$$hmr_default = exports.default;
|
||||
$$hmr_foo = exports.foo;
|
||||
$$hmr_bar = exports.bar;
|
||||
$$hmr_powerLevel = exports.powerLevel;
|
||||
$$hmr_what = exports.what;
|
||||
$$hmr_when = exports.when;
|
||||
$$hmr_whence = exports.whence;
|
||||
$$hmr_where = exports.where;
|
||||
$$hmr_booop = exports.booop;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_yoyoyo as yoyoyo,
|
||||
$$hmr_default as default,
|
||||
$$hmr_foo as foo,
|
||||
$$hmr_bar as bar,
|
||||
$$hmr_powerLevel as powerLevel,
|
||||
$$hmr_what as what,
|
||||
$$hmr_when as when,
|
||||
$$hmr_whence as whence,
|
||||
$$hmr_where as where,
|
||||
$$hmr_booop as booop,
|
||||
$$hmr_test as test
|
||||
};
|
||||
export {default as auth} from "http://localhost:8080/_auth.js";
|
||||
export {default as login} from "http://localhost:8080/_login.js";
|
||||
export * from "http://localhost:8080/_bacon.js";
|
||||
export {} from "http://localhost:8080/_bacon.js";
|
||||
31
integration/snapshots/export.js
Normal file
31
integration/snapshots/export.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import what from "http://localhost:8080/_auth.js";
|
||||
export {default as auth} from "http://localhost:8080/_auth.js";
|
||||
|
||||
export {default as login} from "http://localhost:8080/_login.js";
|
||||
export * from "http://localhost:8080/_bacon.js";
|
||||
export let yoyoyo = "yoyoyo";
|
||||
|
||||
export default function hey() {
|
||||
return true;
|
||||
}
|
||||
export const foo = () => {
|
||||
};
|
||||
export var bar = 100;
|
||||
export let powerLevel = Symbol("9001");
|
||||
|
||||
export {what};
|
||||
export {what as when, what as whence};
|
||||
export {} from "http://localhost:8080/_bacon.js";
|
||||
import * as where from "http://localhost:8080/_auth.js";
|
||||
|
||||
export {where};
|
||||
|
||||
export {bar as booop};
|
||||
export function test() {
|
||||
hey();
|
||||
foo();
|
||||
if (where.default !== "hi")
|
||||
throw new Error(`_auth import is incorrect.`);
|
||||
console.assert(powerLevel.description === "9001", "Symbol is not exported correctly");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
8
integration/snapshots/forbid-in-is-correct.debug.js
Normal file
8
integration/snapshots/forbid-in-is-correct.debug.js
Normal file
@@ -0,0 +1,8 @@
|
||||
var foo = () => {
|
||||
var D = (i, r) => () => (r || i((r = {exports: {} }).exports, r), r.exports);
|
||||
return D;
|
||||
};
|
||||
export function test() {
|
||||
foo();
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
30
integration/snapshots/forbid-in-is-correct.hmr.debug.js
Normal file
30
integration/snapshots/forbid-in-is-correct.hmr.debug.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
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);
|
||||
return D;
|
||||
};
|
||||
function test() {
|
||||
foo();
|
||||
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
|
||||
};
|
||||
30
integration/snapshots/forbid-in-is-correct.hmr.js
Normal file
30
integration/snapshots/forbid-in-is-correct.hmr.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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(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);
|
||||
return D;
|
||||
};
|
||||
function test() {
|
||||
foo();
|
||||
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
|
||||
};
|
||||
8
integration/snapshots/forbid-in-is-correct.js
Normal file
8
integration/snapshots/forbid-in-is-correct.js
Normal file
@@ -0,0 +1,8 @@
|
||||
var foo = () => {
|
||||
var D = (i, r) => () => (r || i((r = {exports: {} }).exports, r), r.exports);
|
||||
return D;
|
||||
};
|
||||
export function test() {
|
||||
foo();
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export function test() {
|
||||
console.assert(globalThis === globalThis);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(713665787, "global-is-remapped-to-globalThis.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
function test() {
|
||||
console.assert(globalThis === globalThis);
|
||||
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
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
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(713665787, "global-is-remapped-to-globalThis.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
function test() {
|
||||
console.assert(globalThis === globalThis);
|
||||
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
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export function test() {
|
||||
console.assert(globalThis === globalThis);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
21
integration/snapshots/lodash-regexp.debug.js
Normal file
21
integration/snapshots/lodash-regexp.debug.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
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];
|
||||
|
||||
const bar = shuffle(foo);
|
||||
console.assert(bar !== foo);
|
||||
console.assert(bar.length === foo.length);
|
||||
bar.sort();
|
||||
foo.sort();
|
||||
for (let i = 0;i < bar.length; i++) {
|
||||
console.assert(bar[i] === foo[i], "expected " + i + " to be " + foo[i]);
|
||||
console.assert(typeof bar[i] === "number");
|
||||
console.assert(typeof foo[i] === "number");
|
||||
}
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
|
||||
41
integration/snapshots/lodash-regexp.hmr.debug.js
Normal file
41
integration/snapshots/lodash-regexp.hmr.debug.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $60f52dc2 from "http://localhost:8080/node_modules/lodash/lodash.js";
|
||||
var { shuffle} = require($60f52dc2);
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(2158065009, "lodash-regexp.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
function test() {
|
||||
const foo = [1, 2, 3, 4, 6];
|
||||
const bar = shuffle(foo);
|
||||
console.assert(bar !== foo);
|
||||
console.assert(bar.length === foo.length);
|
||||
bar.sort();
|
||||
foo.sort();
|
||||
for (let i = 0;i < bar.length; i++) {
|
||||
console.assert(bar[i] === foo[i], "expected " + i + " to be " + foo[i]);
|
||||
console.assert(typeof bar[i] === "number");
|
||||
console.assert(typeof foo[i] === "number");
|
||||
}
|
||||
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
|
||||
};
|
||||
41
integration/snapshots/lodash-regexp.hmr.js
Normal file
41
integration/snapshots/lodash-regexp.hmr.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $60f52dc2 from "http://localhost:8080/node_modules/lodash/lodash.js";
|
||||
var { shuffle} = require($60f52dc2);
|
||||
Bun.activate(false);
|
||||
|
||||
var hmr = new HMR(2158065009, "lodash-regexp.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
function test() {
|
||||
const foo = [1, 2, 3, 4, 6];
|
||||
const bar = shuffle(foo);
|
||||
console.assert(bar !== foo);
|
||||
console.assert(bar.length === foo.length);
|
||||
bar.sort();
|
||||
foo.sort();
|
||||
for (let i = 0;i < bar.length; i++) {
|
||||
console.assert(bar[i] === foo[i], "expected " + i + " to be " + foo[i]);
|
||||
console.assert(typeof bar[i] === "number");
|
||||
console.assert(typeof foo[i] === "number");
|
||||
}
|
||||
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
|
||||
};
|
||||
21
integration/snapshots/lodash-regexp.js
Normal file
21
integration/snapshots/lodash-regexp.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
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];
|
||||
|
||||
const bar = shuffle(foo);
|
||||
console.assert(bar !== foo);
|
||||
console.assert(bar.length === foo.length);
|
||||
bar.sort();
|
||||
foo.sort();
|
||||
for (let i = 0;i < bar.length; i++) {
|
||||
console.assert(bar[i] === foo[i], "expected " + i + " to be " + foo[i]);
|
||||
console.assert(typeof bar[i] === "number");
|
||||
console.assert(typeof foo[i] === "number");
|
||||
}
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
|
||||
25
integration/snapshots/multiple-imports.debug.js
Normal file
25
integration/snapshots/multiple-imports.debug.js
Normal file
@@ -0,0 +1,25 @@
|
||||
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 $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
var JSXClassic = require($bbcd215f);
|
||||
var jsx = require(JSX).jsxDEV, fileName = "multiple-imports.js", JSXFrag = require(JSX, JSXClassic).Fragment;
|
||||
|
||||
var { default: React} = require($bbcd215f);
|
||||
var { default: React2} = require($bbcd215f);
|
||||
const bacon = React;
|
||||
|
||||
const bacon2 = jsx(JSXFrag, {
|
||||
children: ["hello"]
|
||||
}, undefined, true, {
|
||||
fileName,
|
||||
lineNumber: 92
|
||||
}, this);
|
||||
export function test() {
|
||||
console.assert(bacon === React);
|
||||
console.assert(bacon === React2);
|
||||
console.assert(typeof bacon2 !== "undefined");
|
||||
console.assert(React.isValidElement(bacon2));
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
46
integration/snapshots/multiple-imports.hmr.debug.js
Normal file
46
integration/snapshots/multiple-imports.hmr.debug.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
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 $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
var JSXClassic = require($bbcd215f);
|
||||
var jsx = require(JSX).jsxDEV, fileName = "multiple-imports.js", JSXFrag = require(JSX, JSXClassic).Fragment;
|
||||
|
||||
var { default: React} = require($bbcd215f);
|
||||
var { default: React2} = require($bbcd215f);
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(2165509932, "multiple-imports.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
const bacon = React;
|
||||
const bacon2 = jsx(JSXFrag, {
|
||||
children: ["hello"]
|
||||
}, undefined, true, {
|
||||
fileName,
|
||||
lineNumber: 92
|
||||
}, this);
|
||||
function test() {
|
||||
console.assert(bacon === React);
|
||||
console.assert(bacon === React2);
|
||||
console.assert(typeof bacon2 !== "undefined");
|
||||
console.assert(React.isValidElement(bacon2));
|
||||
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
|
||||
};
|
||||
46
integration/snapshots/multiple-imports.hmr.js
Normal file
46
integration/snapshots/multiple-imports.hmr.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
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 $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
var JSXClassic = require($bbcd215f);
|
||||
var jsx = require(JSX).jsxDEV, fileName = "multiple-imports.js", JSXFrag = require(JSX, JSXClassic).Fragment;
|
||||
|
||||
var { default: React} = require($bbcd215f);
|
||||
var { default: React2} = require($bbcd215f);
|
||||
Bun.activate(false);
|
||||
|
||||
var hmr = new HMR(2165509932, "multiple-imports.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
const bacon = React;
|
||||
const bacon2 = jsx(JSXFrag, {
|
||||
children: ["hello"]
|
||||
}, undefined, true, {
|
||||
fileName,
|
||||
lineNumber: 92
|
||||
}, this);
|
||||
function test() {
|
||||
console.assert(bacon === React);
|
||||
console.assert(bacon === React2);
|
||||
console.assert(typeof bacon2 !== "undefined");
|
||||
console.assert(React.isValidElement(bacon2));
|
||||
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
|
||||
};
|
||||
25
integration/snapshots/multiple-imports.js
Normal file
25
integration/snapshots/multiple-imports.js
Normal file
@@ -0,0 +1,25 @@
|
||||
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 $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
var JSXClassic = require($bbcd215f);
|
||||
var jsx = require(JSX).jsxDEV, fileName = "multiple-imports.js", JSXFrag = require(JSX, JSXClassic).Fragment;
|
||||
|
||||
var { default: React} = require($bbcd215f);
|
||||
var { default: React2} = require($bbcd215f);
|
||||
const bacon = React;
|
||||
|
||||
const bacon2 = jsx(JSXFrag, {
|
||||
children: ["hello"]
|
||||
}, undefined, true, {
|
||||
fileName,
|
||||
lineNumber: 92
|
||||
}, this);
|
||||
export function test() {
|
||||
console.assert(bacon === React);
|
||||
console.assert(bacon === React2);
|
||||
console.assert(typeof bacon2 !== "undefined");
|
||||
console.assert(React.isValidElement(bacon2));
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
17
integration/snapshots/package-json-exports/index.debug.js
Normal file
17
integration/snapshots/package-json-exports/index.debug.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
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");
|
||||
|
||||
console.assert(InexactFile.target === "browser");
|
||||
console.assert(ExactFile.target === "browser");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
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(true);
|
||||
|
||||
var hmr = new HMR(1953708113, "package-json-exports/index.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
async function test() {
|
||||
console.assert(InexactRoot.target === "browser");
|
||||
console.assert(InexactFile.target === "browser");
|
||||
console.assert(ExactFile.target === "browser");
|
||||
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
|
||||
};
|
||||
37
integration/snapshots/package-json-exports/index.hmr.js
Normal file
37
integration/snapshots/package-json-exports/index.hmr.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
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(1953708113, "package-json-exports/index.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
async function test() {
|
||||
console.assert(InexactRoot.target === "browser");
|
||||
console.assert(InexactFile.target === "browser");
|
||||
console.assert(ExactFile.target === "browser");
|
||||
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
|
||||
};
|
||||
17
integration/snapshots/package-json-exports/index.js
Normal file
17
integration/snapshots/package-json-exports/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
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");
|
||||
|
||||
console.assert(InexactFile.target === "browser");
|
||||
console.assert(ExactFile.target === "browser");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
|
||||
34
integration/snapshots/string-escapes.debug.js
Normal file
34
integration/snapshots/string-escapes.debug.js
Normal file
@@ -0,0 +1,34 @@
|
||||
var tab = "\t";
|
||||
var シ = "wow";
|
||||
var f = "";
|
||||
var obj = {
|
||||
"\r\n": "\r\n",
|
||||
"\n": "\n",
|
||||
"\t": "\t",
|
||||
"\u2028": "\u2028",
|
||||
"\u2029": "\u2029",
|
||||
"😊": "😊",
|
||||
"😃": "😃",
|
||||
"㋡": "㋡",
|
||||
"☺": "☺",
|
||||
シ: "シ",
|
||||
f,
|
||||
"☹": "☹",
|
||||
"☻": "☻",
|
||||
children: 123
|
||||
};
|
||||
const foo = () => {
|
||||
};
|
||||
const Bar = foo("a", {
|
||||
children: 123
|
||||
});
|
||||
const carriage = obj["\r\n"];
|
||||
const newline = obj["\n"];
|
||||
|
||||
export {obj};
|
||||
export function test() {
|
||||
console.assert(carriage === "\r\n");
|
||||
console.assert(newline === "\n");
|
||||
console.assert(tab === "\t");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
57
integration/snapshots/string-escapes.hmr.debug.js
Normal file
57
integration/snapshots/string-escapes.hmr.debug.js
Normal file
@@ -0,0 +1,57 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(2482749838, "string-escapes.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var tab = "\t";
|
||||
var シ = "wow";
|
||||
var f = "";
|
||||
var obj = {
|
||||
"\r\n": "\r\n",
|
||||
"\n": "\n",
|
||||
"\t": "\t",
|
||||
"\u2028": "\u2028",
|
||||
"\u2029": "\u2029",
|
||||
"😊": "😊",
|
||||
"😃": "😃",
|
||||
"㋡": "㋡",
|
||||
"☺": "☺",
|
||||
シ: "シ",
|
||||
f,
|
||||
"☹": "☹",
|
||||
"☻": "☻",
|
||||
children: 123
|
||||
};
|
||||
const foo = () => {
|
||||
};
|
||||
const Bar = foo("a", {
|
||||
children: 123
|
||||
});
|
||||
const carriage = obj["\r\n"];
|
||||
const newline = obj["\n"];
|
||||
function test() {
|
||||
console.assert(carriage === "\r\n");
|
||||
console.assert(newline === "\n");
|
||||
console.assert(tab === "\t");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
obj: () => obj,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_obj = hmr.exports.obj, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_obj = exports.obj;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_obj as obj,
|
||||
$$hmr_test as test
|
||||
};
|
||||
57
integration/snapshots/string-escapes.hmr.js
Normal file
57
integration/snapshots/string-escapes.hmr.js
Normal file
@@ -0,0 +1,57 @@
|
||||
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(2482749838, "string-escapes.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var tab = "\t";
|
||||
var シ = "wow";
|
||||
var f = "";
|
||||
var obj = {
|
||||
"\r\n": "\r\n",
|
||||
"\n": "\n",
|
||||
"\t": "\t",
|
||||
"\u2028": "\u2028",
|
||||
"\u2029": "\u2029",
|
||||
"😊": "😊",
|
||||
"😃": "😃",
|
||||
"㋡": "㋡",
|
||||
"☺": "☺",
|
||||
シ: "シ",
|
||||
f,
|
||||
"☹": "☹",
|
||||
"☻": "☻",
|
||||
children: 123
|
||||
};
|
||||
const foo = () => {
|
||||
};
|
||||
const Bar = foo("a", {
|
||||
children: 123
|
||||
});
|
||||
const carriage = obj["\r\n"];
|
||||
const newline = obj["\n"];
|
||||
function test() {
|
||||
console.assert(carriage === "\r\n");
|
||||
console.assert(newline === "\n");
|
||||
console.assert(tab === "\t");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
obj: () => obj,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_obj = hmr.exports.obj, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_obj = exports.obj;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_obj as obj,
|
||||
$$hmr_test as test
|
||||
};
|
||||
34
integration/snapshots/string-escapes.js
Normal file
34
integration/snapshots/string-escapes.js
Normal file
@@ -0,0 +1,34 @@
|
||||
var tab = "\t";
|
||||
var シ = "wow";
|
||||
var f = "";
|
||||
var obj = {
|
||||
"\r\n": "\r\n",
|
||||
"\n": "\n",
|
||||
"\t": "\t",
|
||||
"\u2028": "\u2028",
|
||||
"\u2029": "\u2029",
|
||||
"😊": "😊",
|
||||
"😃": "😃",
|
||||
"㋡": "㋡",
|
||||
"☺": "☺",
|
||||
シ: "シ",
|
||||
f,
|
||||
"☹": "☹",
|
||||
"☻": "☻",
|
||||
children: 123
|
||||
};
|
||||
const foo = () => {
|
||||
};
|
||||
const Bar = foo("a", {
|
||||
children: 123
|
||||
});
|
||||
const carriage = obj["\r\n"];
|
||||
const newline = obj["\n"];
|
||||
|
||||
export {obj};
|
||||
export function test() {
|
||||
console.assert(carriage === "\r\n");
|
||||
console.assert(newline === "\n");
|
||||
console.assert(tab === "\t");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
3
integration/snapshots/ts-fallback-rewrite-works.debug.js
Normal file
3
integration/snapshots/ts-fallback-rewrite-works.debug.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
25
integration/snapshots/ts-fallback-rewrite-works.hmr.debug.js
Normal file
25
integration/snapshots/ts-fallback-rewrite-works.hmr.debug.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(421762902, "ts-fallback-rewrite-works.ts"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
function test() {
|
||||
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
|
||||
};
|
||||
25
integration/snapshots/ts-fallback-rewrite-works.hmr.js
Normal file
25
integration/snapshots/ts-fallback-rewrite-works.hmr.js
Normal file
@@ -0,0 +1,25 @@
|
||||
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(421762902, "ts-fallback-rewrite-works.ts"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
function test() {
|
||||
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
|
||||
};
|
||||
3
integration/snapshots/ts-fallback-rewrite-works.js
Normal file
3
integration/snapshots/ts-fallback-rewrite-works.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(2117426367, "tsx-fallback-rewrite-works.tsx"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
function test() {
|
||||
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
|
||||
};
|
||||
25
integration/snapshots/tsx-fallback-rewrite-works.hmr.js
Normal file
25
integration/snapshots/tsx-fallback-rewrite-works.hmr.js
Normal file
@@ -0,0 +1,25 @@
|
||||
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(2117426367, "tsx-fallback-rewrite-works.tsx"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
function test() {
|
||||
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
|
||||
};
|
||||
3
integration/snapshots/tsx-fallback-rewrite-works.js
Normal file
3
integration/snapshots/tsx-fallback-rewrite-works.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
7
integration/snapshots/type-only-imports.debug.ts
Normal file
7
integration/snapshots/type-only-imports.debug.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const baconator = true;
|
||||
export const SilentSymbolCollisionsAreOkayInTypeScript = true;
|
||||
export function test() {
|
||||
console.assert(SilentSymbolCollisionsAreOkayInTypeScript);
|
||||
console.assert(baconator);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
35
integration/snapshots/type-only-imports.hmr.debug.ts
Normal file
35
integration/snapshots/type-only-imports.hmr.debug.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(650094581, "type-only-imports.ts"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var baconator = true;
|
||||
var SilentSymbolCollisionsAreOkayInTypeScript = true;
|
||||
function test() {
|
||||
console.assert(SilentSymbolCollisionsAreOkayInTypeScript);
|
||||
console.assert(baconator);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
baconator: () => baconator,
|
||||
SilentSymbolCollisionsAreOkayInTypeScript: () => SilentSymbolCollisionsAreOkayInTypeScript,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_baconator = hmr.exports.baconator, $$hmr_SilentSymbolCollisionsAreOkayInTypeScript = hmr.exports.SilentSymbolCollisionsAreOkayInTypeScript, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_baconator = exports.baconator;
|
||||
$$hmr_SilentSymbolCollisionsAreOkayInTypeScript = exports.SilentSymbolCollisionsAreOkayInTypeScript;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_baconator as baconator,
|
||||
$$hmr_SilentSymbolCollisionsAreOkayInTypeScript as SilentSymbolCollisionsAreOkayInTypeScript,
|
||||
$$hmr_test as test
|
||||
};
|
||||
35
integration/snapshots/type-only-imports.hmr.ts
Normal file
35
integration/snapshots/type-only-imports.hmr.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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(650094581, "type-only-imports.ts"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var baconator = true;
|
||||
var SilentSymbolCollisionsAreOkayInTypeScript = true;
|
||||
function test() {
|
||||
console.assert(SilentSymbolCollisionsAreOkayInTypeScript);
|
||||
console.assert(baconator);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
baconator: () => baconator,
|
||||
SilentSymbolCollisionsAreOkayInTypeScript: () => SilentSymbolCollisionsAreOkayInTypeScript,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_baconator = hmr.exports.baconator, $$hmr_SilentSymbolCollisionsAreOkayInTypeScript = hmr.exports.SilentSymbolCollisionsAreOkayInTypeScript, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_baconator = exports.baconator;
|
||||
$$hmr_SilentSymbolCollisionsAreOkayInTypeScript = exports.SilentSymbolCollisionsAreOkayInTypeScript;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_baconator as baconator,
|
||||
$$hmr_SilentSymbolCollisionsAreOkayInTypeScript as SilentSymbolCollisionsAreOkayInTypeScript,
|
||||
$$hmr_test as test
|
||||
};
|
||||
7
integration/snapshots/type-only-imports.ts
Normal file
7
integration/snapshots/type-only-imports.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const baconator = true;
|
||||
export const SilentSymbolCollisionsAreOkayInTypeScript = true;
|
||||
export function test() {
|
||||
console.assert(SilentSymbolCollisionsAreOkayInTypeScript);
|
||||
console.assert(baconator);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
7
integration/snapshots/unicode-identifiers.debug.js
Normal file
7
integration/snapshots/unicode-identifiers.debug.js
Normal file
@@ -0,0 +1,7 @@
|
||||
var ε = 1.0e-06, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π;
|
||||
|
||||
export {d3_radians};
|
||||
export function test() {
|
||||
console.assert(ε === 1.0e-06);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
30
integration/snapshots/unicode-identifiers.hmr.debug.js
Normal file
30
integration/snapshots/unicode-identifiers.hmr.debug.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
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() {
|
||||
console.assert(ε === 1.0e-06);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
d3_radians: () => d3_radians,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_d3_radians = hmr.exports.d3_radians, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_d3_radians = exports.d3_radians;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_d3_radians as d3_radians,
|
||||
$$hmr_test as test
|
||||
};
|
||||
30
integration/snapshots/unicode-identifiers.hmr.js
Normal file
30
integration/snapshots/unicode-identifiers.hmr.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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(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() {
|
||||
console.assert(ε === 1.0e-06);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
d3_radians: () => d3_radians,
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_d3_radians = hmr.exports.d3_radians, $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_d3_radians = exports.d3_radians;
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_d3_radians as d3_radians,
|
||||
$$hmr_test as test
|
||||
};
|
||||
7
integration/snapshots/unicode-identifiers.js
Normal file
7
integration/snapshots/unicode-identifiers.js
Normal file
@@ -0,0 +1,7 @@
|
||||
var ε = 1.0e-06, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π;
|
||||
|
||||
export {d3_radians};
|
||||
export function test() {
|
||||
console.assert(ε === 1.0e-06);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
1
integration/snippets/_auth.js
Normal file
1
integration/snippets/_auth.js
Normal file
@@ -0,0 +1 @@
|
||||
export default "hi";
|
||||
1
integration/snippets/_bacon.js
Normal file
1
integration/snippets/_bacon.js
Normal file
@@ -0,0 +1 @@
|
||||
export let hello = true;
|
||||
3
integration/snippets/_login.js
Normal file
3
integration/snippets/_login.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function () {
|
||||
return true;
|
||||
}
|
||||
28
integration/snippets/array-args-with-default-values.js
Normal file
28
integration/snippets/array-args-with-default-values.js
Normal file
@@ -0,0 +1,28 @@
|
||||
var lines;
|
||||
const data = () =>
|
||||
lines.map(([a = null, b = null, c = null, d = null]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
}));
|
||||
|
||||
export function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
];
|
||||
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
7
integration/snippets/bundled-entry-point.js
Normal file
7
integration/snippets/bundled-entry-point.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import "react";
|
||||
|
||||
var hello = 123 ? null ?? "world" : "ok";
|
||||
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import _login from "./_login";
|
||||
import _auth from "./_auth";
|
||||
import * as _loginReally from "./_login";
|
||||
import * as _loginReally2 from "./_login";
|
||||
import * as _authReally from "./_auth";
|
||||
|
||||
module.exports.iAmCommonJs = true;
|
||||
exports.YouAreCommonJS = true;
|
||||
require("./_login");
|
||||
require("./_login");
|
||||
export { _login as login };
|
||||
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
|
||||
export let foo, bar;
|
||||
56
integration/snippets/code-simplification-neql-define.js
Normal file
56
integration/snippets/code-simplification-neql-define.js
Normal file
@@ -0,0 +1,56 @@
|
||||
var testFailed = false;
|
||||
const invariant = () => {
|
||||
testFailed = true;
|
||||
};
|
||||
var $$m = (arg) => {
|
||||
var module = { exports: {} },
|
||||
exports = module.exports;
|
||||
return arg(module, exports);
|
||||
};
|
||||
var size = 100,
|
||||
ttl = 3600;
|
||||
|
||||
export var $f332019d = $$m(
|
||||
{
|
||||
"relay-runtime/lib/network/RelayQueryResponseCache.js": (
|
||||
module,
|
||||
exports
|
||||
) => {
|
||||
var RelayQueryResponseCache = function () {
|
||||
var foo = function RelayQueryResponseCache(_ref) {
|
||||
var size = _ref.size,
|
||||
ttl = _ref.ttl;
|
||||
!(size > 0)
|
||||
? process.env.NODE_ENV !== "production"
|
||||
? invariant(
|
||||
false,
|
||||
"RelayQueryResponseCache: Expected the max cache size to be > 0, got " +
|
||||
"`%s`.",
|
||||
size
|
||||
)
|
||||
: invariant(false)
|
||||
: void 0;
|
||||
!(ttl > 0)
|
||||
? process.env.NODE_ENV !== "production"
|
||||
? invariant(
|
||||
false,
|
||||
"RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.",
|
||||
ttl
|
||||
)
|
||||
: invariant(false)
|
||||
: void 0;
|
||||
};
|
||||
foo({ size: 100, ttl: 3600 });
|
||||
};
|
||||
RelayQueryResponseCache();
|
||||
},
|
||||
}["relay-runtime/lib/network/RelayQueryResponseCache.js"]
|
||||
);
|
||||
|
||||
export function test() {
|
||||
var foo = () => result;
|
||||
// $f332019d;
|
||||
|
||||
if (testFailed) throw new Error("invariant should not be called");
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
29
integration/snippets/export.js
Normal file
29
integration/snippets/export.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import what from "./_auth";
|
||||
export { default as auth } from "./_auth";
|
||||
export { default as login } from "./_login";
|
||||
export * from "./_bacon";
|
||||
export let yoyoyo = "yoyoyo";
|
||||
export default function hey() {
|
||||
return true;
|
||||
}
|
||||
export const foo = () => {};
|
||||
export var bar = 100;
|
||||
export let powerLevel = Symbol("9001");
|
||||
export { what };
|
||||
export { what as when, what as whence };
|
||||
export {} from "./_bacon";
|
||||
export * as where from "./_auth";
|
||||
export { bar as booop };
|
||||
|
||||
export function test() {
|
||||
hey();
|
||||
foo();
|
||||
if (where.default !== "hi") {
|
||||
throw new Error(`_auth import is incorrect.`);
|
||||
}
|
||||
console.assert(
|
||||
powerLevel.description === "9001",
|
||||
"Symbol is not exported correctly"
|
||||
);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
10
integration/snippets/forbid-in-is-correct.js
Normal file
10
integration/snippets/forbid-in-is-correct.js
Normal file
@@ -0,0 +1,10 @@
|
||||
var foo = () => {
|
||||
// prettier-ignore
|
||||
var D=(i,r)=>()=>(r||i((r={exports:{}}).exports,r),r.exports);
|
||||
return D;
|
||||
};
|
||||
|
||||
export function test() {
|
||||
foo();
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
4
integration/snippets/global-is-remapped-to-globalThis.js
Normal file
4
integration/snippets/global-is-remapped-to-globalThis.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export function test() {
|
||||
console.assert(global === globalThis);
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
24
integration/snippets/lodash-regexp.js
Normal file
24
integration/snippets/lodash-regexp.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { shuffle } from "lodash";
|
||||
|
||||
// Lodash uses a variety of uncommon syntax (such as unicode escapes in regexp)
|
||||
// so running it is a broad test of the parser, lexer, and printer
|
||||
export function test() {
|
||||
const foo = [1, 2, 3, 4, 6];
|
||||
const bar = shuffle(foo);
|
||||
console.assert(bar !== foo);
|
||||
console.assert(bar.length === foo.length);
|
||||
bar.sort();
|
||||
foo.sort();
|
||||
for (let i = 0; i < bar.length; i++) {
|
||||
console.assert(bar[i] === foo[i], "expected " + i + " to be " + foo[i]);
|
||||
console.assert(typeof bar[i] === "number");
|
||||
console.assert(typeof foo[i] === "number");
|
||||
}
|
||||
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
|
||||
// export function test() {
|
||||
// const regexp = RegExp("['\u2019]", "g");
|
||||
// return testDone(import.meta.url);
|
||||
// }
|
||||
13
integration/snippets/multiple-imports.js
Normal file
13
integration/snippets/multiple-imports.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from "react";
|
||||
import React2 from "react";
|
||||
|
||||
const bacon = React;
|
||||
const bacon2 = <>hello</>;
|
||||
|
||||
export function test() {
|
||||
console.assert(bacon === React);
|
||||
console.assert(bacon === React2);
|
||||
console.assert(typeof bacon2 !== "undefined");
|
||||
console.assert(React.isValidElement(bacon2));
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export const target = "browser";
|
||||
@@ -0,0 +1 @@
|
||||
export const target = 'browser';
|
||||
@@ -0,0 +1 @@
|
||||
export const target = 'browser';
|
||||
@@ -0,0 +1 @@
|
||||
export const target = 'browser';
|
||||
@@ -0,0 +1 @@
|
||||
export const target = "default";
|
||||
@@ -0,0 +1 @@
|
||||
export const target = "default";
|
||||
@@ -0,0 +1 @@
|
||||
export const target = 'default';
|
||||
@@ -0,0 +1 @@
|
||||
export const target = "default";
|
||||
@@ -0,0 +1 @@
|
||||
export const target = "node";
|
||||
@@ -0,0 +1 @@
|
||||
export const target = "node";
|
||||
@@ -0,0 +1 @@
|
||||
export const target = 'node';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user