@nudojs/service 1.0.0 → 2.0.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/dist/chunk-ADFCZP72.js +556 -0
- package/dist/config-Cqj8zeZH.d.ts +117 -0
- package/dist/evaluator/evaluator-api.d.ts +10 -21
- package/dist/evaluator/evaluator-api.js +11 -53
- package/dist/index.d.ts +539 -52
- package/dist/index.js +3780 -1490
- package/package.json +5 -5
- package/dist/chunk-FSIHAE7I.js +0 -5871
- package/dist/config-UlReSTfh.d.ts +0 -152
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { Node } from '@babel/types';
|
|
2
|
-
import { TypeValue, Environment } from '@nudojs/core';
|
|
3
|
-
|
|
4
|
-
/** 值上命名成员是否可能存在(union 部分成员持有的 no-method 降 warning
|
|
5
|
-
* 用):primitive/literal 走 wrapper 原型近似表('x'.charCodeAt),
|
|
6
|
-
* instance 走近似方法表。诊断侧据此区分"部分成员可能有"与"确定没有"。 */
|
|
7
|
-
declare function memberMayExistOn(tv: TypeValue, propName: string): boolean;
|
|
8
|
-
type SourceRange = {
|
|
9
|
-
start: {
|
|
10
|
-
line: number;
|
|
11
|
-
column: number;
|
|
12
|
-
};
|
|
13
|
-
end: {
|
|
14
|
-
line: number;
|
|
15
|
-
column: number;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
declare function setCurrentSource(source: string): void;
|
|
19
|
-
declare const RETURN_SIGNAL: unique symbol;
|
|
20
|
-
declare const BRANCH_SIGNAL: unique symbol;
|
|
21
|
-
declare const THROW_SIGNAL: unique symbol;
|
|
22
|
-
type ReturnSignal = {
|
|
23
|
-
readonly [RETURN_SIGNAL]: true;
|
|
24
|
-
readonly value: TypeValue;
|
|
25
|
-
};
|
|
26
|
-
type BranchSignal = {
|
|
27
|
-
readonly [BRANCH_SIGNAL]: true;
|
|
28
|
-
readonly returnedValue: TypeValue;
|
|
29
|
-
readonly fallthroughEnv: Environment;
|
|
30
|
-
};
|
|
31
|
-
type ThrowSignal = {
|
|
32
|
-
readonly [THROW_SIGNAL]: true;
|
|
33
|
-
readonly thrown: TypeValue;
|
|
34
|
-
readonly loc?: SourceRange;
|
|
35
|
-
};
|
|
36
|
-
type EvalResult = TypeValue | ReturnSignal | BranchSignal | ThrowSignal;
|
|
37
|
-
declare function resetMemo(): void;
|
|
38
|
-
declare function setModuleResolver(resolver: ((source: string, fromDir: string) => {
|
|
39
|
-
ast: Node;
|
|
40
|
-
filePath: string;
|
|
41
|
-
json?: unknown;
|
|
42
|
-
} | null) | null): void;
|
|
43
|
-
declare function setEnvModules(modules: Record<string, Record<string, TypeValue>>): void;
|
|
44
|
-
declare function resetEnvModules(): void;
|
|
45
|
-
declare function setMockModules(mocks: Map<string, {
|
|
46
|
-
fromPath: string;
|
|
47
|
-
names?: string[];
|
|
48
|
-
}>): void;
|
|
49
|
-
declare function resetMockModules(): void;
|
|
50
|
-
declare function setUnknownBuiltinHandler(handler: ((name: string, loc?: {
|
|
51
|
-
start: {
|
|
52
|
-
line: number;
|
|
53
|
-
column: number;
|
|
54
|
-
};
|
|
55
|
-
end: {
|
|
56
|
-
line: number;
|
|
57
|
-
column: number;
|
|
58
|
-
};
|
|
59
|
-
}) => void) | null): void;
|
|
60
|
-
declare function setSampleCount(count: number): void;
|
|
61
|
-
declare function setMaxConcreteIter(count: number): void;
|
|
62
|
-
declare function setNodeTypeCollector(collector: ((node: Node, tv: TypeValue) => void) | null): void;
|
|
63
|
-
type CallRecord = {
|
|
64
|
-
fnName: string;
|
|
65
|
-
argTypes: TypeValue[];
|
|
66
|
-
resultType: TypeValue;
|
|
67
|
-
throws: TypeValue;
|
|
68
|
-
/** Line-relative. Per-fn cache replay shifts this by lineDelta — if you
|
|
69
|
-
* add another position field (callee loc, arg loc), extend
|
|
70
|
-
* shiftCallRecordLines in analyzer.ts in the same change. */
|
|
71
|
-
callLoc?: {
|
|
72
|
-
line: number;
|
|
73
|
-
column: number;
|
|
74
|
-
};
|
|
75
|
-
targetModule?: string;
|
|
76
|
-
targetExport?: string;
|
|
77
|
-
/** export names the same function value was re-exported under after its
|
|
78
|
-
* defining module (barrel `index.js`, CJS forwarding shims); usage-site
|
|
79
|
-
* records stay name-matchable against them */
|
|
80
|
-
targetAliases?: string[];
|
|
81
|
-
/** module whose evaluation created the function value (definition site).
|
|
82
|
-
* Usage-site collection transitively evaluates the library under require(),
|
|
83
|
-
* so records of the library's INTERNAL calls (no export tag) can still be
|
|
84
|
-
* attributed to the defining file — while test-local functions and builtin
|
|
85
|
-
* statics stay unattributed and cannot pollute same-name candidates. */
|
|
86
|
-
fnModule?: string;
|
|
87
|
-
};
|
|
88
|
-
/** usage-site 执行标记:外部调用记录的实参里携带的闭包(测试回调等)在
|
|
89
|
-
* case 合成重求值时被执行,其内部错误属于使用现场文件,与本文件分析无关。
|
|
90
|
-
* 分析侧在注入前对全部外部实参调用本函数;执行来源栈读到该标记时
|
|
91
|
-
* recordUnknown.originModule 记为标记值,分析侧据此丢弃。不按模块路径
|
|
92
|
-
* 比较——跨文件依赖(本文件 require 链上加载的模块)的执行记录是合法
|
|
93
|
-
* 的可达分析,不能误伤。 */
|
|
94
|
-
declare const USAGE_SITE_MODULE = "__usage_site__";
|
|
95
|
-
declare function setUsageSiteTag(tv: TypeValue, _seen?: Set<object>): void;
|
|
96
|
-
declare function setCallCollector(collector: ((record: CallRecord) => void) | null): void;
|
|
97
|
-
type UnknownRecord = {
|
|
98
|
-
kind: "method" | "property" | "global";
|
|
99
|
-
name: string;
|
|
100
|
-
receiverType?: TypeValue;
|
|
101
|
-
loc?: {
|
|
102
|
-
line: number;
|
|
103
|
-
column: number;
|
|
104
|
-
};
|
|
105
|
-
reason?: string;
|
|
106
|
-
origin?: {
|
|
107
|
-
line: number;
|
|
108
|
-
column: number;
|
|
109
|
-
};
|
|
110
|
-
/** 定义当前正在执行的函数的模块(执行来源栈顶)。case 合成重求值会执行
|
|
111
|
-
* 注入实参携带的使用现场闭包体,其内部错误记录属于使用现场文件——
|
|
112
|
-
* 分析侧据此丢弃(行数守卫会被同行号假阳性骗过)。 */
|
|
113
|
-
originModule?: string;
|
|
114
|
-
};
|
|
115
|
-
declare function setUnknownCollector(collector: ((record: UnknownRecord) => void) | null): void;
|
|
116
|
-
declare function setProvenanceTracking(enabled: boolean): void;
|
|
117
|
-
declare function evaluate(node: Node, env: Environment): EvalResult;
|
|
118
|
-
type CallResult = {
|
|
119
|
-
value: TypeValue;
|
|
120
|
-
throws: TypeValue;
|
|
121
|
-
throwLoc?: SourceRange;
|
|
122
|
-
};
|
|
123
|
-
declare function evaluateFunction(fnNode: Node, args: TypeValue[], env: Environment): TypeValue;
|
|
124
|
-
declare function evaluateFunctionFull(fnNode: Node, args: TypeValue[], env: Environment): CallResult;
|
|
125
|
-
declare function evaluateProgram(node: Node, env: Environment): TypeValue;
|
|
126
|
-
declare function getUnreachableRanges(): SourceRange[];
|
|
127
|
-
declare function resetUnreachableRanges(): void;
|
|
128
|
-
declare function setCurrentFileDir(dir: string): void;
|
|
129
|
-
|
|
130
|
-
type NudoConfig = {
|
|
131
|
-
env?: string[];
|
|
132
|
-
mocks?: Record<string, string>;
|
|
133
|
-
interface?: {
|
|
134
|
-
/** 侧车 ambient 绑定总开关(check/LSP 执法与 interface 打印共用) */
|
|
135
|
-
autoBind?: boolean;
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
type InterfaceConfig = {
|
|
139
|
-
autoBind: boolean;
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* 归一化 `nudo.interface` 配置段:autoBind 默认 true。
|
|
143
|
-
* (emit/ignore 白名单键随 Phase 2 root 推导落地时再引入——不留未接线的
|
|
144
|
-
* 声明面,用户写了会被静默忽略。)
|
|
145
|
-
*/
|
|
146
|
-
declare function interfaceConfig(config: NudoConfig | null | undefined): InterfaceConfig;
|
|
147
|
-
declare function findProjectConfig(startDir: string): {
|
|
148
|
-
config: NudoConfig;
|
|
149
|
-
projectDir: string;
|
|
150
|
-
} | null;
|
|
151
|
-
|
|
152
|
-
export { type CallRecord as C, type InterfaceConfig as I, type NudoConfig as N, USAGE_SITE_MODULE as U, type UnknownRecord as a, evaluateFunction as b, evaluateFunctionFull as c, evaluateProgram as d, evaluate as e, findProjectConfig as f, getUnreachableRanges as g, resetMemo as h, interfaceConfig as i, resetMockModules as j, resetUnreachableRanges as k, setCurrentFileDir as l, memberMayExistOn as m, setCurrentSource as n, setEnvModules as o, setMaxConcreteIter as p, setMockModules as q, resetEnvModules as r, setCallCollector as s, setModuleResolver as t, setNodeTypeCollector as u, setProvenanceTracking as v, setSampleCount as w, setUnknownBuiltinHandler as x, setUnknownCollector as y, setUsageSiteTag as z };
|