toiljs 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/prettier.xml +1 -0
- package/as-pect.config.js +1 -1
- package/build/backend/.tsbuildinfo +1 -1
- package/build/backend/index.js +1 -2
- package/build/cli/.tsbuildinfo +1 -1
- package/build/cli/configure.d.ts +15 -0
- package/build/cli/configure.js +201 -0
- package/build/cli/create.d.ts +4 -0
- package/build/cli/create.js +168 -57
- package/build/cli/features.d.ts +23 -0
- package/build/cli/features.js +85 -0
- package/build/cli/index.js +42 -2
- package/build/cli/proc.d.ts +1 -0
- package/build/cli/proc.js +11 -0
- package/build/cli/ui.js +1 -2
- package/build/cli/validate.d.ts +4 -0
- package/build/cli/validate.js +19 -0
- package/build/client/.tsbuildinfo +1 -1
- package/build/client/Link.d.ts +8 -0
- package/build/client/Link.js +44 -0
- package/build/client/NavLink.d.ts +14 -0
- package/build/client/NavLink.js +37 -0
- package/build/client/Router.d.ts +7 -0
- package/build/client/Router.js +55 -0
- package/build/client/error-boundary.d.ts +16 -0
- package/build/client/error-boundary.js +19 -0
- package/build/client/head.d.ts +26 -0
- package/build/client/head.js +87 -0
- package/build/client/hooks.d.ts +17 -0
- package/build/client/hooks.js +48 -0
- package/build/client/index.d.ts +14 -2
- package/build/client/index.js +8 -1
- package/build/client/lazy.d.ts +16 -0
- package/build/client/lazy.js +53 -0
- package/build/client/match.js +7 -0
- package/build/client/mount.d.ts +2 -0
- package/build/client/mount.js +13 -0
- package/build/client/navigation.d.ts +13 -0
- package/build/client/navigation.js +97 -0
- package/build/client/params-context.d.ts +2 -0
- package/build/client/params-context.js +2 -0
- package/build/client/prefetch.d.ts +11 -0
- package/build/client/prefetch.js +100 -0
- package/build/client/scroll.d.ts +8 -0
- package/build/client/scroll.js +36 -0
- package/build/client/types.d.ts +27 -0
- package/build/client/types.js +1 -0
- package/build/compiler/.tsbuildinfo +1 -1
- package/build/compiler/config.d.ts +2 -0
- package/build/compiler/config.js +4 -1
- package/build/compiler/docs.d.ts +10 -0
- package/build/compiler/docs.js +59 -0
- package/build/compiler/generate.js +134 -16
- package/build/compiler/index.d.ts +4 -2
- package/build/compiler/index.js +4 -3
- package/build/compiler/plugin.js +2 -1
- package/build/compiler/routes.js +5 -1
- package/build/compiler/vite.d.ts +1 -1
- package/build/compiler/vite.js +17 -1
- package/build/io/.tsbuildinfo +1 -1
- package/build/io/BinaryWriter.js +2 -2
- package/eslint.config.js +1 -1
- package/examples/basic/.toil/docs/cli.md +3 -0
- package/examples/basic/.toil/docs/client.md +3 -0
- package/examples/basic/.toil/docs/index.md +3 -0
- package/examples/basic/.toil/docs/routing.md +3 -0
- package/examples/basic/.toil/docs/server.md +3 -0
- package/examples/basic/.toil/docs/styling.md +3 -0
- package/examples/basic/.toil/entry.tsx +3 -8
- package/examples/basic/.toil/globals.ts +6 -0
- package/examples/basic/.toil/index.html +16 -12
- package/examples/basic/.toil/public/images/.gitkeep +1 -0
- package/examples/basic/.toil/public/images/logo.svg +37 -0
- package/examples/basic/.toil/public/robots.txt +2 -0
- package/examples/basic/.toil/routes.ts +9 -7
- package/examples/basic/build/client/assets/404-Bq0jNTUo.js +1 -0
- package/examples/basic/build/client/assets/_...slug_-CXKf6qnB.js +1 -0
- package/examples/basic/build/client/assets/_id_-BadAyQnb.js +1 -0
- package/examples/basic/build/client/assets/about-BOhoEcEO.js +1 -0
- package/examples/basic/build/client/assets/get-started-BIXpcjkT.js +9 -0
- package/examples/basic/build/client/assets/index-BmqcTaBB.js +1 -0
- package/examples/basic/build/client/assets/io-DEVjjaJj.js +1 -0
- package/examples/basic/build/client/assets/layout-DJegirdz.js +1 -0
- package/examples/basic/build/client/assets/react-DEQrz1q7.js +9 -0
- package/examples/basic/build/client/assets/rolldown-runtime-KL5VtC6j.js +1 -0
- package/examples/basic/build/client/assets/routes-BYWn6TxK.js +1 -0
- package/examples/basic/build/client/css/style.css +2 -0
- package/examples/basic/build/client/images/.gitkeep +1 -0
- package/examples/basic/build/client/images/logo.svg +37 -0
- package/examples/basic/build/client/index.html +17 -0
- package/examples/basic/build/client/robots.txt +2 -0
- package/examples/basic/client/404.tsx +2 -5
- package/examples/basic/client/components/.gitkeep +1 -0
- package/examples/basic/client/components/Footer.tsx +8 -0
- package/examples/basic/client/layout.tsx +39 -26
- package/examples/basic/client/public/images/.gitkeep +1 -0
- package/examples/basic/client/public/images/logo.svg +37 -0
- package/examples/basic/client/public/index.html +15 -0
- package/examples/basic/client/public/robots.txt +2 -0
- package/examples/basic/client/routes/about.tsx +1 -3
- package/examples/basic/client/routes/blog/[id].tsx +2 -4
- package/examples/basic/client/routes/docs/[...slug].tsx +3 -6
- package/examples/basic/client/routes/get-started.tsx +84 -0
- package/examples/basic/client/routes/index.tsx +74 -7
- package/examples/basic/client/routes/io.tsx +3 -7
- package/examples/basic/client/styles/main.css +461 -0
- package/examples/basic/client/toil.tsx +7 -0
- package/examples/basic/node_modules/.bin/toilinit +16 -0
- package/examples/basic/node_modules/.bin/toilinit.cmd +17 -0
- package/examples/basic/node_modules/.bin/toilinit.ps1 +28 -0
- package/examples/basic/node_modules/.bin/toilscript +16 -0
- package/examples/basic/node_modules/.bin/toilscript.cmd +17 -0
- package/examples/basic/node_modules/.bin/toilscript.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-as +16 -0
- package/examples/basic/node_modules/.bin/wasm-as.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-as.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-ctor-eval +16 -0
- package/examples/basic/node_modules/.bin/wasm-ctor-eval.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-ctor-eval.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-dis +16 -0
- package/examples/basic/node_modules/.bin/wasm-dis.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-dis.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-merge +16 -0
- package/examples/basic/node_modules/.bin/wasm-merge.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-merge.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-metadce +16 -0
- package/examples/basic/node_modules/.bin/wasm-metadce.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-metadce.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-opt +16 -0
- package/examples/basic/node_modules/.bin/wasm-opt.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-opt.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-reduce +16 -0
- package/examples/basic/node_modules/.bin/wasm-reduce.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-reduce.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-shell +16 -0
- package/examples/basic/node_modules/.bin/wasm-shell.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-shell.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm2js +16 -0
- package/examples/basic/node_modules/.bin/wasm2js.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm2js.ps1 +28 -0
- package/examples/basic/node_modules/.package-lock.json +49 -1
- package/examples/basic/node_modules/.vite/deps/_metadata.json +9 -9
- package/examples/basic/node_modules/binaryen/LICENSE +201 -0
- package/examples/basic/node_modules/binaryen/README.md +1362 -0
- package/examples/basic/node_modules/binaryen/bin/package.json +3 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-as +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-ctor-eval +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-dis +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-merge +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-metadce +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-opt +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-reduce +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-shell +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm2js +0 -0
- package/examples/basic/node_modules/binaryen/index.d.ts +2371 -0
- package/examples/basic/node_modules/binaryen/index.js +30552 -0
- package/examples/basic/node_modules/binaryen/package.json +50 -0
- package/examples/basic/node_modules/long/LICENSE +202 -0
- package/examples/basic/node_modules/long/README.md +286 -0
- package/examples/basic/node_modules/long/index.d.ts +2 -0
- package/examples/basic/node_modules/long/index.js +1581 -0
- package/examples/basic/node_modules/long/package.json +58 -0
- package/examples/basic/node_modules/long/types.d.ts +474 -0
- package/examples/basic/node_modules/long/umd/index.d.ts +3 -0
- package/examples/basic/node_modules/long/umd/index.js +1622 -0
- package/examples/basic/node_modules/long/umd/package.json +3 -0
- package/examples/basic/node_modules/long/umd/types.d.ts +474 -0
- package/examples/basic/node_modules/toilscript/LICENSE +201 -0
- package/examples/basic/node_modules/toilscript/NOTICE +94 -0
- package/examples/basic/node_modules/toilscript/README.md +66 -0
- package/examples/basic/node_modules/toilscript/bin/toilinit.js +468 -0
- package/examples/basic/node_modules/toilscript/bin/toilscript.js +35 -0
- package/examples/basic/node_modules/toilscript/dist/cli.d.ts +4 -0
- package/examples/basic/node_modules/toilscript/dist/cli.generated.d.ts +10027 -0
- package/examples/basic/node_modules/toilscript/dist/cli.js +24474 -0
- package/examples/basic/node_modules/toilscript/dist/cli.js.map +7 -0
- package/examples/basic/node_modules/toilscript/dist/importmap.json +9 -0
- package/examples/basic/node_modules/toilscript/dist/toilscript.d.ts +4 -0
- package/examples/basic/node_modules/toilscript/dist/toilscript.generated.d.ts +11242 -0
- package/examples/basic/node_modules/toilscript/dist/toilscript.js +337 -0
- package/examples/basic/node_modules/toilscript/dist/toilscript.js.map +7 -0
- package/examples/basic/node_modules/toilscript/dist/transform.cjs +1 -0
- package/examples/basic/node_modules/toilscript/dist/transform.d.ts +1 -0
- package/examples/basic/node_modules/toilscript/dist/transform.js +1 -0
- package/examples/basic/node_modules/toilscript/dist/web.js +22 -0
- package/examples/basic/node_modules/toilscript/lib/binaryen.d.ts +2 -0
- package/examples/basic/node_modules/toilscript/lib/binaryen.js +2 -0
- package/examples/basic/node_modules/toilscript/package.json +115 -0
- package/examples/basic/node_modules/toilscript/std/README.md +6 -0
- package/examples/basic/node_modules/toilscript/std/assembly/array.ts +550 -0
- package/examples/basic/node_modules/toilscript/std/assembly/arraybuffer.ts +77 -0
- package/examples/basic/node_modules/toilscript/std/assembly/atomics.ts +127 -0
- package/examples/basic/node_modules/toilscript/std/assembly/bindings/asyncify.ts +16 -0
- package/examples/basic/node_modules/toilscript/std/assembly/bindings/dom.ts +291 -0
- package/examples/basic/node_modules/toilscript/std/assembly/bindings/node.ts +6 -0
- package/examples/basic/node_modules/toilscript/std/assembly/bitflags.ts +53 -0
- package/examples/basic/node_modules/toilscript/std/assembly/builtins.ts +2650 -0
- package/examples/basic/node_modules/toilscript/std/assembly/byteslice.ts +177 -0
- package/examples/basic/node_modules/toilscript/std/assembly/compat.ts +2 -0
- package/examples/basic/node_modules/toilscript/std/assembly/console.ts +42 -0
- package/examples/basic/node_modules/toilscript/std/assembly/crypto.ts +9 -0
- package/examples/basic/node_modules/toilscript/std/assembly/dataview.ts +181 -0
- package/examples/basic/node_modules/toilscript/std/assembly/date.ts +375 -0
- package/examples/basic/node_modules/toilscript/std/assembly/diagnostics.ts +11 -0
- package/examples/basic/node_modules/toilscript/std/assembly/encoding.ts +151 -0
- package/examples/basic/node_modules/toilscript/std/assembly/endian.ts +45 -0
- package/examples/basic/node_modules/toilscript/std/assembly/error.ts +44 -0
- package/examples/basic/node_modules/toilscript/std/assembly/fixedarray.ts +173 -0
- package/examples/basic/node_modules/toilscript/std/assembly/fixedmap.ts +326 -0
- package/examples/basic/node_modules/toilscript/std/assembly/fixedset.ts +275 -0
- package/examples/basic/node_modules/toilscript/std/assembly/function.ts +42 -0
- package/examples/basic/node_modules/toilscript/std/assembly/index.d.ts +2892 -0
- package/examples/basic/node_modules/toilscript/std/assembly/iterator.ts +35 -0
- package/examples/basic/node_modules/toilscript/std/assembly/map.ts +269 -0
- package/examples/basic/node_modules/toilscript/std/assembly/math.ts +3289 -0
- package/examples/basic/node_modules/toilscript/std/assembly/memory.ts +123 -0
- package/examples/basic/node_modules/toilscript/std/assembly/number.ts +388 -0
- package/examples/basic/node_modules/toilscript/std/assembly/object.ts +36 -0
- package/examples/basic/node_modules/toilscript/std/assembly/performance.ts +9 -0
- package/examples/basic/node_modules/toilscript/std/assembly/pointer.ts +80 -0
- package/examples/basic/node_modules/toilscript/std/assembly/polyfills.ts +27 -0
- package/examples/basic/node_modules/toilscript/std/assembly/process.ts +50 -0
- package/examples/basic/node_modules/toilscript/std/assembly/reference.ts +48 -0
- package/examples/basic/node_modules/toilscript/std/assembly/regexp.ts +12 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/README.md +83 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/common.ts +81 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index-incremental.ts +2 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index-memory.ts +1 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index-minimal.ts +2 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index-stub.ts +1 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index.d.ts +37 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/itcms.ts +419 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/memory-runtime.ts +94 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/rtrace.ts +15 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/stub.ts +133 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/tcms.ts +254 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/tlsf.ts +592 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt.ts +90 -0
- package/examples/basic/node_modules/toilscript/std/assembly/set.ts +225 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/feature.ts +68 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/runtime.ts +13 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/target.ts +11 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/tsconfig.json +11 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/typeinfo.ts +72 -0
- package/examples/basic/node_modules/toilscript/std/assembly/staticarray.ts +423 -0
- package/examples/basic/node_modules/toilscript/std/assembly/string.ts +850 -0
- package/examples/basic/node_modules/toilscript/std/assembly/symbol.ts +114 -0
- package/examples/basic/node_modules/toilscript/std/assembly/table.ts +16 -0
- package/examples/basic/node_modules/toilscript/std/assembly/toilscript.ts +16 -0
- package/examples/basic/node_modules/toilscript/std/assembly/tsconfig.json +6 -0
- package/examples/basic/node_modules/toilscript/std/assembly/typedarray.ts +1954 -0
- package/examples/basic/node_modules/toilscript/std/assembly/uri.ts +17 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/bytes.ts +107 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/casemap.ts +497 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/error.ts +58 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/hash.ts +117 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/math.ts +1922 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/memory.ts +290 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/number.ts +873 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/sort.ts +313 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/string.ts +1202 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/uri.ts +275 -0
- package/examples/basic/node_modules/toilscript/std/assembly/vector.ts +4 -0
- package/examples/basic/node_modules/toilscript/std/assembly.json +16 -0
- package/examples/basic/node_modules/toilscript/std/portable/index.d.ts +461 -0
- package/examples/basic/node_modules/toilscript/std/portable/index.js +416 -0
- package/examples/basic/node_modules/toilscript/std/portable.json +11 -0
- package/examples/basic/node_modules/toilscript/std/types/assembly/index.d.ts +1 -0
- package/examples/basic/node_modules/toilscript/std/types/assembly/package.json +3 -0
- package/examples/basic/node_modules/toilscript/std/types/portable/index.d.ts +1 -0
- package/examples/basic/node_modules/toilscript/std/types/portable/package.json +3 -0
- package/examples/basic/node_modules/toilscript/tsconfig-base.json +13 -0
- package/examples/basic/node_modules/toilscript/util/README.md +23 -0
- package/examples/basic/node_modules/toilscript/util/browser/fs.js +1 -0
- package/examples/basic/node_modules/toilscript/util/browser/module.js +5 -0
- package/examples/basic/node_modules/toilscript/util/browser/path.js +520 -0
- package/examples/basic/node_modules/toilscript/util/browser/process.js +59 -0
- package/examples/basic/node_modules/toilscript/util/browser/url.js +23 -0
- package/examples/basic/node_modules/toilscript/util/cpu.d.ts +9 -0
- package/examples/basic/node_modules/toilscript/util/cpu.js +42 -0
- package/examples/basic/node_modules/toilscript/util/find.d.ts +6 -0
- package/examples/basic/node_modules/toilscript/util/find.js +20 -0
- package/examples/basic/node_modules/toilscript/util/node.d.ts +21 -0
- package/examples/basic/node_modules/toilscript/util/node.js +34 -0
- package/examples/basic/node_modules/toilscript/util/options.d.ts +70 -0
- package/examples/basic/node_modules/toilscript/util/options.js +262 -0
- package/examples/basic/node_modules/toilscript/util/terminal.d.ts +52 -0
- package/examples/basic/node_modules/toilscript/util/terminal.js +35 -0
- package/examples/basic/node_modules/toilscript/util/text.d.ts +26 -0
- package/examples/basic/node_modules/toilscript/util/text.js +114 -0
- package/examples/basic/node_modules/toilscript/util/tsconfig.json +9 -0
- package/examples/basic/node_modules/toilscript/util/web.d.ts +11 -0
- package/examples/basic/node_modules/toilscript/util/web.js +33 -0
- package/examples/basic/package-lock.json +50 -1
- package/examples/basic/package.json +5 -2
- package/examples/basic/server/index.ts +3 -0
- package/examples/basic/server/main.ts +6 -0
- package/examples/basic/server/tsconfig.json +7 -0
- package/examples/basic/toil-env.d.ts +20 -1
- package/examples/basic/toil.config.ts +2 -5
- package/examples/basic/toilconfig.json +30 -0
- package/package.json +1 -1
- package/presets/eslint.js +2 -7
- package/presets/no-uint8array-tostring.js +4 -5
- package/presets/prettier.json +8 -1
- package/src/backend/index.ts +11 -18
- package/src/cli/configure.ts +272 -0
- package/src/cli/create.ts +227 -69
- package/src/cli/features.ts +128 -0
- package/src/cli/index.ts +44 -3
- package/src/cli/proc.ts +20 -0
- package/src/cli/ui.ts +4 -6
- package/src/cli/validate.ts +31 -0
- package/src/client/Link.tsx +99 -0
- package/src/client/NavLink.tsx +86 -0
- package/src/client/Router.tsx +95 -0
- package/src/client/error-boundary.tsx +43 -0
- package/src/client/head.ts +140 -0
- package/src/client/hooks.ts +115 -0
- package/src/client/index.ts +35 -5
- package/src/client/lazy.ts +93 -0
- package/src/client/match.ts +11 -3
- package/src/client/mount.tsx +28 -0
- package/src/client/navigation.ts +142 -0
- package/src/client/params-context.ts +10 -0
- package/src/client/prefetch.ts +130 -0
- package/src/client/scroll.ts +53 -0
- package/src/client/types.ts +36 -0
- package/src/compiler/config.ts +15 -8
- package/src/compiler/docs.ts +87 -0
- package/src/compiler/generate.ts +164 -23
- package/src/compiler/index.ts +6 -4
- package/src/compiler/plugin.ts +3 -1
- package/src/compiler/routes.ts +13 -7
- package/src/compiler/vite.ts +28 -5
- package/src/io/BinaryReader.ts +1 -5
- package/src/io/BinaryWriter.ts +3 -3
- package/src/server/index.ts +3 -4
- package/src/server/tsconfig.json +4 -0
- package/test/configure.test.ts +90 -0
- package/test/features.test.ts +111 -0
- package/test/head.test.ts +35 -0
- package/test/io.test.ts +8 -0
- package/test/navlink.test.ts +28 -0
- package/test/routes.test.ts +15 -0
- package/test/validate.test.ts +42 -0
- package/vitest.config.ts +1 -1
- package/examples/basic/dist/assets/404-D1bS2aH_.js +0 -1
- package/examples/basic/dist/assets/_...slug_-wR3shlWn.js +0 -1
- package/examples/basic/dist/assets/_id_-EWYvHfi2.js +0 -1
- package/examples/basic/dist/assets/about-Ddvj1tjF.js +0 -1
- package/examples/basic/dist/assets/index-CdG0me90.js +0 -1
- package/examples/basic/dist/assets/io-CODNJU57.js +0 -1
- package/examples/basic/dist/assets/layout-C15ZTPYI.js +0 -1
- package/examples/basic/dist/assets/react-JbAfoxYe.js +0 -9
- package/examples/basic/dist/assets/rolldown-runtime-1VNLd2iN.js +0 -1
- package/examples/basic/dist/assets/routes-GoydenoY.js +0 -1
- package/examples/basic/dist/index.html +0 -12
- package/src/client/runtime.tsx +0 -190
package/src/server/index.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* toilscript server (WASM) entry, compiled to WebAssembly by `toilscript`.
|
|
3
3
|
*
|
|
4
|
-
* Placeholder module: a trivial exported function that compiles with the
|
|
5
|
-
*
|
|
6
|
-
* fork directly — no transformer required.
|
|
4
|
+
* Placeholder module: a trivial exported function that compiles with the toilscript std.
|
|
5
|
+
* Native decorators (e.g. `@main`) ship from toilscript directly — no transformer required.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
export function add(a: i32, b: i32): i32 {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { applyConfigure } from '../src/cli/configure';
|
|
8
|
+
import type { StyleFeatures } from '../src/cli/features';
|
|
9
|
+
|
|
10
|
+
const CSS: StyleFeatures = { preprocessor: 'css', tailwind: false };
|
|
11
|
+
const SASS_TW: StyleFeatures = { preprocessor: 'sass', tailwind: true };
|
|
12
|
+
|
|
13
|
+
const ENTRY = [
|
|
14
|
+
"import { routes, layout, notFound } from 'toiljs/routes';",
|
|
15
|
+
'',
|
|
16
|
+
"import './styles/main.css';",
|
|
17
|
+
'',
|
|
18
|
+
'Toil.mount(routes, layout, notFound);',
|
|
19
|
+
'',
|
|
20
|
+
].join('\n');
|
|
21
|
+
|
|
22
|
+
let dir: string;
|
|
23
|
+
let clientDir: string;
|
|
24
|
+
let pkgPath: string;
|
|
25
|
+
|
|
26
|
+
async function readJson(p: string): Promise<{ devDependencies?: Record<string, string> }> {
|
|
27
|
+
return JSON.parse(await fs.readFile(p, 'utf8')) as { devDependencies?: Record<string, string> };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function exists(p: string): Promise<boolean> {
|
|
31
|
+
try {
|
|
32
|
+
await fs.access(p);
|
|
33
|
+
return true;
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
beforeEach(async () => {
|
|
40
|
+
dir = await fs.mkdtemp(path.join(os.tmpdir(), 'toil-cfg-'));
|
|
41
|
+
clientDir = path.join(dir, 'client');
|
|
42
|
+
pkgPath = path.join(dir, 'package.json');
|
|
43
|
+
await fs.mkdir(path.join(clientDir, 'styles'), { recursive: true });
|
|
44
|
+
await fs.writeFile(path.join(clientDir, 'toil.tsx'), ENTRY, 'utf8');
|
|
45
|
+
await fs.writeFile(path.join(clientDir, 'styles/main.css'), 'body { margin: 0; }\n', 'utf8');
|
|
46
|
+
await fs.writeFile(pkgPath, JSON.stringify({ devDependencies: { typescript: '^6' } }, null, 4), 'utf8');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
afterEach(async () => {
|
|
50
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('applyConfigure', () => {
|
|
54
|
+
it('adds Sass + Tailwind: renames stylesheet, adds entry + imports + deps', async () => {
|
|
55
|
+
const pkg = await readJson(pkgPath);
|
|
56
|
+
await applyConfigure(clientDir, pkgPath, pkg, CSS, SASS_TW);
|
|
57
|
+
|
|
58
|
+
expect(await exists(path.join(clientDir, 'styles/main.scss'))).toBe(true);
|
|
59
|
+
expect(await exists(path.join(clientDir, 'styles/main.css'))).toBe(false);
|
|
60
|
+
expect(await exists(path.join(clientDir, 'styles/tailwind.css'))).toBe(true);
|
|
61
|
+
|
|
62
|
+
const entry = await fs.readFile(path.join(clientDir, 'toil.tsx'), 'utf8');
|
|
63
|
+
expect(entry).toContain("import './styles/tailwind.css';");
|
|
64
|
+
expect(entry).toContain("import './styles/main.scss';");
|
|
65
|
+
expect(entry).not.toContain('main.css');
|
|
66
|
+
expect(entry).toContain('Toil.mount(routes, layout, notFound);');
|
|
67
|
+
|
|
68
|
+
const deps = (await readJson(pkgPath)).devDependencies ?? {};
|
|
69
|
+
expect(deps).toHaveProperty('sass');
|
|
70
|
+
expect(deps).toHaveProperty('tailwindcss');
|
|
71
|
+
expect(deps).toHaveProperty('@tailwindcss/vite');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('removes everything cleanly when switching back to plain CSS', async () => {
|
|
75
|
+
const pkg = await readJson(pkgPath);
|
|
76
|
+
await applyConfigure(clientDir, pkgPath, pkg, CSS, SASS_TW);
|
|
77
|
+
const mid = await readJson(pkgPath);
|
|
78
|
+
await applyConfigure(clientDir, pkgPath, mid, SASS_TW, CSS);
|
|
79
|
+
|
|
80
|
+
expect(await exists(path.join(clientDir, 'styles/main.css'))).toBe(true);
|
|
81
|
+
expect(await exists(path.join(clientDir, 'styles/main.scss'))).toBe(false);
|
|
82
|
+
expect(await exists(path.join(clientDir, 'styles/tailwind.css'))).toBe(false);
|
|
83
|
+
|
|
84
|
+
const deps = (await readJson(pkgPath)).devDependencies ?? {};
|
|
85
|
+
expect(deps).not.toHaveProperty('sass');
|
|
86
|
+
expect(deps).not.toHaveProperty('tailwindcss');
|
|
87
|
+
expect(deps).not.toHaveProperty('@tailwindcss/vite');
|
|
88
|
+
expect(deps).toHaveProperty('typescript');
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
detectPreprocessor,
|
|
5
|
+
detectTailwind,
|
|
6
|
+
packageDiff,
|
|
7
|
+
preprocessorForExt,
|
|
8
|
+
requiredPackages,
|
|
9
|
+
setStyleImports,
|
|
10
|
+
styleEntry,
|
|
11
|
+
styleImportLines,
|
|
12
|
+
type StyleFeatures,
|
|
13
|
+
} from '../src/cli/features';
|
|
14
|
+
|
|
15
|
+
const CSS: StyleFeatures = { preprocessor: 'css', tailwind: false };
|
|
16
|
+
const SASS_TW: StyleFeatures = { preprocessor: 'sass', tailwind: true };
|
|
17
|
+
|
|
18
|
+
describe('styleEntry / preprocessorForExt', () => {
|
|
19
|
+
it('maps preprocessors to stylesheet paths', () => {
|
|
20
|
+
expect(styleEntry('css')).toBe('styles/main.css');
|
|
21
|
+
expect(styleEntry('sass')).toBe('styles/main.scss');
|
|
22
|
+
expect(styleEntry('less')).toBe('styles/main.less');
|
|
23
|
+
expect(styleEntry('stylus')).toBe('styles/main.styl');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('reverses extensions back to preprocessors', () => {
|
|
27
|
+
expect(preprocessorForExt('scss')).toBe('sass');
|
|
28
|
+
expect(preprocessorForExt('.sass')).toBe('sass');
|
|
29
|
+
expect(preprocessorForExt('less')).toBe('less');
|
|
30
|
+
expect(preprocessorForExt('styl')).toBe('stylus');
|
|
31
|
+
expect(preprocessorForExt('css')).toBe('css');
|
|
32
|
+
expect(preprocessorForExt('txt')).toBeNull();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('requiredPackages / packageDiff', () => {
|
|
37
|
+
it('lists packages for a feature set', () => {
|
|
38
|
+
expect(requiredPackages(CSS)).toEqual([]);
|
|
39
|
+
expect(requiredPackages({ preprocessor: 'sass', tailwind: false })).toEqual(['sass']);
|
|
40
|
+
expect(requiredPackages({ preprocessor: 'css', tailwind: true })).toEqual([
|
|
41
|
+
'tailwindcss',
|
|
42
|
+
'@tailwindcss/vite',
|
|
43
|
+
]);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('diffs add/remove between two setups', () => {
|
|
47
|
+
expect(packageDiff(CSS, SASS_TW)).toEqual({
|
|
48
|
+
add: ['sass', 'tailwindcss', '@tailwindcss/vite'],
|
|
49
|
+
remove: [],
|
|
50
|
+
});
|
|
51
|
+
expect(packageDiff(SASS_TW, CSS)).toEqual({
|
|
52
|
+
add: [],
|
|
53
|
+
remove: ['sass', 'tailwindcss', '@tailwindcss/vite'],
|
|
54
|
+
});
|
|
55
|
+
expect(packageDiff({ preprocessor: 'sass', tailwind: false }, { preprocessor: 'less', tailwind: false })).toEqual(
|
|
56
|
+
{ add: ['less'], remove: ['sass'] },
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('styleImportLines / setStyleImports', () => {
|
|
62
|
+
it('orders Tailwind before the main stylesheet', () => {
|
|
63
|
+
expect(styleImportLines(CSS)).toEqual(["import './styles/main.css';"]);
|
|
64
|
+
expect(styleImportLines(SASS_TW)).toEqual([
|
|
65
|
+
"import './styles/tailwind.css';",
|
|
66
|
+
"import './styles/main.scss';",
|
|
67
|
+
]);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('rewrites the app entry imports, preserving the rest', () => {
|
|
71
|
+
const src = [
|
|
72
|
+
"import { routes, layout, notFound } from 'toiljs/routes';",
|
|
73
|
+
'',
|
|
74
|
+
"import './styles/main.css';",
|
|
75
|
+
'',
|
|
76
|
+
'Toil.mount(routes, layout, notFound);',
|
|
77
|
+
'',
|
|
78
|
+
].join('\n');
|
|
79
|
+
|
|
80
|
+
const out = setStyleImports(src, SASS_TW);
|
|
81
|
+
expect(out).toContain("import './styles/tailwind.css';");
|
|
82
|
+
expect(out).toContain("import './styles/main.scss';");
|
|
83
|
+
expect(out).not.toContain("import './styles/main.css';");
|
|
84
|
+
expect(out).toContain("from 'toiljs/routes'");
|
|
85
|
+
expect(out).toContain('Toil.mount(routes, layout, notFound);');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('round-trips back to plain CSS (drops Tailwind import)', () => {
|
|
89
|
+
const src = [
|
|
90
|
+
"import { routes, layout, notFound } from 'toiljs/routes';",
|
|
91
|
+
"import './styles/tailwind.css';",
|
|
92
|
+
"import './styles/main.scss';",
|
|
93
|
+
'Toil.mount(routes, layout, notFound);',
|
|
94
|
+
].join('\n');
|
|
95
|
+
|
|
96
|
+
const out = setStyleImports(src, CSS);
|
|
97
|
+
expect(out).toContain("import './styles/main.css';");
|
|
98
|
+
expect(out).not.toContain('tailwind.css');
|
|
99
|
+
expect(out).not.toContain('main.scss');
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('detect from dependencies', () => {
|
|
104
|
+
it('finds the active preprocessor and Tailwind', () => {
|
|
105
|
+
expect(detectPreprocessor({ sass: '^1' })).toBe('sass');
|
|
106
|
+
expect(detectPreprocessor({ less: '^4' })).toBe('less');
|
|
107
|
+
expect(detectPreprocessor({})).toBe('css');
|
|
108
|
+
expect(detectTailwind({ '@tailwindcss/vite': '^4' })).toBe(true);
|
|
109
|
+
expect(detectTailwind({ react: '^19' })).toBe(false);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { mergeHead } from '../src/client/head';
|
|
4
|
+
|
|
5
|
+
describe('mergeHead', () => {
|
|
6
|
+
it('takes the last title and applies a titleTemplate', () => {
|
|
7
|
+
expect(mergeHead([{ title: 'Home' }]).title).toBe('Home');
|
|
8
|
+
expect(mergeHead([{ title: 'A' }, { title: 'B' }]).title).toBe('B');
|
|
9
|
+
expect(mergeHead([{ titleTemplate: '%s · toiljs' }, { title: 'About' }]).title).toBe(
|
|
10
|
+
'About · toiljs',
|
|
11
|
+
);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('leaves title undefined when nothing sets it', () => {
|
|
15
|
+
expect(mergeHead([{ meta: [{ name: 'x', content: 'y' }] }]).title).toBeUndefined();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('dedupes meta by name/property, last wins', () => {
|
|
19
|
+
const resolved = mergeHead([
|
|
20
|
+
{ meta: [{ name: 'description', content: 'old' }] },
|
|
21
|
+
{ meta: [{ name: 'description', content: 'new' }, { property: 'og:title', content: 'T' }] },
|
|
22
|
+
]);
|
|
23
|
+
expect(resolved.meta).toHaveLength(2);
|
|
24
|
+
expect(resolved.meta.find((m) => m.name === 'description')?.content).toBe('new');
|
|
25
|
+
expect(resolved.meta.find((m) => m.property === 'og:title')?.content).toBe('T');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('dedupes links by rel+href', () => {
|
|
29
|
+
const resolved = mergeHead([
|
|
30
|
+
{ link: [{ rel: 'icon', href: '/a.svg' }] },
|
|
31
|
+
{ link: [{ rel: 'icon', href: '/a.svg' }, { rel: 'canonical', href: '/x' }] },
|
|
32
|
+
]);
|
|
33
|
+
expect(resolved.link).toHaveLength(2);
|
|
34
|
+
});
|
|
35
|
+
});
|
package/test/io.test.ts
CHANGED
|
@@ -53,6 +53,14 @@ describe('BinaryWriter / BinaryReader', () => {
|
|
|
53
53
|
expect(() => w.writeI8(128)).toThrow();
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
it('rejects negative / overflowing u256 and u128', () => {
|
|
57
|
+
const w = new BinaryWriter();
|
|
58
|
+
expect(() => w.writeU256(-1n)).toThrow();
|
|
59
|
+
expect(() => w.writeU256(2n ** 256n)).toThrow();
|
|
60
|
+
expect(() => w.writeU128(-1n)).toThrow();
|
|
61
|
+
expect(() => w.writeU128(2n ** 128n)).toThrow();
|
|
62
|
+
});
|
|
63
|
+
|
|
56
64
|
it('throws when reading past the end', () => {
|
|
57
65
|
const r = new BinaryReader(new Uint8Array(2));
|
|
58
66
|
expect(() => r.readU32()).toThrow();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { matchActive } from '../src/client/NavLink';
|
|
4
|
+
|
|
5
|
+
describe('matchActive', () => {
|
|
6
|
+
it('matches exact paths', () => {
|
|
7
|
+
expect(matchActive('/about', '/about', false)).toBe(true);
|
|
8
|
+
expect(matchActive('/about', '/about/', false)).toBe(true);
|
|
9
|
+
expect(matchActive('/about', '/contact', false)).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('matches sub-paths when not exact (end=false)', () => {
|
|
13
|
+
expect(matchActive('/blog', '/blog/42', false)).toBe(true);
|
|
14
|
+
expect(matchActive('/blog', '/blog', false)).toBe(true);
|
|
15
|
+
expect(matchActive('/blog', '/blogger', false)).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('honors end for exact-only matching', () => {
|
|
19
|
+
expect(matchActive('/blog', '/blog/42', true)).toBe(false);
|
|
20
|
+
expect(matchActive('/blog', '/blog', true)).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('treats "/" as active everywhere unless end', () => {
|
|
24
|
+
expect(matchActive('/', '/anything/deep', false)).toBe(true);
|
|
25
|
+
expect(matchActive('/', '/anything', true)).toBe(false);
|
|
26
|
+
expect(matchActive('/', '/', true)).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
});
|
package/test/routes.test.ts
CHANGED
|
@@ -12,6 +12,14 @@ describe('filePathToRoute', () => {
|
|
|
12
12
|
expect(filePathToRoute('docs/guide/intro.jsx')).toBe('/docs/guide/intro');
|
|
13
13
|
expect(filePathToRoute('docs/[...slug].tsx')).toBe('/docs/*slug');
|
|
14
14
|
});
|
|
15
|
+
|
|
16
|
+
it('maps optional catch-all and strips route groups', () => {
|
|
17
|
+
expect(filePathToRoute('docs/[[...slug]].tsx')).toBe('/docs/**slug');
|
|
18
|
+
expect(filePathToRoute('[[...slug]].tsx')).toBe('/**slug');
|
|
19
|
+
expect(filePathToRoute('(marketing)/about.tsx')).toBe('/about');
|
|
20
|
+
expect(filePathToRoute('(shop)/index.tsx')).toBe('/');
|
|
21
|
+
expect(filePathToRoute('(a)/(b)/deep.tsx')).toBe('/deep');
|
|
22
|
+
});
|
|
15
23
|
});
|
|
16
24
|
|
|
17
25
|
describe('matchRoute', () => {
|
|
@@ -39,4 +47,11 @@ describe('matchRoute', () => {
|
|
|
39
47
|
// catch-all needs at least one trailing segment
|
|
40
48
|
expect(matchRoute('/docs/*slug', '/docs')).toBeNull();
|
|
41
49
|
});
|
|
50
|
+
|
|
51
|
+
it('matches optional catch-all with zero or more segments', () => {
|
|
52
|
+
expect(matchRoute('/docs/**slug', '/docs')).toEqual({ slug: '' });
|
|
53
|
+
expect(matchRoute('/docs/**slug', '/docs/a/b')).toEqual({ slug: 'a/b' });
|
|
54
|
+
expect(matchRoute('/**slug', '/')).toEqual({ slug: '' });
|
|
55
|
+
expect(matchRoute('/**slug', '/x/y')).toEqual({ slug: 'x/y' });
|
|
56
|
+
});
|
|
42
57
|
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { isPackageManager, isValidName, resolveProjectDir } from '../src/cli/validate';
|
|
4
|
+
|
|
5
|
+
describe('isValidName', () => {
|
|
6
|
+
it('accepts simple and nested names', () => {
|
|
7
|
+
expect(isValidName('my-app')).toBe(true);
|
|
8
|
+
expect(isValidName('apps/web')).toBe(true);
|
|
9
|
+
expect(isValidName('@scope/app')).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('rejects empty and illegal characters', () => {
|
|
13
|
+
expect(typeof isValidName('')).toBe('string');
|
|
14
|
+
expect(typeof isValidName(' ')).toBe('string');
|
|
15
|
+
expect(typeof isValidName('bad name!')).toBe('string');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe('resolveProjectDir', () => {
|
|
20
|
+
it('resolves names inside cwd', () => {
|
|
21
|
+
expect(resolveProjectDir('/work', 'app')).toBe('/work/app');
|
|
22
|
+
expect(resolveProjectDir('/work', 'a/b')).toBe('/work/a/b');
|
|
23
|
+
expect(resolveProjectDir('/work', '.')).toBe('/work');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('refuses to escape cwd (traversal / absolute)', () => {
|
|
27
|
+
expect(resolveProjectDir('/work', '../evil')).toBeNull();
|
|
28
|
+
expect(resolveProjectDir('/work', '../../etc')).toBeNull();
|
|
29
|
+
expect(resolveProjectDir('/work', '/etc/passwd')).toBeNull();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('isPackageManager', () => {
|
|
34
|
+
it('allowlists known package managers only', () => {
|
|
35
|
+
expect(isPackageManager('npm')).toBe(true);
|
|
36
|
+
expect(isPackageManager('pnpm')).toBe(true);
|
|
37
|
+
expect(isPackageManager('yarn')).toBe(true);
|
|
38
|
+
expect(isPackageManager('bun')).toBe(true);
|
|
39
|
+
expect(isPackageManager('npm && calc')).toBe(false);
|
|
40
|
+
expect(isPackageManager('rm -rf /')).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
});
|
package/vitest.config.ts
CHANGED
|
@@ -5,7 +5,7 @@ export default defineConfig({
|
|
|
5
5
|
globals: true,
|
|
6
6
|
environment: 'node',
|
|
7
7
|
include: ['test/**/*.test.ts', 'test/**/*.spec.ts'],
|
|
8
|
-
// test/assembly holds
|
|
8
|
+
// test/assembly holds toilscript specs run by as-pect, not vitest.
|
|
9
9
|
exclude: [...configDefaults.exclude, 'test/assembly/**'],
|
|
10
10
|
coverage: {
|
|
11
11
|
provider: 'v8',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./react-JbAfoxYe.js";import{t}from"./index-CdG0me90.js";var n=e();function r(){return(0,n.jsxs)(`main`,{children:[(0,n.jsx)(`h1`,{children:`404 — Page not found`}),(0,n.jsxs)(`p`,{children:[`This custom page is served from `,(0,n.jsx)(`code`,{children:`client/404.tsx`}),` whenever no route matches.`]}),(0,n.jsx)(t,{href:`/`,children:`Back home`})]})}export{r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./react-JbAfoxYe.js";import{n as t,t as n}from"./index-CdG0me90.js";var r=e();function i(){let{slug:e}=t();return(0,r.jsxs)(`main`,{children:[(0,r.jsx)(`h1`,{children:`Docs`}),(0,r.jsxs)(`p`,{children:[`Catch-all route `,(0,r.jsx)(`code`,{children:`client/routes/docs/[...slug].tsx`}),` matched:`,` `,(0,r.jsx)(`code`,{children:e})]}),(0,r.jsx)(n,{href:`/`,children:`Back home`})]})}export{i as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./react-JbAfoxYe.js";import{n as t,t as n}from"./index-CdG0me90.js";var r=e();function i(){let{id:e}=t();return(0,r.jsxs)(`main`,{children:[(0,r.jsxs)(`h1`,{children:[`Blog post `,e]}),(0,r.jsxs)(`p`,{children:[`Dynamic route from `,(0,r.jsx)(`code`,{children:`client/routes/blog/[id].tsx`}),`.`]}),(0,r.jsx)(n,{href:`/`,children:`Back home`})]})}export{i as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./react-JbAfoxYe.js";import{t}from"./index-CdG0me90.js";var n=e();function r(){return(0,n.jsxs)(`main`,{children:[(0,n.jsx)(`h1`,{children:`About`}),(0,n.jsxs)(`p`,{children:[`This page is served by `,(0,n.jsx)(`code`,{children:`client/routes/about.tsx`}),`.`]}),(0,n.jsx)(t,{href:`/`,children:`Back home`})]})}export{r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./react-JbAfoxYe.js";var r=t(),i=e(),a=n();function o(e,t){let n=e.split(`/`).filter(Boolean),r=t.split(`/`).filter(Boolean),i={};for(let e=0;e<n.length;e++){let t=n[e];if(t.startsWith(`*`)){let n=r.slice(e);return n.length===0?null:(i[t.slice(1)]=n.map(e=>decodeURIComponent(e)).join(`/`),i)}if(e>=r.length)return null;let a=r[e];if(t.startsWith(`:`))i[t.slice(1)]=decodeURIComponent(a);else if(t!==a)return null}return n.length===r.length?i:null}var s=new Set;function c(e){window.history.pushState({},``,e);for(let e of s)e()}var l=(0,i.createContext)({});function u(){return(0,i.useContext)(l)}function d(){let[e,t]=(0,i.useState)(()=>window.location.pathname);return(0,i.useEffect)(()=>{let e=()=>{t(window.location.pathname)};return s.add(e),window.addEventListener(`popstate`,e),()=>{s.delete(e),window.removeEventListener(`popstate`,e)}},[]),e}function f(e){let{href:t,className:n,children:i}=e;return(0,r.jsx)(`a`,{href:t,className:n,onClick:e=>{e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),c(t))},children:i})}var p=new Map;function m(e){let t=p.get(e);return t||(t=(0,i.lazy)(e.load),p.set(e,t)),t}var h=null,g=null;function _(e){return(g!==e||!h)&&(h=(0,i.lazy)(e),g=e),h}var v=null,y=null;function b(e){return(y!==e||!v)&&(v=(0,i.lazy)(e),y=e),v}function x(e){let{routes:t,layout:n=null,notFound:a=null}=e,s=d(),c,u={};for(let e of t){let t=o(e.pattern,s);if(t){c=e,u=t;break}}let f;f=c?(0,r.jsx)(i.Suspense,{fallback:null,children:(0,r.jsx)(m(c),{})}):a?(0,r.jsx)(i.Suspense,{fallback:null,children:(0,r.jsx)(b(a),{})}):(0,r.jsx)(`div`,{style:{padding:24,fontFamily:`system-ui`},children:`404 — Not found`});let p=(0,r.jsx)(l.Provider,{value:u,children:f});return n?(0,r.jsx)(i.Suspense,{fallback:null,children:(0,r.jsx)(_(n),{children:p})}):p}function S(e,t=null,n=null){let i=document.getElementById(`root`);if(!i)throw Error(`toil: #root element not found`);(0,a.createRoot)(i).render((0,r.jsx)(x,{routes:e,layout:t,notFound:n}))}function C(e){"@babel/helpers - typeof";return C=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C(e)}function w(e,t){if(C(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(C(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function T(e){var t=w(e,`string`);return C(t)==`symbol`?t:t+``}function E(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var D=class{constructor(e){E(this,`buffer`,void 0),E(this,`currentOffset`,0),this.buffer=new DataView(e.buffer,e.byteOffset,e.byteLength)}get byteLength(){return this.buffer.byteLength}static stringCompare(e,t){return e.localeCompare(t)}static bigintCompare(e,t){return e<t?-1:+(e>t)}static numberCompare(e,t){return e<t?-1:+(e>t)}setBuffer(e){this.buffer=new DataView(e.buffer,e.byteOffset,e.byteLength),this.currentOffset=0}length(){return this.buffer.byteLength}bytesLeft(){return this.buffer.byteLength-this.currentOffset}readI8(){this.verifyEnd(this.currentOffset+1);let e=this.buffer.getInt8(this.currentOffset);return this.currentOffset+=1,e}readI16(e=!0){this.verifyEnd(this.currentOffset+2);let t=this.buffer.getInt16(this.currentOffset,!e);return this.currentOffset+=2,t}readI32(e=!0){this.verifyEnd(this.currentOffset+4);let t=this.buffer.getInt32(this.currentOffset,!e);return this.currentOffset+=4,t}readI64(e=!0){this.verifyEnd(this.currentOffset+8);let t=this.buffer.getBigInt64(this.currentOffset,!e);return this.currentOffset+=8,t}readU8(){this.verifyEnd(this.currentOffset+1);let e=this.buffer.getUint8(this.currentOffset);return this.currentOffset+=1,e}readU16(e=!0){this.verifyEnd(this.currentOffset+2);let t=this.buffer.getUint16(this.currentOffset,!e);return this.currentOffset+=2,t}readU32(e=!0){this.verifyEnd(this.currentOffset+4);let t=this.buffer.getUint32(this.currentOffset,!e);return this.currentOffset+=4,t}readU64(e=!0){this.verifyEnd(this.currentOffset+8);let t=this.buffer.getBigUint64(this.currentOffset,!e);return this.currentOffset+=8,t}readU128(e=!0){let t=this.readBytes(16),n=t;return e||(n=this.reverseBytes(t)),BigInt(`0x`+this.toHexString(n))}readU256(e=!0){let t=this.readBytes(32),n=t;return e||(n=this.reverseBytes(t)),BigInt(`0x`+this.toHexString(n))}readI128(e=!0){let t=this.readBytes(16),n=t;e||(n=this.reverseBytes(t));let r=BigInt(`0x`+this.toHexString(n));if(n[0]&128){let e=BigInt(1)<<BigInt(128);r-=e}return r}readBoolean(){return this.readU8()!==0}readSelector(){return this.readU32(!0)}readBytes(e,t=!1){this.verifyEnd(this.currentOffset+e);let n=new Uint8Array(e);for(let r=0;r<e;r++){let e=this.buffer.getUint8(this.currentOffset++);if(t&&e===0){n=new Uint8Array(n.subarray(0,r));break}n[r]=e}return n}readString(e){let t=new TextDecoder,n=this.readBytes(e,!1);return t.decode(n)}readStringWithLength(e=!0){let t=this.readU32(e);return this.readString(t)}readBytesWithLength(e=0,t=!0){let n=this.readU32(t);if(e>0&&n>e)throw Error(`Data length exceeds maximum length.`);return this.readBytes(n)}readArrayOfBuffer(e=!0){let t=this.readU16(e),n=Array(t);for(let e=0;e<t;e++)n[e]=this.readBytesWithLength();return n}readU256Array(e=!0){let t=this.readU16(e),n=Array(t);for(let r=0;r<t;r++)n[r]=this.readU256(e);return n}readU128Array(e=!0){let t=this.readU16(e),n=Array(t);for(let r=0;r<t;r++)n[r]=this.readU128(e);return n}readU64Array(e=!0){let t=this.readU16(e),n=Array(t);for(let r=0;r<t;r++)n[r]=this.readU64(e);return n}readU32Array(e=!0){let t=this.readU16(e),n=Array(t);for(let r=0;r<t;r++)n[r]=this.readU32(e);return n}readU16Array(e=!0){let t=this.readU16(e),n=Array(t);for(let r=0;r<t;r++)n[r]=this.readU16(e);return n}readU8Array(){let e=this.readU16(!0),t=Array(e);for(let n=0;n<e;n++)t[n]=this.readU8();return t}readStringArray(e=!0){let t=this.readU16(e),n=Array(t);for(let r=0;r<t;r++)n[r]=this.readStringWithLength(e);return n}readBytesArray(e=!0){let t=this.readU16(e),n=Array(t);for(let r=0;r<t;r++)n[r]=this.readBytesWithLength(0,e);return n}getOffset(){return this.currentOffset}setOffset(e){this.currentOffset=e}verifyEnd(e){if(e>this.buffer.byteLength)throw Error(`Attempt to read beyond buffer length: requested up to byte offset ${e}, but buffer is only ${this.buffer.byteLength} bytes.`)}reverseBytes(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[e.length-1-n];return t}toHexString(e){return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}},O;function k(e,t=32){if(e<0n)throw RangeError(`Value cannot be negative`);let n=e.toString(16).padStart(t*2,`0`);if(n.length>t*2)throw RangeError(`Value exceeds ${t}-byte range`);let r=new Uint8Array(t);for(let e=0;e<t;e++)r[e]=parseInt(n.substring(e*2,e*2+2),16);return r}O=Symbol.dispose;var A=class e{constructor(e=0){E(this,`currentOffset`,0),E(this,`buffer`,void 0),this.buffer=this.getDefaultBuffer(e)}static estimateArrayOfBufferLength(e){if(e.length>65535)throw Error(`Array size is too large`);let t=2;for(let n=0;n<e.length;n++)t+=4+e[n].length;return t}writeU8(e){if(e>255)throw Error(`u8 value is too large.`);this.allocSafe(1),this.buffer.setUint8(this.currentOffset++,e)}writeU16(e,t=!0){if(e>65535)throw Error(`u16 value is too large.`);this.allocSafe(2),this.buffer.setUint16(this.currentOffset,e,!t),this.currentOffset+=2}writeU32(e,t=!0){if(e>4294967295)throw Error(`u32 value is too large.`);this.allocSafe(4),this.buffer.setUint32(this.currentOffset,e,!t),this.currentOffset+=4}writeU64(e,t=!0){if(e>18446744073709551615n)throw Error(`u64 value is too large.`);this.allocSafe(8),this.buffer.setBigUint64(this.currentOffset,e,!t),this.currentOffset+=8}writeI8(e){if(e<-128||e>127)throw Error(`i8 value is out of range.`);this.allocSafe(1),this.buffer.setInt8(this.currentOffset,e),this.currentOffset+=1}writeI16(e,t=!0){if(e<-32768||e>32767)throw Error(`i16 value is out of range.`);this.allocSafe(2),this.buffer.setInt16(this.currentOffset,e,!t),this.currentOffset+=2}writeI32(e,t=!0){if(e<-2147483648||e>2147483647)throw Error(`i32 value is out of range.`);this.allocSafe(4),this.buffer.setInt32(this.currentOffset,e,!t),this.currentOffset+=4}writeI64(e,t=!0){if(e<-9223372036854775808n||e>9223372036854775807n)throw Error(`i64 value is out of range.`);this.allocSafe(8),this.buffer.setBigInt64(this.currentOffset,e,!t),this.currentOffset+=8}writeSelector(e){this.writeU32(e,!0)}writeBoolean(e){this.writeU8(+!!e)}writeI128(e,t=!0){if(e>170141183460469231731687303715884105727n||e<-170141183460469231731687303715884105728n)throw Error(`i128 value is too large.`);this.allocSafe(16);let n=k(e,16);if(n.byteLength!==16)throw Error(`Invalid i128 value: ${e}`);if(t)for(let e=0;e<n.byteLength;e++)this.writeU8(n[e]);else for(let e=n.byteLength-1;e>=0;e--)this.writeU8(n[e])}writeU256(e,t=!0){if(e>115792089237316195423570985008687907853269984665640564039457584007913129639935n&&e<0n)throw Error(`u256 value is too large or negative.`);this.allocSafe(32);let n=k(e);if(n.byteLength!==32)throw Error(`Invalid u256 value: ${e}`);if(t)for(let e=0;e<n.byteLength;e++)this.writeU8(n[e]);else for(let e=n.byteLength-1;e>=0;e--)this.writeU8(n[e])}writeU128(e,t=!0){if(e>340282366920938463463374607431768211455n&&e<0n)throw Error(`u128 value is too large or negative.`);this.allocSafe(16);let n=k(e,16);if(n.byteLength!==16)throw Error(`Invalid u128 value: ${e}`);if(t)for(let e=0;e<n.byteLength;e++)this.writeU8(n[e]);else for(let e=n.byteLength-1;e>=0;e--)this.writeU8(n[e])}writeBytes(e){this.allocSafe(e.byteLength);for(let t=0;t<e.byteLength;t++)this.writeU8(e[t])}writeString(e){let t=new TextEncoder().encode(e);this.allocSafe(t.length),this.writeBytes(t)}writeStringWithLength(e){let t=new TextEncoder().encode(e);this.allocSafe(4+t.length),this.writeU32(t.length),this.writeBytes(t)}getBuffer(e=!0){let t=new Uint8Array(this.buffer.byteLength);for(let e=0;e<this.buffer.byteLength;e++)t[e]=this.buffer.getUint8(e);return e&&this.clear(),t}reset(){this.currentOffset=0,this.buffer=this.getDefaultBuffer(4)}toBytesReader(){return new D(this.getBuffer())}getOffset(){return this.currentOffset}setOffset(e){this.currentOffset=e}clear(){this.currentOffset=0,this.buffer=this.getDefaultBuffer()}[O](){this.clear()}allocSafe(e){this.currentOffset+e>this.buffer.byteLength&&this.resize(e)}writeBytesWithLength(e){this.writeU32(e.length),this.writeBytes(e)}writeArrayOfBuffer(t,n=!0){let r=e.estimateArrayOfBufferLength(t);this.allocSafe(r),this.writeU16(t.length,n);for(let e=0;e<t.length;e++)this.writeU32(t[e].length,n),this.writeBytes(t[e])}writeU32Array(e,t=!0){if(e.length>65535)throw Error(`Array size is too large`);this.writeU16(e.length,t);for(let n=0;n<e.length;n++)this.writeU32(e[n],t)}writeU256Array(e,t=!0){if(e.length>65535)throw Error(`Array size is too large`);this.writeU16(e.length,t);for(let n=0;n<e.length;n++)this.writeU256(e[n],t)}writeU128Array(e,t=!0){if(e.length>65535)throw Error(`Array size is too large`);this.writeU16(e.length,t);for(let n=0;n<e.length;n++)this.writeU128(e[n],t)}writeStringArray(e){if(e.length>65535)throw Error(`Array size is too large`);this.writeU16(e.length);for(let t=0;t<e.length;t++)this.writeStringWithLength(e[t])}writeU16Array(e,t=!0){if(e.length>65535)throw Error(`Array size is too large`);this.writeU16(e.length,t);for(let n=0;n<e.length;n++)this.writeU16(e[n],t)}writeU8Array(e){if(e.length>65535)throw Error(`Array size is too large`);this.writeU16(e.length);for(let t=0;t<e.length;t++)this.writeU8(e[t])}writeU64Array(e,t=!0){if(e.length>65535)throw Error(`Array size is too large`);this.writeU16(e.length,t);for(let n=0;n<e.length;n++)this.writeU64(e[n],t)}writeBytesArray(e){if(e.length>65535)throw Error(`Array size is too large`);this.writeU16(e.length);for(let t=0;t<e.length;t++)this.writeBytesWithLength(e[t])}resize(e){let t=new Uint8Array(this.buffer.byteLength+e);for(let e=0;e<this.buffer.byteLength;e++)t[e]=this.buffer.getUint8(e);this.buffer=new DataView(t.buffer,t.byteOffset,t.byteLength)}getDefaultBuffer(e=0){return new DataView(new ArrayBuffer(e))}},j=Symbol.dispose,M=Symbol.iterator,N=class e{constructor(t){if(E(this,`_keys`,[]),E(this,`_values`,{}),t instanceof e)this.setAll(t);else if(t)for(let[e,n]of t)this.set(e,n)}get size(){return this._keys.length}setAll(e){this._keys=[...e._keys],this._values={...e._values}}addAll(e){for(let[t,n]of e.entries())this.set(t,n)}*keys(){yield*this._keys}*values(){for(let e of this._keys)yield this._values[e]}*entries(){for(let e of this._keys)yield[e,this._values[e]]}set(e,t){return this.has(e)||this._keys.push(e),this._values[e]=t,this}indexOf(e){if(!this.has(e))return-1;for(let t=0;t<this._keys.length;t++)if(this._keys[t]===e)return t;throw Error(`Key not found, this should not happen.`)}get(e){return this._values[e]}has(e){return Object.prototype.hasOwnProperty.call(this._values,e)}delete(e){if(!this.has(e))return!1;let t=this.indexOf(e);return this._keys.splice(t,1),delete this._values[e],!0}clear(){this._keys=[],this._values={}}[j](){this.clear()}forEach(e,t){for(let n of this._keys)e.call(t,this._values[n],n,this)}*[M](){for(let e of this._keys)yield[e,this._values[e]]}},P=Symbol.dispose,F=Symbol.iterator,I=class e{constructor(t){if(E(this,`_values`,[]),E(this,`_index`,{}),t instanceof e)this.addAll(t);else if(t)for(let e of t)this.add(e)}get size(){return this._values.length}add(e){return this.has(e)||(this._values.push(e),this._index[e]=!0),this}has(e){return Object.prototype.hasOwnProperty.call(this._index,e)}indexOf(e){for(let t=0;t<this._values.length;t++)if(this._values[t]===e)return t;return-1}delete(e){if(!this.has(e))return!1;let t=this.indexOf(e);return t!==-1&&this._values.splice(t,1),delete this._index[e],!0}addAll(e){for(let t of e.values())this.add(t)}*values(){yield*this._values}*keys(){yield*this._values}forEach(e,t){for(let n of this._values)e.call(t,n,n,this)}clear(){this._values=[],this._index={}}[P](){this.clear()}*[F](){yield*this._values}},L=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),R=function(e){return`/`+e},z={},B=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=R(t,n),t in z)return;z[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:L,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};Object.assign(globalThis,{BinaryWriter:A,BinaryReader:D,FastMap:N,FastSet:I}),S([{pattern:`/blog/:id`,load:()=>B(()=>import(`./_id_-EWYvHfi2.js`),[])},{pattern:`/docs/*slug`,load:()=>B(()=>import(`./_...slug_-wR3shlWn.js`),[])},{pattern:`/about`,load:()=>B(()=>import(`./about-Ddvj1tjF.js`),[])},{pattern:`/io`,load:()=>B(()=>import(`./io-CODNJU57.js`),[])},{pattern:`/`,load:()=>B(()=>import(`./routes-GoydenoY.js`),[])}],()=>B(()=>import(`./layout-C15ZTPYI.js`),[]),()=>B(()=>import(`./404-D1bS2aH_.js`),[]));export{u as n,f as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./react-JbAfoxYe.js";import{t}from"./index-CdG0me90.js";var n=e();function r(){let e=new BinaryWriter;e.writeU32(42),e.writeStringWithLength(`hello toil`);let r=e.getBuffer(),i=new BinaryReader(r),a=i.readU32(),o=i.readStringWithLength(),s=new FastSet;return s.add(1n).add(2n).add(1n),(0,n.jsxs)(`main`,{children:[(0,n.jsx)(`h1`,{children:`Native IO`}),(0,n.jsxs)(`p`,{children:[(0,n.jsx)(`code`,{children:`new BinaryWriter()`}),` with no import — round-tripped `,a,` and "`,o,`" through `,r.length,` bytes; FastSet size `,s.size,`.`]}),(0,n.jsx)(t,{href:`/`,children:`Back home`})]})}export{r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./react-JbAfoxYe.js";import{t}from"./index-CdG0me90.js";var n=e();function r({children:e}){return(0,n.jsxs)(`div`,{style:{fontFamily:`system-ui`,maxWidth:640,margin:`2rem auto`},children:[(0,n.jsxs)(`header`,{style:{borderBottom:`1px solid #ddd`,paddingBottom:8,marginBottom:16},children:[(0,n.jsx)(`strong`,{children:`Toil`}),` — `,(0,n.jsx)(t,{href:`/`,children:`home`}),` · `,(0,n.jsx)(t,{href:`/about`,children:`about`})]}),e]})}var i=new BinaryWriter;console.log(i);export{r as default};
|