@morehao/dsh-github-trending 0.4.1 → 0.4.2
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/CHANGELOG.md +21 -0
- package/README.md +6 -6
- package/client.js +501 -324
- package/lib/{chunk-QXAKMNHQ.js → chunk-WTVBXQYN.js} +18 -3
- package/lib/index.js +1 -1
- package/lib/internal.d.ts +10 -5
- package/lib/internal.js +1 -1
- package/package.json +1 -1
|
@@ -363,8 +363,8 @@ __export(state_exports, {
|
|
|
363
363
|
});
|
|
364
364
|
import { mkdirSync, readFileSync, readdirSync, renameSync, statSync, unlinkSync, writeFileSync, appendFileSync, existsSync } from "fs";
|
|
365
365
|
import path3 from "path";
|
|
366
|
-
var HISTORY_LIMIT =
|
|
367
|
-
var PREVIEW_LIMIT =
|
|
366
|
+
var HISTORY_LIMIT = 90;
|
|
367
|
+
var PREVIEW_LIMIT = 90;
|
|
368
368
|
var PREVIEW_MAX_BYTES = 512 * 1024;
|
|
369
369
|
var CONTENT_HASH_ALGO_V2 = "jcs-sha256-v1";
|
|
370
370
|
var V2_CORE_MIN = [0, 3, 0];
|
|
@@ -483,7 +483,7 @@ var Store = class {
|
|
|
483
483
|
const file = readJson(this.historyPath, { records: [] });
|
|
484
484
|
return Array.isArray(file.records) ? file.records : [];
|
|
485
485
|
}
|
|
486
|
-
/** 记录一次运行:历史裁剪到
|
|
486
|
+
/** 记录一次运行:历史裁剪到 HISTORY_LIMIT 条,state 同步更新。 */
|
|
487
487
|
recordRun(record, next = {}) {
|
|
488
488
|
const records = [record, ...this.readHistoryRaw()].slice(0, HISTORY_LIMIT);
|
|
489
489
|
writeJsonAtomic(this.historyPath, { records });
|
|
@@ -1498,12 +1498,25 @@ async function runCore(options) {
|
|
|
1498
1498
|
// src/host/core.ts
|
|
1499
1499
|
var core_exports = {};
|
|
1500
1500
|
__export(core_exports, {
|
|
1501
|
+
coreRepoFromSource: () => coreRepoFromSource,
|
|
1501
1502
|
detectCoexistence: () => detectCoexistence,
|
|
1502
1503
|
findOnPath: () => findOnPath,
|
|
1503
1504
|
inspectCore: () => inspectCore
|
|
1504
1505
|
});
|
|
1505
1506
|
import { accessSync as accessSync2, constants as constants3, statSync as statSync4 } from "fs";
|
|
1506
1507
|
import path7 from "path";
|
|
1508
|
+
function coreRepoFromSource(repo) {
|
|
1509
|
+
let ownerRepo = repo;
|
|
1510
|
+
if (ownerRepo === void 0) {
|
|
1511
|
+
try {
|
|
1512
|
+
ownerRepo = readCoreRelease().repo;
|
|
1513
|
+
} catch {
|
|
1514
|
+
return void 0;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
if (typeof ownerRepo !== "string" || !/^[\w.-]+\/[\w.-]+$/.test(ownerRepo)) return void 0;
|
|
1518
|
+
return `https://github.com/${ownerRepo}`;
|
|
1519
|
+
}
|
|
1507
1520
|
var CACHE_TTL_MS = 3e4;
|
|
1508
1521
|
function executable2(file) {
|
|
1509
1522
|
try {
|
|
@@ -1544,7 +1557,9 @@ async function inspectCore(settings, options = {}) {
|
|
|
1544
1557
|
binaryPath: view.descriptor.binaryPath,
|
|
1545
1558
|
cached: view.descriptor.cached
|
|
1546
1559
|
};
|
|
1560
|
+
const coreRepository = coreRepoFromSource(release?.repo);
|
|
1547
1561
|
const base = {
|
|
1562
|
+
...coreRepository === void 0 ? {} : { repository: coreRepository },
|
|
1548
1563
|
...release === void 0 ? {} : { release },
|
|
1549
1564
|
...view.override === void 0 ? {} : { override: view.override },
|
|
1550
1565
|
download: view.override !== void 0 ? { state: "override" } : release === void 0 ? { state: "missing", reason: view.error ?? "release \u672A\u914D\u7F6E" } : { state: release.cached ? "cached" : "missing" }
|
package/lib/index.js
CHANGED
package/lib/internal.d.ts
CHANGED
|
@@ -373,9 +373,9 @@ declare namespace paths {
|
|
|
373
373
|
export { paths_HISTORY_FILE as HISTORY_FILE, paths_PLUGIN_DIR_NAME as PLUGIN_DIR_NAME, paths_SETTINGS_FILE as SETTINGS_FILE, paths_STATE_FILE as STATE_FILE, paths_dataDir as dataDir, paths_dshHome as dshHome, paths_homeDir as homeDir, paths_runsDir as runsDir };
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
declare const HISTORY_LIMIT =
|
|
377
|
-
/**
|
|
378
|
-
declare const PREVIEW_LIMIT =
|
|
376
|
+
declare const HISTORY_LIMIT = 90;
|
|
377
|
+
/** 预览副本上限:与 history 对齐,三周期混跑时也要留够 90 期。 */
|
|
378
|
+
declare const PREVIEW_LIMIT = 90;
|
|
379
379
|
/** 一次预览只读这么多字节;超过的不复制,避免把大文件塞进状态目录。 */
|
|
380
380
|
declare const PREVIEW_MAX_BYTES: number;
|
|
381
381
|
/** 契约 v2 的固定内容哈希算法;旧版状态没有这个字段,据此识别 legacy。 */
|
|
@@ -486,7 +486,7 @@ declare class Store {
|
|
|
486
486
|
readHistory(): RunRecord[];
|
|
487
487
|
/** 原始历史(不做 legacy 标注):写入路径用它,避免把「读时标注」持久化。 */
|
|
488
488
|
private readHistoryRaw;
|
|
489
|
-
/** 记录一次运行:历史裁剪到
|
|
489
|
+
/** 记录一次运行:历史裁剪到 HISTORY_LIMIT 条,state 同步更新。 */
|
|
490
490
|
recordRun(record: RunRecord, next?: Partial<PluginState>): void;
|
|
491
491
|
newLogPath(id: string): string;
|
|
492
492
|
appendLog(file: string, line: string): void;
|
|
@@ -786,6 +786,8 @@ declare namespace run {
|
|
|
786
786
|
export { run_DEFAULT_RUN_TIMEOUT_MS as DEFAULT_RUN_TIMEOUT_MS, type run_RunCoreOptions as RunCoreOptions, type run_RunCoreResult as RunCoreResult, run_buildCoreArgs as buildCoreArgs, run_runCore as runCore };
|
|
787
787
|
}
|
|
788
788
|
|
|
789
|
+
/** `owner/repo`(可选带前后 `v`)→ `https://github.com/owner/repo`;非 GitHub 形态返回 undefined。 */
|
|
790
|
+
declare function coreRepoFromSource(repo: string | undefined): string | undefined;
|
|
789
791
|
/** Release 分发下的核心视图:用户一眼能看出「版本、下没下、从哪来」。 */
|
|
790
792
|
interface ReleaseStatus {
|
|
791
793
|
repo: string;
|
|
@@ -816,6 +818,8 @@ interface CoreStatus {
|
|
|
816
818
|
ipcSchema?: number;
|
|
817
819
|
digestSchema?: number;
|
|
818
820
|
supportedProviders: string[];
|
|
821
|
+
/** 核心开源仓库(`https://github.com/<owner>/<repo>`),来自 package.json 的 `dsh.core.repo`。 */
|
|
822
|
+
repository?: string;
|
|
819
823
|
code?: string;
|
|
820
824
|
message?: string;
|
|
821
825
|
hint?: string;
|
|
@@ -849,11 +853,12 @@ declare function detectCoexistence(ownPath: string | undefined, options?: {
|
|
|
849
853
|
type core_CoexistenceStatus = CoexistenceStatus;
|
|
850
854
|
type core_CoreStatus = CoreStatus;
|
|
851
855
|
type core_ReleaseStatus = ReleaseStatus;
|
|
856
|
+
declare const core_coreRepoFromSource: typeof coreRepoFromSource;
|
|
852
857
|
declare const core_detectCoexistence: typeof detectCoexistence;
|
|
853
858
|
declare const core_findOnPath: typeof findOnPath;
|
|
854
859
|
declare const core_inspectCore: typeof inspectCore;
|
|
855
860
|
declare namespace core {
|
|
856
|
-
export { type core_CoexistenceStatus as CoexistenceStatus, type core_CoreStatus as CoreStatus, type core_ReleaseStatus as ReleaseStatus, core_detectCoexistence as detectCoexistence, core_findOnPath as findOnPath, core_inspectCore as inspectCore };
|
|
861
|
+
export { type core_CoexistenceStatus as CoexistenceStatus, type core_CoreStatus as CoreStatus, type core_ReleaseStatus as ReleaseStatus, core_coreRepoFromSource as coreRepoFromSource, core_detectCoexistence as detectCoexistence, core_findOnPath as findOnPath, core_inspectCore as inspectCore };
|
|
857
862
|
}
|
|
858
863
|
|
|
859
864
|
/**
|
package/lib/internal.js
CHANGED