Socket
Socket
Sign inDemoInstall

vite-plugin-checker

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-checker - npm Package Compare versions

Comparing version 0.5.5 to 0.5.6

2

dist/cjs/Checker.d.ts

@@ -19,3 +19,3 @@ import * as vite from 'vite';

declare abstract class Checker<T extends BuildInCheckerNames> implements CheckerMeta<T> {
static logger: ((...args: any[]) => void)[];
static logger: ((...v: string[]) => unknown)[];
static log(...args: any[]): void;

@@ -22,0 +22,0 @@ name: T;

@@ -71,7 +71,3 @@ "use strict";

}
Checker.logger = [
(...args) => {
console.log(args[0].payload);
}
];
Checker.logger = [];
// Annotate the CommonJS export names for ESM import in node:

@@ -78,0 +74,0 @@ 0 && (module.exports = {

@@ -88,3 +88,2 @@ "use strict";

tryReplace(/allSupportedExtensions = .*(?=;)/, (s) => s + '.concat([[".vue"]])');
tryReplace(/ = tracingEnabled\./g, ` = require(${JSON.stringify(proxyApiPath)}).loadTsLib().`);
tryReplace(

@@ -91,0 +90,0 @@ /function createProgram\(.+\) {/,

@@ -67,7 +67,7 @@ "use strict";

let checkers = [];
let isProduction = true;
let skipRuntime = false;
let isProduction = false;
let devBase = "/";
let viteMode;
let resolvedConfig;
let buildWatch = false;
let logger = null;
return {

@@ -98,6 +98,6 @@ name: "vite-plugin-checker",

configResolved(config) {
resolvedConfig = config;
logger = config.logger;
devBase = config.base;
isProduction = config.isProduction;
skipRuntime || (skipRuntime = isProduction || config.command === "build");
isProduction || (isProduction = config.isProduction || config.command === "build");
buildWatch = !!config.build.watch;
},

@@ -132,3 +132,3 @@ buildEnd() {

return;
if (skipRuntime)
if (isProduction)
return;

@@ -139,3 +139,3 @@ return [

attrs: { type: "module" },
children: (0, import_client.composePreambleCode)(resolvedConfig.base, overlayConfig)
children: (0, import_client.composePreambleCode)(devBase, overlayConfig)
}

@@ -147,3 +147,3 @@ ];

return;
if (!skipRuntime || !enableBuild)
if (!isProduction || !enableBuild)
return;

@@ -160,3 +160,3 @@ const localEnv = import_npm_run_path.default.env({

const exitCode = exitCodes.find((code) => code !== 0) ?? 0;
if (exitCode !== 0 && !(resolvedConfig == null ? void 0 : resolvedConfig.build.watch)) {
if (exitCode !== 0 && !buildWatch) {
process.exit(exitCode);

@@ -180,29 +180,31 @@ }

} else if (action.type === import_types.ACTION_TYPES.console) {
import_Checker.Checker.log(action);
if (import_Checker.Checker.logger.length) {
import_Checker.Checker.log(action);
} else {
logger.error(action.payload);
}
}
});
});
return () => {
if (server.ws.on) {
server.ws.on("vite-plugin-checker", (data) => {
if (data.event === "runtime-loaded") {
server.ws.send("vite-plugin-checker", {
event: import_client.WS_CHECKER_RECONNECT_EVENT,
data: latestOverlayErrors.filter(Boolean)
});
}
});
} else {
setTimeout(() => {
console.warn(
import_chalk.default.yellow(
"[vite-plugin-checker]: `server.ws.on` is introduced to Vite in 2.6.8, see [PR](https://github.com/vitejs/vite/pull/5273) and [changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#268-2021-10-18). \nvite-plugin-checker relies on `server.ws.on` to bring diagnostics back after a full reload and it' not available for you now due to the old version of Vite. You can upgrade Vite to latest version to eliminate this warning."
)
);
}, 5e3);
}
server.middlewares.use((req, res, next) => {
next();
if (server.ws.on) {
server.watcher.on("change", () => {
logger.clearScreen("error");
});
};
server.ws.on("vite-plugin-checker", (data) => {
if (data.event === "runtime-loaded") {
server.ws.send("vite-plugin-checker", {
event: import_client.WS_CHECKER_RECONNECT_EVENT,
data: latestOverlayErrors.filter(Boolean)
});
}
});
} else {
setTimeout(() => {
logger.warn(
import_chalk.default.yellow(
"[vite-plugin-checker]: `server.ws.on` is introduced to Vite in 2.6.8, see [PR](https://github.com/vitejs/vite/pull/5273) and [changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#268-2021-10-18). \nvite-plugin-checker relies on `server.ws.on` to send overlay message to client. Support for Vite < 2.6.8 will be removed in the next major version release."
)
);
}, 5e3);
}
}

@@ -209,0 +211,0 @@ };

@@ -1,2 +0,2 @@

import { ErrorPayload, ConfigEnv } from 'vite';
import { ConfigEnv, ErrorPayload } from 'vite';
import { Worker } from 'worker_threads';

@@ -165,7 +165,7 @@ import { ESLint } from 'eslint';

}
interface Action {
interface AbstractAction {
type: string;
payload: unknown;
}
interface OverlayErrorAction extends Action {
interface OverlayErrorAction extends AbstractAction {
type: ACTION_TYPES.overlayError;

@@ -178,12 +178,7 @@ /**

}
interface ConfigActionPayload {
enableOverlay: boolean;
enableTerminal: boolean;
env: ConfigEnv;
}
interface ConfigAction extends Action {
interface ConfigAction extends AbstractAction {
type: ACTION_TYPES.config;
payload: ConfigActionPayload;
}
interface ConfigureServerAction extends Action {
interface ConfigureServerAction extends AbstractAction {
type: ACTION_TYPES.configureServer;

@@ -194,6 +189,15 @@ payload: {

}
interface UnrefAction extends Action {
interface ConsoleAction extends AbstractAction {
type: ACTION_TYPES.console;
payload: string;
}
interface UnrefAction extends AbstractAction {
type: ACTION_TYPES.unref;
}
declare type Actions = OverlayErrorAction | ConfigAction | ConfigureServerAction | UnrefAction;
interface ConfigActionPayload {
enableOverlay: boolean;
enableTerminal: boolean;
env: ConfigEnv;
}
declare type Action = ConfigAction | ConfigureServerAction | ConsoleAction | OverlayErrorAction | UnrefAction;
declare type BuildCheckBin = BuildCheckBinStr | BuildCheckBinFn;

@@ -231,2 +235,2 @@ declare type BuildCheckBinStr = [string, ReadonlyArray<string>];

export { ACTION_TYPES, Actions, BuildCheckBin, BuildCheckBinFn, BuildCheckBinStr, BuildInCheckerNames, BuildInCheckers, CheckerDiagnostic, ClientDiagnosticPayload, ClientPayload, ClientReconnectPayload, ConfigAction, ConfigureServeChecker, ConfigureServerAction, CreateDiagnostic, DeepPartial, DiagnosticLevel, DiagnosticToRuntime, EslintConfig, OverlayErrorAction, PluginConfig, ServeAndBuildChecker, ServeChecker, SharedConfig, StylelintConfig, TscConfig, UnrefAction, UserPluginConfig, VlsConfig, VueTscConfig };
export { ACTION_TYPES, Action, BuildCheckBin, BuildCheckBinFn, BuildCheckBinStr, BuildInCheckerNames, BuildInCheckers, CheckerDiagnostic, ClientDiagnosticPayload, ClientPayload, ClientReconnectPayload, ConfigAction, ConfigureServeChecker, ConfigureServerAction, ConsoleAction, CreateDiagnostic, DeepPartial, DiagnosticLevel, DiagnosticToRuntime, EslintConfig, OverlayErrorAction, PluginConfig, ServeAndBuildChecker, ServeChecker, SharedConfig, StylelintConfig, TscConfig, UnrefAction, UserPluginConfig, VlsConfig, VueTscConfig };

@@ -19,3 +19,3 @@ import * as vite from 'vite';

declare abstract class Checker<T extends BuildInCheckerNames> implements CheckerMeta<T> {
static logger: ((...args: any[]) => void)[];
static logger: ((...v: string[]) => unknown)[];
static log(...args: any[]): void;

@@ -22,0 +22,0 @@ name: T;

@@ -42,7 +42,3 @@ import invariant from "tiny-invariant";

}
Checker.logger = [
(...args) => {
console.log(args[0].payload);
}
];
Checker.logger = [];
export {

@@ -49,0 +45,0 @@ Checker

@@ -57,3 +57,2 @@ import fsExtra from "fs-extra";

tryReplace(/allSupportedExtensions = .*(?=;)/, (s) => s + '.concat([[".vue"]])');
tryReplace(/ = tracingEnabled\./g, ` = require(${JSON.stringify(proxyApiPath)}).loadTsLib().`);
tryReplace(

@@ -60,0 +59,0 @@ /function createProgram\(.+\) {/,

@@ -45,7 +45,7 @@ import chalk from "chalk";

let checkers = [];
let isProduction = true;
let skipRuntime = false;
let isProduction = false;
let devBase = "/";
let viteMode;
let resolvedConfig;
let buildWatch = false;
let logger = null;
return {

@@ -76,6 +76,6 @@ name: "vite-plugin-checker",

configResolved(config) {
resolvedConfig = config;
logger = config.logger;
devBase = config.base;
isProduction = config.isProduction;
skipRuntime || (skipRuntime = isProduction || config.command === "build");
isProduction || (isProduction = config.isProduction || config.command === "build");
buildWatch = !!config.build.watch;
},

@@ -110,3 +110,3 @@ buildEnd() {

return;
if (skipRuntime)
if (isProduction)
return;

@@ -117,3 +117,3 @@ return [

attrs: { type: "module" },
children: composePreambleCode(resolvedConfig.base, overlayConfig)
children: composePreambleCode(devBase, overlayConfig)
}

@@ -125,3 +125,3 @@ ];

return;
if (!skipRuntime || !enableBuild)
if (!isProduction || !enableBuild)
return;

@@ -138,3 +138,3 @@ const localEnv = npmRunPath.env({

const exitCode = exitCodes.find((code) => code !== 0) ?? 0;
if (exitCode !== 0 && !(resolvedConfig == null ? void 0 : resolvedConfig.build.watch)) {
if (exitCode !== 0 && !buildWatch) {
process.exit(exitCode);

@@ -158,29 +158,31 @@ }

} else if (action.type === ACTION_TYPES.console) {
Checker.log(action);
if (Checker.logger.length) {
Checker.log(action);
} else {
logger.error(action.payload);
}
}
});
});
return () => {
if (server.ws.on) {
server.ws.on("vite-plugin-checker", (data) => {
if (data.event === "runtime-loaded") {
server.ws.send("vite-plugin-checker", {
event: WS_CHECKER_RECONNECT_EVENT,
data: latestOverlayErrors.filter(Boolean)
});
}
});
} else {
setTimeout(() => {
console.warn(
chalk.yellow(
"[vite-plugin-checker]: `server.ws.on` is introduced to Vite in 2.6.8, see [PR](https://github.com/vitejs/vite/pull/5273) and [changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#268-2021-10-18). \nvite-plugin-checker relies on `server.ws.on` to bring diagnostics back after a full reload and it' not available for you now due to the old version of Vite. You can upgrade Vite to latest version to eliminate this warning."
)
);
}, 5e3);
}
server.middlewares.use((req, res, next) => {
next();
if (server.ws.on) {
server.watcher.on("change", () => {
logger.clearScreen("error");
});
};
server.ws.on("vite-plugin-checker", (data) => {
if (data.event === "runtime-loaded") {
server.ws.send("vite-plugin-checker", {
event: WS_CHECKER_RECONNECT_EVENT,
data: latestOverlayErrors.filter(Boolean)
});
}
});
} else {
setTimeout(() => {
logger.warn(
chalk.yellow(
"[vite-plugin-checker]: `server.ws.on` is introduced to Vite in 2.6.8, see [PR](https://github.com/vitejs/vite/pull/5273) and [changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#268-2021-10-18). \nvite-plugin-checker relies on `server.ws.on` to send overlay message to client. Support for Vite < 2.6.8 will be removed in the next major version release."
)
);
}, 5e3);
}
}

@@ -187,0 +189,0 @@ };

@@ -1,2 +0,2 @@

import { ErrorPayload, ConfigEnv } from 'vite';
import { ConfigEnv, ErrorPayload } from 'vite';
import { Worker } from 'worker_threads';

@@ -165,7 +165,7 @@ import { ESLint } from 'eslint';

}
interface Action {
interface AbstractAction {
type: string;
payload: unknown;
}
interface OverlayErrorAction extends Action {
interface OverlayErrorAction extends AbstractAction {
type: ACTION_TYPES.overlayError;

@@ -178,12 +178,7 @@ /**

}
interface ConfigActionPayload {
enableOverlay: boolean;
enableTerminal: boolean;
env: ConfigEnv;
}
interface ConfigAction extends Action {
interface ConfigAction extends AbstractAction {
type: ACTION_TYPES.config;
payload: ConfigActionPayload;
}
interface ConfigureServerAction extends Action {
interface ConfigureServerAction extends AbstractAction {
type: ACTION_TYPES.configureServer;

@@ -194,6 +189,15 @@ payload: {

}
interface UnrefAction extends Action {
interface ConsoleAction extends AbstractAction {
type: ACTION_TYPES.console;
payload: string;
}
interface UnrefAction extends AbstractAction {
type: ACTION_TYPES.unref;
}
declare type Actions = OverlayErrorAction | ConfigAction | ConfigureServerAction | UnrefAction;
interface ConfigActionPayload {
enableOverlay: boolean;
enableTerminal: boolean;
env: ConfigEnv;
}
declare type Action = ConfigAction | ConfigureServerAction | ConsoleAction | OverlayErrorAction | UnrefAction;
declare type BuildCheckBin = BuildCheckBinStr | BuildCheckBinFn;

@@ -231,2 +235,2 @@ declare type BuildCheckBinStr = [string, ReadonlyArray<string>];

export { ACTION_TYPES, Actions, BuildCheckBin, BuildCheckBinFn, BuildCheckBinStr, BuildInCheckerNames, BuildInCheckers, CheckerDiagnostic, ClientDiagnosticPayload, ClientPayload, ClientReconnectPayload, ConfigAction, ConfigureServeChecker, ConfigureServerAction, CreateDiagnostic, DeepPartial, DiagnosticLevel, DiagnosticToRuntime, EslintConfig, OverlayErrorAction, PluginConfig, ServeAndBuildChecker, ServeChecker, SharedConfig, StylelintConfig, TscConfig, UnrefAction, UserPluginConfig, VlsConfig, VueTscConfig };
export { ACTION_TYPES, Action, BuildCheckBin, BuildCheckBinFn, BuildCheckBinStr, BuildInCheckerNames, BuildInCheckers, CheckerDiagnostic, ClientDiagnosticPayload, ClientPayload, ClientReconnectPayload, ConfigAction, ConfigureServeChecker, ConfigureServerAction, ConsoleAction, CreateDiagnostic, DeepPartial, DiagnosticLevel, DiagnosticToRuntime, EslintConfig, OverlayErrorAction, PluginConfig, ServeAndBuildChecker, ServeChecker, SharedConfig, StylelintConfig, TscConfig, UnrefAction, UserPluginConfig, VlsConfig, VueTscConfig };
{
"name": "vite-plugin-checker",
"version": "0.5.5",
"version": "0.5.6",
"description": "Vite plugin that runs TypeScript type checker on a separate process.",

@@ -105,3 +105,3 @@ "types": "./dist/esm/main.d.ts",

"vti": "^0.1.7",
"vue-tsc": "^1.0.24"
"vue-tsc": "~1.0.0"
},

@@ -108,0 +108,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc