0.0.5 • Published 4 months ago

vite-host-qrcode v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

vite-host-qrcode

NPM version

Install

npm i vite-host-qrcode -D
# package.json
"scripts": {
  "dev": "vite --host",
  ...
},
// vite.config.ts
import HostQrCode from 'vite-host-qrcode/vite'

export default defineConfig({
  plugins: [
    HostQrCode({ /* options */ }),
  ],
})

Example: playground/

Options

type Message = string | MessageValue | ((kolorist: Kolorist) => string | MessageValue | Promise<string | MessageValue | void>)

export interface Options {
	info?: Message[]
  /**
	 * filter list of shown QR codes. Useful if you have multiple interfaces and only need one
	 *
	 *  examples:
	 *    url => url.startsWith('http://192.')
	 *    url => !url.startsWith('http://172.)
	 *    url => url === 'http://192.168.1.70:4173'
	 *
	 * @param url {string} ip address
	 * @returns {boolean}
	 */
  filter?: (url: string) => boolean
}

filter

A function that allows you to select addresses to show QR-Codes for in case you have multiple interfaces

Example:

// vite.config.js
import HostQrCode from 'vite-host-qrcode/vite'

export default defineConfig({
	plugins: [HostQrCode({ filter: (url) => url === 'http://192.168.1.1:4173' })]
});
0.0.5

4 months ago

0.0.3

7 months ago

0.0.4

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago