Compare commits

...

557 Commits

Author SHA1 Message Date
Jarred Sumner
940570af59 skeleton code 2021-09-24 16:41:45 -07:00
Jarred Sumner
bdfb5a91b1 macro 2021-09-24 15:33:02 -07:00
Jarred Sumner
29b986684d 🍧 2021-09-24 15:28:30 -07:00
Jarred Sumner
e48a0877ef @setCold 2021-09-24 15:26:55 -07:00
Jarred Sumner
22837d69b7 Remove cache_files since it's not used and causes slower Bun compilation times 2021-09-24 15:23:55 -07:00
Jarred Sumner
af306b523b Update README.md 2021-09-24 14:49:17 -07:00
Jarred Sumner
ba20fd7566 Update README.md 2021-09-24 14:28:12 -07:00
Jarred Sumner
6d1330d601 Update README.md 2021-09-24 14:26:54 -07:00
Jarred Sumner
f3be0c79c2 Update README.md 2021-09-24 14:26:05 -07:00
Jarred Sumner
10c01af692 Update README.md 2021-09-23 23:28:45 -07:00
Jarred Sumner
a68a1983cf Update README.md 2021-09-23 23:28:25 -07:00
Jarred Sumner
90a647fb72 Update README.md 2021-09-23 23:22:41 -07:00
Jarred Sumner
3cbf209d5b clarify 2021-09-23 23:18:38 -07:00
Jarred Sumner
bee45c4fdc add the other tests 2021-09-23 22:54:38 -07:00
Jarred Sumner
61202cb464 Update README.md 2021-09-23 22:46:43 -07:00
Jarred Sumner
0091944161 Elaborate on bun bun a little 2021-09-23 22:43:20 -07:00
Jarred Sumner
78cd857bf6 Add link to webpack doc 2021-09-23 22:09:41 -07:00
Jarred Sumner
4fe1b4df1c Bump version 2021-09-23 22:02:13 -07:00
Jarred Sumner
2a1235c9db 🏃 2021-09-23 22:01:43 -07:00
Jarred Sumner
4bb41b95a8 📷 2021-09-23 22:01:34 -07:00
Jarred Sumner
f78f4854a4 Handle more edgecases in our CJS2ESM conversion code 2021-09-23 21:45:15 -07:00
Jarred Sumner
ff01dfa03d When bundling JSON, only use JSON.parse when the input is ASCII.
We don't want to add an extra pass over the input to convert it to UTF16. And JS engines storing strings as UTF-16 is more expensive anyway, so the runtime win here probably isn't as big (though open to evidence to the contrary!)
2021-09-23 21:43:37 -07:00
Jarred Sumner
638b204d1e Add __exportValue and __exportDefault to runtime 2021-09-23 19:20:33 -07:00
Jarred Sumner
58e88c4aed When bundling, parse the JSON to verify correctness, but print it as a string for better runtime performance 2021-09-23 19:20:07 -07:00
Jarred Sumner
8433919342 Safer export default transform for bundled code 2021-09-23 19:19:32 -07:00
Jarred Sumner
8150b9aeba Fix crash when loading JS fails really quickly 2021-09-23 17:40:25 -07:00
Jarred Sumner
01601fc8a7 Globally define require() so that UMD modules which check for the existence of require() to determine if it's CommonJS use the CommonJS code path instead of the globalThis code path 2021-09-23 17:36:49 -07:00
Jarred Sumner
7b24042d5f Embed regeneratorRuntime so that things which expect it to be a global still work 2021-09-23 17:36:04 -07:00
Jarred Sumner
2177dda242 Fix bug when multiple-levels of nested exports when bundled have a boolean .default value 2021-09-23 17:34:54 -07:00
Jarred Sumner
0585c86390 Support alwaysBundle for workspace packages 2021-09-23 17:33:20 -07:00
Jarred Sumner
528caab47c Add a pointer to the parent package_json for a directory. This reduces pointer chasing 2021-09-23 17:33:01 -07:00
Jarred Sumner
b150df34e0 Fix another simplification bug 2021-09-23 17:32:39 -07:00
Jarred Sumner
da80c3b309 Fix a simplification bug 2021-09-23 17:32:29 -07:00
Jarred Sumner
e8804bd80f Use the package_json hash for matching bundled modules instead of searching strings (should improve perf a little) 2021-09-23 17:31:59 -07:00
Jarred Sumner
2300886008 Symlinks work 2021-09-23 13:29:51 -07:00
Jarred Sumner
57ed3c89a2 Add "bun": { "alwaysBundle": ["packageName"] }, to package.json
This is for monorepos that symlink directories into node_modules. For example, if you have a design system in your monorepo, you probably want to always bundle that.
2021-09-23 00:17:06 -07:00
Jarred Sumner
1a284a1c94 Extremely minor perf improvements 2021-09-22 18:12:18 -07:00
Jarred Sumner
f12dd51c00 Update query_string_map.zig 2021-09-22 16:19:25 -07:00
Jarred Sumner
e00c1e99d6 Allow URLs containing absolute filepaths in imports if they match specific file extensions
This is to support ../../ imports

Allowlisting to specific file extensions prevents common webserver security vulnerabilities like reading /etc/passwd
2021-09-22 16:19:16 -07:00
Jarred Sumner
39323b46ba Fix edgecase with whether to wrap arrow expressions in parentheses when printing 2021-09-22 16:13:44 -07:00
Jarred Sumner
9dff80aeee Fix edgecase with bare imports inside .bun 2021-09-22 16:13:14 -07:00
Jarred Sumner
9f7d05bab4 Print how many lines of code was parsed in bun bun 2021-09-22 04:08:40 -07:00
Jarred Sumner
53c0a4b568 Add disabled status to ESM resolution 2021-09-22 02:17:13 -07:00
Jarred Sumner
8f460a9be3 Fix parsing bug with arrays that have default values 2021-09-22 02:16:31 -07:00
Jarred Sumner
204b07f46b package json exports seems to work now!!! 2021-09-22 01:03:06 -07:00
Jarred Sumner
a48a02bade Switch to a single directory for storing snapshots and explicitly note whats a debug snapshot and a non-debug snapshot 2021-09-22 01:02:32 -07:00
Jarred Sumner
2326a1e105 Fix the compiler errors 2021-09-21 23:28:05 -07:00
Jarred Sumner
c4dc6d9bff Resolve "exports" field in package.json (doesn't work yet) 2021-09-21 22:52:40 -07:00
Jarred Sumner
6213a73e6f Add "exports" to PackageJSON 2021-09-21 21:53:38 -07:00
Jarred Sumner
9c109b744f Most of the ESM resolution algorithm (still untested) 2021-09-21 21:49:32 -07:00
Jarred Sumner
42c1d54b3f endsWithAny -> endsWithAnyComptime 2021-09-21 18:07:23 -07:00
Jarred Sumner
5e634cd612 Parse "exports" field from package.json (WIP) 2021-09-21 18:05:42 -07:00
Jarred Sumner
79c7fe0f7a [Bun.js] Add Bun.readFileBytes() to get a Uint8Array of the file's contents without copying. 2021-09-21 15:39:52 -07:00
Jarred Sumner
8e86d2cf1d Add comment explaining failed package.json parsing optimization 2021-09-21 14:40:19 -07:00
Jarred Sumner
4e12a4c013 [Bun.js] Add support for console.time, console.timeEnd 2021-09-21 00:58:55 -07:00
Jarred Sumner
e869cdca9f Slightly improve .env loader string inference 2021-09-20 22:37:39 -07:00
Jarred Sumner
ab565f1a3c Fix parsing/printing unicode identifiers, switch to UTF-8 for prefilled strings, remove eagerly loading identifier_name 2021-09-20 22:37:22 -07:00
Jarred Sumner
90cd3bf4cb Fix how error lines with strings are highlighted 2021-09-20 18:04:45 -07:00
Jarred Sumner
9752ee8819 Always log errors when generating node_modules.server.bun 2021-09-20 17:40:09 -07:00
Jarred Sumner
9f1e0660dd Fix handling when file metadata store stored exceeds statically allocated count (at time of writing, 16k) 2021-09-20 17:39:39 -07:00
Jarred Sumner
7c05bb7d1d Merge pull request #27 from DAlperin/main 2021-09-17 20:33:48 -07:00
Dov Alperin
bb0faacf06 All deps now build on linux
Move CC and CXX into variables
Fix some capitalization
+A few other portability improvements
2021-09-17 23:21:06 -04:00
Jarred Sumner
9ae35ec581 Slightly improve JSX decoding perf 2021-09-17 18:37:26 -07:00
Jarred Sumner
b1ca1eb228 Package.json 2021-09-17 17:42:01 -07:00
Jarred Sumner
832502555c Bump 2021-09-17 17:40:54 -07:00
Jarred Sumner
1176a07c93 Fix whitespace & emoji bug when parsing JSX 2021-09-17 17:40:30 -07:00
Jarred Sumner
3770102843 Snapshots 2021-09-17 16:22:53 -07:00
Jarred Sumner
cf7c80d42d package.json 2021-09-17 16:22:43 -07:00
Jarred Sumner
84632571c7 Add test for "shuffle" function for lodash 2021-09-17 16:10:43 -07:00
Jarred Sumner
af1061e47a Update js_printer.zig 2021-09-17 16:09:59 -07:00
Jarred Sumner
e1ce0e8467 Fix lexer bug with UTF-16 strings 2021-09-17 16:09:26 -07:00
Jarred Sumner
468c475359 Add test for tsx/ts fallback imports 2021-09-17 15:15:43 -07:00
Jarred Sumner
8902a19bb4 Update package.json 2021-09-17 15:10:02 -07:00
Jarred Sumner
f4e72be58f Update launch.json 2021-09-17 15:09:59 -07:00
Jarred Sumner
c20b5414c4 Fix test makefile 2021-09-17 15:01:28 -07:00
Jarred Sumner
1a0438b3b1 Update cjs-transform-shouldnt-have-static-imports-in-cjs-function.js 2021-09-17 14:54:42 -07:00
Jarred Sumner
da2f85ba4b Exclude snapshots from search 2021-09-17 14:50:21 -07:00
Jarred Sumner
bc65e40313 Fix multiple imports to CJS modules when referencing via module_id hash 2021-09-17 14:47:14 -07:00
Jarred Sumner
a188c7d791 Bump build ID 2021-09-17 14:28:47 -07:00
Jarred Sumner
f2cccdd1fb Merge branch 'main' of github.com:Jarred-Sumner/bun 2021-09-17 14:27:55 -07:00
Jarred Sumner
6621de709e Commit previosu bump 2021-09-17 14:25:28 -07:00
Jarred Sumner
98e9b93b7e global -> globalThis 2021-09-17 14:24:42 -07:00
Jarred Sumner
3aef65597b Merge pull request #26 from DAlperin/main
Get bun ready for linux builds
2021-09-17 05:47:33 -07:00
Dov Alperin
c98e007ff7 Get bun ready for linux builds
Adds: conditional builds in makefile
Fixes: incorrect imports of 'JavaScriptCore.zig' (note the caps 's')
replaces with correct import of 'JavascriptCore.zig'
2021-09-17 08:43:15 -04:00
Jarred Sumner
3350e63004 Add puppeteer to package.json 2021-09-17 03:14:56 -07:00
Jarred Sumner
d71b37e292 Little more clarify readme 2021-09-17 03:14:40 -07:00
Jarred Sumner
1c7485e58c Begin to add integration tests 2021-09-17 03:14:23 -07:00
Jarred Sumner
872428de89 Fix bugs with ESM -> CJS when not bundled 2021-09-17 03:14:05 -07:00
Jarred Sumner
93441babd8 Do not attempt to HMR export {value} from, just assume it will be HMR'd (or not) 2021-09-16 22:37:11 -07:00
Jarred Sumner
1328285bbc Update options.zig 2021-09-16 20:35:08 -07:00
Jarred Sumner
9912a4ce98 Fix export * as from 2021-09-16 20:34:48 -07:00
Jarred Sumner
d5186ee663 Add flag to dev server to disable HMR 2021-09-16 20:34:22 -07:00
Jarred Sumner
9e2910365a Help output should print command names 2021-09-16 19:08:02 -07:00
Jarred Sumner
3be2571a31 Fix symbol name for cjs2esm 2021-09-16 18:46:27 -07:00
Jarred Sumner
6352e95d0f When port is in use, auto-increment port number up to 10 times and then bail if all 10 are in use 2021-09-16 18:27:54 -07:00
Jarred Sumner
b6a72f7d72 Always bold ^ 2021-09-16 17:49:17 -07:00
Jarred Sumner
b923134023 Delete some dead code 2021-09-16 17:38:05 -07:00
Jarred Sumner
6e82fa0dab Print absolute paths in log errors so that ctrl+click to open file in editor works (depending on terminal) 2021-09-16 17:37:52 -07:00
Jarred Sumner
9511bf94d5 Colorize build/resolve errors and add a ^ 2021-09-16 17:37:22 -07:00
Jarred Sumner
03983ac24e Commit build id 2021-09-16 03:31:29 -07:00
Jarred Sumner
347dbc6237 Automatically rewrite TS import paths from .jsx? -> .tsx? when .jsx? is not found
This was already partially implemented but it was returning filenames instead of absolute paths. This matches the behavior from https://github.com/microsoft/TypeScript/issues/4595.
2021-09-16 03:24:27 -07:00
Jarred Sumner
b2a6f3f81c write the version 2021-09-15 23:42:47 -07:00
Jarred Sumner
5a89f30841 Switch to 0.0.x instead of 0.0.0-x to fix the npm install issue 2021-09-15 23:34:17 -07:00
Jarred Sumner
244585b82a Bump versions 2021-09-15 21:42:24 -07:00
Jarred Sumner
bc727e8d79 Bump 2021-09-15 21:30:32 -07:00
Jarred Sumner
472589aa14 Fix require bug in runtime.js 2021-09-15 21:30:12 -07:00
Jarred Sumner
ba9825eca9 Fix CJS symbol names 2021-09-15 21:29:49 -07:00
Jarred Sumner
f4d1a3c33d Remove most usages of anytype in js_ast.zig 2021-09-15 21:29:20 -07:00
Jarred Sumner
be05f65339 Fix crash in bun bun 2021-09-15 21:28:06 -07:00
Jarred Sumner
dcabe86ea8 woops 2021-09-15 19:00:41 -07:00
Jarred Sumner
2a98c323c1 Bump 2021-09-15 18:53:06 -07:00
Jarred Sumner
be5ed44580 Add aarch64 2021-09-15 18:40:00 -07:00
Jarred Sumner
93010b71b4 delete dead code 2021-09-15 18:11:56 -07:00
Jarred Sumner
62d9a18ec6 zig fmt 2021-09-15 18:11:51 -07:00
Jarred Sumner
b0bb65f494 Big Heap: 2021-09-15 18:07:08 -07:00
Jarred Sumner
09ab634d32 Fix Bun on M1. 2021-09-15 17:06:49 -07:00
Jarred Sumner
bba102c076 Warn when JIT is disabled 2021-09-15 17:04:00 -07:00
Jarred Sumner
9719ae096d Fix build-generated typo 2021-09-14 23:07:55 -07:00
Jarred Sumner
0854188f3c fix 2021-09-14 23:02:48 -07:00
Jarred Sumner
0cfcb96e5c typo 2 2021-09-14 23:01:47 -07:00
Jarred Sumner
39bbb7b9cd typo 2021-09-14 23:01:34 -07:00
Jarred Sumner
e3d828648e fix it better 2021-09-14 22:58:14 -07:00
Jarred Sumner
ed8f381b5c fix debug bin path 2021-09-14 22:57:19 -07:00
Jarred Sumner
516369d748 commit webkit update 2021-09-14 20:34:46 -07:00
Jarred Sumner
dff9fd8ae1 Tweak readme 2021-09-14 18:13:05 -07:00
Jarred Sumner
3f3dc56da5 Tweak readme 2021-09-14 18:03:24 -07:00
Jarred Sumner
5dbbad5cc4 Support installing bun from npm 2021-09-14 16:59:21 -07:00
Jarred Sumner
24522f7d74 Include build id in welcome note 2021-09-14 13:23:51 -07:00
Jarred Sumner
4173b03f54 Include a build id 2021-09-14 02:21:40 -07:00
Jarred Sumner
bdd5502aef SPAs now work by default when there's a public/index.html file 2021-09-14 01:28:04 -07:00
Jarred Sumner
2f301e39d7 Handle edgecase during SyntaxError that can lead to an out of bounds index access when printing source code 2021-09-14 01:24:37 -07:00
Jarred Sumner
c75ae828bc FIx missing page assets with next.js 2021-09-13 22:30:16 -07:00
Jarred Sumner
b0598f64ea Fix crashes when accessing request metadata 2021-09-13 22:29:44 -07:00
Jarred Sumner
8721ba7474 v0.0.0-21 2021-09-13 22:28:16 -07:00
Jarred Sumner
d7a5b60405 v0.0.0-20 2021-09-13 21:47:44 -07:00
Jarred Sumner
4f0d4cee0b Feature flag auto_import_buffer since it's not fully implemented yet 2021-09-13 20:56:22 -07:00
Jarred Sumner
a0b6892c09 Good enough for now solution to symbol collision 2021-09-13 02:53:18 -07:00
Jarred Sumner
359df89fe3 Fix "browser" map resolution, _almost_ fix symbol collisions, cache absolute paths for file entries 2021-09-12 23:40:12 -07:00
Jarred Sumner
dca47a565e ok 2021-09-12 01:53:32 -07:00
Jarred Sumner
19922287aa Fix panic handler to not double panic 2021-09-12 00:40:27 -07:00
Jarred Sumner
5944c91de4 Support importing Node.js fallback modules as ESM 2021-09-12 00:40:17 -07:00
Jarred Sumner
350569655b Support bundling dynamically imported modules. 2021-09-12 00:39:57 -07:00
Jarred Sumner
092f9ac766 Fix CommonJS interop issue when, while linking, we find out the import is possibly CommonJS 2021-09-12 00:39:01 -07:00
Jarred Sumner
dfb65ef1ca Reduce number of allocations for serializing error messages 2021-09-12 00:37:59 -07:00
Jarred Sumner
57ca04444b Fix symbol collisions for JSX & React Refresh. Choose a JSX identifier based on the user's JSX import source 2021-09-12 00:37:13 -07:00
Jarred Sumner
125d88bd65 bun:error.js into separate module, ensure we don't include fast refresh in Bun.js, log build errors to browser console, don't warn for node_modules, 2021-09-11 01:48:23 -07:00
Jarred Sumner
6f2554b13a Tweaks 2021-09-10 13:41:24 -07:00
Jarred Sumner
b66ef23167 yay 2021-09-10 03:32:21 -07:00
Jarred Sumner
812f641ee3 fix 2021-09-10 02:39:50 -07:00
Jarred Sumner
4bd9cccbc9 filepath 2021-09-10 02:34:12 -07:00
Jarred Sumner
2ebe9ad101 v0.0.0-19 2021-09-09 23:34:08 -07:00
Jarred Sumner
fc907e2f81 current 2021-09-09 23:33:34 -07:00
Jarred Sumner
8a02ad48a5 fetc h!!! 2021-09-09 05:40:07 -07:00
Jarred Sumner
c30ec608b1 upgrade 2021-09-08 16:57:10 -07:00
Jarred Sumner
d18e73aa57 Fixes for AARCH64: 2021-09-08 01:03:08 -07:00
Jarred Sumner
292668ed43 up 2021-09-07 22:09:47 -07:00
Jarred Sumner
2a6edf00cd lotta changes 2021-09-07 22:08:18 -07:00
Jarred Sumner
cbd2c56a1f Initial
Former-commit-id: 780ec8b1a7ce2f06ccb1dc01a4df84bf866803e8
2021-09-07 20:39:37 -07:00
Jarred Sumner
83c54db836 more words
Former-commit-id: 7ad294cded991218c79f9036ba9a632a87d05634 [formerly 78058ac327ae266296588613d97391aa470f49a6]
Former-commit-id: 7eb9207a6e9c3667439228b760945f8f2f6049d9
2021-09-07 14:50:52 -07:00
Jarred Sumner
abf5f873b6 more readme
Former-commit-id: f38ce524a75c9b0781d3fcf9ae4f5f8da888395f
2021-09-07 14:41:31 -07:00
Jarred Sumner
1d1a70c21f WIP error css
Former-commit-id: 36f03bf491cf274f68361e334a706538464ee271
2021-09-07 03:21:58 -07:00
Jarred Sumner
d59e7b27b0 expose top level dir
Former-commit-id: 00c222c35a4460b21e095acc35a470fbb4778b19
2021-09-06 03:37:37 -07:00
Jarred Sumner
0108695438 Always store the list of stylesheets
Former-commit-id: 867ebf04348439c48037e4944fef6d48a33555bd
2021-09-06 03:37:17 -07:00
Jarred Sumner
34b55c3350 Fix crashy bug
Former-commit-id: 76162477e0c315599b375dd2aba0acdc58864b59
2021-09-06 03:36:59 -07:00
Jarred Sumner
2fc89a69e3 Move
Former-commit-id: b795168d774fa0b3dcde7955e30baa0eefbc88ab
2021-09-05 21:44:43 -07:00
Jarred Sumner
cb70d08573 current
Former-commit-id: 8517ba72e79b75bf016c3fa66deb85fab9ff6554
2021-09-05 21:43:25 -07:00
Jarred Sumner
cd69063660 Update README.md
Former-commit-id: 74973a4535244c65269247334b59ae6d7d3598ea
2021-09-05 19:41:08 -07:00
Jarred Sumner
0822e67594 such entitle
Former-commit-id: de26ae30116e3c13c48a710201a7da0817ffd9e5
2021-09-05 19:40:59 -07:00
Jarred Sumner
7e79d9dae6 Update WebKit
Former-commit-id: db455d9f78cfe3526f79a94ef28d9680f8a21a69
2021-09-05 17:21:44 -07:00
Jarred Sumner
bb84a8cc6c prefix
Former-commit-id: 92ed909e1eb98542d61b7f04c1ab02c22ab20b37
2021-09-05 16:51:12 -07:00
Jarred Sumner
2c429f7732 guess
Former-commit-id: 6e95bd8a1457d3c514adb0af6ae0c5feb1564a80
2021-09-05 16:48:26 -07:00
Jarred Sumner
4f966f30a5 Fix sizegen
Former-commit-id: f8e8a357c00ceb2d71e216af21daf56f7ba27a1b
2021-09-05 16:21:53 -07:00
Jarred Sumner
ac123f2371 create-react-app
Former-commit-id: 33647ef65cbac1c89c16a8b81dfa7de0fad5af3e
2021-09-05 15:34:35 -07:00
Jarred Sumner
48dadc17f6 Makefile
Former-commit-id: fdda2024afeaab244a19ab31380a1c4739c67f4c
2021-09-05 15:21:06 -07:00
Jarred Sumner
fb4feea8c3 aarch64 build.zig
Former-commit-id: 701ec4668e8f8276c207d92487633857d2db5ead
2021-09-05 15:18:13 -07:00
Jarred Sumner
4749669e74 Makefile
Former-commit-id: 7815afe6a5a250b14dff1a769fd4c30066fcb466
2021-09-05 14:33:29 -07:00
Jarred Sumner
6f2749d13d Update WebKit
Former-commit-id: 2d155ba16395ac01c08daddcbe1e861eaddacda7
2021-09-05 14:27:48 -07:00
Jarred Sumner
e43d3e995f package.json
Former-commit-id: 2299f44cc9092dad2ef48ea54af2555c192a723e
2021-09-05 14:27:00 -07:00
Jarred Sumner
c20df72d73 more mutexes
Former-commit-id: 52966012b4b74d24ab28a0c75740aef35fb75327
2021-09-05 02:05:45 -07:00
Jarred Sumner
b8941666b4 v0.0.0-18
Former-commit-id: 597600521199046bc81d311f9bd29983331d9dac
2021-09-04 18:34:03 -07:00
Jarred Sumner
4f7ff6db2c Fixed memory leaks, but SSR is slower. Should move cleanup & restart steps to a real idle timeout
Former-commit-id: 9499ee3109cb336deb9380f0190631a30c9da51c
2021-09-04 04:50:47 -07:00
Jarred Sumner
0045fc36d6 Update README.md
Former-commit-id: a46d0259e6024b2321e25c055b11fece207936f7
2021-09-03 13:40:47 -07:00
Jarred Sumner
44ae01dded Update README.md
Former-commit-id: 4511f00ba592e99bafdc74aaea08b247183c135d
2021-09-03 13:23:06 -07:00
Jarred Sumner
e48b5945c3 Update README.md
Former-commit-id: d36fba6fe02efdea602e70a2552eeb3e20cf58ae
2021-09-03 13:21:12 -07:00
Jarred Sumner
194b60191d Update README.md
Former-commit-id: 3e5e26fccb7a2127f4bf396494e99d33f965840d
2021-09-03 13:20:27 -07:00
Jarred Sumner
172aede346 release make
Former-commit-id: 0828b39f9961e68d2705610cbd866ad33aa2d656
2021-09-03 13:19:46 -07:00
Jarred Sumner
b85cfa52d0 loggers gonna log
Former-commit-id: cbf0b6750fbee21df6a78231e7050307c9af1d96
2021-09-03 13:19:36 -07:00
Jarred Sumner
a90760b597 Fix logging in bun bun + bump
Former-commit-id: 19275a07342879d9b02b9d9527b762c8bfadb9e6
2021-09-03 13:01:36 -07:00
Jarred Sumner
3fc0c899c9 endsWith("") should return true
Former-commit-id: fdbb66abc4e539ef960a72588495cd9964eff68b
2021-09-02 19:26:07 -07:00
Jarred Sumner
2e58176ac7 Ensure we log the file path when reading a file fails
Former-commit-id: 90f53eafb983bccd662c0329f031cef405bc80b0
2021-09-02 19:25:54 -07:00
Jarred Sumner
54a7c4290a More defensive file handle reuse
Former-commit-id: 5bb38e0bc75a600d9c1b744990d9e4a1b66edf42
2021-09-02 19:25:32 -07:00
Jarred Sumner
4debcdcbbb Fix tsconfig paths
Former-commit-id: 1ea6a0d624b0fc42acda9a81f214d06336b9271e
2021-09-02 19:24:51 -07:00
Jarred Sumner
f23d7c5259 Fix bug with spread properties in function arguments
Former-commit-id: 661fa35a8a0fbd9277682f6bd31cdf85c29481af
2021-09-02 19:24:35 -07:00
Jarred Sumner
d009e02c1d latest
Former-commit-id: 1086d4f894611c1171f57d9eaf82f9170e9de2d1
2021-09-02 15:54:07 -07:00
Jarred Sumner
1b894ad9f6 v0.0.0-17
Former-commit-id: 5b7e7714457dccd07091504e8b7244ba7600cd71
2021-09-02 11:58:41 -07:00
Jarred Sumner
336aa0d9a5 Commit latest bun-frmaework-next changes
Former-commit-id: ac2100b990eca4288201b070d0ba972484e57556
2021-09-02 11:54:38 -07:00
Jarred Sumner
c015c0c0cd Add warning when @tailwind, improve not found error for .css files
Former-commit-id: 0b776fb7f19dde86ea53968412c6eeaf9bae556f
2021-09-02 11:53:28 -07:00
Jarred Sumner
2fa09f7c09 Fix UMD, fix PNPM, importing require'd modules in app code
Former-commit-id: 3d831ad95904d2123964f2ebccff48f1e9f954e9
2021-09-02 11:51:52 -07:00
Jarred Sumner
47c660f2e1 v0.0.0-16
Former-commit-id: 7c92af994d5de52ef758ac1747c8e3d65eb39658
2021-09-02 01:04:03 -07:00
Jarred Sumner
4b7917ba8f latest
Former-commit-id: 20b96180ffc41610dfb21a041d1258f2ff8d4196
2021-09-01 14:00:46 -07:00
Jarred Sumner
e2b9f23231 Add display name field to frameworks, improve logging, add counters, add
Former-commit-id: b2cf011b6c6405a786fe22367e1cd4e6c2c4c90f
2021-08-31 23:07:03 -07:00
Jarred Sumner
78e1144ca5 Fix JSX fragments bug, fix unnamed export default bug
Former-commit-id: a48965cb80b713f72a859cd16c2a1b670c75d731
2021-08-31 21:38:05 -07:00
Jarred Sumner
212182f745 v0.0.0-15
Former-commit-id: 0741d36654eb5f94527cba22897d9849458e40a1
2021-08-31 19:43:19 -07:00
Jarred Sumner
00c5e07b56 v0.0.0-14
Former-commit-id: 0fa9174e701e4afbfba6ec18edda25578442a7c2
2021-08-31 15:05:18 -07:00
Jarred Sumner
6a5f34a6bc Fallback, fragments, printer compat, better errors
Former-commit-id: 486e8c9d460eeebea024e96dbabcb7f2bfaffafb
2021-08-31 15:03:40 -07:00
Jarred Sumner
bd9f137b1b latest
Former-commit-id: 096ec1222ad723d006b0151f10cb0c1b95e2bfd3
2021-08-29 21:48:14 -07:00
Jarred Sumner
34792c15f1 Single-threaded mode
Former-commit-id: 8f49faa68bf1357bdf5f0574036fb17216c4edcd
2021-08-29 21:46:15 -07:00
Jarred Sumner
69b101adcf Blob
Former-commit-id: 2174c6b769676c50686bb23a5ecca26a1d6eb1bc
2021-08-29 21:45:53 -07:00
Jarred Sumner
bd0f74a6fd v0.0.0-13
Former-commit-id: ccae6da4ab28ea9497134f1fac3e1d8e4e28df5c
2021-08-28 21:10:21 -07:00
Jarred Sumner
61ff6b8e49 v0.0.0-12
Former-commit-id: 3264fe15270286b26b700eb2a2b7f5edc91628d9
2021-08-28 21:04:58 -07:00
Jarred Sumner
65ea600b55 Fix unused imports
Former-commit-id: 7cbafbc9bddb77f8a1e65b084ff5942ed7ef1133
2021-08-27 18:20:02 -07:00
Jarred Sumner
c8f2def7c4 Fix missing RefreshRuntime import
Former-commit-id: 3b27a2cb502325f8c9ef0ae95f6bfaf5d4c9accd
2021-08-27 18:19:22 -07:00
Jarred Sumner
eba7b8b51e Always import runtime before JSX
Former-commit-id: efe0fb5edf07efa7f04ec379c2d319875b53ed87
2021-08-27 18:19:01 -07:00
Jarred Sumner
f53c4a0716 statusTExt
Former-commit-id: 52de5c6b9a3e8b030dcc2baf3fb372a50a7da99f
2021-08-27 18:17:05 -07:00
Jarred Sumner
4e3dd3aadc Skip unused
Former-commit-id: 82de54e123f629bf3ca17df6d10151b32efb2409
2021-08-27 18:16:57 -07:00
Jarred Sumner
476bcfdae3 const
Former-commit-id: 4366e33712174036de02e0446c09abeeb89aec83
2021-08-27 18:15:37 -07:00
Jarred Sumner
0510d63ee5 inline some things
Former-commit-id: aa13654739c00b669f0b0d864abff11a8386c2b5
2021-08-27 18:15:29 -07:00
Jarred Sumner
9a2ce8e1fa jsx comment fixture
Former-commit-id: e3d9bb34c8deff27b72a45f182522a0057eeb42d
2021-08-27 02:33:31 -07:00
Jarred Sumner
da540bc449 only do special default name handling when there is no default name alias
Former-commit-id: 1544ff0d1fdecf4ca9c379925f56fce98acbb656
2021-08-27 02:33:10 -07:00
Jarred Sumner
33f344288f Fix JSX comment parsing bug
Former-commit-id: ecaf29b47ec7b23a13615799a4e8ced9f42dcafe
2021-08-27 02:24:12 -07:00
Jarred Sumner
a8da18cbc4 Latest
Former-commit-id: a52b8b9f1052b3e3136c249aac0a7d93334a3eb7
2021-08-26 23:25:02 -07:00
Jarred Sumner
ec334111c9 better errors
Former-commit-id: a16d16ac2d649b3678d3baaa7a4641c7a56f5d6d
2021-08-26 22:40:22 -07:00
Jarred Sumner
92229ac0f6 Fix unbundled imports
Former-commit-id: f221da115c1afcd136648c9683d8e9907005a128
2021-08-26 21:43:42 -07:00
Jarred Sumner
3a34f2e952 Shouldn't have to type --use every time you bun bun
Former-commit-id: 5c9dc3f46c2382dd72b8cf8b54cbc58355301381
2021-08-26 21:43:14 -07:00
Jarred Sumner
3ae0accbe3 Fix file loader, automatically support CSS imports when a framework isn't set
Former-commit-id: 94750e5987ea8f6e4c946bfc06715e09a48c0eec
2021-08-26 19:56:25 -07:00
Jarred Sumner
db740a4eb4 Bun.readFile() api
Former-commit-id: 4fd408537571b7b960d1f451ef774a067c125fce
2021-08-26 15:10:07 -07:00
Jarred Sumner
a6bf54668a Bug fixes
Former-commit-id: 853b372665a3762b1eeeb2202e279895bce6f544
2021-08-26 15:09:53 -07:00
Jarred Sumner
029ba1ea44 Fix scoped packages with bun bun
Former-commit-id: c29ff9ff602aeed4f9b19e4f003a20effcf70c0a
2021-08-25 19:08:11 -07:00
Jarred Sumner
4541606469 latest
Former-commit-id: f5600d123d3710e7ea80ff2b7c66d13382462420
2021-08-25 17:56:06 -07:00
Jarred Sumner
039bf6ecdb mimalloc as git submodule
Former-commit-id: 946e614bf0a61d52767869942005fa8473d3877c
2021-08-24 00:49:39 -07:00
Jarred Sumner
04467b82d3 Disable verbose fs
Former-commit-id: dc7b2c059f3db6ca4f0e91d659b7a7269ed60263
2021-08-23 02:41:36 -07:00
Jarred Sumner
a3cfd26125 emoji
Former-commit-id: 812c1222bd62826a9bd829219970332d4b22bcd7
2021-08-23 02:31:06 -07:00
Jarred Sumner
945cd08931 Fix bug with copyLowercase and add a test
Former-commit-id: 87946b9fecd8b3e75a5995f38311053ae54b0424
2021-08-23 02:30:52 -07:00
Jarred Sumner
afb6684782 Fix resolve bug with mixed-case node_modules
Former-commit-id: 5bdae0ee491e28b49ceed6136f04e0c1feddc808
2021-08-23 02:30:30 -07:00
Jarred Sumner
8c67007926 Use mimalloc for a 10% boost
Former-commit-id: 044e11d720bc6742dc53b30b4e88e8be7e76c419
2021-08-23 02:29:07 -07:00
Jarred Sumner
e012efa124 Fix watcher when you move files/dirs around. It'll bust the cache and recreate it (and leak memory)
Former-commit-id: 8faf6127547411c1fdcee9e4e7440825f21ecd99
2021-08-21 22:53:25 -07:00
Jarred Sumner
468c22de0e feature_falgs
Former-commit-id: b6a313b37b2c92047eddb98dc2b05c2cda870a3b
2021-08-21 20:04:55 -07:00
Jarred Sumner
fe71f70775 ex
Former-commit-id: 92f6068939eaf4636a4a2bf4342a6eb1925ed5ed
2021-08-21 20:04:40 -07:00
Jarred Sumner
d90049be28 TinyString optimization
Former-commit-id: e23202f6228d292c4fac08c7667b5f2a0e5f1c32
2021-08-21 19:45:28 -07:00
Jarred Sumner
2d67691038 Readme
Former-commit-id: a6574eca3584deb7bad5e7681ddfa1c0058c652c
2021-08-21 19:32:04 -07:00
Jarred Sumner
e6eba3e484 Use the new Lock type
Former-commit-id: fcb04d39a1629047ab0a227c2992922725189ca7
2021-08-20 16:45:01 -07:00
Jarred Sumner
de657fe350 Support directories in Watcher
Former-commit-id: af0813dc3c8cc93874a1903e7b4c92fc5817337a
2021-08-20 16:43:38 -07:00
Jarred Sumner
fb5b0ffedd Obj build step
Former-commit-id: e598d04eb85bf74baa66f555024dd298b1e4b444
2021-08-20 16:42:49 -07:00
Jarred Sumner
9f43f92cfa Add obj build step
Former-commit-id: cd9c4f4dccfce2a5782d285e3ade78c22f1b2a9b
2021-08-20 16:42:34 -07:00
Jarred Sumner
5db15b6ec7 demos -> examples
Former-commit-id: 19a5d395bd41b0a0b854cdf749eb96149f91cbe1
2021-08-20 13:17:57 -07:00
Jack Hanford
f1d3aade3b remove unused code in route-loader, fix CSS load promise when loading /
Former-commit-id: 2b6a239fb6a5ba735b544949e4a770765887fcf8
2021-08-19 10:45:54 -07:00
Jarred Sumner
0826f77101 Fix loading client-side CSS during page transitions
Former-commit-id: f2b6acad6a2e77d3982dd684f88edca222edab06
2021-08-19 00:45:29 -07:00
Jarred Sumner
c92c7beece Log level + onimportcss
Former-commit-id: 12ba9b9bc288573e3a5099adfa14c486c4cc980c
2021-08-19 00:44:44 -07:00
Jarred Sumner
0ba399d8ed etc
Former-commit-id: 67546a63021c0b5b58841a03115fa699ae3e441f
2021-08-18 16:52:35 -07:00
Jack Hanford
abdc26a5fc Get most of the Next.js router working
Former-commit-id: 3521bd1bb606f164f6ef1cdc4cfaae1663c22891
2021-08-18 16:40:23 -07:00
Jarred Sumner
306c7dda61 Merge branch 'main' of github.com:Jarred-Sumner/esdev
Former-commit-id: f4062ec24c4368670a0f5bc336de32fe1df6e821
2021-08-17 21:20:34 -07:00
Jarred Sumner
a703afeddd gitignore
Former-commit-id: 34571e473cf4e83a92ea778f551f51598ed91ac5
2021-08-17 21:20:22 -07:00
Jarred Sumner
6585226de7 Ignore
Former-commit-id: b2c4fce705222612b0457481657db3f42db41d1c
2021-08-17 21:19:45 -07:00
Jack Hanford
28cc70cf50 add some routing methods across hello-next
Former-commit-id: a1b7b13b54d535743e1fc15287f27fd1b3198abc
2021-08-17 21:04:52 -07:00
Jarred Sumner
bbe0a3d58c Merge branch 'main' of github.com:Jarred-Sumner/esdev
Former-commit-id: 7aec17b6232cb51067a289944aa733466c0478fb
2021-08-17 18:49:58 -07:00
Jarred Sumner
68b6e80b91 Prettier http formatt
Former-commit-id: 55951edd7a1a349c1cada83cf52abe73c6d6023c
2021-08-17 18:48:40 -07:00
Jarred Sumner
4b647fdbec v0.0.0-8
Former-commit-id: 106d1754971a0e8465cb9d0e1c73485a93593e05
2021-08-17 18:24:14 -07:00
Jarred Sumner
4a3b03a063 fix static dir
Former-commit-id: 6b396f27940250d33539846ae47596066f12034f
2021-08-17 17:54:23 -07:00
Jarred Sumner
06ef8cf9eb static
Former-commit-id: 1da09a997008e246955167b79883b958e23f0d78
2021-08-17 17:47:19 -07:00
Jarred Sumner
3b6259edf3 fix jsx
Former-commit-id: a9bfcbce261798cdd0c3f8cb09076dc246920b48
2021-08-17 15:25:36 -07:00
Jack Hanford
7a1ca0bc0c add React.Children.only pollyfill
Former-commit-id: e140319390f56979487444529ca49a677264ad57
2021-08-17 15:25:09 -07:00
Jarred Sumner
ae01e9b98d Move bun-framework-next folder, add tsconfig.json
Former-commit-id: cfd7b425f071f200504493fef206afb7c68de6d9
2021-08-17 13:31:33 -07:00
Jarred Sumner
afcbcd231c Fix CSS bug, dont' run HMR code on server
Former-commit-id: 541084b7238d54d77cb13402274718311f2030b4
2021-08-17 12:26:06 -07:00
Jarred Sumner
d7151f07bf hello-next folder
Former-commit-id: dc1c431e6e5c24dd581857090ca872c716cffe07
2021-08-17 04:10:49 -07:00
Jarred Sumner
6997367242 log error on respondWith rejection,
Former-commit-id: 8f6312a17dc9811d54e4dc31d9ada68e98bae891
2021-08-17 04:10:21 -07:00
Jarred Sumner
1e81d4d2a9 fix endsWith
Former-commit-id: 5d89343b0bd923fd7400770d25b12985eb937f70
2021-08-17 04:09:55 -07:00
Jarred Sumner
71943a83e6 Support implicit bun-framework- package prefix
Former-commit-id: a525b9fb31e1b806ef91e1a464a93a607f2bbe32
2021-08-17 04:09:42 -07:00
Jarred Sumner
ca6514c77c Fix JSX runtime when children are 0
Former-commit-id: 094913a99f22888b97696aabe12fc1a5452788d6
2021-08-17 04:09:02 -07:00
Jarred Sumner
d27a599ec2 v0.0.0-6
Former-commit-id: 4a5076bdc2ff91907af0293b38e29f96782d1a83
2021-08-17 03:59:12 -07:00
Jarred Sumner
e0c0dc7191 v0.0.0-5
Former-commit-id: 119b115f69632ca93fbce753f9daf5b91f411c20
2021-08-17 03:56:18 -07:00
Jarred Sumner
574be79253 alright thats the rename
Former-commit-id: 0faf61249e76382dfb1aa8721249474eae920753
2021-08-17 01:44:30 -07:00
Jarred Sumner
209391d01c Update package.json
Former-commit-id: ad0b74a24ae1f9c711d05d08ca9378f0e54f1933
2021-08-16 16:51:27 -07:00
Jarred Sumner
2600c4f4c4 A little less crashy
Former-commit-id: f90ce9e4563de98ad2b6524653821411dd262243
2021-08-15 22:35:47 -07:00
Jarred Sumner
2335780618 rename to bun
Former-commit-id: f982fc85fac3f0120e1851ad4027dd8413216439
2021-08-15 22:17:20 -07:00
Jarred Sumner
bd11b04c18 Support prepending to E.Arrow body
Former-commit-id: ebebca4da402b0cdbeff378ab74227facf34fbf6
2021-08-15 21:50:34 -07:00
Jarred Sumner
41260ecd18 Support multiple route dirs, fix bundling JSX, fix cjs bug, remove warning about unbundled modules in speedy env,
Former-commit-id: ae718dbd05397bed9bc49a77fae20de70b635e82
2021-08-15 21:48:56 -07:00
Jarred Sumner
db4caf0d42 Fix reconnect logic
Former-commit-id: 67fc1488169e9779794b23600401f70a1e812cad
2021-08-15 21:43:53 -07:00
Jarred Sumner
197b3ee34d Fix comma
Former-commit-id: 04c57114d5a7719af387e9d2476d91b17570107c
2021-08-14 23:09:45 -07:00
Jarred Sumner
bfac22d951 fix defines
Former-commit-id: 12db22bc3f5875ee0c43d25f8247983967451c3f
2021-08-14 23:04:29 -07:00
Jarred Sumner
d95ffe6302 .env works
Former-commit-id: 45ee7874f2c8566c3034743161031b0859423f41
2021-08-14 21:28:13 -07:00
Jarred Sumner
76bb26de83 Nested values and recursive nested values
Former-commit-id: 02063fca614201895bb174cce04f920541f760d8
2021-08-14 12:51:06 -07:00
Jarred Sumner
16c7674304 lots
Former-commit-id: 0b8128cb3b4db02f9d33331b4c2c1b595156e6c8
2021-08-14 02:39:44 -07:00
Jarred Sumner
f59892f647 late
Former-commit-id: 1d598bb05a3bac62d86063125e1fe2962f0b5cc6
2021-08-13 02:01:41 -07:00
Jarred Sumner
86642cbdd5 Support tsconfig.json "paths" (instead of just "baseUrl")
Former-commit-id: 02db9729e1d0cddf9343135f46bf843a3d3a34f8
2021-08-12 02:01:29 -07:00
Jarred Sumner
882c963398 Support tsconfig.json "paths" (instead of just "baseUrl")
Former-commit-id: 3780a0cbb033aa7524e220d247067e02af70d998
2021-08-12 02:01:10 -07:00
Jarred Sumner
4d61ce4dd7 FIx .jsb when bundling packages that have multiple nested package.json
Former-commit-id: 1567dafa8c7bbe97c34e42c86995bd193eeeb6d5
2021-08-12 02:00:25 -07:00
Jarred Sumner
3becf2d801 Further reduce allocations in resolver
Former-commit-id: 8ec2529e5ac910e1c46b8e5b912e4a679ff4994c
2021-08-12 01:58:58 -07:00
Jarred Sumner
bae23210f4 Fix __dirname and __pathname
Former-commit-id: 58c1c3b1a5ff24e040d995559baf3162f7e11ab7
2021-08-12 01:58:35 -07:00
Jarred Sumner
6cda74994b Reduce resolver allocations
Former-commit-id: 3833d6059e1fe11590e60a5e2c11f19b2c7c48e2
2021-08-11 21:46:50 -07:00
Jarred Sumner
160f83cf9e When there are errors while generating the .jsb, fail the build.
Former-commit-id: 734f021602ac59aeaef9d7583a927ede94ab644a
2021-08-11 21:46:23 -07:00
Jarred Sumner
3e0a78bc0d Fix parser/printer bugs
Former-commit-id: 8d5fa093546432e803eb066190a3b4b48e5c95f2
2021-08-11 20:22:03 -07:00
Jarred Sumner
d51d39ef32 Add missing jsonStringify
Former-commit-id: d94dfa2ed1ff26079c091331ebcf7d6bfb68df69
2021-08-11 19:43:53 -07:00
Jarred Sumner
70912ec46f Fix incorrect error generated for shorthand properties with initializers
Former-commit-id: 3637987b9ba42805c60ed664769e8fc46fa524f1
2021-08-11 16:22:48 -07:00
Jarred Sumner
3c6d687423 Fix missing check for is_async in shorthand property check
Former-commit-id: 8f2f739bcb303e0ca42853097449133a1630debe
2021-08-11 16:22:08 -07:00
Jarred Sumner
c3c14ff9ce Fix two parser bugs
Former-commit-id: 884b0e3e31e562e4f0e0676819c442842ba9040b
2021-08-11 15:54:15 -07:00
Jarred Sumner
3b0a19efe0 Fix crash when require and import are on the same line
Former-commit-id: 215b03322953ea41de93c5c3c368554d1ab12e92
2021-08-11 14:10:05 -07:00
Jarred Sumner
cfb549b7ce wip
Former-commit-id: e335f297c8ad57af82e74c405351a100524cd7e0
2021-08-11 13:56:32 -07:00
Jarred Sumner
842bb9cba2 go
Former-commit-id: d90f4747fe450c6f5d11d550df5117a9dca9962e
2021-08-11 13:56:03 -07:00
Jarred Sumner
ca90126cc4 client-side entry point works and also generates a correct url on the server
Former-commit-id: 272e52f55e44e998b9238e4173de37bfc6a05a94
2021-08-11 00:02:08 -07:00
Jarred Sumner
10b4b872a2 This is alot
Former-commit-id: 4b2a396611ec03270dc768b70e488b0f5eee2a37
2021-08-10 18:26:16 -07:00
Jarred Sumner
0daff24b16 Fix origin
Former-commit-id: 1abca35a1e83a1ccb2cd39bc04568eb9bc170b15
2021-08-09 02:36:13 -07:00
Jarred Sumner
f74771144e Split up + generate client & server bundles, support framework +router in GenerateNodeModulesBundle , read framework from package.json + rename "publicURL" to "origin" + add import.meta.filepath
Former-commit-id: 1e76ebb5375247231181ec19a6396c6acf4684fb
2021-08-09 02:21:31 -07:00
Jarred Sumner
687b22908f Fix bug when resolving basePath
Former-commit-id: 361e1eef7ff766c0cd395bdbc75dbf1ed5689ce2
2021-08-08 16:41:00 -07:00
Jarred Sumner
0babc4037b Fix missing space when printing class expressions
Former-commit-id: 38413effab0fe4073d64780bcbc898d44c0cb724
2021-08-08 14:17:37 -07:00
Jarred Sumner
33832aa887 Fix infinite loop when class statements are missing an identifier. This may expose a larger issue. We used to panic on lexer errors, but we don't anymore.
Former-commit-id: f4e14ece75b3d381798e317a45833ffa929e900f
2021-08-08 14:17:14 -07:00
Jarred Sumner
063ac7dce5 Fix export default in HMR
Former-commit-id: 4eb1220c53ec179ed40081a3d50a5248ae013af3
2021-08-08 14:16:01 -07:00
Jarred Sumner
e490577a7d More correctly choose the export_default default_name
Former-commit-id: 8b32f4c91e543b9cebba5b5cdd90fa705f471cd4
2021-08-08 14:03:44 -07:00
Jarred Sumner
dbad798c92 eqlComptime
Former-commit-id: 37aaab196be93693511180f50f14618e9eb64312
2021-08-08 14:02:40 -07:00
Jarred Sumner
bdc3308271 getImportedStyles hook
Former-commit-id: 730eb465fb23bcfa23842f293712cfc2cf51d363
2021-08-07 22:09:19 -07:00
Jarred Sumner
de35ad995e SSR!
Former-commit-id: bbc23b382c2eec15436fad632f5efe06e8e8360d
2021-08-07 18:57:41 -07:00
Jarred Sumner
8ce74beafa Clean up logic for choosing when to use filesystem router or public dir
Former-commit-id: 84bb17d9e0dd6e31995afb7b2f49436187fc9f76
2021-08-07 15:24:37 -07:00
Jarred Sumner
7b48e206db Dynamic routes resolve! Just gotta pass query params to the JS correctly
Former-commit-id: 2c4d3184a4f06ba9dd7d27d653834589796ebd0f
2021-08-07 02:28:53 -07:00
Jarred Sumner
4b1f89114e Query String parser with JS integration
Former-commit-id: 8542778c30e9757fa87514f46ff5086d7c8f6bfa
2021-08-06 23:28:13 -07:00
Jarred Sumner
6e4da63abe router almost works
Former-commit-id: a8b9d27bd0946f9c48bd8e4b5b5c2031aa434f28
2021-08-05 23:47:36 -07:00
Jarred Sumner
49929405df alright
Former-commit-id: 66a0a9f4fc554afeef9891915b203772fce2ffc4
2021-08-05 19:54:31 -07:00
Jarred Sumner
c0273a09f1 alright server-side reloading code works
Former-commit-id: a49ef52eec1037014e3c9cda1a09f387a01116b8
2021-08-05 19:48:36 -07:00
Jarred Sumner
56c689d684 Fix SSR
Former-commit-id: 27284f129c72bd3faac27707cc0e6716ad9288e0
2021-08-05 19:45:36 -07:00
Jarred Sumner
5ecf48a21d Fix node_modules.jsb loading in JSC
Former-commit-id: 43366ce3634ca35629e1f8234df86206f6411910
2021-08-04 13:02:16 -07:00
Jarred Sumner
bb00c519c3 Update headers
Former-commit-id: 430460b82f411aaa2c3b87f2e2478de8de24513f
2021-08-04 12:31:33 -07:00
Jarred Sumner
d2b15c0d75 Fix typo in runtime js code
Former-commit-id: 4b996236ef859c3f5aa8b93eae66d8878674f527
2021-08-04 12:30:17 -07:00
Jarred Sumner
5467f2fc1a Fix potential crash when printing summary of node_modules.jsb without any packages in it
Former-commit-id: 928957dffcb907f188f097b13f90901f74caab86
2021-08-04 12:30:04 -07:00
Jarred Sumner
bff37539b9 Fix incorrect module chosen
Former-commit-id: 2cb2628ff3be77ca42db8e40fe94dd6e42891533
2021-08-04 12:29:31 -07:00
Jarred Sumner
88b992abd6 cold
Former-commit-id: 29ceac2a8474322997b89ce217b059bc0c5bc810
2021-08-04 12:18:25 -07:00
Jarred Sumner
340982e58a Fix HMR undefined memory bug when the file doesn't import or export from anything
Former-commit-id: affb0a3580ba137f217ccbdb336f56c0d9948ee8
2021-08-04 12:18:02 -07:00
Jarred Sumner
a23ce8245d Skip empty stack traces
Former-commit-id: 25902aab817f4c075d570fa5774715d3955e25a7
2021-08-04 12:17:26 -07:00
Jarred Sumner
96046fcaa2 Better error message on assertion crash
Former-commit-id: 99cca6f806cdb861b581989a0a17a6bb9fd6b30d
2021-08-04 12:17:01 -07:00
Jarred Sumner
d2d7e08145 Pass allocatorreplace
Former-commit-id: 91a465b58c9860ea601f6a5c1bf4b9238b914932
2021-08-03 23:33:44 -07:00
Jarred Sumner
1aa81cd90d Pass allocator
Former-commit-id: 3a09f407179b44180c9bec9ae221909012fc293b
2021-08-03 23:30:16 -07:00
Jarred Sumner
1167bcef3d Update
Former-commit-id: 977587910ebd7732fd7afe2af4d27df65eed74e4
2021-08-03 23:29:13 -07:00
Jarred Sumner
a9ab385183 Fix
Former-commit-id: 79565ff0f8af2c11a7ef1d9a927443d8b8537963
2021-08-03 23:28:54 -07:00
Jarred Sumner
58fd17867d Threader
Former-commit-id: a13dd6402f54527e87e9afdbbf48e5ff1501c8f9
2021-08-03 19:04:24 -07:00
Jarred Sumner
3b684308c3 ok
Former-commit-id: e7d0ff27193defd870ae29bd9b4d4c2044488eac
2021-08-03 16:01:15 -07:00
Jarred Sumner
3ee7467d66 ok
Former-commit-id: ceef4402d40f701b0527eee038f9f4e5abe3fb70
2021-08-02 23:07:09 -07:00
Jarred Sumner
81f9e0b9e6 fix errorssome names
Former-commit-id: a0ceae3471aa3b16356588645eeca1f2159de356
2021-08-02 22:26:13 -07:00
Jarred Sumner
dbda84ff87 fix errors
Former-commit-id: ac66d6af52f6a2340c57a957bed078f94a8cf8ed
2021-08-02 21:22:58 -07:00
Jarred Sumner
b6e19438ea Lexer is not allowed to panic
Former-commit-id: 98dd448ba21559caac4167f7acd1e8e9f551a0ab
2021-08-02 13:30:06 -07:00
Jarred Sumner
85b6d448ce hm
Former-commit-id: 0dc1c1a74b845d037326f4f2facd786924ca722e
2021-08-01 19:04:38 -07:00
Jarred Sumner
7245f90b2d little bit of errors, little bit of bytecode caching. neither finished
Former-commit-id: c774c395136d58330aa7cad7e9fa434bcef7d5c6
2021-07-30 00:50:29 -07:00
Jarred Sumner
ba743d776a clang-format mostly
Former-commit-id: 1e0462781fc05d22b6f84c2d9f23ce1124a5b9a6
2021-07-29 14:28:50 -07:00
Jarred Sumner
4a8b254652 esmodules work?
Former-commit-id: 5cb5af4416c12518eb195d1b310990fc5c94d6c8
2021-07-28 20:56:29 -07:00
Jarred Sumner
86296897e5 JSClassRef globals work!
Former-commit-id: b1d3eb19872b2c09bda3e9e3b3a4c1f40c3b6a6d
2021-07-28 14:32:51 -07:00
Jarred Sumner
68fa7ec2d0 WIP
Former-commit-id: 60cc85dc0652b34e9c7ec409f32ba635cc4b2e51
2021-07-28 10:56:36 -07:00
Jarred Sumner
d18ff76912 alright console.log works at least
Former-commit-id: 35b5bb035be33001a3c2accbe590bb5312ea4b04
2021-07-27 16:45:02 -07:00
Jarred Sumner
a4a62d9874 Fix build issues
Former-commit-id: 5164b69b57
2021-07-26 18:57:09 -07:00
Jarred Sumner
d9cf78c267 thats a mistake
Former-commit-id: eec8f5afcf
2021-07-26 18:56:04 -07:00
Jarred Sumner
84d7234f24 cool
Former-commit-id: a7214ab61c
2021-07-26 16:39:40 -07:00
Jarred Sumner
5354a44d6a wip
Former-commit-id: 796a9854b4
2021-07-24 15:00:08 -07:00
Jarred Sumner
610c75a492 ok
Former-commit-id: 0d79861a94
2021-07-22 15:41:03 -07:00
Jarred Sumner
e914c5f3d2 most of the bindings!
Former-commit-id: a8a4f28046
2021-07-21 02:07:07 -07:00
Jarred Sumner
f1d6dd2c8b wip
Former-commit-id: f2ea202730
2021-07-19 18:16:32 -07:00
Jarred Sumner
4f2077a4de wrapped!
Former-commit-id: eddbafadfb
2021-07-19 17:15:57 -07:00
Jarred Sumner
79cd2fbfe0 WIP bindings
Former-commit-id: 74e75d6925
2021-07-18 02:12:58 -07:00
Jarred Sumner
e2b9d4c869 1
Former-commit-id: 6d25d816a0
2021-07-16 18:17:00 -07:00
Jarred Sumner
07b26525ca .gitmodules
Former-commit-id: 4a4039fcb3
2021-07-16 18:16:48 -07:00
Jarred Sumner
49ba78767c wip
Former-commit-id: 3f2a2e25ce
2021-07-14 13:11:03 -07:00
Jarred Sumner
d92a3861c9 ts
Former-commit-id: f4381bb297
2021-07-14 00:14:11 -07:00
Jarred Sumner
fea9faaf4c alright
Former-commit-id: ab73c7b323
2021-07-13 10:32:57 -07:00
Jarred Sumner
b1b459435f WIP
Former-commit-id: 6ba2feb8d2
2021-07-11 15:40:14 -07:00
Jarred Sumner
b7d7fac635 this kind of works, but there is a crash when bundling. I think its missing a Stmt.Data.Store.reset()
Former-commit-id: 88aad6aeb1
2021-07-01 05:12:15 -07:00
Jarred Sumner
a1d3191b89 asdasdasd
Former-commit-id: a8536a7337
2021-06-30 02:38:28 -07:00
Jarred Sumner
516f264138 latest
Former-commit-id: cb2ee39bfa
2021-06-30 02:38:23 -07:00
Jarred Sumner
07416311ce Fix crash, fix detecting node_modules, fix undefined not being simplified
Former-commit-id: 3f197d1ce0
2021-06-29 17:47:58 -07:00
Jarred Sumner
ece2a3ccfd alright now it crashes
Former-commit-id: 26745bb5f3
2021-06-29 01:34:38 -07:00
Jarred Sumner
70126c074f require_ref
Former-commit-id: 23e64279d8
2021-06-28 23:14:46 -07:00
Jarred Sumner
adbeb24979 starting to work
Former-commit-id: ae113559c6
2021-06-27 23:36:35 -07:00
Jarred Sumner
b918e7e372 wip
Former-commit-id: 506d9b81a7
2021-06-26 23:12:57 -07:00
Jarred Sumner
b55e64ffa3 I like this direction
Former-commit-id: 3a95a74b7f
2021-06-24 22:55:42 -07:00
Jarred Sumner
d09194f05a Support live-reload and fallback
Former-commit-id: c3f9d77391
2021-06-20 18:15:13 -07:00
Jarred Sumner
6fbfd69699 Rename CSS stress test
Former-commit-id: cbb6f8b1a9
2021-06-20 17:38:55 -07:00
Jarred Sumner
7b549c6551 g
Former-commit-id: 88ac58962e
2021-06-20 17:38:44 -07:00
Jarred Sumner
af0972d6f2 Feature detect fast refresh
Former-commit-id: 73247e5c91
2021-06-19 20:19:50 -07:00
Jarred Sumner
020ce32779 color looper i'll probably get rid of
Former-commit-id: 5015c6a969
2021-06-19 18:30:32 -07:00
Jarred Sumner
0b68ccd742 Use CSSOM for HMR when available.
Former-commit-id: 72f1c676b9
2021-06-19 18:26:43 -07:00
Jarred Sumner
fc1a37cced Show line counts for CSS
Former-commit-id: 3d9028f0ee
2021-06-19 18:23:15 -07:00
Jarred Sumner
7ed1b19d94 CSS HMR!
Former-commit-id: 3f10c87906
2021-06-18 20:48:07 -07:00
Jarred Sumner
6dce0c1e03 100x!!
Former-commit-id: e0fa2e78da
2021-06-18 00:51:11 -07:00
Jarred Sumner
9ca283bb43 CSS scanner works
Former-commit-id: 4ca1e17778
2021-06-17 11:14:20 -07:00
Jarred Sumner
e1677bb774 Skeleton!
Former-commit-id: 6e2c6cd6ea
2021-06-16 16:23:02 -07:00
Jarred Sumner
7eb887edd5 HMR crashily works, started working on CSS Scanner
Former-commit-id: d0f91082fc
2021-06-14 19:45:51 -07:00
Jarred Sumner
122ef023dd extremely close!!!!!
Former-commit-id: 44fce3c5e8
2021-06-14 01:49:53 -07:00
Jarred Sumner
c51c65325f I think thats the JS part of HMR
Former-commit-id: 43380a4d68
2021-06-12 19:10:08 -07:00
Jarred Sumner
f43234bc30 little kqueue fs watcher
Former-commit-id: f93472101a
2021-06-12 00:49:46 -07:00
Jarred Sumner
223410eab3 lil websocket server
Former-commit-id: 19f4c59b42
2021-06-11 17:05:15 -07:00
Jarred Sumner
dc3309d130 alright basic stuff works now. still bugs with JS parser
Former-commit-id: a1dd2a2a32
2021-06-11 10:53:55 -07:00
Jarred Sumner
d2e1c7955b The code looks like it might work
Former-commit-id: 8070da6ec9
2021-06-10 14:57:08 -07:00
Jarred Sumner
f280758fa7 We don't do the exports resolve step, so we must copy the namespace alias
Former-commit-id: b1dd6cf400
2021-06-10 14:56:39 -07:00
Jarred Sumner
a2d8026810 cool!
Former-commit-id: 5ffd8e40b3
2021-06-10 01:07:42 -07:00
Jarred Sumner
0e2fb5d132 Fix expression simplification bug
Former-commit-id: f8b7e45f0c
2021-06-09 22:45:31 -07:00
Jarred Sumner
df01d4de6f ok
Former-commit-id: 8444492e3c
2021-06-09 18:11:17 -07:00
Jarred Sumner
ecda693e38 lots
Former-commit-id: 7346cdaa5a
2021-06-09 13:26:30 -07:00
Jarred Sumner
6a4712f4c9 add prop
Former-commit-id: 94304788dd
2021-06-08 22:34:35 -07:00
Jarred Sumner
3b8cabcc81 Generate summary
Former-commit-id: cdb9af36c1
2021-06-08 02:54:50 -07:00
Jarred Sumner
395deef793 json
Former-commit-id: aa554728f1
2021-06-06 21:17:48 -07:00
Jarred Sumner
9f74fba395 Fix crash that happens when hundreds of files have been parsed and process.env.NODE_ENV is accessed
Former-commit-id: 48e56be05e
2021-06-06 21:17:43 -07:00
Jarred Sumner
f96f299377 hash
Former-commit-id: b97aca7fa1
2021-06-06 21:16:50 -07:00
Jarred Sumner
079fe523d4 Upgrade hash table
Former-commit-id: 5d208f9ea0
2021-06-06 21:16:43 -07:00
Jarred Sumner
13653a93a2 Fix bug printing large scientific notation floats
Former-commit-id: f9b02d2891
2021-06-06 21:15:07 -07:00
Jarred Sumner
19d472c847 hm
Former-commit-id: 024b2ea94e
2021-06-06 18:34:16 -07:00
Jarred Sumner
d49e0a5fa1 WIP node module bundles
Former-commit-id: 797b2ff557
2021-06-06 18:34:01 -07:00
Jarred Sumner
e66466cc1a wip
Former-commit-id: 7d6950da46
2021-06-06 18:33:53 -07:00
Jarred Sumner
69627d8a47 debug-only print
Former-commit-id: af7054c69b
2021-06-06 14:12:52 -07:00
Jarred Sumner
f4245c90e8 Bump schema
Former-commit-id: a93c53651c
2021-06-06 14:12:08 -07:00
Jarred Sumner
913891905f Generate parser versions at compile time
Former-commit-id: 38fe54261d
2021-06-04 19:30:26 -07:00
Jarred Sumner
9dc7f25825 oops typescript
Former-commit-id: 7c400c9b24
2021-06-04 19:30:08 -07:00
Jarred Sumner
faa3c867e2 Fix extra space in printer
Former-commit-id: c17c200cfd
2021-06-04 18:26:55 -07:00
Jarred Sumner
756c41719c Fix extra underscore in ensureValidIdentifier
Former-commit-id: 1cc15b6c20
2021-06-04 17:33:11 -07:00
Jarred Sumner
65f4ea1e18 Generate differnet versions of Bundler, Resolver, and Caches at comptime based on whether we're serving over HTTP
Former-commit-id: e1a8852706
2021-06-04 16:06:38 -07:00
Jarred Sumner
3d827342a5 mostly fix --resolve=disable
Former-commit-id: 981759fafa
2021-06-04 14:46:46 -07:00
Jarred Sumner
ea2a4aa181 rename
Former-commit-id: f584a38a72
2021-06-04 13:50:22 -07:00
Jarred Sumner
7626746904 readme was premature
Former-commit-id: a0d6d02fe8
2021-06-04 03:46:52 -07:00
Jarred Sumner
fa2f60cdd5 fix the leaks
Former-commit-id: 58d77ab827
2021-06-04 02:47:07 -07:00
Jarred Sumner
21a1134de3 okl
Former-commit-id: 0fb2584f15
2021-06-02 20:37:04 -07:00
Jarred Sumner
3bd725d80b keep that
Former-commit-id: 72813b5b48
2021-06-02 20:36:23 -07:00
Jarred Sumner
da0bb118dc HTTP fixes + buffer stdout/in + a little HTTP caching
Former-commit-id: d49df1df57
2021-06-02 16:39:40 -07:00
Jarred Sumner
ddd5ed1cc2 JSX & CJS work end-to-end!
Former-commit-id: 44bab947c6
2021-06-02 12:48:38 -07:00
Jarred Sumner
ee6643ce8b wip
Former-commit-id: a6bc130918
2021-06-01 20:49:49 -07:00
Jarred Sumner
38f1eb0701 linker things
Former-commit-id: 73452660fd
2021-05-31 20:30:40 -07:00
Jarred Sumner
87d01c9f4a Fix printing bugs
Former-commit-id: 52f37e4fe4
2021-05-30 23:35:43 -07:00
Jarred Sumner
dd72bf5ab6 cool
Former-commit-id: 7dc3ee4c89
2021-05-30 18:26:18 -07:00
Jarred Sumner
741d35f0b3 stderr
Former-commit-id: 1d3588ef5a
2021-05-30 15:42:47 -07:00
Jarred Sumner
0e74b0081c Fix indent
Former-commit-id: 4a3b4953ee
2021-05-30 15:32:39 -07:00
Jarred Sumner
d264d4e4ba Fix Define, JSX, use more pointers for property access to minimize calls to memmove
Former-commit-id: 09ceececba
2021-05-30 12:50:08 -07:00
Jarred Sumner
534f9cf509 This'll do for now, I guess.
Former-commit-id: cfda423c01
2021-05-30 01:17:55 -07:00
Jarred Sumner
d1db1fdd79 This blocks approach seems to work
Former-commit-id: 95d5bc78f2
2021-05-30 00:17:17 -07:00
Jarred Sumner
2a54b9f138 Revert "WIP"
This reverts commit b5612b303b [formerly 55dcde581d].


Former-commit-id: 6c2d19c1b0
2021-05-29 19:55:35 -07:00
Jarred Sumner
b5612b303b WIP
Former-commit-id: 55dcde581d
2021-05-29 17:40:00 -07:00
Jarred Sumner
3436ee9ded microp
Former-commit-id: b876a8d480
2021-05-29 13:33:48 -07:00
Jarred Sumner
923e2c5c5d fix crash
Former-commit-id: 0657f16e27
2021-05-29 13:33:37 -07:00
Jarred Sumner
bbc95209f0 microp-optimize hash table stuff
Former-commit-id: 42aaa8eb81
2021-05-29 13:33:31 -07:00
Jarred Sumner
e73da759b9 Move wyhasxh
Former-commit-id: cd91772f2f
2021-05-29 13:32:13 -07:00
Jarred Sumner
6e8e16d916 2
Former-commit-id: f1403901d9
2021-05-28 23:48:10 -07:00
Jarred Sumner
05ec7232bf all
Former-commit-id: 664dbf569c
2021-05-28 23:26:13 -07:00
Jarred Sumner
254a2b779b w
Former-commit-id: 95a3b72e94
2021-05-28 23:04:40 -07:00
Jarred Sumner
12dde03184 wap
Former-commit-id: efe1479299
2021-05-28 23:04:12 -07:00
Jarred Sumner
e01dde3fa2 okay
Former-commit-id: 6dde9a7540
2021-05-28 22:59:46 -07:00
Jarred Sumner
983bc9bbdc maekfile
Former-commit-id: 474df61a86
2021-05-28 22:48:37 -07:00
Jarred Sumner
dbbde8d858 commit
Former-commit-id: 7c576d7b62
2021-05-28 22:47:30 -07:00
Jarred Sumner
a16a5c209c typo
Former-commit-id: 4e1619c17a
2021-05-28 13:34:02 -07:00
Jarred Sumner
494177773f Fix integer overflow
Former-commit-id: 54d9969b4c
2021-05-28 13:33:02 -07:00
Jarred Sumner
5e26ed1320 Remove legacy_octal_loc
Former-commit-id: 91d6bf26b9
2021-05-28 13:32:55 -07:00
Jarred Sumner
0f6a4854e3 keep lexer/loc
Former-commit-id: 2172f3c5e3
2021-05-28 13:27:05 -07:00
Jarred Sumner
089bce8828 launch.json
Former-commit-id: d44fa1ca92
2021-05-28 13:23:29 -07:00
Jarred Sumner
da210d75e8 fixtures
Former-commit-id: e72ad4777c
2021-05-28 13:22:31 -07:00
Jarred Sumner
6e7c954161 gitignore
Former-commit-id: f1bcf07e2b
2021-05-27 21:35:41 -07:00
Jarred Sumner
248354d549 lists
Former-commit-id: cbf0b77e52
2021-05-27 21:35:28 -07:00
Jarred Sumner
db5a78d5f6 stmt experiment
Former-commit-id: b6e7f01e6a
2021-05-27 18:50:20 -07:00
Jarred Sumner
b5173afc44 lots
Former-commit-id: d1b3bce067
2021-05-27 16:38:53 -07:00
Jarred Sumner
f51f303b35 Fix blah = value inside function args
Former-commit-id: 05b9e89417
2021-05-27 15:27:58 -07:00
Jarred Sumner
c6d42bf0a9 Fix yield*
Former-commit-id: ebefe97073
2021-05-27 14:56:53 -07:00
Jarred Sumner
7d1439d570 Fix parsing await inside scopes that contain functions, return the backtracking error in TypeScript
Former-commit-id: 84ea80b813
2021-05-27 14:42:33 -07:00
Jarred Sumner
81f3a52e89 Error message for using node builtins outside of platform == .node
Former-commit-id: 3bcce51fa4
2021-05-27 14:38:28 -07:00
Jarred Sumner
feb7adcd08 faster writes performance
Former-commit-id: 2c212929f8
2021-05-27 00:42:02 -07:00
Jarred Sumner
84be179f7c trying to fix outbase
Former-commit-id: 9b47a8791e
2021-05-27 00:41:33 -07:00
Jarred Sumner
5b4c8449a8 node builtins
Former-commit-id: ca2897b466
2021-05-27 00:40:56 -07:00
Jarred Sumner
8036244eb2 fuckin with absolute paths
Former-commit-id: 453cfa5689
2021-05-27 00:40:47 -07:00
Jarred Sumner
6e46883ca7 Use a normal string to represent template literal content for easier UTF8/UTF16 mixing
Former-commit-id: 7337f27a7e
2021-05-26 18:15:49 -07:00
Jarred Sumner
6a69c971d4 Skip slow path
Former-commit-id: 96a33924fb
2021-05-26 18:15:21 -07:00
Jarred Sumner
4a7067a0a2 FIx parsing 2 digit hex
Former-commit-id: bc794e89ed
2021-05-26 18:14:49 -07:00
Jarred Sumner
3d5e021dea Fix returning parse errors and template tags
Former-commit-id: bb7404d6bc
2021-05-26 18:14:36 -07:00
Jarred Sumner
379566f052 More reliable path storage
Former-commit-id: f47d7b3d2d
2021-05-26 18:13:54 -07:00
Jarred Sumner
112741dfde Fix base_url always null
Former-commit-id: 831a461916
2021-05-26 18:13:39 -07:00
Jarred Sumner
8c41ac8b23 Fix tempalte tags
Former-commit-id: 0e6c46819a
2021-05-26 18:11:55 -07:00
Jarred Sumner
4aee9094a7 detect JSON errors
Former-commit-id: 9b5f317c5b
2021-05-26 18:11:28 -07:00
Jarred Sumner
1a24d77699 I love enums
Former-commit-id: 63b8182b7c
2021-05-26 13:15:52 -07:00
Jarred Sumner
e4b054060e namespace/enum? is that it?
Former-commit-id: 1e0eb4012a
2021-05-26 12:23:09 -07:00
Jarred Sumner
6510697627 print_ast feature flag
Former-commit-id: bc4e76c2a5
2021-05-26 12:21:02 -07:00
Jarred Sumner
0e5955287b import==
Former-commit-id: 9c2c005b58
2021-05-26 10:08:14 -07:00
Jarred Sumner
2fc4a5c564 lexer bug!
Former-commit-id: 84472ed57f
2021-05-26 10:07:56 -07:00
Jarred Sumner
657903c03e cloner
Former-commit-id: d04ef8c53f
2021-05-25 23:34:14 -07:00
Jarred Sumner
a381233e40 like all of typescript lol
Former-commit-id: f2a9dc9eea
2021-05-25 20:01:33 -07:00
Jarred Sumner
5162ab0bbf newline
Former-commit-id: 1cd6b587a2
2021-05-25 20:01:21 -07:00
Jarred Sumner
2b66058a95 add cat, microoptimize the microptimize
Former-commit-id: 28534b2e34
2021-05-25 20:01:16 -07:00
Jarred Sumner
adbbe2963c mostly just zig fmt
Former-commit-id: 6c7eeb2030
2021-05-25 20:01:06 -07:00
Jarred Sumner
f96528adde Malformed headers breaks request parsing
Former-commit-id: 9b206cca2b
2021-05-25 11:12:22 -07:00
Jarred Sumner
ea10dacc92 relative path
Former-commit-id: 06fbc24b11
2021-05-25 01:34:44 -07:00
Jarred Sumner
f234456bd0 w
Former-commit-id: a2637e9016
2021-05-24 12:44:49 -07:00
Jarred Sumner
fe88e7bcf4 try
Former-commit-id: 244ae8c593
2021-05-24 12:44:39 -07:00
Jarred Sumner
35b249d23e ok
Former-commit-id: f7ed006a08
2021-05-24 12:44:23 -07:00
Jarred Sumner
db6ac5f51b ok
Former-commit-id: 5f72442386
2021-05-24 12:44:13 -07:00
Jarred Sumner
6aa88ae931 little separation
Former-commit-id: 1957f0fc23
2021-05-23 11:10:23 -07:00
Jarred Sumner
8a0836c239 The little things
Former-commit-id: 37e17be7aa
2021-05-23 10:20:48 -07:00
Jarred Sumner
cbe78efb9c muck
Former-commit-id: ac4ac8f5a8
2021-05-23 10:05:21 -07:00
Jarred Sumner
7cc2661aa6 http server can load static files...slowly.
Former-commit-id: 45b55a8970
2021-05-22 23:25:25 -07:00
Jarred Sumner
c3d3d70ced wip
Former-commit-id: 63e622f2f3
2021-05-21 17:55:42 -07:00
Jarred Sumner
8b75f56577 pico
Former-commit-id: cee857ac4e
2021-05-20 02:34:42 -07:00
Jarred Sumner
9541d268de cool
Former-commit-id: 6475442469
2021-05-19 23:12:23 -07:00
Jarred Sumner
a58adfcaa2 Starting to work on rutnime
Former-commit-id: 23220fd348
2021-05-19 19:30:24 -07:00
Jarred Sumner
2884b759c3 tread
Former-commit-id: 4f1d32be16
2021-05-18 20:33:45 -07:00
Jarred Sumner
70cc0f47bb decodeEscapeSequences...kiond of?
Former-commit-id: f502d0f1a4
2021-05-18 20:32:55 -07:00
Jarred Sumner
2fac623977 hm
Former-commit-id: 4d6a8f598a
2021-05-18 20:06:08 -07:00
Jarred Sumner
7396fae4e2 Fix DotDefine
Former-commit-id: 78fa4c4f87
2021-05-18 14:40:37 -07:00
Jarred Sumner
904bf17a51 Fix label parsing
Former-commit-id: 1c80859431
2021-05-18 14:07:51 -07:00
Jarred Sumner
e0e32986c7 Fix duplicate exports error
Former-commit-id: 957e871f4a
2021-05-18 13:49:23 -07:00
Jarred Sumner
54730377e2 Fix "in" keyword
Former-commit-id: 0840845d68
2021-05-18 13:13:04 -07:00
Jarred Sumner
28ecf60267 Resolver is fast now!
Former-commit-id: 2ef6397ab9
2021-05-18 02:24:40 -07:00
Jarred Sumner
154e049638 lots
Former-commit-id: 9ccb4dd082
2021-05-16 23:25:12 -07:00
Jarred Sumner
e80f865974 lots
Former-commit-id: d8b1d29656
2021-05-15 17:23:55 -07:00
Jarred Sumner
c88625436c keep
Former-commit-id: 778c24f176
2021-05-13 23:22:08 -07:00
Jarred Sumner
68aa776217 w
Former-commit-id: 248d1a7a93
2021-05-13 21:12:41 -07:00
Jarred Sumner
0666f8151a more utf8
Former-commit-id: e1f996e1b8
2021-05-13 21:10:02 -07:00
Jarred Sumner
1fba2dc20f bugfix
Former-commit-id: dbcddc79fc
2021-05-13 21:09:41 -07:00
Jarred Sumner
ca4120afec bug fixes galore
Former-commit-id: 7243945291
2021-05-13 17:44:50 -07:00
Jarred Sumner
2eb09c1fec okay
Former-commit-id: b42b239344
2021-05-13 13:51:40 -07:00
Jarred Sumner
f6f40b5b64 various bug fixes
Former-commit-id: 87771ba895
2021-05-13 01:24:10 -07:00
Jarred Sumner
bed0227a8f hm
Former-commit-id: 28fce4aac1
2021-05-13 00:46:22 -07:00
Jarred Sumner
9fd6f635cd hm
Former-commit-id: d8828b69d8
2021-05-12 20:40:38 -07:00
Jarred Sumner
f12ed9904b okay I think that's most of resolving packages/imports algorithm!!!
Former-commit-id: 80037859ec
2021-05-12 20:33:58 -07:00
Jarred Sumner
1010bae1a3 cool
Former-commit-id: 51df94e599
2021-05-12 13:17:26 -07:00
Jarred Sumner
c09d7cf839 That's all the errors??
Former-commit-id: f9a74df73d
2021-05-12 13:00:25 -07:00
Jarred Sumner
f8131f42bc okay
Former-commit-id: 2c20d88e8d
2021-05-12 01:46:58 -07:00
Jarred Sumner
175bbdd3c3 now we do resolver??
Former-commit-id: 8df97221a4
2021-05-11 20:49:11 -07:00
Jarred Sumner
515172263b cool
Former-commit-id: cf4d0fe3b6
2021-05-11 20:26:13 -07:00
Jarred Sumner
324784cd6e update
Former-commit-id: a5f1670e92
2021-05-11 18:39:00 -07:00
Jarred Sumner
0c951bd012 opts
Former-commit-id: d75a1deb4a
2021-05-11 17:19:08 -07:00
Jarred Sumner
62dab0703d submodule
Former-commit-id: 033b74cc2a
2021-05-11 11:55:38 -07:00
Jarred Sumner
fc75a0dea6 asdasdasdasd
Former-commit-id: 2b3c0584c6
2021-05-10 20:05:53 -07:00
Jarred Sumner
166c353ddb 1day
Former-commit-id: b7d8fe2f35
2021-05-09 18:57:48 -07:00
Jarred Sumner
ae90b3deea Use try for errors during parsing so that backtracking can happen
Former-commit-id: 7d3b0e7daa
2021-05-08 20:48:20 -07:00
Jarred Sumner
7257094662 Okay this hunks solution seems to work for now. It's not _great_ though.
Former-commit-id: 32cdc13f63
2021-05-08 19:41:52 -07:00
Jarred Sumner
ecabda3ced Fix exporting default twice
Former-commit-id: 2f4cd402e4
2021-05-08 18:12:54 -07:00
Jarred Sumner
18794b18b3 Fix for loop initializer
Former-commit-id: 6b863d5d51
2021-05-08 14:23:52 -07:00
Jarred Sumner
e70ac2ce82 wip
Former-commit-id: 79223472f7
2021-05-07 23:34:16 -07:00
Jarred Sumner
1261560214 This _sort of_ works
Former-commit-id: 8c4917fe60
2021-05-07 20:19:32 -07:00
Jarred Sumner
caa747ba71 wip
Former-commit-id: f4267e2d1f
2021-05-07 14:12:56 -07:00
Jarred Sumner
fad34bb4ab cool
Former-commit-id: 96ff169e46
2021-05-07 01:26:26 -07:00
Jarred Sumner
dd9e7de689 123
Former-commit-id: 741e1513b7
2021-05-05 19:02:36 -07:00
Jarred Sumner
d975ab19db cool
Former-commit-id: 3708dd4484
2021-05-05 19:02:30 -07:00
Jarred Sumner
41c9896e11 I think that fixes the scopes bug
Former-commit-id: 2cbd4c9d80
2021-05-05 19:02:14 -07:00
Jarred Sumner
7a4084a23f alright
Former-commit-id: e0d01a9a91
2021-05-05 13:12:19 -07:00
Jarred Sumner
6be0a4653f damn tho
Former-commit-id: e1df98878d
2021-05-05 03:09:59 -07:00
Jarred Sumner
08961dc3ce Revert "the fast way"
This reverts commit a9ca6c8a07 [formerly 808e5cfac3].


Former-commit-id: 596f3c064a
2021-05-04 16:05:15 -07:00
Jarred Sumner
274b139aa8 hbm
Former-commit-id: 29fe5b730f
2021-05-04 16:03:00 -07:00
Jarred Sumner
5a51ea3957 w
Former-commit-id: 082d184848
2021-05-04 16:02:22 -07:00
Jarred Sumner
ed9981c9c6 re
Former-commit-id: 2e8d6d549d
2021-05-04 16:02:09 -07:00
Jarred Sumner
3ce9f07171 *src
Former-commit-id: 6431b90b9e
2021-05-04 16:01:43 -07:00
Jarred Sumner
adc4e9b23c *
Former-commit-id: 4c60accdc1
2021-05-04 16:01:21 -07:00
Jarred Sumner
a9ca6c8a07 the fast way
Former-commit-id: 808e5cfac3
2021-05-04 15:58:18 -07:00
Jarred Sumner
a432247053 slice
Former-commit-id: 0bfd74af55
2021-05-04 15:56:55 -07:00
Jarred Sumner
d19f939e7d keeper
Former-commit-id: 83ff3453dc
2021-05-04 15:54:17 -07:00
Jarred Sumner
ea84c6dc3c it works???
Former-commit-id: e034383833
2021-05-03 22:37:28 -07:00
Jarred Sumner
ca2a3f69ff hm
Former-commit-id: 1d44b63675
2021-05-03 20:29:38 -07:00
Jarred Sumner
1b3d46d92c maybePrintSpace
Former-commit-id: 468927c14b
2021-05-02 23:45:41 -07:00
Jarred Sumner
0b1fc17636 wip
Former-commit-id: c8a8da370c
2021-05-02 18:24:46 -07:00
Jarred Sumner
26f53dbcd8 shorthand
Former-commit-id: 195c69606b
2021-05-02 16:42:15 -07:00
Jarred Sumner
320e0460e0 various
Former-commit-id: 8db9c7650c
2021-05-02 16:25:14 -07:00
Jarred Sumner
97cb54de2e classes work, excluding name and constructor/super
Former-commit-id: 818d014931
2021-05-02 13:04:55 -07:00
Jarred Sumner
3050d5a1a4 Assorted bugfixes but the next step really is porting tests and fixing
Former-commit-id: f59ec8d6c0
2021-05-01 01:28:40 -07:00
Jarred Sumner
7005f4c43c it prints end to end though doesn't work yet
Former-commit-id: 006ca4f13c
2021-04-30 17:26:17 -07:00
Jarred Sumner
2961b7c8ca inching closure
Former-commit-id: 107310d785
2021-04-30 15:34:31 -07:00
Jarred Sumner
cb639afb57 all in a days work
Former-commit-id: fd56d41c8e
2021-04-30 00:55:15 -07:00
Jarred Sumner
64d35e1dbf ao[slk
Former-commit-id: daf9ea419b
2021-04-29 22:12:22 -07:00
Jarred Sumner
c895f10bbf aoskdp
Former-commit-id: ac83057d08
2021-04-29 21:46:07 -07:00
Jarred Sumner
24d1479ea8 hm
Former-commit-id: 2567243c8d
2021-04-29 20:22:25 -07:00
Jarred Sumner
3731376943 okay
Former-commit-id: 38c7eb73c1
2021-04-29 14:43:30 -07:00
Jarred Sumner
75d2ee53b0 wap
Former-commit-id: a32116476a
2021-04-29 14:03:01 -07:00
Jarred Sumner
1e9e42618b asdasd
Former-commit-id: 4e3f680ac4
2021-04-29 10:29:25 -07:00
Jarred Sumner
cabe773a4f wip
Former-commit-id: b37acf309c
2021-04-28 21:58:02 -07:00
515 changed files with 170525 additions and 9996 deletions

66
.gitignore vendored
View File

@@ -3,4 +3,68 @@ zig-cache
*.wasm
*.o
*.a
*.a
profile.json
node_modules
.swcrc
yarn.lock
dist
*.log
*.out.js
/package-lock.json
build
*.wat
zig-out
pnpm-lock.yaml
README.md.template
src/deps/zig-clap/example
src/deps/zig-clap/README.md
src/deps/zig-clap/.github
src/deps/zig-clap/.gitattributes
out
outdir
.trace
cover
coverage
coverv
*.trace
bench
github
out.*
out
.parcel-cache
esbuilddir
*.bun
parceldist
esbuilddir
outdir/
outcss
.next
txt.js
.idea
.vscode/cpp*
node_modules_*
*.jsb
*.zip
bun-zigld
bun-singlehtreaded
bun-nomimalloc
bun-mimalloc
examples/lotta-modules/bun-yday
examples/lotta-modules/bun-old
examples/lotta-modules/bun-nofscache
src/node-fallbacks/out/*
src/node-fallbacks/node_modules
sign.json
release/
*.dmg
sign.*.json
packages/debug-*
packages/bun-cli/postinstall.js
packages/bun-*/bin/*
packages/bun-cli/bin/*

15
.gitmodules vendored Normal file
View File

@@ -0,0 +1,15 @@
# [submodule "src/deps/zig-clap"]
# path = src/deps/zig-clap
# url = https://github.com/Hejsil/zig-clap
[submodule "src/deps/picohttpparser"]
path = src/deps/picohttpparser
url = https://github.com/h2o/picohttpparser/
ignore = dirty
[submodule "src/javascript/jsc/WebKit"]
path = src/javascript/jsc/WebKit
url = git@github.com:/Jarred-Sumner/WebKit
ignore = dirty
[submodule "src/deps/mimalloc"]
path = src/deps/mimalloc
url = https://github.com/microsoft/mimalloc
ignore = dirty

48
.vscode/c_cpp_properties.json vendored Normal file
View File

@@ -0,0 +1,48 @@
{
"configurations": [
{
"name": "Mac",
"forcedInclude": [
"${workspaceFolder}/src/javascript/jsc/bindings/root.h"
],
"includePath": [
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/",
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/WTF/Headers",
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/*",
"${workspaceFolder}/src/JavaScript/jsc/bindings/",
"${workspaceFolder}/src/JavaScript/jsc/WebKit/Source/bmalloc/",
"${workspaceFolder}/src/javascript/jsc/WebKit/WebKitBuild/Release/ICU/Headers/"
],
"browse": {
"path": [
"${workspaceFolder}/src/javascript/jsc/bindings/*",
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/",
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/WTF/Headers/**",
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/*",
"${workspaceFolder}/src/JavaScript/jsc/bindings/**",
"${workspaceFolder}/src/JavaScript/jsc/WebKit/Source/bmalloc/**",
"${workspaceFolder}/src/javascript/jsc/WebKit/WebKitBuild/Release/ICU/Headers/"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ".vscode/cppdb"
},
"defines": [
"STATICALLY_LINKED_WITH_JavaScriptCore=1",
"STATICALLY_LINKED_WITH_WTF=1",
"BUILDING_WITH_CMAKE=1",
"NOMINMAX",
"ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=0",
"BUILDING_JSCONLY__",
"USE_FOUNDATION=1",
"ASSERT_ENABLED=0",
"DU_DISABLE_RENAMING=1"
],
"macFrameworkPath": [],
"compilerPath": "/usr/local/opt/llvm/bin/clang",
"cStandard": "c17",
"cppStandard": "c++11",
"intelliSenseMode": "macos-clang-x64"
}
],
"version": 4
}

541
.vscode/launch.json vendored
View File

@@ -2,39 +2,532 @@
"version": "0.2.0",
"configurations": [
{
"name": "Test",
"type": "lldb",
"request": "launch",
"stdio": null,
"stopOnEntry": false,
"program": "/usr/local/bin/zig",
"name": "Transpile small",
"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"
"./dotenv-load-check.ts"
],
"cwd": "${workspaceFolder}/examples/css-stress-test",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Eval Error",
"program": "${workspaceFolder}/build/debug/macos-x86_64/spjs",
"args": [
"error.js",
"--resolve=dev",
"--outdir=outcss"
// "--origin=https://localhost:9000/"
],
"cwd": "${workspaceFolder}",
"args": ["test", "${file}"],
"presentation": {
"hidden": false,
"group": "",
"order": 1
},
"env": {
"TERM": "xterm"
}
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": ".bun",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [
"./examples/hello-next/node_modules.server.bun"
// "--origin=https://localhost:9000/"
],
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Discord",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [
"discord"
// "--origin=https://localhost:9000/"
],
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Eval",
"program": "${workspaceFolder}/build/debug/macos-x86_64/spjs",
"args": [
"./src/index.tsx"
// "--origin=https://localhost:9000/"
],
"cwd": "${workspaceFolder}/examples/css-stress-test",
"console": "internalConsole"
},
{
"name": "Launch",
"type": "cppdbg",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/zig-cache/bin/esdev",
"name": "Dev Launch",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [
"./simple.css",
"--resolve=dev",
"--outdir=outcss",
"--origin=https://localhost:9000/"
],
"cwd": "${workspaceFolder}/src/test/fixtures",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Release Serve",
"program": "${workspaceFolder}/build/macos-x86_64/bun",
// "args": ["--serve", "--origin=http://localhost:3000"],
"args": ["dev", "--origin=http://localhost:3000"],
"cwd": "${workspaceFolder}/examples/hello-next",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo Serve",
"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"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo Serve aarch64",
"program": "${workspaceFolder}/build/macos-aarch64/bun",
// "args": ["--serve", "--origin=http://localhost:3000"],
"args": ["dev", "--origin=http://ci.local:3000"],
"cwd": "${workspaceFolder}/examples/hello-next",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo Lazy Build",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [
"./src/index.tsx",
"--resolve=lazy",
"--origin=http://localhost:9000/"
],
"cwd": "${workspaceFolder}/examples/simple-react",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo Build",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [
"./src/index.tsx",
"--resolve=dev",
"--outdir=outcss",
"--platform=browser",
"--origin=http://localhost:9000/"
],
"cwd": "${workspaceFolder}/examples/css-stress-test",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Fixture serve",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/src/test/fixtures",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo .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"
},
{
"type": "lldb",
"request": "launch",
"name": "PNPM .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"
},
{
"type": "lldb",
"request": "launch",
"name": "PNPM serve",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [],
"cwd": "/Users/jarred/Build/pnpm-bun/packages/app",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Mixed case resolve",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [
"build",
"./index.js",
"--origin=http://localhost:9000/",
// "--use=./bun-framework-next",
"--platform=browser"
],
"cwd": "${workspaceFolder}/examples/lotta-modules/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Build .bun lotta-modules",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": ["bun", "./index.js", "--platform=browser"],
"cwd": "${workspaceFolder}/examples/lotta-modules/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Dev CRA",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": ["dev", "--platform=browser"],
"cwd": "${workspaceFolder}/examples/hello-create-react-app/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Fragment",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [],
"cwd": "${workspaceFolder}/src/test/fixtures",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Context Bun Bug",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": ["bun", "./code.js"],
"cwd": "/Users/jarred/Build/context/www",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Context 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": "a",
"args": ["dev"],
"cwd": "${workspaceFolder}/src/test/fixtures",
"console": "internalConsole"
},
{
"type": "cppvsdbg",
"request": "launch",
"name": "Fixtures Rel",
"program": "${workspaceFolder}/build/macos-x86_64/bun",
"args": ["dev"],
"cwd": "${workspaceFolder}/src/test/fixtures",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Context Dev",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [],
"cwd": "/Users/jarred/Build/context/www",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Context Rel",
"program": "${workspaceFolder}/build/macos-x86_64/bun",
"args": [],
"cwd": "/Users/jarred/Build/context/www",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug Dev",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": ["dev"],
"cwd": "${workspaceFolder}/examples/hello-next",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Type-only import",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [
"bun",
"./src/test/fixtures/type-only-import.ts",
"--external=react"
],
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"internalConsoleOptions": "openOnSessionStart",
"logging": {
"moduleLoad": false
}
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Dev lotta-modules",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": ["dev", "./index.js", "--platform=browser"],
"cwd": "${workspaceFolder}/examples/lotta-modules/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo Build .bun",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": [
"bun",
// "./index.js",
"--origin=http://localhost:9000/",
"--use=./bun-framework-next",
"--platform=browser"
],
"cwd": "${workspaceFolder}/examples/hello-next/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "PNPM Resolve symlink",
"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"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo Print .bun",
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"args": ["./node_modules.bun"],
"cwd": "${workspaceFolder}/examples/simple-react",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "DAev Launch",
"program": "${workspaceFolder}/build/macos-x86_64/bun",
"args": ["./simple.jsx", "--resolve=disable"],
"cwd": "${workspaceFolder}/src/test/fixtures",
"console": "internalConsole"
},
{
"name": "esbuild",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "/Users/jarred/Code/esbuild/cmd/esbuild",
"cwd": "/Users/jarred/Code/bun/src/test/fixtures",
"args": ["--bundle", "--outfile=out.esbuild.js", "await.ts"]
},
// {
// "type": "lldb",
// "request": "launch",
// "name": "Dev Launch (other)",
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
// "args": ["./simple.jsx", "--resolve=disable"],
// "cwd": "${workspaceFolder}/src/test/fixtures",
// "console": "internalConsole"
// },
// {
// "type": "lldb",
// "request": "launch",
// "name": "Dev Launch",
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
// "preLaunchTask": "build",
// "args": [
// "--resolve=disable",
// "--cwd",
// "/Users/jarredsumner/Code/bun/src/test/fixtures",
// "escape-chars.js"
// ],
// "cwd": "${workspaceFolder}",
// "console": "internalConsole"
// }
// {
// "type": "lldb",
// "request": "launch",
// "name": "Dev Launch",
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
// "preLaunchTask": "build",
// "args": [
// "--resolve=dev",
// "--cwd",
// "/Users/jarredsumner/Builds/esbuild/bench/three/src/",
// "./entry.js",
// "-o",
// "out"
// ],
// "cwd": "/Users/jarredsumner/Builds/esbuild/bench/three/src",
// "console": "internalConsole"
// }
// {
// "type": "lldb",
// "request": "launch",
// "name": "Dev Launch",
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
// "preLaunchTask": "build",
// "args": [
// "--resolve=dev",
// "--cwd",
// "/Users/jarredsumner/Builds/esbuild/bench/three/src/",
// "./entry.js",
// "-o",
// "out"
// ],
// "cwd": "${workspaceFolder}",
// "console": "internalConsole"
// }
// {
// "type": "lldb",
// "request": "launch",
// "name": "Dev Launch",
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
// // "preLaunchTask": "build",
// "args": [
// "--resolve=dev",
// "--cwd",
// "./src/api/demo",
// "pages/index.jsx",
// "-o",
// "out",
// "--origin=https://hello.com/",
// "--serve"
// ],
// "cwd": "${workspaceFolder}",
// "console": "internalConsole"
// }
{
"type": "lldb",
"request": "launch",
"name": "Rome",
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
"program": "${workspaceFolder}/build/macos-x86_64/bun",
// "preLaunchTask": "build",
"args": [
"--resolve=dev",
// "--resolve=lazy",
"--cwd",
"${workspaceFolder}/bench/rome/src",
"entry",
"--platform=node",
// "@romejs/js-analysis/evaluators/modules/ImportCall.ts",
"--outdir=${workspaceFolder}/bench/rome/src/out",
// "@romejs/cli-diagnostics/banners/success.json",
"--origin=https://hello.com/"
],
"cwd": "${workspaceFolder}/bench/rome/src",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Rome Dev",
// "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",
// "--resolve=lazy",
"--cwd",
"${workspaceFolder}/bench/rome/src",
"entry",
"--platform=node",
// "@romejs/js-analysis/evaluators/modules/ImportCall.ts",
"--outdir=${workspaceFolder}/bench/rome/src/out",
// "@romejs/cli-diagnostics/banners/success.json",
"--origin=https://hello.com/"
],
"cwd": "${workspaceFolder}/bench/rome/src",
"console": "internalConsole"
}
// {
// "type": "lldb",
// "request": "launch",
// "name": "Dev Launch",
// "program": "${workspaceFolder}/build/bin/debug/bun",
// "preLaunchTask": "build",
// "args": [
// "--resolve=dev",
// "--cwd",
// "/",
// "/Users/jarredsumner/Code/bun/src/test/fixtures/img-bug.js",
// "-o",
// "out"
// ],
// "cwd": "${workspaceFolder}",
// "console": "internalConsole",
// "presentation": {
// "hidden": false,
// "group": "",
// "order": 1
// }
// }
]
}

134
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,134 @@
{
"git.autoRepositoryDetection": "openEditors",
"search.quickOpen.includeSymbols": false,
"search.seedWithNearestWord": true,
"search.smartCase": true,
"search.exclude": {
"src/javascript/jsc/WebKit/**/*": true
},
"search.followSymlinks": false,
"search.useIgnoreFiles": true,
"zig.buildOnSave": false,
"[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,
"src/javascript/jsc/WebKit/Tools": true,
"src/javascript/jsc/WebKit/WebDriverTests": true,
"src/javascript/jsc/WebKit/WebKit.xcworkspace": true,
"src/javascript/jsc/WebKit/WebKitLibraries": true,
"src/javascript/jsc/WebKit/Websites": true,
"src/javascript/jsc/WebKit/resources": true,
"src/javascript/jsc/WebKit/LayoutTests": true,
"src/javascript/jsc/WebKit/ManualTests": true,
"src/javascript/jsc/WebKit/PerformanceTests": true,
"src/javascript/jsc/WebKit/WebKitLegacy": true,
"src/javascript/jsc/WebKit/WebCore": true,
"src/javascript/jsc/WebKit/WebDriver": true,
"src/javascript/jsc/WebKit/WebKitBuild": true,
"src/javascript/jsc/WebKit/WebInspectorUI": true
},
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"[h]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"[c]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"files.associations": {
"*.idl": "cpp",
"memory": "cpp",
"iostream": "cpp",
"algorithm": "cpp",
"random": "cpp",
"ios": "cpp",
"filesystem": "cpp",
"__locale": "cpp",
"type_traits": "cpp",
"__mutex_base": "cpp",
"__string": "cpp",
"string": "cpp",
"string_view": "cpp",
"typeinfo": "cpp",
"__config": "cpp",
"__nullptr": "cpp",
"exception": "cpp",
"__bit_reference": "cpp",
"atomic": "cpp",
"utility": "cpp",
"sstream": "cpp",
"__functional_base": "cpp",
"new": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__hash_table": "cpp",
"__node_handle": "cpp",
"__split_buffer": "cpp",
"__threading_support": "cpp",
"__tuple": "cpp",
"array": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"locale": "cpp",
"mutex": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"__bits": "cpp",
"__tree": "cpp",
"map": "cpp",
"numeric": "cpp",
"set": "cpp",
"__memory": "cpp",
"memory_resource": "cpp"
},
"go.logging.level": "off",
"cmake.configureOnOpen": false
}

28
.vscode/tasks.json vendored
View File

@@ -3,9 +3,17 @@
"tasks": [
{
"label": "build",
"type": "shell",
"command": "zig build",
"type": "process",
"command": "zig",
"args": ["build"],
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"group": {
"kind": "build",
"isDefault": true
@@ -26,7 +34,15 @@
"label": "test",
"type": "shell",
"command": "zig",
"args": ["test", "${file}", "-femit-bin=zig-cache/bin/test"],
"args": [
"test",
"${file}",
"--main-pkg-path",
"${workspaceFolder}",
"-femit-bin=${workspaceFolder}/zig-out/bin/test",
";",
"true"
],
"group": {
"kind": "test",
@@ -34,7 +50,9 @@
},
"presentation": {
"showReuseMessage": false,
"clear": true
"clear": true,
"panel": "new",
"reveal": "always"
}
}
]

260
Makefile Normal file
View File

@@ -0,0 +1,260 @@
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 build-obj bun-link-lld-release
vendor: api node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp jsc
build-obj:
zig build obj -Drelease-fast
sign-macos-x64:
gon sign.macos-x64.json
sign-macos-aarch64:
gon sign.macos-aarch64.json
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
fallback_decoder:
@esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.js
runtime_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_STEPS)
jsc-bindings: jsc-bindings-headers jsc-bindings-mac
jsc-bindings-headers:
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 \;
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:
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
JSC_FILES := src/deps/libJavaScriptCore.a \
src/deps/libWTF.a \
src/deps/libbmalloc.a
ifeq ($(OS_NAME),darwin)
HOMEBREW_PREFIX := $(shell brew --prefix)/
endif
SRC_DIR := src/javascript/jsc/bindings
OBJ_DIR := src/javascript/jsc/bindings-obj
SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))
INCLUDE_DIRS := -Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders \
-Isrc/javascript/jsc/WebKit/WebKitBuild/Release/WTF/Headers \
-Isrc/javascript/jsc/WebKit/WebKitBuild/Release/ICU/Headers \
-Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/ \
-Isrc/JavaScript/jsc/bindings/ \
-Isrc/javascript/jsc/WebKit/Source/bmalloc
CLANG_FLAGS := $(INCLUDE_DIRS) \
-std=gnu++1z \
-stdlib=libc++ \
-DSTATICALLY_LINKED_WITH_JavaScriptCore=1 \
-DSTATICALLY_LINKED_WITH_WTF=1 \
-DBUILDING_WITH_CMAKE=1 \
-DNDEBUG=1 \
-DNOMINMAX \
-DIS_BUILD \
-g \
-DENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=0 \
-DBUILDING_JSCONLY__ \
-DASSERT_ENABLED=0\
-DDU_DISABLE_RENAMING=1
jsc-bindings-mac: $(OBJ_FILES)
MACOS_ICU_FILES := $(HOMEBREW_PREFIX)opt/icu4c/lib/libicudata.a \
$(HOMEBREW_PREFIX)opt/icu4c/lib/libicui18n.a \
$(HOMEBREW_PREFIX)opt/icu4c/lib/libicuuc.a
MACOS_ICU_INCLUDE := $(HOMEBREW_PREFIX)opt/icu4c/include
MACOS_ICU_FLAGS := -l icucore \
$(MACOS_ICU_FILES) \
-I$(MACOS_ICU_INCLUDE)
BUN_LLD_FLAGS := $(OBJ_FILES) \
${MACOS_ICU_FLAGS} \
${JSC_FILES} \
src/deps/picohttpparser.o \
src/deps/mimalloc/libmimalloc.a \
$(CLANG_FLAGS) \
-fpie \
mimalloc:
cd src/deps/mimalloc; cmake .; make;
bun-link-lld-debug:
$(CXX) $(BUN_LLD_FLAGS) \
$(DEBUG_BIN)/bun-debug.o \
-Wl,-dead_strip \
-ftls-model=local-exec \
-flto \
-o $(DEBUG_BIN)/bun-debug
bun-link-lld-release:
$(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:
$(CXX) $(BUN_LLD_FLAGS) \
build/macos-aarch64/bun.o \
-o build/macos-aarch64/bun \
-Wl,-dead_strip \
-ftls-model=local-exec \
-flto \
-O3
# 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
$(CXX) -c -o $@ $< \
$(CLANG_FLAGS) \
-O1
sizegen:
$(CXX) src/javascript/jsc/headergen/sizegen.cpp -o /tmp/sizegen $(CLANG_FLAGS) -O1
/tmp/sizegen > src/javascript/jsc/bindings/sizes.zig
picohttp:
$(CC) -O3 -g -c src/deps/picohttpparser.c -Isrc/deps -o src/deps/picohttpparser.o; cd ../../

655
README.md
View File

@@ -1,181 +1,600 @@
# esdev
# Bun
Incredibly fast ECMAScript & TypeScript bundler designed for development.
Bun is a new:
## Motivation
- JavaScript/TypeScript/JSX transpiler
- JavaScript & CSS bundler
- Development server with 60fps Hot Module Reloading (& WIP support for React Fast Refresh)
- JavaScript Runtime Environment (powered by JavaScriptCore, what WebKit/Safari uses)
JavaScript bundlers run very slow in web browsers.
All in one fast &amp; easy-to-use tool. Instead of 1,000 node_modules for development, you only need Bun.
## Purpose
**Bun is experimental software**. Join [Bun's Discord](https://bun.sh/discord) for help and have a look at [things that don't work yet](#things-that-dont-work-yet).
The purpose of esdev is to very quickly convert ECMAScript/TypeScript into something a web browser can execute.
## Install:
Goals:
```
# Global install is recommended so bun appears in your $PATH
npm install -g bun-cli
```
- Transpile fast inside a web browser. "Fast" is defined as "<= 3ms per un-minified file up to 1000 LOC" without build caching (FS cache yes).
- Transpile JSX to ECMAScript
- Remove TypeScript annotations
- Conditionally support React Fast Refresh
- Rewrite CommonJS/SystemJS/UMD imports and exports to ESM
- Support most of tsconfig.json/jsconfig.json
- Support `defines` like in esbuild
- Support esbuild plugins
- Support importing CSS files from JavaScript
- Tree-shaking
### Getting started
Non-goals:
## Using Bun with Next.js
- Bundling for production
- Minification
- AST plugins
- Support Node.js
- CommonJS, UMD, IIFE
- ES6 to ES5
- Supporting non-recent versions of Chromium, Firefox, or Safari. (No IE)
In your project folder root (where `package.json` is):
## How it works
```bash
npm install -D bun-framework-next
bun bun --use next
bun
```
Much of the code is a line-for-line port of esbuild to Zig, with a few important differences.
Many of Next.js' features are supported, but not all.
### Implementation differences
Here's what doesn't work yet:
#### Moar lookup tables
- `getStaticPaths`
- same-origin `fetch` inside of `getStaticProps` or `getServerSideProps`
- locales, zones, `assetPrefix` (workaround: change `--origin \"http://localhsot:3000/assetPrefixInhere\"`)
- `next/image` is polyfilled to a regular `<img src>` tag.
- `proxy` and anything else in `next.config.js`
- API, catch-all &amp; catch-all fallback routes. Dynamic routes _are_ supported.
### Why not just use esbuild?
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`.
#### Missing features
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.
- Hot Module Reloading
- Rewrite CommonJS/SystemJS/UMD imports and exports to ESM
- React Fast Refresh
## Using Bun with single page apps
#### Go WASM performance isn't great.
In your project folder root (where `package.json` is):
There's a number of reasons for this:
```bash
bun bun ./entry-point-1.js ./entry-point-2.jsx
bun
```
- Unlike native targets, Go's WASM target runs the garbage collector on the same thread as the application. Since this usecase is very constrained (no need for shared memory, or long-term objects), rewriting in Zig lets us get away with a bump allocator -- skipping garbage collection entirely. This is faster than what Go does and possibly Rust, since this zeroes out the heap in one call at the end, rather than progressively zeroing memory.
- Goroutines cross the JS<>WASM binding, which is very slow. The more goroutines you use, the slower your code runs. When building a Zig project in single-threaded mode, Zig's `comptime` feature compiles away most of the difference.
- Slow startup time: unless you use TinyGo, Go WASM binaries are > 2 MB. In esbuild's case, at the time of writing its 6 MB. That's a lot of code for the web browser to download & compile.
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.
#### Different constraints enable performance improvements
Here are examples of routing from `public/` and how they're matched:
| 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 |
If bundler means "merge N source files into 1 or few source file(s)", esdev is most definitely not a bundler. Unlike most bundlers today, esdev deliberately outputs
If `public/index.html` exists, it becomes the default page instead of a 404 page, unless that pathname has a file extension.
If bundler means "turn my development code into something a browser can run",
#### Using Bun with Create React App
### Compatibility Table
To use Bun with `create-react-app`, there are two changes you will need to make in `public/index.html`:
| Feature | esbuild | esdev |
| ------------------------------------ | ------- | ----- |
| JSX (transform) | ✅ | ⌛ |
| TypeScript (transform) | ✅ | ⌛ |
| React Fast Refresh | ❌ | ⌛ |
| Hot Module Reloading | ❌ | ⌛ |
| Minification | ✅ | ❌ |
| Tree Shaking | ✅ | ⌛ |
| Incremental builds | ✅ | ⌛ |
| CSS | ✅ | 🗓️ |
| Expose CSS dependencies per file | ✅ | 🗓️ |
| CommonJS, IIFE, UMD outputs | ✅ | ❌ |
| Node.js build target | ✅ | ❌ |
| Code Splitting | ✅ | ⌛ |
| Browser build target | ✅ | ⌛ |
| Bundling for production | ✅ | ❌ |
| Support older browsers | ✅ | ❌ |
| Plugins | ✅ | 🗓️ |
| AST Plugins | ❌ | ❌ |
| Filesystem Cache API (for plugins) | ❓ | 🗓️ |
| Transform to ESM with `bundle` false | ❓ | ⌛ |
1. Replace `%PUBLIC_URL%` with `/`
2. Insert `<script type="module" async src="/src/index.js">` just before `</body>`
Key:
These changes are (sadly) necessary until Bun supports parsing &amp; transpiling HTML.
| Tag | Meaning |
| --- | ------------------------------------------ |
| ✅ | Compatible |
| ❌ | Not supported, and no plans to change that |
| ⌛ | In-progress |
| 🗓️ | Planned but work has not started |
| ❓ | Unknown |
In your project folder root (where `package.json` is):
#### Notes
```bash
bun bun ./src/index.js
bun
```
##### Hot Module Reloading & React Fast Refresh
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).
esdev exposes a runtime API to support Hot Module Reloading and React Fast Refresh. React Fast Refresh depends on Hot Module Reloading to work, but you can turn either of them off. esdev itself doesn't serve bundled files, it's up to the development server to provide that.
Here are examples of routing source code file paths:
##### Code Splitting
| 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 |
esdev supports code splitting the way browsers do natively: through ES Modules. This works great for local development files. It doesn't work great for node_modules or for production due to the sheer number of network requests. There are plans to make this better, stay tuned.
You do not need to include file extensions in `import` paths. CommonJS-style import paths without the file extension works.
##### Support older browsers
You can override the public directory by passing `--public-dir="path-to-folder"`.
To simplify the parser, esdev doesn't support lowering features to non-current browsers. This means if you run a development build with esdev with, for example, optional chaining, it won't work in Internet Explorer 11. If you want to support older browsers, use a different tool.
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.
#### Implementation Notes
## Using Bun with TypeScript
##### HMR & Fast Refresh implementation
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.
This section only applies when Hot Module Reloading is enabled. When it's off, none of this part runs. React Fast Refresh depends on Hot Module Reloading.
Bun also reads `tsconfig.json`, including `baseUrl` and `paths`.
###### What is hot module reloading?
## Using Tailwind with Bun
HMR: "hot module reloading"
[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.
A lot of developers know what it does -- but what actually is it and how does it work? Essentially, it means when a source file changes, automatically reload the code without reloading the web page.
Tailwind's docs talk more about [Tailwind's CLI usage](https://tailwindcss.com/docs/installation#watching-for-changes), but the gist is you'll want to run this:
A big caveat here is JavaScript VMs don't expose an API to "unload" parts of the JavaScript context. In all HMR implementations, What really happens is this:
```bash
npx tailwindcss -i ./src/tailwind.css -o ./dist/tailwind.css --watch
```
1. Load a new copy of the code that changed
2. Update references to the old code to point to the new code
3. Handle errors
From there, make sure to import the `dist/tailwind.css` file (or what you chose as the output).
The old code still lives there, in your browser's JavaScript VM until the page is refreshed. If any past references are kept (side effects!), undefined behavior happens. That's why, historically (by web standards), HMR has a reputation for being buggy.
## Things that don't work yet
Loading code is easy. The hard parts are updating references and handling errors.
Bun is a project with incredibly large scope, and it's early days.
There are two ways to update references:
| Feature | In |
| ---------------------------------------------------------------------------------------------------------------------- | -------------- |
| ~Symlinks~ | Resolver |
| [Finish Fast Refresh](https://github.com/Jarred-Sumner/bun/issues/18) | JSX Transpiler |
| Source Maps | JavaScript |
| Source Maps | CSS |
| [Private Class Fields](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields) | JS Transpiler |
| [Import Assertions](https://github.com/tc39/proposal-import-assertions) | JS Transpiler |
| [`extends`](https://www.typescriptlang.org/tsconfig#extends) in tsconfig.json | TS Transpiler |
| [jsx](https://www.typescriptlang.org/tsconfig)\* in tsconfig.json | TS Transpiler |
| [TypeScript Decorators](https://www.typescriptlang.org/docs/handbook/decorators.html) | TS Transpiler |
| `@jsxPragma` comments | JS Transpiler |
| JSX source file name | JS Transpiler |
| Sharing `.bun` files | Bun |
| [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 |
- Update all module imports
- Update the exports
<sup>JS Transpiler == JavaScript Transpiler</sup><br/>
<sup>TS Transpiler == TypeScript Transpiler</sup><br/>
<sup>Bun.js == Bun's JavaScriptCore integration that executes JavaScript. Similar to how Node.js & Deno embed V8.</sup><br/>
Either approach works.
### Limitations & intended usage
###### How it's implemented in esdev
Bun is great for building websites &amp; 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.
At build time, esdev replaces all import URLs with import manifests that wrap the real module.
Today, Bun is focused on:
In the simple case, that looks like this:
- 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
A loader determines how to map imports &amp; file extensions to transforms and output.
Currently, Bun implements the following loaders:
| Input | Loader | Output |
| ----- | ----------------------------- | ------ |
| .js | JSX + JavaScript | .js |
| .jsx | JSX + JavaScript | .js |
| .ts | TypeScript + JavaScript | .js |
| .tsx | TypeScript + JSX + JavaScript | .js |
| .mjs | JavaScript | .js |
| .css | CSS | .css |
| .env | Env | N/A |
| .\* | file | string |
Everything else is treated as `file`. `file` replaces the import with a URL (or a path).
You can configure which loaders map to which extensions by passing `--loaders` to `bun`. For example:
```
bun --loader=.js:js
```
This will disable JSX transforms for `.js` files.
#### CSS in JS
When importing CSS in JavaScript-like loaders, CSS is treated special.
By default, Bun will transform a statement like this:
```js
import "../styles/global.css";
```
##### When `platform` is `browser`:
```js
globalThis.document?.dispatchEvent(
new CustomEvent("onimportcss", {
detail: "http://localhost:3000/styles/globals.css",
})
);
```
An event handler for turning that into a `<link>` is automatically registered when HMR is enabled. That event handler can be turned off either in a framework's `package.json` or by setting `globalThis["Bun_disableCSSImports"] = true;` in client-side code. Additionally, you can get a list of every .css file imported this way via `globalThis["__BUN"].allImportedStyles`.
##### When `platform` is `bun`:
```js
//@import url("http://localhost:3000/styles/globals.css");
```
Additionally, Bun exposes an API for SSR/SSG that returns a flat list of URLs to css files imported. That function is `Bun.getImportedStyles()`.
```ts
import { Button as _Button } from "http://localhost:3000/src/components/button.KXk23UX3.js";
addEventListener("fetch", async (event: FetchEvent) => {
var route = Bun.match(event);
const App = await import("pages/_app");
export let Button = _Button;
// This returns all .css files that were imported in the line above.
// It's recursive, so any file that imports a CSS file will be included.
const appStylesheets = Bun.getImportedStyles();
import.meta.onUpdate(import.meta.url, (exports) => {
if ("Button" in exports) {
Button = exports["Button"];
}
// ...rest of code
});
```
Then, lets say you updated `button.tsx` from this:
This is useful for preventing flash of unstyled content.
```tsx
export const Button = ({ children }) => (
<div className="Button">{children}</div>
);
### CSS Loader
Bun bundles `.css` files imported via `@import` into a single file. It doesn't autoprefix or minify CSS today. Multiple `.css` files imported in one JavaScript file will _not_ be bundled into one file. You'll have to import those from a `.css` file.
This input:
```css
@import url("./hi.css");
@import url("./hello.css");
@import url("./yo.css");
```
To this:
Becomes:
```tsx
export const Button = ({ children }) => (
<div className="Button">
<div className="Button-label">{children}</div>
</div>
);
```css
/* hi.css */
/* ...contents of hi.css */
/* hello.css */
/* ...contents of hello.css */
/* yo.css */
/* ...contents of yo.css */
```
This triggers the HMR client in esdev to:
#### CSS runtime
1. import `/src/components/button.js` once again
To support hot CSS reloading, Bun inserts `@supports` annotations into CSS that tag which files a stylesheet is composed of. Browsers ignore this, so it doesn't impact styles.
By default, Bun's runtime code automatically listens to `onimportcss` and will insert the `event.detail` into a `<link rel="stylesheet" href={${event.detail}}>` if there is no existing `link` tag with that stylesheet. That's how Bun's equivalent of `style-loader` works.
### Frameworks
Frameworks preconfigure Bun to enable developers to use Bun with their existing tooling.
Frameworks are configured via the `framework` object in the `package.json` of the framework (not in the application's `package.json`):
Here is an example:
```json
{
"name": "bun-framework-next",
"version": "0.0.0-18",
"description": "",
"framework": {
"displayName": "Next.js",
"static": "public",
"assetPrefix": "_next/",
"router": {
"dir": ["pages", "src/pages"],
"extensions": [".js", ".ts", ".tsx", ".jsx"]
},
"css": "onimportcss",
"development": {
"client": "client.development.tsx",
"fallback": "fallback.development.tsx",
"server": "server.development.tsx",
"css": "onimportcss",
"define": {
"client": {
".env": "NEXT_PUBLIC_",
"defaults": {
"process.env.__NEXT_TRAILING_SLASH": "false",
"process.env.NODE_ENV": "\"development\"",
"process.env.__NEXT_ROUTER_BASEPATH": "''",
"process.env.__NEXT_SCROLL_RESTORATION": "false",
"process.env.__NEXT_I18N_SUPPORT": "false",
"process.env.__NEXT_HAS_REWRITES": "false",
"process.env.__NEXT_ANALYTICS_ID": "null",
"process.env.__NEXT_OPTIMIZE_CSS": "false",
"process.env.__NEXT_CROSS_ORIGIN": "''",
"process.env.__NEXT_STRICT_MODE": "false",
"process.env.__NEXT_IMAGE_OPTS": "null"
}
},
"server": {
".env": "NEXT_",
"defaults": {
"process.env.__NEXT_TRAILING_SLASH": "false",
"process.env.__NEXT_OPTIMIZE_FONTS": "false",
"process.env.NODE_ENV": "\"development\"",
"process.env.__NEXT_OPTIMIZE_IMAGES": "false",
"process.env.__NEXT_OPTIMIZE_CSS": "false",
"process.env.__NEXT_ROUTER_BASEPATH": "''",
"process.env.__NEXT_SCROLL_RESTORATION": "false",
"process.env.__NEXT_I18N_SUPPORT": "false",
"process.env.__NEXT_HAS_REWRITES": "false",
"process.env.__NEXT_ANALYTICS_ID": "null",
"process.env.__NEXT_CROSS_ORIGIN": "''",
"process.env.__NEXT_STRICT_MODE": "false",
"process.env.__NEXT_IMAGE_OPTS": "null",
"global": "globalThis",
"window": "undefined"
}
}
}
}
}
}
```
Here are type definitions:
```ts
type Framework = Environment & {
// This changes what's printed in the console on load
displayName?: string;
// This allows a prefix to be added (and ignored) to requests.
// Useful for integrating an existing framework that expects internal routes to have a prefix
// e.g. "_next"
assetPrefix?: string;
development?: Environment;
production?: Environment;
// The directory used for serving unmodified assets like fonts and images
// Defaults to "public" if exists, else "static", else disabled.
static?: string;
// "onimportcss" disables the automatic "onimportcss" feature
// If the framework does routing, you may want to handle CSS manually
// "facade" removes CSS imports from JavaScript files,
// and replaces an imported object with a proxy that mimics CSS module support without doing any class renaming.
css?: "onimportcss" | "facade";
// Bun's filesystem router
router?: Router;
};
type Define = {
// By passing ".env", Bun will automatically load .env.local, .env.development, and .env if exists in the project root
// (in addition to the processes' environment variables)
// When "*", all environment variables will be automatically injected into the JavaScript loader
// When a string like "NEXT_PUBLIC_", only environment variables starting with that prefix will be injected
".env": string | "*";
// These environment variables will be injected into the JavaScript loader
// These are the equivalent of Webpack's resolve.alias and esbuild's --define.
// Values are parsed as JSON, so they must be valid JSON. The only exception is '' is a valid string, to simplify writing stringified JSON in JSON.
// If not set, `process.env.NODE_ENV` will be transformed into "development".
defaults: Record<string, string>;
};
type Environment = {
// This is a wrapper for the client-side entry point for a route.
// This allows frameworks to run initialization code on pages.
client: string;
// This is a wrapper for the server-side entry point for a route.
// This allows frameworks to run initialization code on pages.
server: string;
// This runs when "server" code fails to load due to an exception.
fallback: string;
// This is how environment variables and .env is configured.
define?: Define;
};
// Bun's filesystem router
// Currently, Bun supports pages by either an absolute match or a parameter match.
// pages/index.tsx will be executed on navigation to "/" and "/index"
// pages/posts/[id].tsx will be executed on navigation to "/posts/123"
// Routes & parameters are automatically passed to `fallback` and `server`.
type Router = {
// This determines the folder to look for pages
dir: string[];
// These are the allowed file extensions for pages.
extensions?: string[];
};
```
To use a framework, you pass `bun bun --use package-name`.
Your framework's package.json `name` should start with `bun-framework-`. This is so that people can type something like `bun bun --use next` and it will check `bun-framework-next` first. This is similar to how Babel plugins tend to start with `babel-plugin-`.
For developing frameworks, you can also do `bun bun --use ./relative-path-to-framework`.
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.
# License
Bun itself is MIT-licensed.
However, JavaScriptCore (and WebKit) is LGPL-2 and Bun statically links it.
Per LGPL2:
> (1) If you statically link against an LGPL'd library, you must also provide your application in an object (not necessarily source) format, so that a user has the opportunity to modify the library and relink the application.
You can find the patched version of WebKit used by Bun here: https://github.com/jarred-sumner/webkit. If you would like to relink Bun with changes:
- `git submodule update --init --recursive`
- `make jsc`
- `zig build`
This compiles JavaScriptCore, compiles Bun's `.cpp` bindings for JavaScriptCore (which are the object files using JavaScriptCore) and outputs a new `bun` binary with your changes.
To successfully run `zig build`, you will need to install a patched version of Zig available here: https://github.com/jarred-sumner/zig/tree/jarred/zig-sloppy.
Bun also statically links these libraries:
- `libicu`, which can be found here: https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE
- [`picohttp`](https://github.com/h2o/picohttpparser), which is dual-licensed under the Perl License or the MIT License
- [`mimalloc`](https://github.com/microsoft/mimalloc), which is MIT licensed
For compatibiltiy reasons, these NPM packages are embedded into Bun's binary and injected if imported.
- [`assert`](https://npmjs.com/package/assert) (MIT license)
- [`browserify-zlib`](https://npmjs.com/package/browserify-zlib) (MIT license)
- [`buffer`](https://npmjs.com/package/buffer) (MIT license)
- [`constants-browserify`](https://npmjs.com/package/constants-browserify) (MIT license)
- [`crypto-browserify`](https://npmjs.com/package/crypto-browserify) (MIT license)
- [`domain-browser`](https://npmjs.com/package/domain-browser) (MIT license)
- [`events`](https://npmjs.com/package/events) (MIT license)
- [`https-browserify`](https://npmjs.com/package/https-browserify) (MIT license)
- [`os-browserify`](https://npmjs.com/package/os-browserify) (MIT license)
- [`path-browserify`](https://npmjs.com/package/path-browserify) (MIT license)
- [`process`](https://npmjs.com/package/process) (MIT license)
- [`punycode`](https://npmjs.com/package/punycode) (MIT license)
- [`querystring-es3`](https://npmjs.com/package/querystring-es3) (MIT license)
- [`stream-browserify`](https://npmjs.com/package/stream-browserify) (MIT license)
- [`stream-http`](https://npmjs.com/package/stream-http) (MIT license)
- [`string_decoder`](https://npmjs.com/package/string_decoder) (MIT license)
- [`timers-browserify`](https://npmjs.com/package/timers-browserify) (MIT license)
- [`tty-browserify`](https://npmjs.com/package/tty-browserify) (MIT license)
- [`url`](https://npmjs.com/package/url) (MIT license)
- [`util`](https://npmjs.com/package/util) (MIT license)
- [`vm-browserify`](https://npmjs.com/package/vm-browserify) (MIT license)
# Developing Bun
Estimated: 30-90 minutes :(
Compile Zig:
```bash
git clone https://github.com/jarred-sumner/zig
cd zig
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
```
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`:
```bash
git submodule update --init --recursive --progress --depth=1
make vendor
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.

1
build-id Normal file
View File

@@ -0,0 +1 @@
22

362
build.zig
View File

@@ -1,28 +1,297 @@
const std = @import("std");
const resolve_path = @import("./src/resolver/resolve_path.zig");
pub fn build(b: *std.build.Builder) void {
pub fn addPicoHTTP(step: *std.build.LibExeObjStep, comptime with_obj: bool) void {
const picohttp = step.addPackage(.{
.name = "picohttp",
.path = .{ .path = "src/deps/picohttp.zig" },
});
_ = step.addPackage(.{
.name = "iguanaTLS",
.path = .{ .path = "src/deps/iguanaTLS/src/main.zig" },
});
step.addIncludeDir("src/deps");
if (with_obj) {
step.addObjectFile("src/deps/picohttpparser.o");
}
// step.add("/Users/jarred/Code/WebKit/WebKitBuild/Release/lib/libWTF.a");
// ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON"
// set -gx ICU_INCLUDE_DIRS "/usr/local/opt/icu4c/include"
// homebrew-provided icu4c
}
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
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
var cwd_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const cwd: []const u8 = b.pathFromRoot(".");
var exe: *std.build.LibExeObjStep = undefined;
if (target.getCpuArch().isWasm()) {
exe = b.addExecutable("esdev", "src/main_wasm.zig");
} else {
exe = b.addExecutable("esdev", "src/main.zig");
var output_dir_buf = std.mem.zeroes([4096]u8);
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_executable_name, "src/main_wasi.zig");
exe.linkage = .dynamic;
exe.setOutputDir(output_dir);
} else if (target.getCpuArch().isWasm()) {
// exe = b.addExecutable(
// "bun",
// "src/main_wasm.zig",
// );
// exe.is_linking_libc = false;
// exe.is_dynamic = true;
var lib = b.addExecutable(bun_executable_name, "src/main_wasm.zig");
lib.single_threaded = true;
// exe.want_lto = true;
// exe.linkLibrary(lib);
if (mode == std.builtin.Mode.Debug) {
// exception_handling
var features = target.getCpuFeatures();
features.addFeature(2);
target.updateCpuFeatures(&features);
} else {
// lib.strip = true;
}
lib.setOutputDir(output_dir);
lib.want_lto = true;
b.install_path = lib.getOutputSource().getPath(b);
std.debug.print("Build: ./{s}\n", .{b.install_path});
b.default_step.dependOn(&lib.step);
b.verbose_link = true;
lib.setTarget(target);
lib.setBuildMode(mode);
std.fs.deleteTreeAbsolute(std.fs.path.join(b.allocator, &.{ cwd, lib.getOutputSource().getPath(b) }) catch unreachable) catch {};
var install = b.getInstallStep();
lib.strip = false;
lib.install();
const run_cmd = lib.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
return;
} else {
exe = b.addExecutable(bun_executable_name, "src/main.zig");
}
// exe.setLibCFile("libc.txt");
exe.linkLibC();
// exe.linkLibCpp();
exe.addPackage(.{
.name = "clap",
.path = .{ .path = "src/deps/zig-clap/clap.zig" },
});
exe.setOutputDir(output_dir);
var cwd_dir = std.fs.cwd();
if (std.builtin.is_test) {
var walker = cwd_dir.walk(std.heap.c_allocator) catch unreachable;
while (walker.next() catch unreachable) |entry| {
if (std.mem.endsWith(u8, entry.basename, "_test.zig")) {
std.debug.print("[test] Added {s}", .{entry.basename});
_ = b.addTest(entry.path);
}
}
}
const runtime_hash = std.hash.Wyhash.hash(0, @embedFile("./src/runtime.out.js"));
const runtime_version_file = std.fs.cwd().openFile("src/runtime.version", .{ .write = true }) catch unreachable;
runtime_version_file.writer().print("{x}", .{runtime_hash}) catch unreachable;
defer runtime_version_file.close();
const fallback_hash = std.hash.Wyhash.hash(0, @embedFile("./src/fallback.out.js"));
const fallback_version_file = std.fs.cwd().openFile("src/fallback.version", .{ .write = true }) catch unreachable;
fallback_version_file.writer().print("{x}", .{fallback_hash}) catch unreachable;
defer fallback_version_file.close();
exe.setTarget(target);
exe.setBuildMode(mode);
b.install_path = output_dir;
exe.addLibPath("/usr/local/lib");
exe.install();
var javascript = b.addExecutable("spjs", "src/main_javascript.zig");
var typings_exe = b.addExecutable("typescript-decls", "src/javascript/jsc/typescript.zig");
javascript.setMainPkgPath(b.pathFromRoot("."));
typings_exe.setMainPkgPath(b.pathFromRoot("."));
exe.setMainPkgPath(b.pathFromRoot("."));
// exe.want_lto = true;
if (!target.getCpuArch().isWasm()) {
b.default_step.dependOn(&exe.step);
const bindings_dir = std.fs.path.join(
b.allocator,
&.{
cwd,
"src",
"javascript",
"jsc",
"bindings-obj",
},
) catch unreachable;
var bindings_dir_ = cwd_dir.openDir(bindings_dir, .{ .iterate = true }) catch unreachable;
var bindings_walker = bindings_dir_.walk(b.allocator) catch unreachable;
var bindings_files = std.ArrayList([]const u8).init(b.allocator);
while (bindings_walker.next() catch unreachable) |entry| {
if (std.mem.eql(u8, std.fs.path.extension(entry.basename), ".o")) {
bindings_files.append(bindings_dir_.realpathAlloc(b.allocator, entry.path) catch unreachable) catch unreachable;
}
}
// // References:
// // - https://github.com/mceSystems/node-jsc/blob/master/deps/jscshim/webkit.gyp
// // - https://github.com/mceSystems/node-jsc/blob/master/deps/jscshim/docs/webkit_fork_and_compilation.md#webkit-port-and-compilation
// const flags = [_][]const u8{
// "-Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders",
// "-Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/WTF/Headers",
// "-Isrc/javascript/jsc/WebKit/WebKitBuild/Release/ICU/Headers",
// "-DSTATICALLY_LINKED_WITH_JavaScriptCore=1",
// "-DSTATICALLY_LINKED_WITH_WTF=1",
// "-DBUILDING_WITH_CMAKE=1",
// "-DNOMINMAX",
// "-DENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=0",
// "-DBUILDING_JSCONLY__",
// "-DASSERT_ENABLED=0", // missing symbol errors like this will happen "JSC::DFG::DoesGCCheck::verifyCanGC(JSC::VM&)"
// "-Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/", // config.h,
// "-Isrc/JavaScript/jsc/bindings/",
// "-Isrc/javascript/jsc/WebKit/Source/bmalloc",
// "-std=gnu++17",
// if (target.getOsTag() == .macos) "-DUSE_FOUNDATION=1" else "",
// if (target.getOsTag() == .macos) "-DUSE_CF_RETAIN_PTR=1" else "",
// };
const headers_step = b.step("headers", "JSC headers");
var headers_exec: *std.build.LibExeObjStep = b.addExecutable("headers", "src/javascript/jsc/bindings/bindings-generator.zig");
var headers_runner = headers_exec.run();
headers_exec.setMainPkgPath(javascript.main_pkg_path.?);
headers_step.dependOn(&headers_runner.step);
var translate_c: *std.build.TranslateCStep = b.addTranslateC(.{ .path = b.pathFromRoot("src/javascript/jsc/bindings/headers.h") });
translate_c.out_basename = "headers";
translate_c.output_dir = b.pathFromRoot("src/javascript/jsc/bindings/");
headers_step.dependOn(&translate_c.step);
headers_zig_file = b.pathFromRoot("src/javascript/jsc/bindings/headers.zig");
original_make_fn = headers_step.makeFn;
headers_step.makeFn = HeadersMaker.make;
b.default_step.dependOn(&exe.step);
var steps = [_]*std.build.LibExeObjStep{ exe, javascript, typings_exe, headers_exec };
// const single_threaded = b.option(bool, "single-threaded", "Build single-threaded") orelse false;
for (steps) |step, i| {
step.linkLibC();
step.linkLibCpp();
addPicoHTTP(
step,
true,
);
step.addObjectFile("src/deps/libJavaScriptCore.a");
step.addObjectFile("src/deps/libWTF.a");
step.addObjectFile("src/deps/libbmalloc.a");
step.addObjectFile("src/deps/mimalloc/libmimalloc.a");
step.addLibPath("src/deps/mimalloc");
step.addIncludeDir("src/deps/mimalloc");
// step.single_threaded = single_threaded;
if (target.getOsTag() == .macos) {
const homebrew_prefix = comptime if (std.Target.current.cpu.arch == .aarch64)
"/opt/homebrew/"
else
"/usr/local/";
// We must link ICU statically
step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicudata.a");
step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicui18n.a");
step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicuuc.a");
// icucore is a weird macOS only library
step.linkSystemLibrary("icucore");
step.addLibPath(homebrew_prefix ++ "opt/icu4c/lib");
step.addIncludeDir(homebrew_prefix ++ "opt/icu4c/include");
}
for (bindings_files.items) |binding| {
step.addObjectFile(
binding,
);
}
}
var obj_step = b.step("obj", "Build Bun as a .o file");
var obj = b.addObject(bun_executable_name, exe.root_src.?.path);
obj.bundle_compiler_rt = true;
addPicoHTTP(obj, false);
obj.addPackage(.{
.name = "clap",
.path = .{ .path = "src/deps/zig-clap/clap.zig" },
});
obj_step.dependOn(&obj.step);
obj.setOutputDir(output_dir);
obj.setBuildMode(mode);
obj.setTarget(target);
} else {
b.default_step.dependOn(&exe.step);
}
javascript.strip = false;
javascript.packages = std.ArrayList(std.build.Pkg).fromOwnedSlice(b.allocator, b.allocator.dupe(std.build.Pkg, exe.packages.items) catch unreachable);
javascript.setOutputDir(output_dir);
javascript.setBuildMode(mode);
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
@@ -32,4 +301,81 @@ 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_executable_name });
log_step.step.dependOn(&exe.step);
var typings_cmd: *std.build.RunStep = typings_exe.run();
typings_cmd.cwd = cwd;
typings_cmd.addArg(cwd);
typings_cmd.addArg("types");
typings_cmd.step.dependOn(&typings_exe.step);
typings_exe.linkLibC();
typings_exe.linkLibCpp();
typings_exe.setMainPkgPath(cwd);
var typings_step = b.step("types", "Build TypeScript types");
typings_step.dependOn(&typings_cmd.step);
var javascript_cmd = b.step("spjs", "Build standalone JavaScript runtime. Must run \"make jsc\" first.");
javascript_cmd.dependOn(&javascript.step);
}
pub var original_make_fn: ?fn (step: *std.build.Step) anyerror!void = null;
pub var headers_zig_file: ?[]const u8 = null;
const HeadersMaker = struct {
pub fn make(self: *std.build.Step) anyerror!void {
try original_make_fn.?(self);
var headers_zig: std.fs.File = try std.fs.openFileAbsolute(headers_zig_file.?, .{ .write = true });
var contents = try headers_zig.readToEndAlloc(std.heap.page_allocator, headers_zig.getEndPos() catch unreachable);
const last_extern_i = std.mem.lastIndexOf(u8, contents, "pub extern fn") orelse @panic("Expected contents");
const last_newline = std.mem.indexOf(u8, contents[last_extern_i..], "\n") orelse @panic("Expected newline");
const to_splice = "usingnamespace @import(\"./headers-replacements.zig\");\n";
var new_contents = try std.heap.page_allocator.alloc(u8, contents.len + to_splice.len);
std.mem.copy(u8, new_contents, to_splice);
std.mem.copy(u8, new_contents[to_splice.len..], contents);
var i: usize = to_splice.len;
var remainder = new_contents[i..];
while (remainder.len > 0) {
i = std.mem.indexOf(u8, remainder, "\npub const struct_b") orelse break + "\npub const struct_b".len;
var begin = remainder[i..];
const end_line = std.mem.indexOf(u8, begin, "extern struct {") orelse break;
const end_struct = std.mem.indexOf(u8, begin, "\n};\n") orelse break + "\n};\n".len;
std.mem.set(u8, begin[1 .. end_struct + 3], ' ');
remainder = begin[end_struct..];
}
i = to_splice.len;
remainder = new_contents[i..];
while (remainder.len > 0) {
i = std.mem.indexOf(u8, remainder, "\npub const struct_") orelse break + "\npub const struct_".len;
var begin = remainder[i..];
var end_struct = std.mem.indexOf(u8, begin, "opaque {};") orelse break;
end_struct += std.mem.indexOf(u8, begin[end_struct..], "\n") orelse break;
i = 0;
std.mem.set(u8, begin[1..end_struct], ' ');
remainder = begin[end_struct..];
}
const HARDCODE = [_][]const u8{
"[*c][*c]JSC__Exception",
"*?*JSC__Exception ",
"[*c]?*c_void",
"[*c]*c_void",
};
i = 0;
while (i < HARDCODE.len) : (i += 2) {
_ = std.mem.replace(u8, new_contents, HARDCODE[i], HARDCODE[i + 1], new_contents);
}
const js_value_start = std.mem.indexOf(u8, new_contents, "pub const JSC__JSValue") orelse unreachable;
const js_value_end = std.mem.indexOf(u8, new_contents[js_value_start..], "\n") orelse unreachable;
std.mem.set(u8, new_contents[js_value_start..][0..js_value_end], ' ');
try headers_zig.seekTo(0);
try headers_zig.writeAll(new_contents);
try headers_zig.setEndPos(last_newline + last_extern_i + to_splice.len);
}
};

14
entitlements.plist Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<link
rel="stylesheet"
crossorigin="anonymous"
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap"
/>
<link rel="stylesheet" href="src/index.css" />
<script async src="src/index.tsx" type="module"></script>
</head>
<body>
<div id="reactroot"></div>
</body>
</html>

View File

@@ -0,0 +1,2 @@
import React from "react";
export { React };

View File

@@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@@ -0,0 +1,37 @@
{
"name": "simple-react",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@emotion/css": "^11.1.3",
"@vitejs/plugin-react-refresh": "^1.3.3",
"antd": "^4.16.1",
"left-pad": "^1.3.0",
"next": "^11.0.1",
"parcel": "2.0.0-beta.3",
"path-browserify": "^1.0.1",
"react": "^17.0.2",
"react-bootstrap": "^1.6.1",
"react-dom": "^17.0.2",
"react-form": "^4.0.1",
"react-hook-form": "^7.8.3",
"url": "^0.11.0",
"wipwipwipwip-next-donotuse": "4.0.0"
},
"parcel": "parceldist/index.js",
"targets": {
"parcel": {
"outputFormat": "esmodule",
"sourceMap": false,
"optimize": false,
"engines": {
"chrome": "last 1 version"
}
}
},
"devDependencies": {
"@microsoft/fetch-event-source": "^2.0.1",
"@snowpack/plugin-react-refresh": "^2.5.0",
"typescript": "^4.3.4"
}
}

View File

@@ -0,0 +1,11 @@
import { Main } from "../../src/main";
function IndexRoute() {
return (
<div>
<Main productName={"Boom id"} />
</div>
);
}
export { IndexRoute as default };

View File

@@ -0,0 +1,12 @@
// import "../src/index.css";
import App from "next/app";
class MyApp extends App {
render() {
const { Component, pageProps } = this.props;
return <Component {...pageProps} />;
}
}
export default MyApp;

View File

@@ -0,0 +1,7 @@
import { Main } from "src/main";
export function IndexPage() {
return <Main />;
}
export default IndexPage;

View File

@@ -0,0 +1,9 @@
import { Main } from "../../src/main";
export default function IndexRoute() {
return (
<div>
<Main productName={"nested!"} />
</div>
);
}

View File

@@ -0,0 +1,13 @@
import { Main } from "../src/main";
export function getInitialProps() {
return {};
}
export default function IndexRoute() {
return (
<div>
<Main productName={"Page 2! Next.js (Webpack 5)"} />
</div>
);
}

View File

@@ -0,0 +1 @@
export { default as React } from "react";

View File

@@ -0,0 +1,21 @@
// Snowpack Configuration File
// See all supported options: https://www.snowpack.dev/reference/configuration
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
root: "src",
mount: {
public: "/",
src: "/",
},
plugins: ["@snowpack/plugin-react-refresh"],
packageOptions: {
/* ... */
},
devOptions: {
/* ... */
},
buildOptions: {
/* ... */
},
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
export const Button = ({ children }) => <div>asdasasd{children}</div>;

View File

@@ -0,0 +1,14 @@
:root {
--timestamp: "596";
--interval: "64";
--progress-bar: 33.167%;
--spinner-1-muted: rgb(42, 74, 66);
--spinner-1-primary: rgb(53, 93, 82);
--spinner-2-muted: rgb(90, 51, 192);
--spinner-2-primary: rgb(112, 64, 240);
--spinner-3-muted: rgb(157, 140, 68);
--spinner-3-primary: rgb(196, 175, 85);
--spinner-4-muted: rgb(86, 152, 66);
--spinner-4-primary: rgb(108, 190, 82);
--spinner-rotate: 237deg;
}

View File

@@ -0,0 +1,3 @@
body {
filter: sepia(50%) brightness(200%);
}

View File

@@ -0,0 +1,27 @@
import React from "react";
import { NewComponent } from "./new-comp";
const Toast = () => {
const [baconyes, baconno] = useBacon();
return <div>false</div>;
};
const Button = ({ label, label2, onClick }) => {
const useCustomHookInsideFunction = (what, arr) => {
return [true, false];
};
const [on, setOn] = React.useState(false);
React.useEffect(() => {
console.log({ on });
}, [on]);
// const [foo1, foo2] = useCustomHookInsideFunction(() => {}, [on]);
return (
<div className="Button" onClick={onClick}>
<Toast>f</Toast>
<div className="Button-label">{label}12</div>
<NewComponent />
</div>
);
};

View File

@@ -0,0 +1,3 @@
export const NewComponent = () => {
return <div>NEW!</div>;
};

View File

@@ -0,0 +1 @@
/* @import "https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap"; */

View File

@@ -0,0 +1,237 @@
@import "./colors.css";
:root {
--heading-font: "Space Mono", system-ui;
--body-font: "IBM Plex Sans", system-ui;
--color-brand: #02ff00;
--color-brand-muted: rgb(2, 150, 0);
--padding-horizontal: 90px;
--page-background: black;
--page-background-alpha: rgba(0, 0, 0, 0.8);
--result__background-color: black;
--result__primary-color: var(--color-brand);
--result__foreground-color: white;
--result__muted-color: rgb(165, 165, 165);
--card-width: 352px;
--page-width: 1152px;
--snippets_container-background-unfocused: #171717;
--snippets_container-background-focused: #0017e9;
--snippets_container-background: var(
--snippets_container-background-unfocused
);
--snippets_container-muted-color: rgb(153, 153, 153);
}
body {
color: white;
margin: 0;
padding: 0;
font-family: var(--body-font);
background-color: var(--page-background);
color: var(--result__muted-color);
display: flex;
flex-direction: column;
height: 100%;
}
.Subtitle {
text-align: center;
font-size: 4em;
margin: 0;
padding: 0;
margin-bottom: 0.25em;
align-items: center;
display: flex;
flex-direction: row;
}
#reactroot,
#__next,
body,
html {
height: 100%;
}
.Title {
color: var(--color-brand);
font-family: var(--heading-font);
font-weight: 700;
margin-top: 48px;
font-size: 48px;
text-transform: capitalize;
text-align: center;
}
.Description {
text-align: center;
}
.main {
display: flex;
flex-direction: column;
height: 100%;
}
header,
.main {
width: 650px;
margin: 0 auto;
}
section {
width: 650px;
}
header {
margin-bottom: 48px;
}
footer {
flex-shrink: 0;
}
#reactroot,
#__next {
display: flex;
flex-direction: column;
justify-content: center;
}
section {
height: 300px;
display: flex;
flex-direction: column;
}
.timer {
font-weight: normal;
}
.ProgressBar-container {
width: 100%;
display: block;
position: relative;
border: 1px solid var(--color-brand-muted);
border-radius: 4px;
height: 92px;
}
.ProgressBar {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
background-color: var(--color-brand);
transform-origin: top left;
border-radius: 4px;
transform: scaleX(var(--progress-bar, 0%));
}
.Bundler-container {
background-color: var(--snippets_container-background-focused);
font-size: 64px;
font-weight: bold;
color: white;
left: 0;
right: 0;
padding: 0.8em 0.8em;
}
.Bundler-updateRate {
font-size: 0.8em;
font-weight: normal;
display: flex;
color: var(--result__muted-color);
}
.interval:before {
content: var(--interval, "16");
}
.highlight {
margin-left: 0.5ch;
color: white;
}
.timer:after {
content: var(--timestamp);
font-variant-numeric: tabular-nums;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
display: inline;
font-weight: 500;
color: white;
width: 100%;
}
.SectionLabel {
font-weight: 300;
font-family: var(--heading-font);
text-align: center;
width: 100%;
font-weight: 700;
margin-top: 24px;
}
.FooterLabel {
margin-top: 0;
margin-bottom: 12px;
}
.Spinner-container {
--spinner-muted: rgb(0, 255, 0);
--spinner-primary: rgb(0, 60, 255);
width: 96px;
height: 96px;
border-radius: 50%;
background-color: var(--page-background);
border-top: 1.1em solid var(--spinner-muted);
border-right: 1.1em solid var(--spinner-muted);
border-bottom: 1.1em solid var(--spinner-muted);
border-left: 1.1em solid var(--spinner-primary);
transform: rotate(var(--spinner-rotate, 12deg));
}
.Spinners {
display: grid;
grid-auto-flow: column;
justify-content: space-between;
width: 100%;
}
.Spinner-1.Spinner-container {
--spinner-muted: var(--spinner-1-muted);
--spinner-primary: var(--spinner-1-primary);
}
.Spinner-2.Spinner-container {
--spinner-muted: var(--spinner-2-muted);
--spinner-primary: var(--spinner-2-primary);
}
.Spinner-3.Spinner-container {
--spinner-muted: var(--spinner-3-muted);
--spinner-primary: var(--spinner-3-primary);
}
.Spinner-4.Spinner-container {
--spinner-muted: var(--spinner-4-muted);
--spinner-primary: var(--spinner-4-primary);
}

View File

@@ -0,0 +1,25 @@
import { Main } from "./main";
import classNames from "classnames";
import ReactDOM from "react-dom";
const Base = ({}) => {
const name =
typeof location !== "undefined"
? decodeURIComponent(location.search.substring(1))
: null;
return <Main productName={name || "asdasdasdasdasdasd"} />;
};
function startReact() {
ReactDOM.hydrate(<Base />, document.querySelector("#reactroot"));
}
if (typeof window !== "undefined") {
globalThis.addEventListener("DOMContentLoaded", () => {
startReact();
});
startReact();
}
export { Base };

View File

@@ -0,0 +1,67 @@
export const Main = ({ productName }) => {
return (
<>
<header>
<div className="Title">CSS HMR Stress Test!</div>
<p className="Description">
This page visually tests how quickly a bundler can update CSS over Hot
Module Reloading.
</p>
</header>
<main className="main">
<section className="ProgressSection">
<p className="Subtitle">
<span className="Subtitle-part">
Ran: <span className="timer"></span>
</span>
</p>
<div className="ProgressBar-container">
<div className="ProgressBar"></div>
</div>
<div className="SectionLabel">
The progress bar should move from left to right smoothly.
</div>
</section>
<section>
<div className="Spinners">
<div className="Spinner-container Spinner-1">
<div className="Spinner"></div>
</div>
<div className="Spinner-container Spinner-2">
<div className="Spinner"></div>
</div>
<div className="Spinner-container Spinner-3">
<div className="Spinner"></div>
</div>
<div className="Spinner-container Spinner-4">
<div className="Spinner"></div>
</div>
</div>
<div className="SectionLabel">
The spinners should rotate &amp; change color smoothly.
</div>
</section>
</main>
<footer>
<div className="SectionLabel FooterLabel">
There are no CSS animations on this page.
</div>
<div className="Bundler-container">
<div className="Bundler">{productName}</div>
<div className="Bundler-updateRate">
{/* This should loose all the styles
<span className="highlight">
<span className="interval"></span>ms
</span> */}
</div>
</div>
</footer>
</>
);
};

View File

@@ -0,0 +1 @@
import jsx from "/Users/jarred/Code/bun/demos/css-stress-test/node_modules/react/cjs/react-jsx-dev-runtime.development.js";

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext", "WebWorker"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": ".",
"paths": {
"path": ["node_modules/path-browserify"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

View File

@@ -0,0 +1,5 @@
import reactRefresh from "@vitejs/plugin-react-refresh";
export default {
plugins: [reactRefresh()],
};

View File

@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@@ -0,0 +1,70 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `yarn start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `yarn build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

View File

@@ -0,0 +1,41 @@
{
"name": "hello-create-react-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"typescript": "^4.4.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="/src/index.jsx" async type="module"></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View File

@@ -0,0 +1,38 @@
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@@ -0,0 +1,25 @@
import logo from "./logo.svg";
import * as React from "react";
import "./App.css";
function App() {
const ms = Date.now() - parseInt(window.location.search.substring(1), 10);
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h3>Loaded in {ms}ms.</h3>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;

View File

@@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View File

@@ -0,0 +1,17 @@
import * as React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,13 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View File

@@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

View File

@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

34
examples/hello-next/.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel

View File

@@ -0,0 +1,34 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

View File

@@ -0,0 +1,13 @@
import Hey from "./subtitle";
export default function Title() {
return (
<h1>
Hello <Hey></Hey>
</h1>
);
}
export enum TitleEnum {
wow = 1,
}

View File

@@ -0,0 +1,4 @@
export default function Hey() {
return <div>!!yep</div>;
}

View File

@@ -0,0 +1 @@
export const yep = true;

6
examples/hello-next/next-env.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@@ -0,0 +1,10 @@
module.exports = {
reactStrictMode: true,
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
};

18014
examples/hello-next/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
{
"name": "hello-next",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@jarred/react-static-tweets": "0.5.8",
"@jarred/static-tweets": "^0.5.8",
"date-fns": "^2.23.0",
"isomorphic-fetch": "^3.0.0",
"next": "^11.1.0",
"parcel": "2.0.0-rc.0",
"path-browserify": "^1.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-is": "^17.0.2",
"whatwg-url": "^9.1.0"
},
"devDependencies": {
"@babel/standalone": "^7.15.3",
"@types/react": "^17.0.19",
"bun-framework-next": "^0.0.0-21",
"typescript": "^4.3.5"
}
}

View File

@@ -0,0 +1,7 @@
import "../styles/globals.css";
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />;
}
export default MyApp;

View File

@@ -0,0 +1,5 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default function handler(req, res) {
res.status(200).json({ name: 'John Doe' })
}

View File

@@ -0,0 +1,26 @@
import Link from "next/link";
export default function Baz({}) {
return (
<div style={{ padding: 16 }}>
<h1>Third</h1>
<ul>
<li>
<Link href="/">
<a>Root page</a>
</Link>
</li>
<li>
<Link href="/second">
<a>Second page</a>
</Link>
</li>
<li>
<Link href="/posts/123">
<a>Post page 123</a>
</Link>
</li>
</ul>
</div>
);
}

View File

@@ -0,0 +1,82 @@
import Head from "next/head";
import Link from "next/link";
import React from "react";
import styles from "../styles/Home.module.css";
export async function getStaticProps(ctx) {
return {
props: {
},
};
}
export default function Home({ }) {
return (
<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>
<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 &rarr;</h2>
<p>Link</p>
</div>
</Link>
<a
onClick={() => router.push("/foo/bar/third")}
className={styles.card}
>
<h2>Third Page &rarr;</h2>
<p>button, router.push()</p>
</a>
<a
href="https://github.com/vercel/next.js/tree/master/examples"
className={styles.card}
>
<h2>Examples &rarr;</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 &rarr;</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>
</div>
);
}

View File

@@ -0,0 +1,19 @@
import { useRouter } from "next/router";
import Link from "next/link";
export default function Post({}) {
const router = useRouter();
return (
<div style={{ padding: 16 }}>
<h1>Post: {router.query.id}</h1>
<ul>
<li>
<Link href="/">
<a>Root page</a>
</Link>
</li>
</ul>
</div>
);
}

View File

@@ -0,0 +1,22 @@
import Link from "next/link";
export default function Second({}) {
return (
<div style={{ padding: 16 }}>
<h1>Second</h1>
<ul>
<li>
<Link href="/">
<a>Root page</a>
</Link>
</li>
<li>
<Link href="/foo/bar/third">
<a>Third! page</a>
</Link>
</li>
</ul>
</div>
);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -0,0 +1,4 @@
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

View File

@@ -0,0 +1,121 @@
@import url("./2.css");
.container {
min-height: 100vh;
padding: 0 0.5rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
}
.main {
padding: 5rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.footer {
width: 100%;
height: 100px;
border-top: 1px solid #eaeaea;
display: flex;
justify-content: center;
align-items: center;
}
.footer a {
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
}
.title a {
color: #0070f3;
text-decoration: none;
}
.title a:hover,
.title a:focus,
.title a:active {
text-decoration: underline;
}
.title {
margin: 0;
line-height: 1.15;
font-size: 4rem;
}
.title,
.description {
text-align: center;
}
.description {
line-height: 1.5;
font-size: 1.5rem;
}
.code {
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
Bitstream Vera Sans Mono, Courier New, monospace;
}
.grid {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
max-width: 800px;
margin-top: 3rem;
}
.card {
margin: 1rem;
padding: 1.5rem;
text-align: left;
color: inherit;
text-decoration: none;
border: 1px solid #eaeaea;
border-radius: 10px;
transition: color 0.15s ease, border-color 0.15s ease;
width: 45%;
}
.card:hover,
.card:focus,
.card:active {
color: #0070f3;
border-color: #0070f3;
}
.card h2 {
margin: 0 0 1rem 0;
font-size: 1.5rem;
}
.card p {
margin: 0;
font-size: 1.25rem;
line-height: 1.5;
}
.logo {
height: 1em;
margin-left: 0.5rem;
}
@media (max-width: 600px) {
.grid {
width: 100%;
flex-direction: column;
}
}

View File

@@ -0,0 +1,21 @@
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
body {
background-image: url(https://wompampsupport.azureedge.net/fetchimage?siteId=7575&v=2&jpgQuality=100&width=700&url=https%3A%2F%2Fi.kym-cdn.com%2Fentries%2Ficons%2Foriginal%2F000%2F013%2F564%2Fdoge.jpg);
background-size: cover;
}

View File

@@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": ".",
"paths": {}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

View File

@@ -0,0 +1,11 @@
import "three/three1";
import "three/three2";
import "three/three3";
import "three/three4";
import "three/three5";
import "three/three6";
import "three/three7";
import "three/three8";
import "three/three9";
import "three/three10";
// import "@babel/standalone/babel";

View File

@@ -0,0 +1,11 @@
{
"name": "lotta-modules",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@babel/standalone": "^7.15.3",
"lodash": "^4.17.21",
"three.js": "^0.77.1",
"underscore": "^1.13.1"
}
}

View File

@@ -0,0 +1,6 @@
<html>
<head> </head>
<body>
<script src="/index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,33 @@
{
"name": "simple-react",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@emotion/css": "^11.1.3",
"@vitejs/plugin-react-refresh": "^1.3.3",
"antd": "^4.16.1",
"left-pad": "^1.3.0",
"next": "^11.0.0",
"parcel": "2.0.0-beta.3",
"react": "^17.0.2",
"react-bootstrap": "^1.6.1",
"react-dom": "^17.0.2",
"react-form": "^4.0.1",
"react-hook-form": "^7.8.3"
},
"parcel": "parceldist/index.js",
"targets": {
"parcel": {
"outputFormat": "esmodule",
"sourceMap": false,
"optimize": false,
"engines": {
"chrome": "last 1 version"
}
}
},
"devDependencies": {
"@snowpack/plugin-react-refresh": "^2.5.0",
"typescript": "^4.3.4"
}
}

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<link
rel="stylesheet"
crossorigin="anonymous"
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap"
/>
</head>
<body>
<div id="reactroot"></div>
<link rel="stylesheet" href="./src/index.css" />
<script src="./src/index.tsx" async type="module"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
:root {
--timestamp: "12812";
--interval: "8";
--progress-bar: 11.83299999999997%;
--spinner-1-muted: rgb(142, 6, 182);
--spinner-1-primary: rgb(177, 8, 227);
--spinner-2-muted: rgb(110, 148, 190);
--spinner-2-primary: rgb(138, 185, 238);
--spinner-3-muted: rgb(75, 45, 64);
--spinner-3-primary: rgb(94, 56, 80);
--spinner-4-muted: rgb(155, 129, 108);
--spinner-4-primary: rgb(194, 161, 135);
--spinner-rotate: 213deg;
}

View File

@@ -0,0 +1,21 @@
import React from "react";
export function RenderCounter({ name, children }) {
const counter = React.useRef(1);
return (
<div className="RenderCounter">
<div className="RenderCounter-meta">
<div className="RenderCounter-title">
{name} rendered <strong>{counter.current++} times</strong>
</div>
<div className="RenderCounter-lastRender">
LAST RENDER:{" "}
{new Intl.DateTimeFormat([], {
timeStyle: "long",
}).format(new Date())}
</div>
</div>
<div className="RenderCounter-children">{children}</div>
</div>
);
}

View File

@@ -0,0 +1,14 @@
import * as React from "react";
import { Button } from "./Button";
import { RenderCounter } from "./RenderCounter";
export function App() {
return (
<RenderCounter name="App">
<div className="AppRoot">
<h1>This is the root element</h1>
<Button>Click</Button>
</div>
</RenderCounter>
);
}

View File

@@ -0,0 +1,9 @@
import { RenderCounter } from "./RenderCounter";
export const Button = ({ children }) => {
return (
<RenderCounter name="Button">
<div className="Button">{children}</div>
</RenderCounter>
);
};

View File

@@ -0,0 +1 @@
@import "https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap";

View File

@@ -0,0 +1,98 @@
@import "./colors.css";
:root {
--heading-font: "Space Mono", system-ui;
--body-font: "IBM Plex Sans", system-ui;
--color-brand: #02ff00;
--color-brand-muted: rgb(2, 150, 0);
--padding-horizontal: 90px;
--page-background: black;
--page-background-alpha: rgba(0, 0, 0, 0.8);
--result__background-color: black;
--result__primary-color: var(--color-brand);
--result__foreground-color: white;
--result__muted-color: rgb(165, 165, 165);
--card-width: 352px;
--page-width: 1152px;
--snippets_container-background-unfocused: #171717;
--snippets_container-background-focused: #0017e9;
--snippets_container-background: var(
--snippets_container-background-unfocused
);
--snippets_container-muted-color: rgb(153, 153, 153);
}
body {
color: white;
margin: 0;
padding: 0;
font-family: var(--body-font);
background-color: var(--page-background);
color: var(--result__muted-color);
display: flex;
flex-direction: column;
height: 100%;
}
#reactroot,
#__next,
body,
html {
height: 100%;
}
.RenderCounter {
border: 10px solid var(--snippets_container-background-focused);
margin: 10px;
padding: 10px;
animation: flash 0.2s linear;
animation-fill-mode: forwards;
}
.RenderCounter-meta {
display: flex;
flex-direction: row;
justify-content: space-between;
margin: -10px;
padding: 10px;
background-color: #111;
}
.RenderCounter-lastRender,
.RenderCounter-title {
white-space: nowrap;
color: rgb(153, 153, 153);
}
@keyframes flash {
from {
border-color: var(--snippets_container-background-focused);
}
to {
border-color: var(--snippets_container-background-unfocused);
}
}
.Button {
display: block;
border: 1px solid rgb(20, 180, 0);
background-color: rgb(2, 150, 0);
color: white;
font-weight: 500;
padding: 10px 12px;
border-radius: 4px;
text-transform: uppercase;
text-align: center;
width: fit-content;
cursor: pointer;
}

View File

@@ -0,0 +1,15 @@
import ReactDOM from "react-dom";
import React from "react";
import { App } from "./components/app";
import classNames from "classnames";
function startReact() {
ReactDOM.render(<App />, document.querySelector("#reactroot"));
}
globalThis.addEventListener("DOMContentLoaded", () => {
startReact();
});
startReact();
export { App };

View File

@@ -0,0 +1,69 @@
import React from "react";
export const Main = ({ productName }) => {
return (
<>
<header>
<div className="Title">CSS HMR Stress Test</div>
<p className="Description">
This page visually tests how quickly a bundler can update CSS over Hot
Module Reloading.
</p>
</header>
<main className="main">
<section className="ProgressSection">
<p className="Subtitle">
<span className="Subtitle-part">
Ran:&nbsp;<span className="timer"></span>
</span>
</p>
<div className="ProgressBar-container">
<div className="ProgressBar"></div>
</div>
<div className="SectionLabel">
The progress bar should move from left to right smoothly.
</div>
</section>
<section>
<div className="Spinners">
<div className="Spinner-container Spinner-1">
<div className="Spinner"></div>
</div>
<div className="Spinner-container Spinner-2">
<div className="Spinner"></div>
</div>
<div className="Spinner-container Spinner-3">
<div className="Spinner"></div>
</div>
<div className="Spinner-container Spinner-4">
<div className="Spinner"></div>
</div>
</div>
<div className="SectionLabel">
The spinners should rotate &amp; change color smoothly.
</div>
</section>
</main>
<footer>
<div className="SectionLabel FooterLabel">
There are no CSS animations on this page.
</div>
<div className="Bundler-container">
<div className="Bundler">{productName}</div>
<div className="Bundler-updateRate">
Saving a css file every&nbsp;
<span className="highlight">
<span className="interval"></span>ms
</span>
</div>
</div>
</footer>
</>
);
};

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

View 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;
})
);

View File

@@ -0,0 +1 @@
*.js

View 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);
}

View 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(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
};

View 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
};

View 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);
}

View 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);
}

View 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
};

View 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
};

View 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);
}

View File

@@ -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");

Some files were not shown because too many files have changed in this diff Show More