@nudojs/service 5.0.0-beta.0 → 5.0.0-beta.1
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 +7 -12
- package/dist/{analysis-CSXrOVlg.d.ts → analysis-_DlXLC-L.d.ts} +17 -3
- package/dist/analysis.d.ts +3 -2
- package/dist/analysis.js +9 -5
- package/dist/{analyzer-types-JyJiCt8w.d.ts → analyzer-types-CfBrPK9L.d.ts} +1 -1
- package/dist/{chunk-LFZRUXGK.js → chunk-EG6FYQLI.js} +1 -1
- package/dist/chunk-J2PUE4NV.js +235 -0
- package/dist/{chunk-QAFMPM2E.js → chunk-NQXAF4LJ.js} +2277 -2225
- package/dist/{chunk-YLALZXTZ.js → chunk-ZXVAX7DE.js} +255 -11
- package/dist/{interface-BGlP7aIk.d.ts → emit/index.d.ts} +258 -18
- package/dist/{chunk-HEU4WON5.js → emit/index.js} +1627 -299
- package/dist/evaluator/evaluator-api.d.ts +1 -1
- package/dist/evaluator/evaluator-api.js +5 -5
- package/dist/index.d.ts +17 -19
- package/dist/index.js +188 -197
- package/dist/what-if-mIo7I5Ii.d.ts +21 -0
- package/package.json +9 -25
- package/dist/case.d.ts +0 -124
- package/dist/case.js +0 -18
- package/dist/chunk-6IZR4ZYJ.js +0 -1107
- package/dist/chunk-E4N4A4JV.js +0 -651
- package/dist/chunk-K3ZPOTP2.js +0 -199
- package/dist/chunk-PVJIMQRI.js +0 -246
- package/dist/chunk-QYRH7Z2Q.js +0 -89
- package/dist/chunk-U7JYTRIB.js +0 -888
- package/dist/chunk-YLVZMHWC.js +0 -364
- package/dist/dts.d.ts +0 -142
- package/dist/dts.js +0 -30
- package/dist/harvest.d.ts +0 -254
- package/dist/harvest.js +0 -75
- package/dist/interface.d.ts +0 -3
- package/dist/interface.js +0 -43
- package/dist/lsp.d.ts +0 -103
- package/dist/lsp.js +0 -36
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { C as CallRecord } from '../call-record-CkyCFkT9.js';
|
|
2
2
|
import { Abs } from '@nudojs/core';
|
|
3
3
|
export { L as LoadedEnv, l as loadEnvs, a as loadEnvsAsync, p as preloadPathEnvs } from '../env-loader-fj0TSCcA.js';
|
|
4
|
-
export { A as AnalysisConfig, a as AnalysisMode, C as CheckConfig, D as DiagnosticsLevel, I as InterfaceConfig, N as NudoConfig, b as analysisConfig, c as checkConfig, d as diskCacheRoot, f as findProjectConfig, i as interfaceConfig } from '../config-DDB588oA.js';
|
|
4
|
+
export { A as AnalysisConfig, a as AnalysisMode, C as CheckConfig, D as DiagnosticsLevel, I as InterfaceConfig, N as NudoConfig, b as analysisConfig, c as checkConfig, d as diskCacheRoot, f as findProjectConfig, i as interfaceConfig, m as matchesEmitAllowlist } from '../config-DDB588oA.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 内置类原型成员近似表(Abs 声明)。
|
|
@@ -8,13 +8,12 @@ import {
|
|
|
8
8
|
diskCacheRoot,
|
|
9
9
|
findProjectConfig,
|
|
10
10
|
interfaceConfig,
|
|
11
|
-
resolveNpmNudo
|
|
12
|
-
} from "../chunk-YLALZXTZ.js";
|
|
13
|
-
import {
|
|
14
11
|
loadEnvs,
|
|
15
12
|
loadEnvsAsync,
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
matchesEmitAllowlist,
|
|
14
|
+
preloadPathEnvs,
|
|
15
|
+
resolveNpmNudo
|
|
16
|
+
} from "../chunk-ZXVAX7DE.js";
|
|
18
17
|
export {
|
|
19
18
|
BUILTIN_PROTOTYPE_METHOD_APPROXIMATIONS,
|
|
20
19
|
analysisConfig,
|
|
@@ -27,6 +26,7 @@ export {
|
|
|
27
26
|
interfaceConfig,
|
|
28
27
|
loadEnvs,
|
|
29
28
|
loadEnvsAsync,
|
|
29
|
+
matchesEmitAllowlist,
|
|
30
30
|
preloadPathEnvs,
|
|
31
31
|
resolveNpmNudo
|
|
32
32
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as BindingInfo, C as CaseHint, b as CaseResult, c as CompletionItem, d as Diagnostic, e as DiagnosticSeverity, f as DiagnosticTag, F as FunctionAnalysis, R as ReferenceInfo, S as SourceLocation, g as SymbolInfo, h as SymbolTable } from './analyzer-types-
|
|
3
|
-
export { A as AbsGraphOptions, a as AbsModuleCacheEntry, b as AbsModuleGraphResult, c as AbsModuleLoadIssue, B as BPathRunResult, E as EnvHarvestConflict, M as MergeHarvestOptions, d as ModuleGraphCache, e as analyzeFile, f as analyzeFileAsync, g as buildModuleGraph, h as clearAbsModuleCache, i as clearBPathCache, j as collectAbsBindingsFromGraph, k as collectBPathReplacements, l as collectCallRecords, m as collectEnvGlobals, n as collectEnvModules, o as
|
|
1
|
+
import { a as AnalyzeLoadModule, D as DirectiveCaseMode, A as AnalysisResult } from './analyzer-types-CfBrPK9L.js';
|
|
2
|
+
export { B as BindingInfo, C as CaseHint, b as CaseResult, c as CompletionItem, d as Diagnostic, e as DiagnosticSeverity, f as DiagnosticTag, F as FunctionAnalysis, R as ReferenceInfo, S as SourceLocation, g as SymbolInfo, h as SymbolTable } from './analyzer-types-CfBrPK9L.js';
|
|
3
|
+
export { A as AbsGraphOptions, a as AbsModuleCacheEntry, b as AbsModuleGraphResult, c as AbsModuleLoadIssue, B as BPathRunResult, E as EnvHarvestConflict, M as MergeHarvestOptions, d as ModuleGraphCache, e as analyzeFile, f as analyzeFileAsync, g as buildModuleGraph, h as clearAbsModuleCache, i as clearBPathCache, j as collectAbsBindingsFromGraph, k as collectBPathReplacements, l as collectCallRecords, m as collectEnvGlobals, n as collectEnvModules, o as collectEnvNames, p as computeDirtySet, q as defaultAbsLoadModule, r as diagnosticsLevelForFile, s as evalAbsModuleGraph, t as evictAbsModuleCacheFiles, u as evictBPathCacheForFiles, v as filterDiagnosticsByLevel, w as getAbsModuleCacheSize, x as getBPathCacheSize, y as getEnvHarvestConflictCollector, z as isBPathCapable, C as locFromNode, D as mergeHarvestUnderEnv, F as resolveModule, G as setEnvHarvestConflictCollector, H as shouldAnalyzeFile, I as sourceHasNudoDirectives, J as topoSortDirty, K as trimBPathCache, L as tryBPathCall, N as tryBPathCallFull, O as tryRunBPath } from './analysis-_DlXLC-L.js';
|
|
4
4
|
import { C as CallRecord } from './call-record-CkyCFkT9.js';
|
|
5
5
|
export { c as clearPathEnvCaches, g as getPathEnvCacheSizes } from './env-loader-fj0TSCcA.js';
|
|
6
6
|
import { N as NudoConfig } from './config-DDB588oA.js';
|
|
7
7
|
export { A as AnalysisConfig, a as AnalysisMode, C as CheckConfig, e as DEFAULT_ANALYSIS_MODE, D as DiagnosticsLevel, I as InterfaceConfig, b as analysisConfig, g as applyBForkBudgetFromConfig, c as checkConfig, h as currentBForkBudgetLimit, d as diskCacheRoot, f as findProjectConfig, i as interfaceConfig, m as matchesEmitAllowlist } from './config-DDB588oA.js';
|
|
8
8
|
import { File, Node } from '@babel/types';
|
|
9
9
|
import { PolyFn, Abs, AbsModuleExports } from '@nudojs/core';
|
|
10
|
-
import { L as LoadModule } from './
|
|
11
|
-
export {
|
|
10
|
+
import { L as LoadModule } from './what-if-mIo7I5Ii.js';
|
|
11
|
+
export { T as TypeBinding, d as defaultLoadModule, i as injectBindings, t as typeExprToDirective } from './what-if-mIo7I5Ii.js';
|
|
12
12
|
import { FunctionWithDirectives, FileDirective } from '@nudojs/parser';
|
|
13
|
-
|
|
14
|
-
export { CaseJson, CaseJsonCase, CaseJsonFunction, EmitResult, EmitSkipReason, buildCaseDirective, insertGeneratedCaseDirectives, serializeCaseArg, serializeCaseJson, stripGeneratedCaseDirectives, unifiedDiff } from './case.js';
|
|
15
|
-
export { BuildSemanticTokensOpts, CaseInfo, HoverInfo, SEMANTIC_TOKEN_MODIFIERS, SEMANTIC_TOKEN_TYPES, SemanticToken, buildSemanticTokens, encodeSemanticTokens, getAbsAtPosition, getAbsAtPositionAsync, getCasesForFile, getCompletionsAtPosition, getHoverAtPosition, getTypeAtPosition, getTypeAtPositionAsync, interfaceTierModifierBit } from './lsp.js';
|
|
16
|
-
export { AbsInlay, BMemberDiag, collectAbsInlays } from '@nudojs/core/internal';
|
|
17
|
-
export { HARVEST_NODE_DEFAULT_MAX_FILES, HARVEST_NODE_DEFAULT_MAX_MS, HarvestJson, HarvestNodeStats, HarvestSig, NodeEnvResult, PackageHarvest, absToHarvestSig, autoHarvestModules, barePackageName, bareSpecToAbsModules, clearHarvestCache, clearNodeHarvestCache, collectBarePackages, collectDtsFromEntry, depsCacheRoot, dtsClosureHash, formatHarvestSummary, getHarvestCacheSize, getNodeHarvestCacheSize, handwrittenNodeEnv, harvestCacheKey, harvestNodeTypes, harvestPackage, harvestPackageCached, harvestPackageWithDisk, harvestSigToAbs, harvestToAbsModules, harvestedValueToAbs, isHarvestNodeDisabled, loadHarvestEnvFromDisk, lookupHarvested, materializeHarvestJson, packageHarvestToAbsModules, readHarvestDisk, resolvePackageRoot, serializeHarvestJson, summarizeNodeEnv, writeHarvestDisk } from './harvest.js';
|
|
18
|
-
import '@nudojs/harvester';
|
|
13
|
+
import '@nudojs/core/internal';
|
|
19
14
|
|
|
20
15
|
declare function analysisFileCacheKey(filePath: string, source: string, activeCases?: Map<string, number>, externalCallRecords?: CallRecord[], analysisCfg?: {
|
|
21
16
|
mode: string;
|
|
@@ -76,7 +71,10 @@ declare function analyzeExportsFromSource(filePath: string, source: string): Mod
|
|
|
76
71
|
declare function collectStaticImports(entryFile: string, maxDepth?: number): Map<string, ModuleExports>;
|
|
77
72
|
|
|
78
73
|
/**
|
|
79
|
-
*
|
|
74
|
+
* Entry-variant (browser / node) observation signal.
|
|
75
|
+
*
|
|
76
|
+
* (Module named entry-variants to avoid "dual engine" confusion; the
|
|
77
|
+
* product diagnostic code remains `nudo:dual-entry`.)
|
|
80
78
|
*
|
|
81
79
|
* Call-site records are file-scoped: when a package ships separate browser and
|
|
82
80
|
* node entrypoints, records collected against one variant do **not** inject
|
|
@@ -90,7 +88,7 @@ declare function collectStaticImports(entryFile: string, maxDepth?: number): Map
|
|
|
90
88
|
* being analyzed is one of those entry targets. Single-entry packages never
|
|
91
89
|
* fire.
|
|
92
90
|
*/
|
|
93
|
-
type
|
|
91
|
+
type EntryVariantInfo = {
|
|
94
92
|
pkgPath: string;
|
|
95
93
|
pkgDir: string;
|
|
96
94
|
pkgName?: string;
|
|
@@ -105,7 +103,7 @@ type DualEntryInfo = {
|
|
|
105
103
|
browserTargets: string[];
|
|
106
104
|
nodeTargets: string[];
|
|
107
105
|
};
|
|
108
|
-
type
|
|
106
|
+
type EntryVariantFaces = {
|
|
109
107
|
kind: "exports-conditions" | "browser-field";
|
|
110
108
|
browser: string[];
|
|
111
109
|
node: string[];
|
|
@@ -114,7 +112,7 @@ type DualFaces = {
|
|
|
114
112
|
* Detect browser/node dual faces in a parsed package.json.
|
|
115
113
|
* Returns null unless both faces exist and differ (zero-FP on single-entry).
|
|
116
114
|
*/
|
|
117
|
-
declare function
|
|
115
|
+
declare function detectEntryVariantsFromPackageJson(pkg: unknown): EntryVariantFaces | null;
|
|
118
116
|
/** Nearest package.json walking up from the file's directory. */
|
|
119
117
|
declare function findOwningPackage(fromFile: string): {
|
|
120
118
|
path: string;
|
|
@@ -126,9 +124,9 @@ declare function findOwningPackage(fromFile: string): {
|
|
|
126
124
|
* differing faces **and** this file must be one of the entry targets.
|
|
127
125
|
* Returns null otherwise (single-entry packages, shared helpers, …).
|
|
128
126
|
*/
|
|
129
|
-
declare function
|
|
127
|
+
declare function entryVariantForFile(filePath: string): EntryVariantInfo | null;
|
|
130
128
|
/** Host-facing info issue (CLI check / JSON) for one analyzed entry variant. */
|
|
131
|
-
type
|
|
129
|
+
type EntryVariantIssue = {
|
|
132
130
|
severity: "info";
|
|
133
131
|
code: "nudo:dual-entry";
|
|
134
132
|
message: string;
|
|
@@ -136,7 +134,7 @@ type DualEntryIssue = {
|
|
|
136
134
|
line: number;
|
|
137
135
|
column: number;
|
|
138
136
|
};
|
|
139
|
-
declare function
|
|
137
|
+
declare function entryVariantIssueForFile(filePath: string): EntryVariantIssue | null;
|
|
140
138
|
|
|
141
139
|
/**
|
|
142
140
|
* `@nudo:skip [returnsExpr]` 采集(host 侧)。
|
|
@@ -484,4 +482,4 @@ declare function clearEnvPathDeps(): void;
|
|
|
484
482
|
/** watch 门禁:env 模板变更必须可被接收(即便扩展名不进 isNudoTargetPath) */
|
|
485
483
|
declare function isEnvTemplatePath(path: string): boolean;
|
|
486
484
|
|
|
487
|
-
export { ANALYSIS_ABI, type AbsMockSeeds, AnalysisResult, type AnalysisSession, type BPathBuiltinUnknown, type BPathDiagnostics, type BPathUnreachable, CallRecord, DEFAULT_SESSION_CACHE_LIMITS, type DepContent, DirectiveCaseMode, DiskCache, type DiskCacheOptions, type
|
|
485
|
+
export { ANALYSIS_ABI, type AbsMockSeeds, AnalysisResult, type AnalysisSession, type BPathBuiltinUnknown, type BPathDiagnostics, type BPathUnreachable, CallRecord, DEFAULT_SESSION_CACHE_LIMITS, type DepContent, DirectiveCaseMode, DiskCache, type DiskCacheOptions, type EntryVariantInfo, type EntryVariantIssue, LoadModule, type MockModuleApplyResult, type ModuleExports, NudoConfig, type SessionCacheLimits, ambientSourcesOfSidecar, analysisFileCacheKey, analyzeExportsFromSource, applyMockModuleDirectives, applyMockModuleDirectivesFromSource, applySessionCacheConfig, checkCacheKey, clearAnalysisFileCache, clearAnalysisSessionCaches, clearEnvPathDeps, clearFnAnalysisCache, collectBPathDiagnostics, collectDependencySpecs, collectLoadDepContents, collectSkipReturns, collectStaticImports, detectEntryVariantsFromPackageJson, entryVariantForFile, entryVariantIssueForFile, envPathDependents, evictAnalysisCachesForFiles, evictAnalysisFileCacheForFiles, evictFnAnalysisCacheForFiles, extractNudoImportSpecs, findOwningPackage, getAnalysisFileCacheSize, getAnalysisSession, getEnvPathDepsSize, getFnAnalysisCacheSize, getSessionCacheLimits, ifaceCacheKey, isEnvTemplatePath, isNudoTargetPath, isProjectConfigPath, isSidecarPath, isWatchRelevantPath, mockDirectivesToAbsSeeds, mockSeedsForSource, mockSeedsToAbsMocks, noteEnvPathDeps, relativizePath, resetAllAnalysisCaches, resetSessionCacheLimitState, setAnalysisSession, setSessionCacheFromProject, setSessionCacheLimits, sha256Hex, trimAnalysisFileCache, trimFnAnalysisCache };
|
package/dist/index.js
CHANGED
|
@@ -4,83 +4,19 @@ import {
|
|
|
4
4
|
hasNudoDirectives,
|
|
5
5
|
isNudoTargetPath,
|
|
6
6
|
shouldAnalyzeFile
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
serializeCaseJson
|
|
10
|
-
} from "./chunk-QYRH7Z2Q.js";
|
|
11
|
-
import {
|
|
12
|
-
absToSchemaNode,
|
|
13
|
-
absToSchemaSource,
|
|
14
|
-
absToStandardSchema,
|
|
15
|
-
absToStandardSchemaModule,
|
|
16
|
-
absToTSType,
|
|
17
|
-
constraintToSchemaNode,
|
|
18
|
-
generateDts,
|
|
19
|
-
generateFunctionDtsLines,
|
|
20
|
-
generateGuardFunction,
|
|
21
|
-
generateGuardFunctionFromAbs,
|
|
22
|
-
projectAbsToSchema,
|
|
23
|
-
schemaNodeToZod,
|
|
24
|
-
validateSchemaNode
|
|
25
|
-
} from "./chunk-6IZR4ZYJ.js";
|
|
26
|
-
import {
|
|
27
|
-
HARVEST_NODE_DEFAULT_MAX_FILES,
|
|
28
|
-
HARVEST_NODE_DEFAULT_MAX_MS,
|
|
29
|
-
clearNodeHarvestCache,
|
|
30
|
-
getNodeHarvestCacheSize,
|
|
31
|
-
handwrittenNodeEnv,
|
|
32
|
-
harvestNodeTypes,
|
|
33
|
-
isHarvestNodeDisabled,
|
|
34
|
-
summarizeNodeEnv
|
|
35
|
-
} from "./chunk-K3ZPOTP2.js";
|
|
7
|
+
} from "./chunk-EG6FYQLI.js";
|
|
36
8
|
import {
|
|
37
9
|
ANALYSIS_ABI,
|
|
38
10
|
DiskCache,
|
|
39
11
|
checkCacheKey,
|
|
40
12
|
collectLoadDepContents,
|
|
41
|
-
collectParamBodyAccesses,
|
|
42
|
-
deriveFromRoot,
|
|
43
|
-
draftInterface,
|
|
44
|
-
emitDerivedFromRoot,
|
|
45
|
-
emitInterface,
|
|
46
|
-
extractFnConstraintSources,
|
|
47
13
|
extractNudoImportSpecs,
|
|
48
|
-
formatDerivedSection,
|
|
49
|
-
formatDraftModule,
|
|
50
|
-
formatDraftSummary,
|
|
51
|
-
formatEmitSummary,
|
|
52
|
-
formatInterfaceSurfaceLine,
|
|
53
14
|
ifaceCacheKey,
|
|
54
15
|
injectBindings,
|
|
55
|
-
interfaceSurface,
|
|
56
|
-
isDraftableEntry,
|
|
57
16
|
relativizePath,
|
|
58
17
|
sha256Hex,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
writeInterfaceDraft
|
|
62
|
-
} from "./chunk-HEU4WON5.js";
|
|
63
|
-
import {
|
|
64
|
-
buildCaseDirective,
|
|
65
|
-
insertGeneratedCaseDirectives,
|
|
66
|
-
serializeCaseArg,
|
|
67
|
-
stripGeneratedCaseDirectives,
|
|
68
|
-
unifiedDiff
|
|
69
|
-
} from "./chunk-YLVZMHWC.js";
|
|
70
|
-
import {
|
|
71
|
-
SEMANTIC_TOKEN_MODIFIERS,
|
|
72
|
-
SEMANTIC_TOKEN_TYPES,
|
|
73
|
-
buildSemanticTokens,
|
|
74
|
-
encodeSemanticTokens,
|
|
75
|
-
getAbsAtPosition,
|
|
76
|
-
getAbsAtPositionAsync,
|
|
77
|
-
getCasesForFile,
|
|
78
|
-
getCompletionsAtPosition,
|
|
79
|
-
getHoverAtPosition,
|
|
80
|
-
getTypeAtPosition,
|
|
81
|
-
getTypeAtPositionAsync,
|
|
82
|
-
interfaceTierModifierBit
|
|
83
|
-
} from "./chunk-E4N4A4JV.js";
|
|
18
|
+
typeExprToDirective
|
|
19
|
+
} from "./chunk-J2PUE4NV.js";
|
|
84
20
|
import {
|
|
85
21
|
analysisFileCacheKey,
|
|
86
22
|
analyzeFile,
|
|
@@ -99,12 +35,13 @@ import {
|
|
|
99
35
|
collectCallRecords,
|
|
100
36
|
collectEnvGlobals,
|
|
101
37
|
collectEnvModules,
|
|
38
|
+
collectEnvNames,
|
|
102
39
|
computeDirtySet,
|
|
103
40
|
defaultAbsLoadModule,
|
|
104
41
|
defaultLoadModule,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
42
|
+
detectEntryVariantsFromPackageJson,
|
|
43
|
+
entryVariantForFile,
|
|
44
|
+
entryVariantIssueForFile,
|
|
108
45
|
envPathDependents,
|
|
109
46
|
evalAbsModuleGraph,
|
|
110
47
|
evictAbsModuleCacheFiles,
|
|
@@ -120,11 +57,13 @@ import {
|
|
|
120
57
|
getFnAnalysisCacheSize,
|
|
121
58
|
isBPathCapable,
|
|
122
59
|
isEnvTemplatePath,
|
|
60
|
+
locFromNode,
|
|
123
61
|
mergeHarvestUnderEnv,
|
|
124
62
|
mockDirectivesToAbsSeeds,
|
|
125
63
|
mockSeedsForSource,
|
|
126
64
|
mockSeedsToAbsMocks,
|
|
127
65
|
noteEnvPathDeps,
|
|
66
|
+
resolveModule,
|
|
128
67
|
setEnvHarvestConflictCollector,
|
|
129
68
|
topoSortDirty,
|
|
130
69
|
trimAnalysisFileCache,
|
|
@@ -133,66 +72,199 @@ import {
|
|
|
133
72
|
tryBPathCall,
|
|
134
73
|
tryBPathCallFull,
|
|
135
74
|
tryRunBPath
|
|
136
|
-
} from "./chunk-
|
|
137
|
-
import {
|
|
138
|
-
absToHarvestSig,
|
|
139
|
-
analyzeExportsFromSource,
|
|
140
|
-
autoHarvestModules,
|
|
141
|
-
barePackageName,
|
|
142
|
-
bareSpecToAbsModules,
|
|
143
|
-
clearHarvestCache,
|
|
144
|
-
collectBarePackages,
|
|
145
|
-
collectDependencySpecs,
|
|
146
|
-
collectDtsFromEntry,
|
|
147
|
-
collectStaticImports,
|
|
148
|
-
depsCacheRoot,
|
|
149
|
-
dtsClosureHash,
|
|
150
|
-
formatHarvestSummary,
|
|
151
|
-
getHarvestCacheSize,
|
|
152
|
-
harvestCacheKey,
|
|
153
|
-
harvestPackage,
|
|
154
|
-
harvestPackageCached,
|
|
155
|
-
harvestPackageWithDisk,
|
|
156
|
-
harvestSigToAbs,
|
|
157
|
-
harvestToAbsModules,
|
|
158
|
-
harvestedValueToAbs,
|
|
159
|
-
loadHarvestEnvFromDisk,
|
|
160
|
-
lookupHarvested,
|
|
161
|
-
materializeHarvestJson,
|
|
162
|
-
packageHarvestToAbsModules,
|
|
163
|
-
readHarvestDisk,
|
|
164
|
-
resolvePackageRoot,
|
|
165
|
-
serializeHarvestJson,
|
|
166
|
-
writeHarvestDisk
|
|
167
|
-
} from "./chunk-U7JYTRIB.js";
|
|
75
|
+
} from "./chunk-NQXAF4LJ.js";
|
|
168
76
|
import {
|
|
169
77
|
DEFAULT_ANALYSIS_MODE,
|
|
170
78
|
DEFAULT_SESSION_CACHE_LIMITS,
|
|
171
79
|
analysisConfig,
|
|
172
80
|
applyBForkBudgetFromConfig,
|
|
173
81
|
checkConfig,
|
|
82
|
+
clearPathEnvCaches,
|
|
174
83
|
currentBForkBudgetLimit,
|
|
175
84
|
diskCacheRoot,
|
|
176
85
|
findProjectConfig,
|
|
86
|
+
getPathEnvCacheSizes,
|
|
177
87
|
getSessionCacheLimits,
|
|
178
88
|
interfaceConfig,
|
|
179
89
|
matchesEmitAllowlist,
|
|
180
90
|
resetSessionCacheLimitState,
|
|
181
91
|
setSessionCacheFromProject,
|
|
182
92
|
setSessionCacheLimits
|
|
183
|
-
} from "./chunk-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
} from "
|
|
93
|
+
} from "./chunk-ZXVAX7DE.js";
|
|
94
|
+
|
|
95
|
+
// src/static-imports.ts
|
|
96
|
+
import { parse } from "@nudojs/parser";
|
|
97
|
+
import { readFileSync, existsSync } from "fs";
|
|
98
|
+
import { resolve, dirname, join } from "path";
|
|
99
|
+
import { generalizeFromAst, foldStaticStringExpr } from "@nudojs/core";
|
|
100
|
+
function resolveRelative(fromFile, spec) {
|
|
101
|
+
if (!spec.startsWith(".") && !spec.startsWith("/")) return void 0;
|
|
102
|
+
const base = resolve(dirname(fromFile), spec);
|
|
103
|
+
for (const cand of [
|
|
104
|
+
base,
|
|
105
|
+
base + ".js",
|
|
106
|
+
base + ".cjs",
|
|
107
|
+
base + ".mjs",
|
|
108
|
+
base + ".ts",
|
|
109
|
+
base + ".mts",
|
|
110
|
+
base + ".cts",
|
|
111
|
+
join(base, "index.js"),
|
|
112
|
+
join(base, "index.cjs"),
|
|
113
|
+
join(base, "index.mjs"),
|
|
114
|
+
join(base, "index.ts")
|
|
115
|
+
]) {
|
|
116
|
+
if (existsSync(cand)) return cand;
|
|
117
|
+
}
|
|
118
|
+
return void 0;
|
|
119
|
+
}
|
|
120
|
+
function collectDependencySpecs(ast) {
|
|
121
|
+
const specs = [];
|
|
122
|
+
for (const stmt of ast.program.body) {
|
|
123
|
+
if (stmt.type === "ImportDeclaration") {
|
|
124
|
+
specs.push(stmt.source.value);
|
|
125
|
+
}
|
|
126
|
+
if (stmt.type === "ExportNamedDeclaration" && stmt.source) {
|
|
127
|
+
specs.push(stmt.source.value);
|
|
128
|
+
}
|
|
129
|
+
if (stmt.type === "ExportAllDeclaration" && stmt.source) {
|
|
130
|
+
specs.push(stmt.source.value);
|
|
131
|
+
}
|
|
132
|
+
collectRequires(stmt, specs);
|
|
133
|
+
}
|
|
134
|
+
return specs;
|
|
135
|
+
}
|
|
136
|
+
function collectRequires(node, out) {
|
|
137
|
+
const visit = (n) => {
|
|
138
|
+
if (!n || typeof n !== "object") return;
|
|
139
|
+
const obj = n;
|
|
140
|
+
if (obj.type === "CallExpression" && obj.callee) {
|
|
141
|
+
const c = obj.callee;
|
|
142
|
+
let spec;
|
|
143
|
+
if (c.type === "Identifier" && c.name === "require") {
|
|
144
|
+
spec = foldStaticStringExpr(obj.arguments?.[0]);
|
|
145
|
+
} else if (c.type === "MemberExpression" && !c.computed && c.object?.type === "Identifier" && c.object.name === "require" && c.property?.type === "Identifier" && c.property.name === "resolve") {
|
|
146
|
+
spec = foldStaticStringExpr(obj.arguments?.[0]);
|
|
147
|
+
}
|
|
148
|
+
if (spec !== void 0) out.push(spec);
|
|
149
|
+
}
|
|
150
|
+
for (const key of Object.keys(obj)) {
|
|
151
|
+
if (key === "loc" || key === "start" || key === "end") continue;
|
|
152
|
+
const v = obj[key];
|
|
153
|
+
if (Array.isArray(v)) v.forEach(visit);
|
|
154
|
+
else if (v && typeof v === "object") visit(v);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
visit(node);
|
|
158
|
+
}
|
|
159
|
+
function analyzeExportsFromSource(filePath, source) {
|
|
160
|
+
const file = parse(source);
|
|
161
|
+
const named = /* @__PURE__ */ new Map();
|
|
162
|
+
let defaultExport;
|
|
163
|
+
const poly = /* @__PURE__ */ new Map();
|
|
164
|
+
for (const stmt of file.program.body) {
|
|
165
|
+
let decl = stmt;
|
|
166
|
+
if (stmt.type === "ExportNamedDeclaration" && stmt.declaration) {
|
|
167
|
+
decl = stmt.declaration;
|
|
168
|
+
}
|
|
169
|
+
if (decl.type === "FunctionDeclaration" && decl.id) {
|
|
170
|
+
named.set(decl.id.name, decl.id.name);
|
|
171
|
+
}
|
|
172
|
+
if (decl.type === "VariableDeclaration") {
|
|
173
|
+
for (const d of decl.declarations) {
|
|
174
|
+
if (d.id.type === "Identifier") named.set(d.id.name, d.id.name);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (decl.type === "ClassDeclaration" && decl.id) {
|
|
178
|
+
named.set(decl.id.name, decl.id.name);
|
|
179
|
+
}
|
|
180
|
+
if (stmt.type === "ExportDefaultDeclaration") {
|
|
181
|
+
const d = stmt.declaration;
|
|
182
|
+
if (d.type === "FunctionDeclaration" && d.id) defaultExport = d.id.name;
|
|
183
|
+
if (d.type === "Identifier") defaultExport = d.name;
|
|
184
|
+
}
|
|
185
|
+
collectCjsExports(stmt, named, (n) => {
|
|
186
|
+
defaultExport = n;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
for (const name of named.values()) {
|
|
190
|
+
const g = generalizeFromAst(name, source);
|
|
191
|
+
if (g) poly.set(name, g);
|
|
192
|
+
}
|
|
193
|
+
if (defaultExport) {
|
|
194
|
+
const g = generalizeFromAst(defaultExport, source);
|
|
195
|
+
if (g) poly.set("default", g);
|
|
196
|
+
}
|
|
197
|
+
return { path: filePath, named, defaultExport, source, poly };
|
|
198
|
+
}
|
|
199
|
+
function collectCjsExports(stmt, named, setDefault) {
|
|
200
|
+
const visit = (n) => {
|
|
201
|
+
if (!n || typeof n !== "object") return;
|
|
202
|
+
const obj = n;
|
|
203
|
+
if (obj.type !== "AssignmentExpression") {
|
|
204
|
+
for (const key of Object.keys(obj)) {
|
|
205
|
+
if (key === "loc" || key === "start" || key === "end") continue;
|
|
206
|
+
const v = obj[key];
|
|
207
|
+
if (Array.isArray(v)) v.forEach(visit);
|
|
208
|
+
else if (v && typeof v === "object") visit(v);
|
|
209
|
+
}
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const left = obj.left;
|
|
213
|
+
const right = obj.right;
|
|
214
|
+
if (left?.type === "MemberExpression" && left.object?.type === "Identifier" && left.object.name === "exports" && left.property?.type === "Identifier" && left.property.name) {
|
|
215
|
+
named.set(left.property.name, left.property.name);
|
|
216
|
+
}
|
|
217
|
+
if (left?.type === "MemberExpression" && left.object?.type === "Identifier" && left.object.name === "module" && left.property?.type === "Identifier" && left.property.name === "exports") {
|
|
218
|
+
if (right?.type === "Identifier" && typeof right.name === "string") {
|
|
219
|
+
named.set(right.name, right.name);
|
|
220
|
+
setDefault(right.name);
|
|
221
|
+
}
|
|
222
|
+
if (right?.type === "ObjectExpression") {
|
|
223
|
+
const props = right.properties;
|
|
224
|
+
for (const p of props) {
|
|
225
|
+
if (p.type !== "ObjectProperty") continue;
|
|
226
|
+
const key = p.key;
|
|
227
|
+
const val = p.value;
|
|
228
|
+
const exportName = key?.type === "Identifier" ? key.name : key?.type === "StringLiteral" ? key.value : void 0;
|
|
229
|
+
if (exportName) named.set(exportName, exportName);
|
|
230
|
+
if (val?.type === "Identifier" && val.name && exportName) {
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
visit(stmt);
|
|
237
|
+
}
|
|
238
|
+
function collectStaticImports(entryFile, maxDepth = 8) {
|
|
239
|
+
const graph = /* @__PURE__ */ new Map();
|
|
240
|
+
const queue = [
|
|
241
|
+
{ file: resolve(entryFile), depth: 0 }
|
|
242
|
+
];
|
|
243
|
+
const seen = /* @__PURE__ */ new Set();
|
|
244
|
+
while (queue.length > 0) {
|
|
245
|
+
const { file, depth } = queue.shift();
|
|
246
|
+
if (seen.has(file) || depth > maxDepth) continue;
|
|
247
|
+
seen.add(file);
|
|
248
|
+
if (!existsSync(file)) continue;
|
|
249
|
+
const source = readFileSync(file, "utf8");
|
|
250
|
+
const mod = analyzeExportsFromSource(file, source);
|
|
251
|
+
graph.set(file, mod);
|
|
252
|
+
const ast = parse(source);
|
|
253
|
+
for (const spec of collectDependencySpecs(ast)) {
|
|
254
|
+
const resolved = resolveRelative(file, spec);
|
|
255
|
+
if (resolved) queue.push({ file: resolved, depth: depth + 1 });
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return graph;
|
|
259
|
+
}
|
|
188
260
|
|
|
189
261
|
// src/skip-directives.ts
|
|
190
|
-
import { extractDirectives, parse } from "@nudojs/parser";
|
|
262
|
+
import { extractDirectives, parse as parse2 } from "@nudojs/parser";
|
|
191
263
|
function collectSkipReturns(source) {
|
|
192
264
|
const out = /* @__PURE__ */ new Map();
|
|
193
265
|
let ast;
|
|
194
266
|
try {
|
|
195
|
-
ast =
|
|
267
|
+
ast = parse2(source);
|
|
196
268
|
} catch {
|
|
197
269
|
return out;
|
|
198
270
|
}
|
|
@@ -203,9 +275,6 @@ function collectSkipReturns(source) {
|
|
|
203
275
|
return out;
|
|
204
276
|
}
|
|
205
277
|
|
|
206
|
-
// src/index.ts
|
|
207
|
-
import { collectAbsInlays } from "@nudojs/core/internal";
|
|
208
|
-
|
|
209
278
|
// src/session-cache.ts
|
|
210
279
|
import {
|
|
211
280
|
resetGeneralizeMemo,
|
|
@@ -312,16 +381,6 @@ export {
|
|
|
312
381
|
DEFAULT_ANALYSIS_MODE,
|
|
313
382
|
DEFAULT_SESSION_CACHE_LIMITS,
|
|
314
383
|
DiskCache,
|
|
315
|
-
HARVEST_NODE_DEFAULT_MAX_FILES,
|
|
316
|
-
HARVEST_NODE_DEFAULT_MAX_MS,
|
|
317
|
-
SEMANTIC_TOKEN_MODIFIERS,
|
|
318
|
-
SEMANTIC_TOKEN_TYPES,
|
|
319
|
-
absToHarvestSig,
|
|
320
|
-
absToSchemaNode,
|
|
321
|
-
absToSchemaSource,
|
|
322
|
-
absToStandardSchema,
|
|
323
|
-
absToStandardSchemaModule,
|
|
324
|
-
absToTSType,
|
|
325
384
|
ambientSourcesOfSidecar,
|
|
326
385
|
analysisConfig,
|
|
327
386
|
analysisFileCacheKey,
|
|
@@ -332,12 +391,7 @@ export {
|
|
|
332
391
|
applyMockModuleDirectives,
|
|
333
392
|
applyMockModuleDirectivesFromSource,
|
|
334
393
|
applySessionCacheConfig,
|
|
335
|
-
autoHarvestModules,
|
|
336
|
-
barePackageName,
|
|
337
|
-
bareSpecToAbsModules,
|
|
338
|
-
buildCaseDirective,
|
|
339
394
|
buildModuleGraph,
|
|
340
|
-
buildSemanticTokens,
|
|
341
395
|
checkCacheKey,
|
|
342
396
|
checkConfig,
|
|
343
397
|
clearAbsModuleCache,
|
|
@@ -346,40 +400,27 @@ export {
|
|
|
346
400
|
clearBPathCache,
|
|
347
401
|
clearEnvPathDeps,
|
|
348
402
|
clearFnAnalysisCache,
|
|
349
|
-
clearHarvestCache,
|
|
350
|
-
clearNodeHarvestCache,
|
|
351
403
|
clearPathEnvCaches,
|
|
352
404
|
collectAbsBindingsFromGraph,
|
|
353
|
-
collectAbsInlays,
|
|
354
405
|
collectBPathDiagnostics,
|
|
355
406
|
collectBPathReplacements,
|
|
356
|
-
collectBarePackages,
|
|
357
407
|
collectCallRecords,
|
|
358
408
|
collectDependencySpecs,
|
|
359
|
-
collectDtsFromEntry,
|
|
360
409
|
collectEnvGlobals,
|
|
361
410
|
collectEnvModules,
|
|
411
|
+
collectEnvNames,
|
|
362
412
|
collectLoadDepContents,
|
|
363
|
-
collectParamBodyAccesses,
|
|
364
413
|
collectSkipReturns,
|
|
365
414
|
collectStaticImports,
|
|
366
415
|
computeDirtySet,
|
|
367
|
-
constraintToSchemaNode,
|
|
368
416
|
currentBForkBudgetLimit,
|
|
369
417
|
defaultAbsLoadModule,
|
|
370
418
|
defaultLoadModule,
|
|
371
|
-
|
|
372
|
-
deriveFromRoot,
|
|
373
|
-
detectDualEntryFromPackageJson,
|
|
419
|
+
detectEntryVariantsFromPackageJson,
|
|
374
420
|
diagnosticsLevelForFile,
|
|
375
421
|
diskCacheRoot,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
dualEntryForFile,
|
|
379
|
-
dualEntryIssueForFile,
|
|
380
|
-
emitDerivedFromRoot,
|
|
381
|
-
emitInterface,
|
|
382
|
-
encodeSemanticTokens,
|
|
422
|
+
entryVariantForFile,
|
|
423
|
+
entryVariantIssueForFile,
|
|
383
424
|
envPathDependents,
|
|
384
425
|
evalAbsModuleGraph,
|
|
385
426
|
evictAbsModuleCacheFiles,
|
|
@@ -387,92 +428,46 @@ export {
|
|
|
387
428
|
evictAnalysisFileCacheForFiles,
|
|
388
429
|
evictBPathCacheForFiles,
|
|
389
430
|
evictFnAnalysisCacheForFiles,
|
|
390
|
-
extractFnConstraintSources,
|
|
391
431
|
extractNudoImportSpecs,
|
|
392
432
|
filterDiagnosticsByLevel,
|
|
393
433
|
findOwningPackage,
|
|
394
434
|
findProjectConfig,
|
|
395
|
-
formatDerivedSection,
|
|
396
|
-
formatDraftModule,
|
|
397
|
-
formatDraftSummary,
|
|
398
|
-
formatEmitSummary,
|
|
399
|
-
formatHarvestSummary,
|
|
400
|
-
formatInterfaceSurfaceLine,
|
|
401
|
-
generateDts,
|
|
402
|
-
generateFunctionDtsLines,
|
|
403
|
-
generateGuardFunction,
|
|
404
|
-
generateGuardFunctionFromAbs,
|
|
405
|
-
getAbsAtPosition,
|
|
406
|
-
getAbsAtPositionAsync,
|
|
407
435
|
getAbsModuleCacheSize,
|
|
408
436
|
getAnalysisFileCacheSize,
|
|
409
437
|
getAnalysisSession,
|
|
410
438
|
getBPathCacheSize,
|
|
411
|
-
getCasesForFile,
|
|
412
|
-
getCompletionsAtPosition,
|
|
413
439
|
getEnvHarvestConflictCollector,
|
|
414
440
|
getEnvPathDepsSize,
|
|
415
441
|
getFnAnalysisCacheSize,
|
|
416
|
-
getHarvestCacheSize,
|
|
417
|
-
getHoverAtPosition,
|
|
418
|
-
getNodeHarvestCacheSize,
|
|
419
442
|
getPathEnvCacheSizes,
|
|
420
443
|
getSessionCacheLimits,
|
|
421
|
-
getTypeAtPosition,
|
|
422
|
-
getTypeAtPositionAsync,
|
|
423
|
-
handwrittenNodeEnv,
|
|
424
|
-
harvestCacheKey,
|
|
425
|
-
harvestNodeTypes,
|
|
426
|
-
harvestPackage,
|
|
427
|
-
harvestPackageCached,
|
|
428
|
-
harvestPackageWithDisk,
|
|
429
|
-
harvestSigToAbs,
|
|
430
|
-
harvestToAbsModules,
|
|
431
|
-
harvestedValueToAbs,
|
|
432
444
|
ifaceCacheKey,
|
|
433
445
|
injectBindings,
|
|
434
|
-
insertGeneratedCaseDirectives,
|
|
435
446
|
interfaceConfig,
|
|
436
|
-
interfaceSurface,
|
|
437
|
-
interfaceTierModifierBit,
|
|
438
447
|
isBPathCapable,
|
|
439
|
-
isDraftableEntry,
|
|
440
448
|
isEnvTemplatePath,
|
|
441
|
-
isHarvestNodeDisabled,
|
|
442
449
|
isNudoTargetPath,
|
|
443
450
|
isProjectConfigPath,
|
|
444
451
|
isSidecarPath,
|
|
445
452
|
isWatchRelevantPath,
|
|
446
|
-
|
|
447
|
-
lookupHarvested,
|
|
453
|
+
locFromNode,
|
|
448
454
|
matchesEmitAllowlist,
|
|
449
|
-
materializeHarvestJson,
|
|
450
455
|
mergeHarvestUnderEnv,
|
|
451
456
|
mockDirectivesToAbsSeeds,
|
|
452
457
|
mockSeedsForSource,
|
|
453
458
|
mockSeedsToAbsMocks,
|
|
454
459
|
noteEnvPathDeps,
|
|
455
|
-
packageHarvestToAbsModules,
|
|
456
|
-
projectAbsToSchema,
|
|
457
|
-
readHarvestDisk,
|
|
458
460
|
relativizePath,
|
|
459
461
|
resetAllAnalysisCaches,
|
|
460
462
|
resetSessionCacheLimitState,
|
|
461
|
-
|
|
462
|
-
schemaNodeToZod,
|
|
463
|
-
serializeCaseArg,
|
|
464
|
-
serializeCaseJson,
|
|
465
|
-
serializeHarvestJson,
|
|
463
|
+
resolveModule,
|
|
466
464
|
setAnalysisSession,
|
|
467
465
|
setEnvHarvestConflictCollector,
|
|
468
466
|
setSessionCacheFromProject,
|
|
469
467
|
setSessionCacheLimits,
|
|
470
468
|
sha256Hex,
|
|
471
469
|
shouldAnalyzeFile,
|
|
472
|
-
sidecarDraftPath,
|
|
473
470
|
hasNudoDirectives as sourceHasNudoDirectives,
|
|
474
|
-
stripGeneratedCaseDirectives,
|
|
475
|
-
summarizeNodeEnv,
|
|
476
471
|
topoSortDirty,
|
|
477
472
|
trimAnalysisFileCache,
|
|
478
473
|
trimBPathCache,
|
|
@@ -480,9 +475,5 @@ export {
|
|
|
480
475
|
tryBPathCall,
|
|
481
476
|
tryBPathCallFull,
|
|
482
477
|
tryRunBPath,
|
|
483
|
-
typeExprToDirective
|
|
484
|
-
unifiedDiff,
|
|
485
|
-
validateSchemaNode,
|
|
486
|
-
writeHarvestDisk,
|
|
487
|
-
writeInterfaceDraft
|
|
478
|
+
typeExprToDirective
|
|
488
479
|
};
|