Skip to content

Commit

Permalink
fix: https
Browse files Browse the repository at this point in the history
  • Loading branch information
stagas committed Aug 1, 2022
1 parent 67660f2 commit 37744b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"@babel/plugin-transform-react-jsx": "7.18.6",
"@babel/plugin-transform-typescript": "7.18.8",
"@stagas/chalk": "5.0.0",
"@vitejs/plugin-basic-ssl": "0.1.1",
"decarg": "^1.2.1",
"everyday-node": "^0.0.1",
"github-markdown-css": "5.1.0",
Expand Down
15 changes: 5 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chalk from '@stagas/chalk'
import basicSsl from '@vitejs/plugin-basic-ssl'
import { arg } from 'decarg'
import * as fs from 'fs'
import type { ServerResponse } from 'http'
Expand All @@ -23,26 +24,18 @@ export let virtualPlugin: any
const defaultLog = (...args: unknown[]) => console.log(chalk.blueBright('[vite-open]'), ...args)

export class Options {
log = defaultLog

@arg('<file>', 'File to open (.js, .jsx, .ts, .tsx, .md)') file!: string

@arg('--root', 'Root directory to serve files from') root = '.'

@arg('--https', 'Use https') https = false

@arg('--jsx', 'JSX transformer') jsx = 'react'

@arg('--no-open', 'Do not open browser on startup') noOpen = false

@arg('--no-force', 'Do not force reoptimization') noForce = false

@arg('--debugging', 'Debugging pattern') debugging = ''

@arg('--debugging-this', 'Enable debugging for current package') debuggingThis = false

@arg('--quiet', 'Quiet output') quiet = false

log = defaultLog

virtual: Record<string, any> = {}

responses: Record<string, {
Expand Down Expand Up @@ -271,6 +264,8 @@ export const open = async (options: Partial<Options>): Promise<ViteServer> => {
},
resolve,
plugins: [
options.https && basicSsl(),

virtualPlugin,

mdPlugin({ mode: [Mode.HTML] }),
Expand Down

0 comments on commit 37744b8

Please sign in to comment.