made-bridge 0.2.0 → 0.2.1
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/package.json +1 -1
- package/src/server.mjs +12 -1
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -903,7 +903,18 @@ export function createApp(config, { run, transcribe, tunnel: providedTunnel, ena
|
|
|
903
903
|
};
|
|
904
904
|
}
|
|
905
905
|
|
|
906
|
-
|
|
906
|
+
// 入口判断要用 realpath:npm bin / npx 通过 node_modules/.bin 里的符号链接调过来,
|
|
907
|
+
// argv[1] 是链接路径,直接和本文件路径比永远不相等——表现为静默退出、什么都不干。
|
|
908
|
+
const isEntry = (() => {
|
|
909
|
+
if (!process.argv[1]) return false;
|
|
910
|
+
try {
|
|
911
|
+
return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
|
|
912
|
+
} catch {
|
|
913
|
+
return false;
|
|
914
|
+
}
|
|
915
|
+
})();
|
|
916
|
+
|
|
917
|
+
if (isEntry) {
|
|
907
918
|
if (process.argv.includes('--doctor')) {
|
|
908
919
|
// 自检只做检查并打印,不监听任何端口;有阻断性缺项时退出码为 1。
|
|
909
920
|
const { runDoctor } = await import('./doctor.mjs');
|