+14
-22
@@ -14,8 +14,2 @@ /** | ||
| const { Debounce } = require('./util.js'); | ||
| const { hookServices, unblocks } = require('./hmr-hook.js'); | ||
| hookServices(); | ||
| const Module = require('node:module'); | ||
@@ -26,7 +20,3 @@ // noinspection JSUnresolvedReference | ||
| const loaded = oldLoad.call(this, request, parent, isMain); | ||
| if ( | ||
| parent && | ||
| !/node_modules/.test(parent.filename) && | ||
| !/package\\modmgr\\src\\hmr-proxy.cjs/.test(parent.filename) | ||
| ) { | ||
| if (parent && !/node_modules/.test(parent.filename) && !/package\\tsxx\\/.test(parent.filename)) { | ||
| const { filename, children } = parent; | ||
@@ -72,13 +62,15 @@ if (!aliveFilenames.includes(filename)) { | ||
| const { Debounce } = require('./util.js'); | ||
| const { hookServices, unblocks } = require('./hmr-hook.js'); | ||
| hookServices(); | ||
| const debouncedFunc = new Debounce(freshFilename => { | ||
| if (aliveFilenames.includes(freshFilename)) { | ||
| unblocks().then(() => { | ||
| cleanModuleCache(freshFilename); | ||
| try { | ||
| require(pathname); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } | ||
| }); | ||
| } | ||
| unblocks().then(() => { | ||
| cleanModuleCache(freshFilename); | ||
| try { | ||
| aliveFilenames.push(pathname); | ||
| require(pathname); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } | ||
| }); | ||
| }, 500); | ||
@@ -91,5 +83,5 @@ | ||
| chokidar.watch(process.cwd()).on('change', freshFilename => { | ||
| if (!/node_modules/.test(freshFilename) && !/idea/.test(freshFilename)) { | ||
| if (aliveFilenames.includes(freshFilename)) { | ||
| debouncedFunc.call(freshFilename); | ||
| } | ||
| }); |
+2
-2
| { | ||
| "name": "tsxx", | ||
| "version": "1.0.10", | ||
| "version": "1.0.11", | ||
| "description": "tsx 增强", | ||
@@ -16,3 +16,3 @@ "scripts": { | ||
| "author": "杨伟杰", | ||
| "license": "MIT", | ||
| "license": "Apache-2.0", | ||
| "dependencies": { | ||
@@ -19,0 +19,0 @@ "chokidar": "^3.5.3", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
7
-12.5%7919
-1.14%258
-1.9%