fix: 修复v3插件process.versions.app缺失/zlib deflateRaw/优先级kw优先

This commit is contained in:
miao-moe
2026-06-20 13:34:32 +08:00
parent da604cd842
commit 9bfe5eb618
7 changed files with 127 additions and 4 deletions

View File

@@ -80,9 +80,9 @@ export const initPlugins = async (): Promise<InitPluginsResult> => {
failedBuiltins = res.failed;
}
// 4) 确保默认激活插件:优先 wy / 首个内置,再是用户的,最后落到 demo
// 4) 确保默认激活插件:优先 kw酷我/ 首个内置,再是用户的,最后落到 demo
const active = pluginManager.getActivePluginId();
const priority = ['wy', 'tx', 'kw', 'kg', 'mg', 'demo'];
const priority = ['kw', 'wy', 'tx', 'kg', 'mg', 'demo'];
if (!active) {
for (const id of priority) {
if (pluginManager.has(id)) {

View File

@@ -738,6 +738,10 @@ export function createNodePolyfills(): Record<string, any> {
inflateSync: (d: any) => d,
deflateSync: (d: any) => d,
gzipSync: (d: any) => d,
deflateRaw: (d: any, cb: (err: Error | null, out: any) => void) => { setTimeout(() => cb(null, d), 0); },
inflateRaw: (d: any, cb: (err: Error | null, out: any) => void) => { setTimeout(() => cb(null, d), 0); },
deflateRawSync: (d: any) => d,
inflateRawSync: (d: any) => d,
gunzip: (d: any, cb: (err: Error | null, out: any) => void) => { setTimeout(() => cb(null, d), 0); },
inflate: (d: any, cb: (err: Error | null, out: any) => void) => { setTimeout(() => cb(null, d), 0); },
createGunzip: () => { const p: any = Object.create(streamMod !== undefined ? streamMod.Transform.prototype : {}); p.write = () => true; p.end = function() { this.emit && this.emit('end'); return this; }; return p; },

View File

@@ -472,9 +472,9 @@ export class PluginManager {
version: 'v20.0.0',
platform: 'browser',
arch: 'x64',
browser: true,
argv: [],
title: 'node',
browser: true,
cwd: () => '/',
chdir: () => { /* noop */ },
on: function () { return this; },
@@ -484,7 +484,7 @@ export class PluginManager {
addListener: function () { return this; },
removeListener: function () { return this; },
removeAllListeners: function () { return this; },
versions: { node: '20.0.0', v8: '11.3.244.8-node.16' },
versions: { node: '20.0.0', v8: '11.3.244.8-node.16', app: '3.0.0' },
exit: function () { /* noop */ },
nextTick: (fn: () => void) => setTimeout(fn, 0),
};