-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
234 additions
and
204 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
packages/vite-plugin-checker/__tests__/unit/logger.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
import { isMainThread } from 'worker_threads' | ||
import { Checker, CheckerAbility } from '../../Checker' | ||
|
||
import { createScript } from '../../worker' | ||
|
||
import type { PluginConfig, CreateDiagnostic } from '../../types' | ||
import type { UserConfig, ViteDevServer } from 'vite' | ||
import type { CreateDiagnostic } from '../../types' | ||
|
||
// TODO: watch mode is not supported for now | ||
// we will wait for vue-tsc | ||
|
||
/** | ||
* Prints a diagnostic every time the watch status changes. | ||
* This is mainly for messages like "Starting compilation" or "Compilation completed". | ||
* | ||
*/ | ||
// @ts-ignore | ||
export const createDiagnostic: CreateDiagnostic<Pick<PluginConfig, 'vueTsc'>> = (checkerConfig) => { | ||
const createDiagnostic: CreateDiagnostic<'vueTsc'> = (pluginConfig) => { | ||
return { | ||
config: (config: UserConfig) => { | ||
config: (config) => { | ||
// | ||
}, | ||
configureServer(server: ViteDevServer) { | ||
configureServer(server) { | ||
// | ||
}, | ||
} | ||
} | ||
|
||
const { mainScript, workerScript } = createScript<Pick<PluginConfig, 'vueTsc'>>({ | ||
absFilename: __filename, | ||
buildBin: ['vue-tsc', ['--noEmit']], | ||
serverChecker: { createDiagnostic }, | ||
})! | ||
export class VueTscChecker extends Checker<'vueTsc'> implements CheckerAbility { | ||
public constructor() { | ||
super({ | ||
name: 'typescript', | ||
absFilePath: __filename, | ||
build: { buildBin: ['vue-tsc', ['--noEmit']] }, | ||
createDiagnostic, | ||
}) | ||
} | ||
|
||
public sealConclusion() {} | ||
|
||
if (isMainThread) { | ||
const createServeAndBuild = mainScript() | ||
module.exports.createServeAndBuild = createServeAndBuild | ||
} else { | ||
workerScript() | ||
public init() { | ||
const createServeAndBuild = super.initMainThread() | ||
module.exports.createServeAndBuild = createServeAndBuild | ||
super.initWorkerThread() | ||
} | ||
} | ||
|
||
const vueTscChecker = new VueTscChecker() | ||
vueTscChecker.prepare() | ||
vueTscChecker.init() |
Oops, something went wrong.