@nudojs/service 3.0.0 → 5.0.0-beta.0
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/README.md +19 -4
- package/dist/analysis-CSXrOVlg.d.ts +267 -0
- package/dist/analysis.d.ts +7 -0
- package/dist/analysis.js +57 -0
- package/dist/analyzer-types-JyJiCt8w.d.ts +158 -0
- package/dist/call-record-CkyCFkT9.d.ts +33 -0
- package/dist/case.d.ts +124 -0
- package/dist/case.js +18 -0
- package/dist/chunk-6IZR4ZYJ.js +1107 -0
- package/dist/chunk-E4N4A4JV.js +651 -0
- package/dist/chunk-HEU4WON5.js +2419 -0
- package/dist/chunk-K3ZPOTP2.js +199 -0
- package/dist/chunk-LFZRUXGK.js +89 -0
- package/dist/chunk-PVJIMQRI.js +246 -0
- package/dist/chunk-QAFMPM2E.js +3687 -0
- package/dist/chunk-QYRH7Z2Q.js +89 -0
- package/dist/chunk-U7JYTRIB.js +888 -0
- package/dist/{chunk-ADFCZP72.js → chunk-YLALZXTZ.js} +180 -165
- package/dist/chunk-YLVZMHWC.js +364 -0
- package/dist/{config-Cqj8zeZH.d.ts → config-DDB588oA.d.ts} +45 -48
- package/dist/dts.d.ts +142 -0
- package/dist/dts.js +30 -0
- package/dist/env-loader-fj0TSCcA.d.ts +20 -0
- package/dist/evaluator/evaluator-api.d.ts +3 -1
- package/dist/evaluator/evaluator-api.js +9 -3
- package/dist/harvest.d.ts +254 -0
- package/dist/harvest.js +75 -0
- package/dist/index.d.ts +293 -1197
- package/dist/index.js +328 -7639
- package/dist/interface-BGlP7aIk.d.ts +367 -0
- package/dist/interface.d.ts +3 -0
- package/dist/interface.js +43 -0
- package/dist/lsp.d.ts +103 -0
- package/dist/lsp.js +36 -0
- package/package.json +32 -8
package/dist/case.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { S as SourceLocation, a as AnalysisResult } from './analyzer-types-JyJiCt8w.js';
|
|
2
|
+
import { Abs } from '@nudojs/core';
|
|
3
|
+
import '@babel/types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Case facts JSON(`nudo test --json` 序列化)。
|
|
7
|
+
*
|
|
8
|
+
* - args / result / throws / combined:formatShape 外延投影(有损)
|
|
9
|
+
* 入口无约束参数展示为 any;unknown 仅表示推导失败
|
|
10
|
+
* - intension.abs*:无损 Abs 展示(主线)
|
|
11
|
+
* - argsAbs / resultAbs:CaseResult 上的无损 Abs(formatAbs);有则补齐
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type CaseJsonCase = {
|
|
15
|
+
name: string;
|
|
16
|
+
/** formatShape 外延投影(有损) */
|
|
17
|
+
args: string[];
|
|
18
|
+
result: string;
|
|
19
|
+
throws: string | null;
|
|
20
|
+
source: string | null;
|
|
21
|
+
aggregatedFrom?: number;
|
|
22
|
+
/** 无损参数 Abs 展示(与 args 对齐;缺失位省略) */
|
|
23
|
+
argsAbs?: string[];
|
|
24
|
+
/** 无损结果 Abs 展示 */
|
|
25
|
+
resultAbs?: string;
|
|
26
|
+
/** 无损内涵(Abs);无则省略 */
|
|
27
|
+
intension?: {
|
|
28
|
+
display?: string;
|
|
29
|
+
abs?: string;
|
|
30
|
+
absMultiline?: string;
|
|
31
|
+
term?: string;
|
|
32
|
+
pred?: string;
|
|
33
|
+
conf?: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
type CaseJsonFunction = {
|
|
37
|
+
name: string;
|
|
38
|
+
loc: SourceLocation;
|
|
39
|
+
entryOnly: boolean;
|
|
40
|
+
noDeclaration?: boolean;
|
|
41
|
+
cases: CaseJsonCase[];
|
|
42
|
+
combined?: string;
|
|
43
|
+
/** 无损 combined Abs 展示 */
|
|
44
|
+
combinedAbs?: string;
|
|
45
|
+
};
|
|
46
|
+
type CaseJson = {
|
|
47
|
+
version: 1;
|
|
48
|
+
file: string;
|
|
49
|
+
summary: {
|
|
50
|
+
functions: number;
|
|
51
|
+
externalFunctions: number;
|
|
52
|
+
cases: number;
|
|
53
|
+
diagnostics: number;
|
|
54
|
+
};
|
|
55
|
+
functions: CaseJsonFunction[];
|
|
56
|
+
externalFunctions?: Array<{
|
|
57
|
+
name: string;
|
|
58
|
+
fromModule?: string;
|
|
59
|
+
cases: CaseJsonCase[];
|
|
60
|
+
}>;
|
|
61
|
+
diagnostics: Array<{
|
|
62
|
+
range: SourceLocation;
|
|
63
|
+
severity: string;
|
|
64
|
+
message: string;
|
|
65
|
+
code?: string;
|
|
66
|
+
suggestions?: string[];
|
|
67
|
+
tags?: string[];
|
|
68
|
+
origin?: {
|
|
69
|
+
line: number;
|
|
70
|
+
column: number;
|
|
71
|
+
};
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
74
|
+
declare function serializeCaseJson(result: AnalysisResult, file: string): CaseJson;
|
|
75
|
+
|
|
76
|
+
/** 单个 Abs → parseCaseArgExpr 可解析回去的表达式文本;不可表达返回 null */
|
|
77
|
+
declare function serializeCaseArg(a: Abs): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* 组装单行 ` * @nudo:case "name" (a, b)` 指令文本(无尾换行)。
|
|
80
|
+
* 任一实参不可序列化、或名字含双引号/换行(名字正则 `"([^"]+)"` 承载不了)→ 整体 null。
|
|
81
|
+
*/
|
|
82
|
+
declare function buildCaseDirective(name: string, argsAbs: Abs[]): string | null;
|
|
83
|
+
/**
|
|
84
|
+
* 从源码剥离所有本模块生成的 @nudo:case 指令(名字以 call@ 开头,整行删除)。
|
|
85
|
+
* 若所属 JSDoc 块因此只剩空 ` *` 行(无其他 @nudo:* 指令、无文字内容),
|
|
86
|
+
* 连块首 `/**` 行与块尾行整块删除。绝不碰非 case 指令与普通注释。
|
|
87
|
+
* 注意:手写但以 call@ 命名的 case 同样会被删——call@ 前缀保留为生成物标记。
|
|
88
|
+
* removed 返回被删指令名列表(按出现顺序)。
|
|
89
|
+
*/
|
|
90
|
+
declare function stripGeneratedCaseDirectives(source: string): {
|
|
91
|
+
source: string;
|
|
92
|
+
removed: string[];
|
|
93
|
+
};
|
|
94
|
+
type EmitSkipReason = "hand-written" | "already-generated" | "entry-only" | "no-serializable-cases" | "no-declaration" | "skipped";
|
|
95
|
+
type EmitResult = {
|
|
96
|
+
source: string;
|
|
97
|
+
changed: boolean;
|
|
98
|
+
written: Array<{
|
|
99
|
+
fn: string;
|
|
100
|
+
cases: string[];
|
|
101
|
+
}>;
|
|
102
|
+
skipped: Array<{
|
|
103
|
+
fn: string;
|
|
104
|
+
reason: EmitSkipReason;
|
|
105
|
+
detail?: string;
|
|
106
|
+
}>;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* 把 analysis 中的合成 case(source === "callsite")固化为源码指令:
|
|
110
|
+
*
|
|
111
|
+
* 1. 源码已有任何非 call@ 命名的 case → skip "hand-written";
|
|
112
|
+
* 已有 call@ case → skip "already-generated"。
|
|
113
|
+
* 2. fn.skipped / fn.noDeclaration / fn.entryOnly → 对应 skip。
|
|
114
|
+
* 3. 逐 case 序列化;个别不可序列化的丢弃并在 skipped 记
|
|
115
|
+
* no-serializable-cases(函数整体仍写可序列化子集,全不可序列化才整函数跳过)。
|
|
116
|
+
* 4. 写入位置:函数声明行正上方——已有 JSDoc 块则插到 `/**` 行后,
|
|
117
|
+
* 无块则新建三行块。缩进取声明行的 loc.start.column(babel 0 基列)。
|
|
118
|
+
* 多函数编辑按行号从下往上应用,避免行号漂移。
|
|
119
|
+
*/
|
|
120
|
+
declare function insertGeneratedCaseDirectives(source: string, analysis: AnalysisResult): EmitResult;
|
|
121
|
+
/** 行级 unified diff:`--- a/path` 头 + `@@` hunk + 上下文 3 行;相同返回 "" */
|
|
122
|
+
declare function unifiedDiff(a: string, b: string, path: string): string;
|
|
123
|
+
|
|
124
|
+
export { type CaseJson, type CaseJsonCase, type CaseJsonFunction, type EmitResult, type EmitSkipReason, buildCaseDirective, insertGeneratedCaseDirectives, serializeCaseArg, serializeCaseJson, stripGeneratedCaseDirectives, unifiedDiff };
|
package/dist/case.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
serializeCaseJson
|
|
3
|
+
} from "./chunk-QYRH7Z2Q.js";
|
|
4
|
+
import {
|
|
5
|
+
buildCaseDirective,
|
|
6
|
+
insertGeneratedCaseDirectives,
|
|
7
|
+
serializeCaseArg,
|
|
8
|
+
stripGeneratedCaseDirectives,
|
|
9
|
+
unifiedDiff
|
|
10
|
+
} from "./chunk-YLVZMHWC.js";
|
|
11
|
+
export {
|
|
12
|
+
buildCaseDirective,
|
|
13
|
+
insertGeneratedCaseDirectives,
|
|
14
|
+
serializeCaseArg,
|
|
15
|
+
serializeCaseJson,
|
|
16
|
+
stripGeneratedCaseDirectives,
|
|
17
|
+
unifiedDiff
|
|
18
|
+
};
|