diff --git a/.gitattributes b/.gitattributes index 6f28e15..176a458 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ * text=auto -*.lockb binary diff=lockb diff --git a/.gitignore b/.gitignore index f6a33e1..08921dc 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ logs node_modules temp docs/.vitepress/cache +.env diff --git a/.vscode/dictionary.txt b/.vscode/dictionary.txt index 9ca446a..50a272b 100644 --- a/.vscode/dictionary.txt +++ b/.vscode/dictionary.txt @@ -3,6 +3,7 @@ biomejs bluesky booleanish bumpp +bunfig bunx changelogen changelogithub @@ -18,6 +19,7 @@ dtsx entrypoints heroicons iconify +localtunnels lockb openweb outdir @@ -27,9 +29,11 @@ prefetch preinstall quickfix shikijs +shoutout socio Solana Spatie +sponsorware stacksjs tlsx twoslash diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 875df6d..8647bb9 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -17,8 +17,8 @@ const analyticsHead: HeadConfig[] = [ ] const nav = [ + { text: 'News', link: 'https://stacksjs.org/news' }, { text: 'Changelog', link: 'https://github.com/stacksjs/vite-plugin-local/releases' }, - // { text: 'Blog', link: 'https://updates.ow3.org' }, { text: 'Resources', items: [ @@ -26,16 +26,11 @@ const nav = [ { text: 'Sponsors', link: '/sponsors' }, { text: 'Partners', link: '/partners' }, { text: 'Postcardware', link: '/postcardware' }, + { text: 'License', link: '/license' }, { items: [ - { - text: 'Awesome Stacks', - link: 'https://github.com/stacksjs/awesome-stacks', - }, - { - text: 'Contributing', - link: 'https://github.com/stacksjs/vite-plugin-local/blob/main/.github/CONTRIBUTING.md', - }, + { text: 'Awesome Stacks', link: 'https://github.com/stacksjs/awesome-stacks' }, + { text: 'Contributing', link: 'https://github.com/stacksjs/vite-plugin-local/blob/main/.github/CONTRIBUTING.md' }, ], }, ], @@ -46,11 +41,13 @@ const sidebar = [ { text: 'Get Started', items: [ - { text: 'Introduction', link: '/intro' }, + { text: 'Intro', link: '/intro' }, { text: 'Install', link: '/install' }, { text: 'Usage', link: '/usage' }, + { text: 'Config', link: '/config' }, ], }, + { text: 'Showcase', link: '/Showcase' }, ] export default withPwa( @@ -76,7 +73,10 @@ export default withPwa( ], themeConfig: { - logo: './images/logo-transparent.svg', + logo: { + light: './images/logo-transparent.svg', + dark: './images/logo-white-transparent.svg', + }, nav, sidebar, diff --git a/docs/config.md b/docs/config.md new file mode 100644 index 0000000..2fc6c82 --- /dev/null +++ b/docs/config.md @@ -0,0 +1,69 @@ +# Configuration + +The plugin can be configured with the following options: + +```ts +// vite.config.ts +import type { LocalConfig } from 'vite-plugin-local' +import { defineConfig } from 'vite' +import Local from 'vite-plugin-local' + +const config: LocalConfig = { + /** + * Enable/disable the plugin + * @default true + */ + enabled: true, + + /** + * The target domain to proxy to (e.g., 'my-app.localhost') + * @example 'my-app.test' + * @example 'example.com' + * @default 'stacks.localhost' + */ + domain: 'my-app.local', // default: stacks.localhost + + /** + * SSL/TLS configuration + * - true: uses default SSL config + * - false: disables SSL + * - object: custom SSL configuration + * @default false + * @example true + */ + https: true, // default: true, pass TlsConfig options for custom certificates + + /** + * Cleanup options + * - true: cleanup everything + * - false: cleanup nothing + * - object: cleanup specific items + * @default { hosts: true, certs: false } + * @example { hosts: true, certs: true } + */ + cleanup: { + certs: true, // default: false, cleans up the certificates created on server shutdown + hosts: true, // default: true, cleans up /etc/hosts on server shutdown + }, + + /** + * By default, VitePress resolves inbound links to URLs ending with .html. + * However, some users may prefer "Clean URLs" without the .html extension + * for example, example.com/path instead of example.com/path.html. + * @default false + */ + cleanUrls: true, // default: false, cleans up URLs by not requiring the .html extension + + /** + * Enable verbose logging + * @default false + */ + verbose: true, // default: false, enables detailed logging +} + +export default defineConfig({ + plugins: [ + Local(config) + ] +}) +``` diff --git a/docs/install.md b/docs/install.md index 0d8ccee..3e99662 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,18 +1,49 @@ # Install -## Bun & Node.js +Installing `vite-plugin-local` is easy. Simply pull it in via your package manager of choice. -```bash -npm install -d vite-plugin-local -#bun install -d @stacksjs/vite-plugin-local +::: code-group -# or, invoke immediately -bunx vite-plugin-local -npx vite-plugin-local +```bash [npm] +npm install --save-dev vite-plugin-local + +# or +# npm i -d vite-plugin-local +``` + +```bash [bun] +bun install --dev vite-plugin-local + +# or +# bun add --dev vite-plugin-local +# bun i -d vite-plugin-local ``` -_We are looking to publish this package npm under the name `vite-plugin-local`. We are also hoping npm will release the name for us._ +```bash [yarn] +yarn add --dev vite-plugin-local + +# or +# yarn i -d vite-plugin-local +``` -## Binaries +::: + +## Usage + +This minimal usage example shows how to use `vite-plugin-local` in your Vite configuration, using the pluginโ€™s default settings. + +```javascript +// vite.config.{js,ts} +import vue from '@vitejs/plugin-vue' +import { defineConfig } from 'vite' +import local from 'vite-plugin-local' + +export default defineConfig({ + plugins: [ + vue(), // svelte(), react(), ... + local() + ] +}) +``` -For now, you can download the `vite-plugin-local` binaries from the [releases page](https://github.com/stacksjs/vite-plugin-local/releases/tag/v0.4.1). Choose the binary that matches your platform and architecture: +To read about the more elaborate usage API, check out the the following page in our documentation. diff --git a/docs/intro.md b/docs/intro.md index 5cf55d7..3d89624 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -4,41 +4,18 @@ `vite-plugin-local` is a smart reverse proxy for local development, with HTTPS support, and other goodies. -## Local Development - -> A smart Vite plugin that enables pretty development URLs, including HTTPS. - ## Features - Pretty development URLs - Smart HTTPS management - Automatically cleans URLs - Lightweight -- _Soon: Local Tunneling_ - -## Changelog - -Please see our [releases](https://github.com/stacksjs/vite-plugin-local/releases) page for more information on what has changed recently. - -## Contributing - -Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details. -## Community - -For help, discussion about best practices, or any other conversation that would benefit from being searchable: - -[Discussions on GitHub](https://github.com/stacksjs/stacks/discussions) - -For casual chit-chat with others using this package: - -[Join the Stacks Discord Server](https://discord.gg/stacksjs) - -## Postcardware - -Two things are true: Stacks OSS will always stay open-source, and we do love to receive postcards from wherever Stacks is used! ๐ŸŒ _We also publish them on our website._ +> A smart Vite plugin that enables pretty development URLs, including HTTPS. -Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States ๐ŸŒŽ +::: info +We are soon releasing [local tunnel](https://localtunnel.sh/) support. +::: ## Sponsors @@ -54,6 +31,6 @@ We would like to extend our thanks to the following sponsors for funding Stacks ## License -The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information. +The MIT License (MIT). Please see [LICENSE](/license) for more information. Made with ๐Ÿ’™ diff --git a/docs/license.md b/docs/license.md new file mode 100644 index 0000000..6d46d1d --- /dev/null +++ b/docs/license.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2024 Stacks.js + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/partners.md b/docs/partners.md new file mode 100644 index 0000000..d0d6180 --- /dev/null +++ b/docs/partners.md @@ -0,0 +1,8 @@ +# Partners + +The following companies and organizations are supporting Stacks development through partnerships: + +- [JetBrains](https://www.jetbrains.com/) +- [The Solana Foundation](https://solana.com/) + +If you are interested in becoming a partner, please reach out to us. diff --git a/docs/postcardware.md b/docs/postcardware.md new file mode 100644 index 0000000..2e71a10 --- /dev/null +++ b/docs/postcardware.md @@ -0,0 +1,11 @@ +# Postcardware + +Two things are true: Stacks OSS will always stay open-source, and we do love to receive postcards from wherever Stacks is used! ๐ŸŒ + +_We also publish them on our website._ + +## Address + +Our address in the US is: + +Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States ๐ŸŒŽ diff --git a/docs/public/images/logo-white-transparent.svg b/docs/public/images/logo-white-transparent.svg new file mode 100644 index 0000000..a5847dd --- /dev/null +++ b/docs/public/images/logo-white-transparent.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/showcase.md b/docs/showcase.md new file mode 100644 index 0000000..3107f5c --- /dev/null +++ b/docs/showcase.md @@ -0,0 +1,3 @@ +# Showcase + +Here are all the cool projects that people have built using `vite-plugin-local`. If you have something youโ€™d like to share, please share it with us in any way _(on Discord, Social Media, or via a PR, etc.)_, and weโ€™ll add it here. diff --git a/docs/sponsors.md b/docs/sponsors.md new file mode 100644 index 0000000..d7fb467 --- /dev/null +++ b/docs/sponsors.md @@ -0,0 +1,131 @@ +# Become a Stacks.js Sponsor + +Stacks.js is an MIT licensed open source project and completely free to use. The tremendous amount of effort needed to maintain such a large ecosystem and develop new features for the project is only made sustainable thanks to the generous financial backing of our sponsors. + +## How to Sponsor + +Sponsorships can be done via [GitHub Sponsors](https://github.com/sponsors/chrisbbreuer) or [OpenCollective](https://opencollective.com/stacksjs). Invoices can be obtained via GitHub's payment system. Both monthly-recurring sponsorships and one-time donations are accepted. Recurring sponsorships are entitled to logo placements as specified in Sponsorship Tiers. + +If you have questions regarding tiers, payment logistics, or sponsor exposure data, please reach out to . + +The following companies and organizations are supporting Stacks development through sponsorships: + +## Sponsoring Stacks as a Business + +Sponsoring Stacks gives you developer exposure around the world through our website and GitHub project READMEs. This not only directly generates leads, but also improves your brand recognition as a business that cares about Open Source. This is an intangible but extremely important asset for companies building products for developers, as it improves your conversion rate. + +If you are using Stacks to build a revenue-generating product, it makes business sense to sponsor Stacks's development: it ensures the project that your product relies on stays healthy and actively maintained. The exposure and positive brand image in the Stacks community also makes it easier to attract and recruit Stacks developers. + +If you are building a product where your target customers are developers, you will gain high quality traffic through the sponsorship exposure, since all our visitors are developers. The sponsorship also builds brand recognition and improves conversion. + +## Sponsoring Stacks as an Individual + +If you are an individual user and have enjoyed the productivity of using Stacks, consider donating as a sign of appreciation - like buying us coffee once in a while. Many of our team members accept sponsorships and donations via GitHub Sponsors. Look for the "Sponsor" button on each team member's profile on our [team page](https://stacksjs-docs.netlify.app/team). + +You can also try to convince your employer to sponsor Stacks as a business. This may not be easy, but business sponsorships typically make a much larger impact on the sustainability of OSS projects than individual donations, so you will help us much more if you succeed. + +## Tier Benefits + +- ***Global Special Sponsor*** + - Limited to one sponsor globally. Currently vacant. [Get in touch!](mailto:sponsors@stacksjs.org) + - (Exclusive) Above the fold logo placement on the front page of [stacksjs.org](https://stacksjs.org). + - (Exclusive) Special shoutout and regular retweets of major product launches via Stacks's official social accounts. + - Most prominent logo placement in all locations from tiers below. + +___ + +- **Diamond (USD$2,500/mo)** + - Prominent logo placement on the front page of [stacksjs.org](https://stacksjs.org), [docs.stacksjs.org](https://docs.stacksjs.org), [tlsx.sh](https://tlsx.sh), [rpx](https://reverse-proxy.sh), [dtsx](github.com/stacksjs/dtsx), [localtunnels](https://localtunnel.sh), [bunfig](https://bunfig.netlify.app/), [vite-plugin-local](https://vite-plugin-local.netlify.app/), [ts-collect](https://ts-collect.netlify.app/), [ts-spreadsheets](https://ts-spreadsheets.netlify.app/). + - Prominent logo placement in sidebar of all content pages. + - Prominent logo placement in the README of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + +___ + +- **Platinum (USD$1,000/mo):** + - Large logo placement on the front page of [stacksjs.org](https://stacksjs.org), [docs.stacksjs.org](https://docs.stacksjs.org), [tlsx.sh](https://tlsx.sh), [rpx](https://reverse-proxy.sh), [dtsx](github.com/stacksjs/dtsx), [localtunnels](https://localtunnel.sh), [bunfig](https://bunfig.netlify.app/), [vite-plugin-local](https://vite-plugin-local.netlify.app/), [ts-collect](https://ts-collect.netlify.app/), [ts-spreadsheets](https://ts-spreadsheets.netlify.app/). + - Large logo placement in the README of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + +___ + +- **Double Gold (USD$500/mo):** + - Large logo placement on the front page of [stacksjs.org](https://stacksjs.org), [docs.stacksjs.org](https://docs.stacksjs.org), [tlsx.sh](https://tlsx.sh), [rpx](https://reverse-proxy.sh), [dtsx](github.com/stacksjs/dtsx), [localtunnels](https://localtunnel.sh), [bunfig](https://bunfig.netlify.app/), [vite-plugin-local](https://vite-plugin-local.netlify.app/), [ts-collect](https://ts-collect.netlify.app/), [ts-spreadsheets](https://ts-spreadsheets.netlify.app/). + - Large logo placement in the README of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + +___ + +- **Gold (USD$500/mo):** + - Large logo placement on the front page of [stacksjs.org](https://stacksjs.org), [docs.stacksjs.org](https://docs.stacksjs.org), [tlsx.sh](https://tlsx.sh), [rpx](https://reverse-proxy.sh), [dtsx](github.com/stacksjs/dtsx), [localtunnels](https://localtunnel.sh), [bunfig](https://bunfig.netlify.app/), [vite-plugin-local](https://vite-plugin-local.netlify.app/), [ts-collect](https://ts-collect.netlify.app/), [ts-spreadsheets](https://ts-spreadsheets.netlify.app/). + - Large logo placement in the README of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + +___ + +- **Silver (USD$100/mo):** + - Medium logo placement on the front page of [stacksjs.org](https://stacksjs.org), [docs.stacksjs.org](https://docs.stacksjs.org), [tlsx.sh](https://tlsx.sh), [rpx](https://reverse-proxy.sh), [dtsx](github.com/stacksjs/dtsx), [localtunnels](https://localtunnel.sh), [bunfig](https://bunfig.netlify.app/), [vite-plugin-local](https://vite-plugin-local.netlify.app/), [ts-collect](https://ts-collect.netlify.app/), [ts-spreadsheets](https://ts-spreadsheets.netlify.app/). + - Medium logo placement in the README of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + - Medium logo placement in the `BACKERS.md` file of>70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + +___ + +- **Bronze (50/mo):** + - Small logo placement on the front page of [stacksjs.org](https://stacksjs.org), [docs.stacksjs.org](https://docs.stacksjs.org), [tlsx.sh](https://tlsx.sh), [rpx](https://reverse-proxy.sh), [dtsx](github.com/stacksjs/dtsx), [localtunnels](https://localtunnel.sh), [bunfig](https://bunfig.netlify.app/), [vite-plugin-local](https://vite-plugin-local.netlify.app/), [ts-collect](https://ts-collect.netlify.app/), [ts-spreadsheets](https://ts-spreadsheets.netlify.app/). + - Small logo placement in the README of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + - Small logo placement in the `BACKERS.md` file of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + +--- + +- **Generous Backer (USD$25/mo):** + - Private Discord channel invite + - Free personal Dashboard usage + - Social media follow + - Name listed in the `BACKERS.md` file of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others, above other individual backers. + +--- + +- **Sponsorware Tier (USD$10/mo):** + - Get access to all current sponsorware projects. + - Name listed in the `BACKERS.md` file of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + +--- + +- **Individual Backer (USD$5/mo):** + - Name listed in the `BACKERS.md` file of >70x `stacksjs/core` repos, `stacksjs/stacks`, `tlsx`, `rpx`, `dtsx`, `localtunnels`, `bunfig`, `vite-plugin-local`, `ts-collect`, `ts-spreadsheets`, and few others. + +## Current Sponsors + +### Global Special Sponsor + +- Vacant + +### Diamond Sponsors + +- Vacant + +### Platinum Sponsors + +- Vacant + +### Gold Sponsors + +- Vacant + +### Silver Sponsors + +- Vacant + +### Bronze Sponsors + +- Vacant + +### Generous Backers + +- Vacant + +### Individual Backers + +- Vacant + +___ + +##### Thanks to Vue.js for the inspiration for this sponsorship page + +*You can find their sponsorship page [here](https://vuejs.org/sponsor/).* diff --git a/docs/usage.md b/docs/usage.md index 8068ccf..f2c9cf4 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -1,7 +1,9 @@ # Usage +Using this plugin is as simple as defining it in your Vite configuration. + ```ts -// vite.config.ts +// vite.config.{ts,js} import { defineConfig } from 'vite' import Local from 'vite-plugin-local' @@ -21,4 +23,4 @@ export default defineConfig({ }) ``` -To learn more, head over to the [documentation](https://docs.stackjs.org/). +To read about all of the available config options, check out the [config](/config) part of our documentation. diff --git a/pkgx.yaml b/pkgx.yaml index ec01868..45a8686 100644 --- a/pkgx.yaml +++ b/pkgx.yaml @@ -1,2 +1,2 @@ dependencies: - bun.sh: ^1.1.40 + bun.sh: ^1.1.42 diff --git a/src/types.ts b/src/types.ts index 99ddc1b..0ff82d3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -10,7 +10,9 @@ export interface VitePluginLocalOptions { /** * The target domain to proxy to (e.g., 'my-app.localhost') - * @example 'my-app.localhost' + * @example 'my-app.test' + * @example 'example.com' + * @default 'stacks.localhost' */ domain: string