Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sapphire/plugin-hmr

Package Overview
Dependencies
Maintainers
3
Versions
641
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sapphire/plugin-hmr - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0-next.4692d34.0

3

dist/lib/hmr.d.ts
import { WatchOptions } from 'chokidar';
export interface HMROptions extends WatchOptions {
enabled?: boolean;
silent?: boolean;
}

@@ -15,3 +16,3 @@ /**

*/
export declare function start({ enabled, ...options }?: HMROptions): void;
export declare function start({ enabled, silent, ...options }?: HMROptions): void;
//# sourceMappingURL=hmr.d.ts.map

@@ -17,17 +17,16 @@ "use strict";

*/
function start({ enabled = true, ...options } = { enabled: true }) {
function start({ enabled = true, silent = false, ...options } = { enabled: true }) {
// Do not enable plugin when enabled is false
if (!enabled)
return;
framework_1.container.logger.info('[HMR-Plugin]: Enabled. Watching for piece changes.');
if (!silent)
framework_1.container.logger.info('[HMR-Plugin]: Enabled. Watching for piece changes.');
for (const store of framework_1.container.stores.values()) {
const deleteCb = handlePiecePathDelete.bind(null, store);
const updateCb = handlePiecePathUpdate.bind(null, store);
(0, chokidar_1.watch)([...store.paths], options)
.on('change', updateCb)
.on('unlink', deleteCb);
.on('change', (path) => handlePiecePathUpdate(store, path, silent))
.on('unlink', (path) => handlePiecePathDelete(store, path, silent));
}
}
exports.start = start;
async function handlePiecePathDelete(store, path) {
async function handlePiecePathDelete(store, path, silent) {
if (!store.strategy.filter(path))

@@ -40,3 +39,4 @@ return;

await pieceToDelete.unload();
framework_1.container.logger.info(`[HMR-Plugin]: Unloaded ${pieceToDelete.name} piece from ${pieceToDelete.store.name} store.`);
if (!silent)
framework_1.container.logger.info(`[HMR-Plugin]: Unloaded ${pieceToDelete.name} piece from ${pieceToDelete.store.name} store.`);
});

@@ -47,3 +47,3 @@ if ((0, framework_1.isErr)(result)) {

}
async function handlePiecePathUpdate(store, path) {
async function handlePiecePathUpdate(store, path, silent) {
if (!store.strategy.filter(path))

@@ -55,3 +55,4 @@ return;

await pieceToUpdate.reload();
framework_1.container.logger.info(`[HMR-Plugin]: reloaded ${pieceToUpdate.name} piece from ${pieceToUpdate.store.name} store.`);
if (!silent)
framework_1.container.logger.info(`[HMR-Plugin]: reloaded ${pieceToUpdate.name} piece from ${pieceToUpdate.store.name} store.`);
}

@@ -65,3 +66,4 @@ else {

const piecesLoadedStoreNames = piecesLoaded.map((piece) => piece.store.name);
framework_1.container.logger.info(`[HMR-Plugin]: Loaded ${piecesLoadedNames.join(', ')} piece(s) from ${[...new Set(piecesLoadedStoreNames)].join(', ')} store(s).`);
if (!silent)
framework_1.container.logger.info(`[HMR-Plugin]: Loaded ${piecesLoadedNames.join(', ')} piece(s) from ${[...new Set(piecesLoadedStoreNames)].join(', ')} store(s).`);
}

@@ -68,0 +70,0 @@ });

{
"name": "@sapphire/plugin-hmr",
"version": "1.1.1",
"version": "1.2.0-next.4692d34.0",
"description": "Plugin for @sapphire/framework for hot module reloading for pieces",

@@ -68,3 +68,3 @@ "author": "@sapphire",

},
"gitHead": "8efee8b0bbdbddb43bb1836346f2a91cf20f6274"
"gitHead": "4692d3442c4bf85e1c46cc2c18da0a46f2c3de4f"
}

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