diff options
author | 2022-10-17 05:52:39 +0200 | |
---|---|---|
committer | 2022-10-16 20:52:39 -0700 | |
commit | 00ae8f79e4c55bf0769a5d0066d2947cf5c52073 (patch) | |
tree | d187172212bf5afcf4589ceb7bb2c8e198e8c84f /examples | |
parent | dc1330aef59827e057ddaaa9db50cd775991ebc7 (diff) | |
download | bun-00ae8f79e4c55bf0769a5d0066d2947cf5c52073.tar.gz bun-00ae8f79e4c55bf0769a5d0066d2947cf5c52073.tar.zst bun-00ae8f79e4c55bf0769a5d0066d2947cf5c52073.zip |
Reflecting new home for bun templates (#1317)
* Reflecting new home for bun templates
https://github.com/bun-community/create-templates/
* templates now in root
Diffstat (limited to 'examples')
72 files changed, 0 insertions, 1630 deletions
diff --git a/examples/blank/package.json b/examples/blank/package.json deleted file mode 100644 index 6b117a8c8..000000000 --- a/examples/blank/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "@bun-examples/blank", - "version": "0.0.3", - "module": "src/index.js", - "devDependencies": { - "bun-types": "latest" - } -} diff --git a/examples/blank/readme.md b/examples/blank/readme.md deleted file mode 100644 index 02b459bb3..000000000 --- a/examples/blank/readme.md +++ /dev/null @@ -1,13 +0,0 @@ -## Getting Started - -### Cloning the repo - -```sh -bun create blank ./NAME_HERE -``` - -### Execute a file (eg. src/index.js) - -```sh -bun run ./src/index.js -``` diff --git a/examples/blank/src/index.js b/examples/blank/src/index.js deleted file mode 100644 index eb065f93f..000000000 --- a/examples/blank/src/index.js +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello, World!'); diff --git a/examples/blank/tsconfig.json b/examples/blank/tsconfig.json deleted file mode 100644 index ebdb7d2f6..000000000 --- a/examples/blank/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ESNext"], - "module": "esnext", - "target": "esnext", - // "bun-types" is the important part - "types": ["bun-types"] - } -} diff --git a/examples/bun-bakery/.gitignore b/examples/bun-bakery/.gitignore deleted file mode 100644 index 87e56100f..000000000 --- a/examples/bun-bakery/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log -package-lock.json -**/*.bun
\ No newline at end of file diff --git a/examples/bun-bakery/assets/bunbakery.png b/examples/bun-bakery/assets/bunbakery.png Binary files differdeleted file mode 100644 index fad02d90e..000000000 --- a/examples/bun-bakery/assets/bunbakery.png +++ /dev/null diff --git a/examples/bun-bakery/gitignore b/examples/bun-bakery/gitignore deleted file mode 100644 index 87e56100f..000000000 --- a/examples/bun-bakery/gitignore +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log -package-lock.json -**/*.bun
\ No newline at end of file diff --git a/examples/bun-bakery/main.ts b/examples/bun-bakery/main.ts deleted file mode 100644 index 432c08208..000000000 --- a/examples/bun-bakery/main.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {Router} from "@kapsonfire/bun-bakery" - - -new Router({ - port: 3000, - assetsPath: import.meta.dir + '/assets/', - routesPath: import.meta.dir + '/routes/' -})
\ No newline at end of file diff --git a/examples/bun-bakery/package.json b/examples/bun-bakery/package.json deleted file mode 100644 index 8723376db..000000000 --- a/examples/bun-bakery/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "1.0.4", - "name": "@bun-examples/bun-bakery", - "dependencies": { - "@kapsonfire/bun-bakery": "^0.2.0" - } -} diff --git a/examples/bun-bakery/routes/index.ts b/examples/bun-bakery/routes/index.ts deleted file mode 100644 index 1b93d5dbe..000000000 --- a/examples/bun-bakery/routes/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import {Context} from "@kapsonfire/bun-bakery" - -export async function GET(ctx: Context) { - ctx.sendHTML('<img src="/assets/bunbakery.png"><h1>Hello World!</h1>'); -}
\ No newline at end of file diff --git a/examples/bun-bakery/tsconfig.json b/examples/bun-bakery/tsconfig.json deleted file mode 100644 index 311824a28..000000000 --- a/examples/bun-bakery/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "types": ["bun-types"], - "module": "esnext", - "moduleResolution": "Node" - } -}
\ No newline at end of file diff --git a/examples/discord-interactions/.env.example b/examples/discord-interactions/.env.example deleted file mode 100644 index a21515794..000000000 --- a/examples/discord-interactions/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -DISCORD_APP_ID= -DISCORD_BOT_TOKEN= -DISCORD_PUBLIC_KEY=
\ No newline at end of file diff --git a/examples/discord-interactions/.gitignore b/examples/discord-interactions/.gitignore deleted file mode 100644 index 1c22d540a..000000000 --- a/examples/discord-interactions/.gitignore +++ /dev/null @@ -1,88 +0,0 @@ -/data - -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -#config file -config.json - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# TernJS port file -.tern-port - -# pm2 -.pm2 -.pm2.bak diff --git a/examples/discord-interactions/README.md b/examples/discord-interactions/README.md deleted file mode 100644 index 2c656b73f..000000000 --- a/examples/discord-interactions/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# /create with Bun runtime - -A [slash-create](https://npm.im/slash-create) template, using [Bun runtime](https://bun.sh). - -## Getting Started - -### Cloning the repo - -```sh -bun create discord-interactions interactions-bot -``` - -### Development - -To run this locally, rename `.env.example` to `.env` and fill in the variables, then run `bun run.js` to start a local dev environment and use something similar to [ngrok](https://ngrok.com/) or [cloudflare](https://www.cloudflare.com/) to tunnel it to a URL. diff --git a/examples/discord-interactions/bun_shim/index.js b/examples/discord-interactions/bun_shim/index.js deleted file mode 100644 index 1eeca90b3..000000000 --- a/examples/discord-interactions/bun_shim/index.js +++ /dev/null @@ -1,39 +0,0 @@ -import { join, extname } from 'path'; -import { Creator } from 'slash-create'; -import { readdirSync, lstatSync } from 'fs'; -import { FetchRequestHandler } from './rest.js'; -export { default as BunServer } from './server.js'; - -export class BunSlashCreator extends Creator { - constructor(...args) { - super(...args); - this.requestHandler = new FetchRequestHandler(this); - } - - async registerCommandsIn(commandPath, customExtensions = []) { - const commands = []; - const extensions = ['.js', '.ts', '.mjs', '.cjs', ...customExtensions]; - - for (const path of find_files_with_extension(commandPath, extensions)) { - try { - commands.push(await import(path)); - } catch (error) { - this.emit('error', new Error(`Failed to load command ${filePath}: ${e}`)); - } - } - - return this.registerCommands(commands, true); - } -} - -function find_files_with_extension(path, extensions, names = []) { - for (const name of readdirSync(path)) { - const p = join(path, name); - const stat = lstatSync(p); - - if (extensions.includes(extname(name))) names.push(p); - else if (stat.isDirectory()) find_files_with_extension(p, extensions, names); - } - - return names; -}
\ No newline at end of file diff --git a/examples/discord-interactions/bun_shim/rest.js b/examples/discord-interactions/bun_shim/rest.js deleted file mode 100644 index d1c0b76ee..000000000 --- a/examples/discord-interactions/bun_shim/rest.js +++ /dev/null @@ -1,48 +0,0 @@ -import { RequestHandler } from 'slash-create'; -import { MultipartData } from 'slash-create/lib/util/multipartData.js'; - -export class FetchRequestHandler extends RequestHandler { - toString() { - return '[RequestHandler]'; - } - - async request(method, url, auth = true, body, file) { - const creator = this._creator; - - const headers = { - 'user-agent': this.userAgent, - 'x-ratelimit-precision': 'millisecond', - }; - - if (auth) { - headers.authorization = creator.options.token; - if (!headers.authorization) throw new Error('No token was set in the SlashCreator.'); - } - - if (body) { - if (method !== 'GET' && method !== 'DELETE') { - body = JSON.stringify(body); - headers['content-type'] = 'application/json'; - } - } - - if (file) { - if (Array.isArray(file)) {} - else if (file.file) file = [file]; - else throw new Error('Invalid file object.'); - - const form = new MultipartData(); - headers['content-type'] = `multipart/form-data; boundary=${form.boundary}`; - - for (const f of file) form.attach(f.name, f.file, f.name); - if (body) form.attach('payload_json', JSON.stringify(body)); - - body = Buffer.concat(form.finish()); - } - - const res = await fetch('https://discord.com' + this.baseURL + url, { body, method, headers }); - - if (res.ok) return res.json(); - throw new Error(`${method} got ${res.status} - ${await res.text()}`); - } -}
\ No newline at end of file diff --git a/examples/discord-interactions/bun_shim/server.js b/examples/discord-interactions/bun_shim/server.js deleted file mode 100644 index 86fb9e542..000000000 --- a/examples/discord-interactions/bun_shim/server.js +++ /dev/null @@ -1,79 +0,0 @@ -import { Server } from 'slash-create'; -import { MultipartData } from 'slash-create/lib/util/multipartData.js'; - -export default class BunServer extends Server { - #server = null; - #handler = null; - isWebserver = true; - - constructor() { - super({ alreadyListening: true }); - } - - createEndpoint(path, handler) { - this.#handler = handler; - } - - stop() { - if (this.#server) this.#server.close(); - else throw new Error('BunServer not started'); - } - - listen(port, options = {}) { - const getHandler = () => this.#handler; - - this.#server = Bun.serve({ - port, - ...options, - - async fetch(req) { - const handler = getHandler(); - if (!handler) return new Response('Server has no handler.', { status: 503 }); - if (req.method !== 'POST') return new Response('Server only supports POST requests.', { status: 405 }); - - const reqHeaders = Object.fromEntries(req.headers.entries()); - - const reqBody = await req.json(); - - return await new Promise(async (ok, err) => { - try { - await handler({ - request: req, - body: reqBody, - response: null, - headers: reqHeaders, - }, response => { - let body = response.body; - const headers = new Headers(); - - if (response.headers) { - for (const key in response.headers) { - headers.set(key, response.headers[key]); - } - } - - if ('string' !== typeof body) { - body = JSON.stringify(body); - headers.set('content-type', 'application/json'); - } - - if (response.files) { - const form = new MultipartData(); - headers.set('content-type', `multipart/form-data; boundary=${form.boundary}`); - - form.attach('payload_json', body); - for (const file of response.files) form.attach(file.name, file.file, file.name); - - body = Buffer.concat(form.finish()); - } - - ok(new Response(body, { headers, status: response.status })); - }); - } catch (error) { - err(error); - } - }); - }, - }); - } -};
\ No newline at end of file diff --git a/examples/discord-interactions/commands/context_menu/avatar.js b/examples/discord-interactions/commands/context_menu/avatar.js deleted file mode 100644 index fee1ccc68..000000000 --- a/examples/discord-interactions/commands/context_menu/avatar.js +++ /dev/null @@ -1,21 +0,0 @@ -import { SlashCommand, ApplicationCommandType } from 'slash-create'; - -export default class AvatarCommand extends SlashCommand { - constructor(creator) { - super(creator, { - // You must specify a type for context menu commands, but defaults - // to `CHAT_INPUT`, or regular slash commands. - type: ApplicationCommandType.USER, - name: 'Get Avatar URL', - }); - - this.filePath = __filename; - } - - async run(ctx) { - // The target user can be accessed from here - // You can also use `ctx.targetMember` for member properties - const target = ctx.targetUser; - return `${target.username}'s Avatar: ${target.avatarURL}`; - } -}
\ No newline at end of file diff --git a/examples/discord-interactions/commands/hello.js b/examples/discord-interactions/commands/hello.js deleted file mode 100644 index b72051724..000000000 --- a/examples/discord-interactions/commands/hello.js +++ /dev/null @@ -1,21 +0,0 @@ -import { SlashCommand, CommandOptionType } from 'slash-create'; - -export default class HelloCommand extends SlashCommand { - constructor(creator) { - super(creator, { - name: 'hello', - description: 'Says hello to you.', - options: [{ - type: CommandOptionType.STRING, - name: 'food', - description: 'What food do you like?' - }] - }); - - this.filePath = __filename; - } - - async run(ctx) { - return ctx.options.food ? `You like ${ctx.options.food}? Nice!` : `Hello, ${ctx.user.username}!`; - } -}
\ No newline at end of file diff --git a/examples/discord-interactions/commands/modal.ts b/examples/discord-interactions/commands/modal.ts deleted file mode 100644 index ed4026ee0..000000000 --- a/examples/discord-interactions/commands/modal.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { SlashCommand, ComponentType, TextInputStyle } from 'slash-create'; - -export default class ModalCommand extends SlashCommand { - constructor(creator) { - super(creator, { - name: 'modal', - description: 'Send a cool modal.' - }); - - this.filePath = __filename; - } - - async run(ctx) { - // You can send a modal this way - // Keep in mind providing a callback is optional, but no callback requires the custom_id to be defined. - ctx.sendModal( - { - title: 'Example Modal', - components: [ - { - type: ComponentType.ACTION_ROW, - components: [ - { - type: ComponentType.TEXT_INPUT, - label: 'Text Input', - style: TextInputStyle.SHORT, - custom_id: 'text_input', - placeholder: 'Type something...' - } - ] - }, - { - type: ComponentType.ACTION_ROW, - components: [ - { - type: ComponentType.TEXT_INPUT, - label: 'Long Text Input', - style: TextInputStyle.PARAGRAPH, - custom_id: 'long_text_input', - placeholder: 'Type something...' - } - ] - } - ] - }, - (mctx) => { - mctx.send(`Your input: ${mctx.values.text_input}\nYour long input: ${mctx.values.long_text_input}`); - } - ); - } -}
\ No newline at end of file diff --git a/examples/discord-interactions/gitignore b/examples/discord-interactions/gitignore deleted file mode 100644 index 1c22d540a..000000000 --- a/examples/discord-interactions/gitignore +++ /dev/null @@ -1,88 +0,0 @@ -/data - -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -#config file -config.json - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# TernJS port file -.tern-port - -# pm2 -.pm2 -.pm2.bak diff --git a/examples/discord-interactions/package.json b/examples/discord-interactions/package.json deleted file mode 100644 index faf7f85d4..000000000 --- a/examples/discord-interactions/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "0.0.9", - "name": "@bun-examples/discord-interactions", - "dependencies": { - "slash-create": "^5.7.0" - } -} diff --git a/examples/discord-interactions/polyfill.js b/examples/discord-interactions/polyfill.js deleted file mode 100644 index abe756dc9..000000000 --- a/examples/discord-interactions/polyfill.js +++ /dev/null @@ -1,2 +0,0 @@ -Error.captureStackTrace = () => {}; -Buffer.isBuffer = Buffer.isBuffer.bind(Buffer);
\ No newline at end of file diff --git a/examples/discord-interactions/run.js b/examples/discord-interactions/run.js deleted file mode 100644 index 108e0f85c..000000000 --- a/examples/discord-interactions/run.js +++ /dev/null @@ -1,22 +0,0 @@ -// polyfill v8 and node (TODO: fix in bun) -import './polyfill.js'; - -import path from 'node:path'; -import { BunServer, BunSlashCreator } from './bun_shim/index.js'; - -const client = new BunSlashCreator({ - token: process.env.DISCORD_BOT_TOKEN, - publicKey: process.env.DISCORD_PUBLIC_KEY, - applicationID: process.env.DISCORD_APP_ID, -}); - -// client.on('debug', console.log); -client.on('error', console.error); - -client.withServer(new BunServer()); -await client.registerCommandsIn(path.join(__dirname, 'commands')); - -client.syncCommands(); -await client.server.listen(1337); - -// client.server.stop(); // stop server
\ No newline at end of file diff --git a/examples/hono/package.json b/examples/hono/package.json deleted file mode 100644 index 475c1ed39..000000000 --- a/examples/hono/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "1.0.4", - "name": "@bun-examples/hono", - "devDependencies": { - "bun-types": "latest" - }, - "dependencies": { - "hono": "^2.0.0" - }, - "scripts": { - "start": "bun run src/index.ts" - }, - "module": "src/index.js" -}
\ No newline at end of file diff --git a/examples/hono/public/favicon.ico b/examples/hono/public/favicon.ico Binary files differdeleted file mode 100644 index 543164354..000000000 --- a/examples/hono/public/favicon.ico +++ /dev/null diff --git a/examples/hono/readme.md b/examples/hono/readme.md deleted file mode 100644 index 20b15e3ea..000000000 --- a/examples/hono/readme.md +++ /dev/null @@ -1,21 +0,0 @@ -# Hono with Bun runtime - -## Getting Started - -### Cloning the repo - -```sh -bun create hono ./NAME_HERE -``` - -### Development - -``` -bun run start -``` - -Open http://localhost:3000 with your browser to see the result. - -### For more information - -See <https://honojs.dev/>
\ No newline at end of file diff --git a/examples/hono/src/index.ts b/examples/hono/src/index.ts deleted file mode 100644 index 801955af3..000000000 --- a/examples/hono/src/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Hono } from "hono"; -import { serveStatic } from 'hono/serve-static.bun'; - -const port = parseInt(process.env.PORT) || 3000; - -const app = new Hono(); - -app.use('/favicon.ico', serveStatic({ path: './public/favicon.ico' })); - -app.get("/", (c) => { - return c.json({ message: "Hello World!" }); -}); - -console.log(`Running at http://localhost:${port}`); - -export default { - port, - fetch: app.fetch -}; diff --git a/examples/hono/tsconfig.json b/examples/hono/tsconfig.json deleted file mode 100644 index a3d4e525d..000000000 --- a/examples/hono/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ESNext"], - "module": "esnext", - "target": "esnext", - "moduleResolution": "node", - // "bun-types" is the important part - "types": ["bun-types"] - } - }
\ No newline at end of file diff --git a/examples/kingworld/README.md b/examples/kingworld/README.md deleted file mode 100644 index cd55f9b3b..000000000 --- a/examples/kingworld/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# KingWorld with Bun runtime - -## Getting Started -To get started with this template, simply paste this command into your terminal: -```bash -bun create kingworld ./kingworld-example -``` - -## Development -KingWorld uses `nodemon` for auto reload. To start the development server run: -```bash -bun run dev -``` - -Open http://localhost:3000/ with your browser to see the result.
\ No newline at end of file diff --git a/examples/kingworld/bun.lockb b/examples/kingworld/bun.lockb Binary files differdeleted file mode 100755 index 6c41c9346..000000000 --- a/examples/kingworld/bun.lockb +++ /dev/null diff --git a/examples/kingworld/gitignore b/examples/kingworld/gitignore deleted file mode 100644 index 87e56100f..000000000 --- a/examples/kingworld/gitignore +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log -package-lock.json -**/*.bun
\ No newline at end of file diff --git a/examples/kingworld/nodemon.json b/examples/kingworld/nodemon.json deleted file mode 100644 index 0aa1f6ecd..000000000 --- a/examples/kingworld/nodemon.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "restartable": "rs", - "ignore": [".git", "node_modules/", "__tests__", "test"], - "exec": "bun src/index.ts", - "ext": "js, json, ts" -} diff --git a/examples/kingworld/package.json b/examples/kingworld/package.json deleted file mode 100644 index 92bef8784..000000000 --- a/examples/kingworld/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "kingworld", - "version": "1.0.0", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "dev": "nodemon --config nodemon.json" - }, - "dependencies": { - "kingworld": "latest" - }, - "devDependencies": { - "bun-types": "latest", - "nodemon": "^2.0.19" - } -} diff --git a/examples/kingworld/src/index.ts b/examples/kingworld/src/index.ts deleted file mode 100644 index 68fd8f1a8..000000000 --- a/examples/kingworld/src/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import KingWorld from 'kingworld' - -new KingWorld() - .get("/", () => "Hello KingWorld") - .listen(3000) - -console.log('🦊 KINGWORLD is running at :3000') diff --git a/examples/kingworld/tsconfig.json b/examples/kingworld/tsconfig.json deleted file mode 100644 index 4845f0f5e..000000000 --- a/examples/kingworld/tsconfig.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - "types": ["bun-types"], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ - } -} diff --git a/examples/next/.eslintrc.json b/examples/next/.eslintrc.json deleted file mode 100644 index bffb357a7..000000000 --- a/examples/next/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/examples/next/.gitignore b/examples/next/.gitignore deleted file mode 100644 index 87e56100f..000000000 --- a/examples/next/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log -package-lock.json -**/*.bun
\ No newline at end of file diff --git a/examples/next/.npmignore b/examples/next/.npmignore deleted file mode 100644 index dc84c8da3..000000000 --- a/examples/next/.npmignore +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log -package-lock.json -**/*.bun diff --git a/examples/next/README.md b/examples/next/README.md deleted file mode 100644 index daec97ae0..000000000 --- a/examples/next/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# Next.js with Bun runtime - -This is a [Next.js](https://nextjs.org/) project bootstrapped with Bun. - -## Getting Started - -### Cloning the repo - -```sh -bun create next ./app -``` - -First, run the development server: - -```bash -bun 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.tsx`. The page auto-updates as you edit the file. - -## 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 the [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/examples/next/bunfig.toml b/examples/next/bunfig.toml deleted file mode 100644 index f191e4e10..000000000 --- a/examples/next/bunfig.toml +++ /dev/null @@ -1 +0,0 @@ -framework = "next" diff --git a/examples/next/components/Title.tsx b/examples/next/components/Title.tsx deleted file mode 100644 index 73963663a..000000000 --- a/examples/next/components/Title.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import Hey from "./subtitle"; - -export default function Title() { - return ( - <h1> - Hello <Hey></Hey> - </h1> - ); -} - -export enum TitleEnum { - wow = 1, -} diff --git a/examples/next/components/subtitle.tsx b/examples/next/components/subtitle.tsx deleted file mode 100644 index 1fda3db60..000000000 --- a/examples/next/components/subtitle.tsx +++ /dev/null @@ -1,4 +0,0 @@ - -export default function Hey() { - return <div>!!yep</div>; -} diff --git a/examples/next/gitignore b/examples/next/gitignore deleted file mode 100644 index 87e56100f..000000000 --- a/examples/next/gitignore +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log -package-lock.json -**/*.bun
\ No newline at end of file diff --git a/examples/next/next-env.d.ts b/examples/next/next-env.d.ts deleted file mode 100644 index 9bc3dd46b..000000000 --- a/examples/next/next-env.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// <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. diff --git a/examples/next/next.config.js b/examples/next/next.config.js deleted file mode 100644 index c161436ab..000000000 --- a/examples/next/next.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - reactStrictMode: true, - typescript: { - // !! WARN !! - // Dangerously allow production builds to successfully complete even if - // your project has type errors. - // !! WARN !! - ignoreBuildErrors: true, - }, -}; diff --git a/examples/next/package.json b/examples/next/package.json deleted file mode 100644 index 54195bbca..000000000 --- a/examples/next/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@bun-examples/next", - "version": "0.0.58", - "dependencies": { - "next": "^12.2.0", - "react": "^18", - "react-dom": "^18", - "react-is": "^18" - }, - "devDependencies": { - "@types/react": "^18", - "bun-framework-next": "^12.2", - "typescript": "latest" - }, - "bun-create": { - "postinstall": [ - "bun bun --use next" - ] - }, - "module": "index.js" -} diff --git a/examples/next/pages/_app.tsx b/examples/next/pages/_app.tsx deleted file mode 100644 index 2fc3e0700..000000000 --- a/examples/next/pages/_app.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import "../styles/globals.css"; - -function MyApp({ Component, pageProps }) { - return <Component {...pageProps} />; -} - -export default MyApp; diff --git a/examples/next/pages/index.tsx b/examples/next/pages/index.tsx deleted file mode 100644 index fc078404d..000000000 --- a/examples/next/pages/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import Head from "next/head"; -import React from "react"; -import styles from "../styles/Home.module.css"; -import nextPackage from "next/package.json"; - -export default function Home({}) { - return ( - <div className={styles.container}> - <Head> - <title>Next.js</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> v - {nextPackage.version} - </h1> - - <p className={styles.description}> - Get started by editing{" "} - <code className={styles.code}>pages/index.tsx</code> - </p> - </main> - </div> - ); -} diff --git a/examples/next/public/favicon.ico b/examples/next/public/favicon.ico Binary files differdeleted file mode 100644 index 718d6fea4..000000000 --- a/examples/next/public/favicon.ico +++ /dev/null diff --git a/examples/next/public/vercel.svg b/examples/next/public/vercel.svg deleted file mode 100644 index fbf0e25a6..000000000 --- a/examples/next/public/vercel.svg +++ /dev/null @@ -1,4 +0,0 @@ -<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>
\ No newline at end of file diff --git a/examples/next/styles/Home.module.css b/examples/next/styles/Home.module.css deleted file mode 100644 index c181f0153..000000000 --- a/examples/next/styles/Home.module.css +++ /dev/null @@ -1,121 +0,0 @@ -.container { - min-height: 99vh; - 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; - } -} diff --git a/examples/next/styles/globals.css b/examples/next/styles/globals.css deleted file mode 100644 index e5e2dcc23..000000000 --- a/examples/next/styles/globals.css +++ /dev/null @@ -1,16 +0,0 @@ -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; -} diff --git a/examples/next/tsconfig.json b/examples/next/tsconfig.json deleted file mode 100644 index 7af6240a5..000000000 --- a/examples/next/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "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"] -} diff --git a/examples/react/.gitignore b/examples/react/.gitignore deleted file mode 100644 index ee1e49b71..000000000 --- a/examples/react/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log - -package-lock.json -**/*.bun - -# 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* diff --git a/examples/react/.npmignore b/examples/react/.npmignore deleted file mode 100644 index 9b5538ebc..000000000 --- a/examples/react/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log -package-lock.json -**/*.bun - -# 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* diff --git a/examples/react/README.md b/examples/react/README.md deleted file mode 100644 index f88b8fe66..000000000 --- a/examples/react/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# React with Bun runtime - -This is a React project bootstrapped with [bun](https://bun.sh/). - -## Getting Started - -### Cloning the repo - -```sh -bun create react ./react-bun-app -``` - -### Development - -First, run the development server. - -``` -bun dev -``` - -Open http://localhost:3000 with your browser to see the result. - -You can start editing the page by modifying src/App.jsx. The page auto-updates as you edit the file. - -## Learn More - -To learn more about React.js, take a look at the following resources: - -- [React.js Documentation](https://reactjs.org/docs/getting-started.html) - learn about React.js features. -- [Learn React.js](https://reactjs.org/tutorial/tutorial.html) - an interactive React.js tutorial. - -You can check out the [React.js GitHub repository](https://github.com/facebook/react) - your feedback and contributions are welcome! diff --git a/examples/react/gitignore b/examples/react/gitignore deleted file mode 100644 index ee1e49b71..000000000 --- a/examples/react/gitignore +++ /dev/null @@ -1,32 +0,0 @@ -**/*.trace -**/*.zip -**/*.tar.gz -**/*.tgz -**/*.log - -package-lock.json -**/*.bun - -# 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* diff --git a/examples/react/package.json b/examples/react/package.json deleted file mode 100644 index fa7ac4c93..000000000 --- a/examples/react/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@bun-examples/react", - "version": "0.1.2", - "dependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0", - "web-vitals": "^2.1.4" - }, - "eslintConfig": { - "extends": [ - "react-app" - ] - }, - "devDependencies": { - "typescript": "latest" - }, - "bun-create": { - "postinstall": [ - "bun bun ./src/index.jsx" - ] - } -} diff --git a/examples/react/public/favicon.ico b/examples/react/public/favicon.ico Binary files differdeleted file mode 100644 index a11777cc4..000000000 --- a/examples/react/public/favicon.ico +++ /dev/null diff --git a/examples/react/public/index.html b/examples/react/public/index.html deleted file mode 100644 index e933c5650..000000000 --- a/examples/react/public/index.html +++ /dev/null @@ -1,44 +0,0 @@ -<!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> diff --git a/examples/react/public/logo192.png b/examples/react/public/logo192.png Binary files differdeleted file mode 100644 index fc44b0a37..000000000 --- a/examples/react/public/logo192.png +++ /dev/null diff --git a/examples/react/public/logo512.png b/examples/react/public/logo512.png Binary files differdeleted file mode 100644 index a4e47a654..000000000 --- a/examples/react/public/logo512.png +++ /dev/null diff --git a/examples/react/public/manifest.json b/examples/react/public/manifest.json deleted file mode 100644 index 080d6c77a..000000000 --- a/examples/react/public/manifest.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "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" -} diff --git a/examples/react/public/robots.txt b/examples/react/public/robots.txt deleted file mode 100644 index e9e57dc4d..000000000 --- a/examples/react/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: diff --git a/examples/react/src/App.css b/examples/react/src/App.css deleted file mode 100644 index c5b692d06..000000000 --- a/examples/react/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -.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 h1 { - font-size: 1.75rem; -} - -.App-article { - 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); - } -} diff --git a/examples/react/src/App.jsx b/examples/react/src/App.jsx deleted file mode 100644 index a3e9150b9..000000000 --- a/examples/react/src/App.jsx +++ /dev/null @@ -1,23 +0,0 @@ -import "./App.css"; -import logo from "./logo.svg"; - -function App() { - return ( - <div className="App" role="main"> - <article className="App-article"> - <img src={logo} className="App-logo" alt="logo" /> - <h3>Welcome to React!</h3> - <a - className="App-link" - href="https://reactjs.org" - target="_blank" - rel="noopener noreferrer" - > - Learn React - </a> - </article> - </div> - ); -} - -export default App; diff --git a/examples/react/src/images.d.ts b/examples/react/src/images.d.ts deleted file mode 100644 index 091d25e21..000000000 --- a/examples/react/src/images.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*.svg' { - const content: any; - export default content; -} diff --git a/examples/react/src/index.css b/examples/react/src/index.css deleted file mode 100644 index ec2585e8c..000000000 --- a/examples/react/src/index.css +++ /dev/null @@ -1,13 +0,0 @@ -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; -} diff --git a/examples/react/src/index.jsx b/examples/react/src/index.jsx deleted file mode 100644 index 951fbfa8d..000000000 --- a/examples/react/src/index.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; - -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render( - <React.StrictMode> - <App /> - </React.StrictMode> -); - -// 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();
\ No newline at end of file diff --git a/examples/react/src/logo.svg b/examples/react/src/logo.svg deleted file mode 100644 index 9dfc1c058..000000000 --- a/examples/react/src/logo.svg +++ /dev/null @@ -1 +0,0 @@ -<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>
\ No newline at end of file diff --git a/examples/react/src/reportWebVitals.js b/examples/react/src/reportWebVitals.js deleted file mode 100644 index 7d7417e81..000000000 --- a/examples/react/src/reportWebVitals.js +++ /dev/null @@ -1,13 +0,0 @@ -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;
\ No newline at end of file |