engine7 7.1.26 → 7.1.27
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/cli.mjs +5 -24
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -691,34 +691,15 @@ function sleep(ms) {
|
|
|
691
691
|
}
|
|
692
692
|
|
|
693
693
|
// src/qr-render.ts
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
if (qrcodeModule) return qrcodeModule;
|
|
697
|
-
try {
|
|
698
|
-
qrcodeModule = await import("qrcode-terminal");
|
|
699
|
-
} catch {
|
|
700
|
-
try {
|
|
701
|
-
qrcodeModule = await import("qrcode");
|
|
702
|
-
} catch {
|
|
703
|
-
throw new Error("\u8BF7\u5148\u5B89\u88C5 qrcode-terminal: npm install qrcode-terminal");
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return qrcodeModule;
|
|
707
|
-
}
|
|
694
|
+
import { createRequire } from "node:module";
|
|
695
|
+
var require2 = createRequire(import.meta.url);
|
|
708
696
|
async function renderQrTerminal(url, options) {
|
|
709
|
-
const mod = await getQrModule();
|
|
710
697
|
return new Promise((resolve2, reject) => {
|
|
711
698
|
try {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
resolve2(output);
|
|
715
|
-
});
|
|
716
|
-
} else if (mod.toString) {
|
|
717
|
-
const output = mod.toString(url, { type: "terminal", small: options?.small ?? true });
|
|
699
|
+
const qt = require2("qrcode-terminal");
|
|
700
|
+
qt.generate(url, { small: options?.small ?? true }, (output) => {
|
|
718
701
|
resolve2(output);
|
|
719
|
-
}
|
|
720
|
-
reject(new Error("\u4E0D\u652F\u6301\u7684\u4E8C\u7EF4\u7801\u5E93"));
|
|
721
|
-
}
|
|
702
|
+
});
|
|
722
703
|
} catch (err) {
|
|
723
704
|
reject(err);
|
|
724
705
|
}
|