Socket
Socket
Sign inDemoInstall

@sapphire/plugin-hmr

Package Overview
Dependencies
Maintainers
3
Versions
607
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.2016134.0

2

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
(0, tslib_1.__exportStar)(require("./lib/hmr"), exports);
tslib_1.__exportStar(require("./lib/hmr"), exports);
//# sourceMappingURL=index.js.map
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.2016134.0",
"description": "Plugin for @sapphire/framework for hot module reloading for pieces",

@@ -14,7 +14,9 @@ "author": "@sapphire",

"import": "./dist/index.mjs",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./register": {
"import": "./register.mjs",
"require": "./register.js"
"require": "./register.js",
"types": "./register.d.ts"
}

@@ -69,3 +71,3 @@ },

},
"gitHead": "8efee8b0bbdbddb43bb1836346f2a91cf20f6274"
"gitHead": "201613418babe93748e74064cf66d4ea0582725c"
}

@@ -166,2 +166,6 @@ <div align="center">

</tr>
<tr>
<td align="center"><a href="https://github.com/Suyashtnt"><img src="https://avatars.githubusercontent.com/u/45307955?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Just a Badly Drawn TABS Dude</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=Suyashtnt" title="Code">πŸ’»</a></td>
<td align="center"><a href="https://newtt.me/"><img src="https://avatars.githubusercontent.com/u/19301186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>newt :D</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=newtykins" title="Code">πŸ’»</a></td>
</tr>
</table>

@@ -168,0 +172,0 @@

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