@sapphire/plugin-hmr 3.0.3-next.f34b540 → 3.0.3-next.f67c68a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/lib/hmr.cjs.map +1 -1
- package/dist/cjs/register.cjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/lib/hmr.mjs +1 -1
- package/dist/esm/lib/hmr.mjs.map +1 -1
- package/dist/esm/register.mjs.map +1 -1
- package/package.json +8 -8
package/dist/cjs/index.cjs
CHANGED
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAiBO,IAAM,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAiBO,IAAM,OAAA,GAAkB","file":"index.cjs","sourcesContent":["export * from './lib/hmr';\n\nimport type { HMROptions } from './lib/hmr';\n\ndeclare module 'discord.js' {\n\texport interface ClientOptions {\n\t\thmr?: HMROptions;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-hmr](https://github.com/sapphiredev/plugins/blob/main/packages/hmr) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '3.0.3-next.f67c68a';\n"]}
|
package/dist/cjs/lib/hmr.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/hmr.ts"],"names":["container","watch","Result","path","relative"],"mappings":";;;;;;;;AAmBO,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/hmr.ts"],"names":["container","watch","Result","path","relative"],"mappings":";;;;;;;;AAmBO,SAA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QAAA,EAAUD,MAAI,CAAC,CAAA;AACxE,MAAA,MAAM,oBAAoB,YAAA,CAAa,GAAA,CAAI,CAAC,KAAA,KAAU,MAAM,IAAI,CAAA;AAChE,MAAA,MAAM,yBAAyB,YAAA,CAAa,GAAA,CAAI,CAAC,KAAA,KAAU,KAAA,CAAM,MAAM,IAAI,CAAA;AAC3E,MAAA,IAAI,CAAC,MAAA;AACJ,QAAAH,mBAAA,CAAU,MAAA,CAAO,IAAA;AAAA,UAChB,CAAA,qBAAA,EAAwB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAC,CAAA,eAAA,EAAkB,CAAC,GAAG,IAAI,IAAI,sBAAsB,CAAC,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,UAAA;AAAA,SACtH;AAAA,IACF;AAAA,EACD,CAAC,CAAA;AAED,EAAA,MAAA,CAAO,UAAA,CAAW,CAAC,KAAA,KAAUA,mBAAA,CAAU,MAAA,CAAO,MAAM,CAAA,yCAAA,EAA4CG,MAAI,CAAA,CAAA,CAAA,EAAK,KAAK,CAAC,CAAA;AAChH;AAxBe,MAAA,CAAA,qBAAA,EAAA,uBAAA,CAAA","file":"hmr.cjs","sourcesContent":["import { Piece, Result, Store, container } from '@sapphire/framework';\nimport { watch, type ChokidarOptions } from 'chokidar';\nimport { relative } from 'node:path';\n\nexport interface HMROptions extends ChokidarOptions {\n\tenabled?: boolean;\n\tsilent?: boolean;\n}\n\n/**\n * Starts HMR for all registered {@link Store Stores} in {@link container.stores the main container}.\n *\n * @param __namedParameter The {@link HMROptions}.\n * This includes [all options from chokidar](https://github.com/paulmillr/chokidar#persistence),\n * as well as whether the HMR should be enabled.\n * The default options are `{ enabled: true }`,\n * and if not provided in the object then `enabled` is also set to true.\n *\n */\nexport function start({ enabled = true, silent = false, ...options }: HMROptions = { enabled: true }) {\n\t// Do not enable plugin when enabled is false\n\tif (!enabled) return;\n\n\tif (!silent) container.logger.info('[HMR-Plugin]: Enabled. Watching for piece changes.');\n\n\tfor (const store of container.stores.values()) {\n\t\twatch([...store.paths], options)\n\t\t\t.on('change', (path) => handlePiecePathUpdate(store, path, silent))\n\t\t\t.on('unlink', (path) => handlePiecePathDelete(store, path, silent));\n\t}\n}\n\nasync function handlePiecePathDelete(store: Store<Piece>, path: string, silent: boolean) {\n\tif (!store.strategy.filter(path)) return;\n\n\tconst pieceToDelete = store.find((piece) => piece.location.full === path);\n\tif (!pieceToDelete) return;\n\n\tconst result = await Result.fromAsync(async () => {\n\t\tawait pieceToDelete.unload();\n\t\tif (!silent) container.logger.info(`[HMR-Plugin]: Unloaded ${pieceToDelete.name} piece from ${pieceToDelete.store.name} store.`);\n\t});\n\n\tresult.inspectErr((error) =>\n\t\tcontainer.logger.error(`[HMR-Plugin]: Failed to unload ${pieceToDelete.name} piece from ${pieceToDelete.store.name} store.`, error)\n\t);\n}\n\nasync function handlePiecePathUpdate(store: Store<Piece>, path: string, silent: boolean) {\n\tif (!store.strategy.filter(path)) return;\n\n\tconst pieceToUpdate = store.find((piece) => piece.location.full === path);\n\n\tconst result = await Result.fromAsync(async () => {\n\t\tif (pieceToUpdate) {\n\t\t\tawait pieceToUpdate.reload();\n\t\t\tif (!silent) container.logger.info(`[HMR-Plugin]: reloaded ${pieceToUpdate.name} piece from ${pieceToUpdate.store.name} store.`);\n\t\t} else {\n\t\t\tconst rootPath = [...store.paths].find((storePath) => path.startsWith(storePath));\n\t\t\tif (!rootPath) throw new Error(`[HMR-Plugin]: Could not find root path for ${path}.`);\n\n\t\t\tconst piecesLoaded = await store.load(rootPath, relative(rootPath, path));\n\t\t\tconst piecesLoadedNames = piecesLoaded.map((piece) => piece.name);\n\t\t\tconst piecesLoadedStoreNames = piecesLoaded.map((piece) => piece.store.name);\n\t\t\tif (!silent)\n\t\t\t\tcontainer.logger.info(\n\t\t\t\t\t`[HMR-Plugin]: Loaded ${piecesLoadedNames.join(', ')} piece(s) from ${[...new Set(piecesLoadedStoreNames)].join(', ')} store(s).`\n\t\t\t\t);\n\t\t}\n\t});\n\n\tresult.inspectErr((error) => container.logger.error(`[HMR-Plugin]: Failed to load pieces from ${path}.`, error));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/register.ts"],"names":["Plugin","postLogin","start","SapphireClient"],"mappings":";;;;;;;AAQO,IAAM,UAAA,GAAN,MAAM,UAAA,SAAkBA,
|
|
1
|
+
{"version":3,"sources":["../../src/register.ts"],"names":["Plugin","postLogin","start","SapphireClient"],"mappings":";;;;;;;AAQO,IAAM,UAAA,GAAN,MAAM,UAAA,SAAkBA,gBAAA,CAAO;AAAA;AAAA;AAAA;AAAA,EAIrC,QAAeC,mBAAS,CAAA,GAA8B;AACrD,IAAAC,eAAA,CAAM,IAAA,CAAK,QAAQ,GAAG,CAAA;AAAA,EACvB;AACD,CAAA;AAPsC,MAAA,CAAA,UAAA,EAAA,WAAA,CAAA;AAA/B,IAAM,SAAA,GAAN;AASPC,wBAAA,CAAe,OAAA,CAAQ,qBAAA,CAAsB,SAAA,CAAUF,mBAAS,GAAG,eAAe,CAAA","file":"register.cjs","sourcesContent":["import './index';\n\nimport { Plugin, postLogin, SapphireClient } from '@sapphire/framework';\nimport { start } from './index';\n\n/**\n * @since 1.0.0\n */\nexport class HmrPlugin extends Plugin {\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postLogin](this: SapphireClient): void {\n\t\tstart(this.options.hmr);\n\t}\n}\n\nSapphireClient.plugins.registerPostLoginHook(HmrPlugin[postLogin], 'Hmr-PostLogin');\n"]}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAiBO,IAAM,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAiBO,IAAM,OAAA,GAAkB","file":"index.mjs","sourcesContent":["export * from './lib/hmr';\n\nimport type { HMROptions } from './lib/hmr';\n\ndeclare module 'discord.js' {\n\texport interface ClientOptions {\n\t\thmr?: HMROptions;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-hmr](https://github.com/sapphiredev/plugins/blob/main/packages/hmr) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '3.0.3-next.f67c68a';\n"]}
|
package/dist/esm/lib/hmr.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __name } from '../chunk-PAWJFY3S.mjs';
|
|
2
2
|
import { container, Result } from '@sapphire/framework';
|
|
3
3
|
import { watch } from 'chokidar';
|
|
4
|
-
import { relative } from '
|
|
4
|
+
import { relative } from 'path';
|
|
5
5
|
|
|
6
6
|
function start({ enabled = true, silent = false, ...options } = { enabled: true }) {
|
|
7
7
|
if (!enabled) return;
|
package/dist/esm/lib/hmr.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/hmr.ts"],"names":[],"mappings":";;;;;AAmBO,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/hmr.ts"],"names":[],"mappings":";;;;;AAmBO,SAAS,KAAA,CAAM,EAAE,OAAA,GAAU,IAAA,EAAM,MAAA,GAAS,KAAA,EAAO,GAAG,OAAA,EAAQ,GAAgB,EAAE,OAAA,EAAS,IAAA,EAAK,EAAG;AAErG,EAAA,IAAI,CAAC,OAAA,EAAS;AAEd,EAAA,IAAI,CAAC,MAAA,EAAQ,SAAA,CAAU,MAAA,CAAO,KAAK,oDAAoD,CAAA;AAEvF,EAAA,KAAA,MAAW,KAAA,IAAS,SAAA,CAAU,MAAA,CAAO,MAAA,EAAO,EAAG;AAC9C,IAAA,KAAA,CAAM,CAAC,GAAG,KAAA,CAAM,KAAK,CAAA,EAAG,OAAO,CAAA,CAC7B,EAAA,CAAG,QAAA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C,CAAA,UAAA;AAAA,SACtH;AAAA,IACF;AAAA,EACD,CAAC,CAAA;AAED,EAAA,MAAA,CAAO,UAAA,CAAW,CAAC,KAAA,KAAU,SAAA,CAAU,MAAA,CAAO,MAAM,CAAA,yCAAA,EAA4C,IAAI,CAAA,CAAA,CAAA,EAAK,KAAK,CAAC,CAAA;AAChH;AAxBe,MAAA,CAAA,qBAAA,EAAA,uBAAA,CAAA","file":"hmr.mjs","sourcesContent":["import { Piece, Result, Store, container } from '@sapphire/framework';\nimport { watch, type ChokidarOptions } from 'chokidar';\nimport { relative } from 'node:path';\n\nexport interface HMROptions extends ChokidarOptions {\n\tenabled?: boolean;\n\tsilent?: boolean;\n}\n\n/**\n * Starts HMR for all registered {@link Store Stores} in {@link container.stores the main container}.\n *\n * @param __namedParameter The {@link HMROptions}.\n * This includes [all options from chokidar](https://github.com/paulmillr/chokidar#persistence),\n * as well as whether the HMR should be enabled.\n * The default options are `{ enabled: true }`,\n * and if not provided in the object then `enabled` is also set to true.\n *\n */\nexport function start({ enabled = true, silent = false, ...options }: HMROptions = { enabled: true }) {\n\t// Do not enable plugin when enabled is false\n\tif (!enabled) return;\n\n\tif (!silent) container.logger.info('[HMR-Plugin]: Enabled. Watching for piece changes.');\n\n\tfor (const store of container.stores.values()) {\n\t\twatch([...store.paths], options)\n\t\t\t.on('change', (path) => handlePiecePathUpdate(store, path, silent))\n\t\t\t.on('unlink', (path) => handlePiecePathDelete(store, path, silent));\n\t}\n}\n\nasync function handlePiecePathDelete(store: Store<Piece>, path: string, silent: boolean) {\n\tif (!store.strategy.filter(path)) return;\n\n\tconst pieceToDelete = store.find((piece) => piece.location.full === path);\n\tif (!pieceToDelete) return;\n\n\tconst result = await Result.fromAsync(async () => {\n\t\tawait pieceToDelete.unload();\n\t\tif (!silent) container.logger.info(`[HMR-Plugin]: Unloaded ${pieceToDelete.name} piece from ${pieceToDelete.store.name} store.`);\n\t});\n\n\tresult.inspectErr((error) =>\n\t\tcontainer.logger.error(`[HMR-Plugin]: Failed to unload ${pieceToDelete.name} piece from ${pieceToDelete.store.name} store.`, error)\n\t);\n}\n\nasync function handlePiecePathUpdate(store: Store<Piece>, path: string, silent: boolean) {\n\tif (!store.strategy.filter(path)) return;\n\n\tconst pieceToUpdate = store.find((piece) => piece.location.full === path);\n\n\tconst result = await Result.fromAsync(async () => {\n\t\tif (pieceToUpdate) {\n\t\t\tawait pieceToUpdate.reload();\n\t\t\tif (!silent) container.logger.info(`[HMR-Plugin]: reloaded ${pieceToUpdate.name} piece from ${pieceToUpdate.store.name} store.`);\n\t\t} else {\n\t\t\tconst rootPath = [...store.paths].find((storePath) => path.startsWith(storePath));\n\t\t\tif (!rootPath) throw new Error(`[HMR-Plugin]: Could not find root path for ${path}.`);\n\n\t\t\tconst piecesLoaded = await store.load(rootPath, relative(rootPath, path));\n\t\t\tconst piecesLoadedNames = piecesLoaded.map((piece) => piece.name);\n\t\t\tconst piecesLoadedStoreNames = piecesLoaded.map((piece) => piece.store.name);\n\t\t\tif (!silent)\n\t\t\t\tcontainer.logger.info(\n\t\t\t\t\t`[HMR-Plugin]: Loaded ${piecesLoadedNames.join(', ')} piece(s) from ${[...new Set(piecesLoadedStoreNames)].join(', ')} store(s).`\n\t\t\t\t);\n\t\t}\n\t});\n\n\tresult.inspectErr((error) => container.logger.error(`[HMR-Plugin]: Failed to load pieces from ${path}.`, error));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;AAQO,IAAM,UAAA,GAAN,MAAM,UAAA,SAAkB,
|
|
1
|
+
{"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;AAQO,IAAM,UAAA,GAAN,MAAM,UAAA,SAAkB,MAAA,CAAO;AAAA;AAAA;AAAA;AAAA,EAIrC,QAAe,SAAS,CAAA,GAA8B;AACrD,IAAA,KAAA,CAAM,IAAA,CAAK,QAAQ,GAAG,CAAA;AAAA,EACvB;AACD,CAAA;AAPsC,MAAA,CAAA,UAAA,EAAA,WAAA,CAAA;AAA/B,IAAM,SAAA,GAAN;AASP,cAAA,CAAe,OAAA,CAAQ,qBAAA,CAAsB,SAAA,CAAU,SAAS,GAAG,eAAe,CAAA","file":"register.mjs","sourcesContent":["import './index';\n\nimport { Plugin, postLogin, SapphireClient } from '@sapphire/framework';\nimport { start } from './index';\n\n/**\n * @since 1.0.0\n */\nexport class HmrPlugin extends Plugin {\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postLogin](this: SapphireClient): void {\n\t\tstart(this.options.hmr);\n\t}\n}\n\nSapphireClient.plugins.registerPostLoginHook(HmrPlugin[postLogin], 'Hmr-PostLogin');\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/plugin-hmr",
|
|
3
|
-
"version": "3.0.3-next.
|
|
3
|
+
"version": "3.0.3-next.f67c68a",
|
|
4
4
|
"description": "Plugin for @sapphire/framework for hot module reloading for pieces",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"lint": "eslint src --ext ts --fix",
|
|
39
39
|
"build": "tsup && yarn build:types && yarn build:rename-cjs-register",
|
|
40
40
|
"build:types": "concurrently \"yarn:build:types:*\"",
|
|
41
|
-
"build:types:cjs": "rollup-type-bundler -d dist/cjs -
|
|
41
|
+
"build:types:cjs": "rollup-type-bundler -d dist/cjs --output-typings-file-extension .cts",
|
|
42
42
|
"build:types:esm": "rollup-type-bundler -d dist/esm -t .mts",
|
|
43
43
|
"build:types:cleanup": "tsx ../../scripts/clean-register-imports.mts",
|
|
44
44
|
"build:rename-cjs-register": "tsx ../../scripts/rename-cjs-register.mts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"check-update": "cliff-jumper --dry-run"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"chokidar": "^4.0.
|
|
52
|
+
"chokidar": "^4.0.3"
|
|
53
53
|
},
|
|
54
54
|
"repository": {
|
|
55
55
|
"type": "git",
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
"access": "public"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@favware/cliff-jumper": "^
|
|
84
|
-
"@favware/rollup-type-bundler": "^
|
|
85
|
-
"concurrently": "^9.1
|
|
86
|
-
"tsup": "^8.
|
|
87
|
-
"tsx": "^4.
|
|
83
|
+
"@favware/cliff-jumper": "^6.0.0",
|
|
84
|
+
"@favware/rollup-type-bundler": "^4.0.0",
|
|
85
|
+
"concurrently": "^9.2.1",
|
|
86
|
+
"tsup": "^8.5.0",
|
|
87
|
+
"tsx": "^4.20.6",
|
|
88
88
|
"typedoc": "^0.26.11",
|
|
89
89
|
"typedoc-json-parser": "^10.2.0",
|
|
90
90
|
"typescript": "~5.4.5"
|