@stillwind/host 0.8.0 → 0.10.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/CHANGELOG.md +122 -0
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +2 -2
- package/dist/{index-BXbvCuG7.d.ts → index-DdFR_SNl.d.ts} +22 -3
- package/dist/index.d.ts +148 -6
- package/dist/index.js +277 -66
- package/dist/index.js.map +1 -1
- package/dist/{options-PMjJ1c8W.js → options-CHkqG1Gc.js} +2293 -1902
- package/dist/options-CHkqG1Gc.js.map +1 -0
- package/dist/{plugin-CxD6forV.js → plugin-CNOsrkrd.js} +21 -3
- package/dist/plugin-CNOsrkrd.js.map +1 -0
- package/dist/{resolution-C3cvLPzx.js → resolution-C5o_tmY3.js} +4 -1
- package/dist/resolution-C5o_tmY3.js.map +1 -0
- package/dist/{resolution-BI5eZllL.d.ts → resolution-C7e21ept.d.ts} +2 -1
- package/dist/resolution.d.ts +1 -1
- package/dist/resolution.js +1 -1
- package/package.json +15 -12
- package/dist/options-PMjJ1c8W.js.map +0 -1
- package/dist/plugin-CxD6forV.js.map +0 -1
- package/dist/resolution-C3cvLPzx.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @stillwind/host
|
|
2
|
+
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- @stillwind/config@0.10.0
|
|
9
|
+
- @stillwind/native@0.10.0
|
|
10
|
+
- @stillwind/projection@0.10.0
|
|
11
|
+
|
|
12
|
+
## 0.9.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Vite builds and development servers now run TypeScript type collection once for all environments, such as client and SSR, while the environments resolve imports of source files to the same files. This shortens builds and the first page load. Packages may resolve differently, for example when SSR externalizes them. An environment that resolves an import of a source file differently continues with its own type collection.
|
|
17
|
+
|
|
18
|
+
Hosts that share a `CompilationProject` can set `resolverDomain` on `CompilerHost` to name their resolver. When another domain resolves an import of a source file differently, preparation and compilation reject with `ResolutionMismatchError`. Prepared import links no longer point the checker at package runtime files, so the checker resolves package types itself.
|
|
19
|
+
|
|
20
|
+
- Generated utility class names now stay the same when an edit elsewhere in the module moves the `style()` call. A class name also no longer changes when only the generated name of an imported ref or container changes.
|
|
21
|
+
|
|
22
|
+
The `utilityClass` and `viewTransitionSlot` naming callbacks now receive `path` and `ordinal` instead of `call`. `path` lists the names of the declarations that enclose the `style()` call, from the outermost to the innermost, and `ordinal` counts the earlier calls of the module with the same path.
|
|
23
|
+
|
|
24
|
+
- Generated names of refs, anchors, containers, keyframes, and view transitions now stay the same when an edit elsewhere in the module moves the declaration. Type facts of consumers also stay the same, so such an edit in a dependency no longer changes the types that its consumers see.
|
|
25
|
+
|
|
26
|
+
Naming callbacks for these names now receive `path` and `ordinal` instead of `start` and `end`. `path` lists the names of the declarations that enclose the declaration, from the outermost to the innermost. `ordinal` counts the earlier declarations of the module with the same kind, path, and binding name. Composition identities and asset identities in compilation results carry `path` and `ordinal` instead of byte offsets.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Compile modules that import one style from a module whose other styles compose bases from further modules. These builds no longer fail with `SW11003: style base producer is unavailable` or with an undetermined declaration identity.
|
|
31
|
+
|
|
32
|
+
- Apply edits of keyframes and view-transition declarations without compiling the modules that use them again. The document stylesheet now takes these declarations from the module that declares them.
|
|
33
|
+
|
|
34
|
+
- Accept modern CSS length units in typed Tailwind plugins and preserve DEFAULT entries when reading theme namespaces.
|
|
35
|
+
|
|
36
|
+
- Updated dependencies:
|
|
37
|
+
- @stillwind/config@0.9.0
|
|
38
|
+
- @stillwind/native@0.9.0
|
|
39
|
+
- @stillwind/projection@0.9.0
|
|
40
|
+
|
|
41
|
+
## 0.8.0
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Updated dependencies:
|
|
46
|
+
- @stillwind/config@0.8.0
|
|
47
|
+
- @stillwind/native@0.8.0
|
|
48
|
+
- @stillwind/projection@0.8.0
|
|
49
|
+
|
|
50
|
+
## 0.7.0
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- The npm package page now shows that each package includes TypeScript declarations. Packages without a root JavaScript entry declare an empty root module, so TypeScript setups that ignore `exports` report a missing export instead of resolving unrelated types.
|
|
55
|
+
|
|
56
|
+
- Updated dependencies:
|
|
57
|
+
- @stillwind/config@0.7.0
|
|
58
|
+
- @stillwind/native@0.7.0
|
|
59
|
+
- @stillwind/projection@0.7.0
|
|
60
|
+
|
|
61
|
+
## 0.6.0
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies:
|
|
66
|
+
- @stillwind/config@0.6.0
|
|
67
|
+
- @stillwind/native@0.6.0
|
|
68
|
+
- @stillwind/projection@0.6.0
|
|
69
|
+
|
|
70
|
+
## 0.5.0
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Updated dependencies:
|
|
75
|
+
- @stillwind/config@0.5.0
|
|
76
|
+
- @stillwind/native@0.5.0
|
|
77
|
+
- @stillwind/projection@0.5.0
|
|
78
|
+
|
|
79
|
+
## 0.4.1
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies:
|
|
84
|
+
- @stillwind/config@0.4.1
|
|
85
|
+
- @stillwind/native@0.4.1
|
|
86
|
+
- @stillwind/projection@0.4.1
|
|
87
|
+
|
|
88
|
+
## 0.4.0
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- Updated dependencies:
|
|
93
|
+
- @stillwind/config@0.4.0
|
|
94
|
+
- @stillwind/native@0.4.0
|
|
95
|
+
- @stillwind/projection@0.4.0
|
|
96
|
+
|
|
97
|
+
## 0.3.0
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- Updated dependencies:
|
|
102
|
+
- @stillwind/config@0.3.0
|
|
103
|
+
- @stillwind/native@0.3.0
|
|
104
|
+
- @stillwind/projection@0.3.0
|
|
105
|
+
|
|
106
|
+
## 0.2.0
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- Updated dependencies:
|
|
111
|
+
- @stillwind/config@0.2.0
|
|
112
|
+
- @stillwind/native@0.2.0
|
|
113
|
+
- @stillwind/projection@0.2.0
|
|
114
|
+
|
|
115
|
+
## 0.1.0
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Updated dependencies:
|
|
120
|
+
- @stillwind/config@0.1.0
|
|
121
|
+
- @stillwind/native@0.1.0
|
|
122
|
+
- @stillwind/projection@0.1.0
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as PluginPathCompletion, C as TypeFactSource, D as PluginHost, E as UnverifiedRange, F as EditorResult, M as EditorCompletion, N as EditorEdit, P as EditorRequest, S as SemanticInputs, T as TypeFactsError, a as DesignSystemResult, b as AvailableFacts, c as queryDesignSystem, i as DesignSystemRequest, j as EditorColor, k as defaultPluginExport, n as DesignCandidate, o as DesignToken, r as DesignSystemContext, s as DesignTokenSource, t as EditorSnapshot, u as ModuleAnalysis, w as TypeFactsBackend } from "./index-
|
|
2
|
-
import { t as resolveVirtualModule } from "./resolution-
|
|
1
|
+
import { A as PluginPathCompletion, C as TypeFactSource, D as PluginHost, E as UnverifiedRange, F as EditorResult, M as EditorCompletion, N as EditorEdit, P as EditorRequest, S as SemanticInputs, T as TypeFactsError, a as DesignSystemResult, b as AvailableFacts, c as queryDesignSystem, i as DesignSystemRequest, j as EditorColor, k as defaultPluginExport, n as DesignCandidate, o as DesignToken, r as DesignSystemContext, s as DesignTokenSource, t as EditorSnapshot, u as ModuleAnalysis, w as TypeFactsBackend } from "./index-DdFR_SNl.js";
|
|
2
|
+
import { t as resolveVirtualModule } from "./resolution-C7e21ept.js";
|
|
3
3
|
import { BindingRejectedIdentifier, BindingReport, NativeAssetRecord, NativeTypeFact } from "@stillwind/native";
|
|
4
4
|
import ts from "typescript-6";
|
|
5
5
|
import { AnalysisProjectConfig } from "@stillwind/config";
|
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as resolveVirtualModule } from "./resolution-
|
|
1
|
+
import { A as fileSourceKind, E as CompilationProject, F as prepareSourcePlugins, M as attachPlugins, _ as defaultPluginExport, a as pluginDirectory, b as analyzeModule, c as CheckerSource, d as queryDesignSystem, f as isStylesheet, h as loadEditorCssGraph, i as completePluginPaths, j as TypeFactsError, l as checkerId, m as loadCssGraph, n as cssEntrypoint, o as queryPluginPaths, r as StylesheetEditor, s as EditorSnapshot, t as compilerOptions, u as withRequestedProbes, y as finalizeCss } from "./options-CHkqG1Gc.js";
|
|
2
|
+
import { t as resolveVirtualModule } from "./resolution-C5o_tmY3.js";
|
|
3
3
|
import { NativeProjectSession, fingerprint } from "@stillwind/native";
|
|
4
4
|
import ts from "typescript-6";
|
|
5
5
|
import * as path from "pathe";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BindingEdit, BindingReport, NativeAssetRecord, NativeCheckerBinding, NativeCompilerOptions, NativeCssFileInput, NativeCssRequest, NativeDesignSystemLoader, NativeDiagnosticBatch, NativeEditorQuery, NativeProjectSession, NativeSourceIssue, NativeTypeFact, ProjectModuleOutput } from "@stillwind/native";
|
|
2
2
|
import { CheckerBuffer, PreparedSource } from "@stillwind/projection";
|
|
3
|
-
import "
|
|
3
|
+
import "tsrs/sync";
|
|
4
4
|
import { BaseConfig, PluginDirectoryEntry, PluginWatchKind, PreviewOptions, StillwindPlugin, TailwindConfig } from "@stillwind/config";
|
|
5
|
-
import "
|
|
5
|
+
import "tsrs/ast";
|
|
6
6
|
/**
|
|
7
7
|
* A replacement in the original document, using half-open UTF-16 offsets.
|
|
8
8
|
*/
|
|
@@ -410,6 +410,16 @@ interface TypeFactsBackend {
|
|
|
410
410
|
* Replacing the inputs clears the backend's prepared checker buffers.
|
|
411
411
|
*/
|
|
412
412
|
setProjectSources?(sources: readonly TypeFactSource[], assets: ReadonlyMap<string, readonly NativeAssetRecord[]>, inputs?: SemanticInputs): void;
|
|
413
|
+
/**
|
|
414
|
+
* Describes the exports of an installed source as consumers read them through facts. Without
|
|
415
|
+
* this method, every edit of a source counts as a change of its exports.
|
|
416
|
+
*
|
|
417
|
+
* @param resolverId - Resolver identity of a source passed to {@link setProjectSources}.
|
|
418
|
+
* @returns A description that is equal in two installations when consumers read the same facts
|
|
419
|
+
* from the exports, or undefined when the backend cannot describe them. Undefined must be treated
|
|
420
|
+
* as a change.
|
|
421
|
+
*/
|
|
422
|
+
exportInterface?(resolverId: string): string | undefined;
|
|
413
423
|
/**
|
|
414
424
|
* Resolves imports using the checker environment before source-provider fallback resolution.
|
|
415
425
|
*
|
|
@@ -599,6 +609,15 @@ declare class TypeScriptFactsService implements TypeFactsBackend {
|
|
|
599
609
|
* @throws If the service is closed, project preparation fails, or checker resolution fails.
|
|
600
610
|
*/
|
|
601
611
|
resolveModules(sources: readonly TypeFactSource[], assetsByModuleId: ReadonlyMap<string, readonly AssetRecord[]>, inputs?: TypeFactsInputs): Map<string, Map<string, string>>;
|
|
612
|
+
/**
|
|
613
|
+
* Describes the exports of an installed source as consumers read them through facts.
|
|
614
|
+
*
|
|
615
|
+
* @param resolverId - Resolver identity of a source passed to {@link setProjectSources}.
|
|
616
|
+
* @returns A description that is equal in two installations when consumers read the same facts
|
|
617
|
+
* from the exports. Returns undefined when the service is closed, no project is installed, the
|
|
618
|
+
* source is not installed, the exports are too large to describe, or the checker fails.
|
|
619
|
+
*/
|
|
620
|
+
exportInterface(resolverId: string): string | undefined;
|
|
602
621
|
/**
|
|
603
622
|
* Marks the service closed, disposes its retained snapshot, and closes the checker API. Repeated
|
|
604
623
|
* calls return without further work.
|
|
@@ -949,4 +968,4 @@ declare class EditorSnapshot {
|
|
|
949
968
|
query(id: string, request: EditorRequest): EditorResult | undefined;
|
|
950
969
|
}
|
|
951
970
|
export { PluginPathCompletion as A, TypeFactSource as C, PluginHost as D, UnverifiedRange as E, EditorResult as F, EditorCompletion as M, EditorEdit as N, TailwindSettings as O, EditorRequest as P, SemanticInputs as S, TypeFactsError as T, TypeFactsInputs as _, DesignSystemResult as a, AvailableFacts as b, queryDesignSystem as c, ModuleCompileOptions as d, SemanticDependency as f, TypeFactsEnvironment as g, TypeScriptFactsStats as h, DesignSystemRequest as i, EditorColor as j, defaultPluginExport as k, PluginRuntime as l, TypeScriptFactsService as m, DesignCandidate as n, DesignToken as o, TypeFact as p, DesignSystemContext as r, DesignTokenSource as s, EditorSnapshot as t, ModuleAnalysis as u, TypeScriptProject as v, TypeFactsBackend as w, CheckerSpan as x, resolveTypeFactsEnvironment as y };
|
|
952
|
-
//# sourceMappingURL=index-
|
|
971
|
+
//# sourceMappingURL=index-DdFR_SNl.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as PluginPathCompletion, C as TypeFactSource, D as PluginHost, E as UnverifiedRange, F as EditorResult, M as EditorCompletion, N as EditorEdit, O as TailwindSettings, P as EditorRequest, S as SemanticInputs, T as TypeFactsError, _ as TypeFactsInputs, a as DesignSystemResult, b as AvailableFacts, c as queryDesignSystem, d as ModuleCompileOptions, f as SemanticDependency, g as TypeFactsEnvironment, h as TypeScriptFactsStats, i as DesignSystemRequest, j as EditorColor, k as defaultPluginExport, l as PluginRuntime, m as TypeScriptFactsService, n as DesignCandidate, o as DesignToken, p as TypeFact, r as DesignSystemContext, s as DesignTokenSource, t as EditorSnapshot, u as ModuleAnalysis, v as TypeScriptProject, w as TypeFactsBackend, x as CheckerSpan, y as resolveTypeFactsEnvironment } from "./index-
|
|
1
|
+
import { A as PluginPathCompletion, C as TypeFactSource, D as PluginHost, E as UnverifiedRange, F as EditorResult, M as EditorCompletion, N as EditorEdit, O as TailwindSettings, P as EditorRequest, S as SemanticInputs, T as TypeFactsError, _ as TypeFactsInputs, a as DesignSystemResult, b as AvailableFacts, c as queryDesignSystem, d as ModuleCompileOptions, f as SemanticDependency, g as TypeFactsEnvironment, h as TypeScriptFactsStats, i as DesignSystemRequest, j as EditorColor, k as defaultPluginExport, l as PluginRuntime, m as TypeScriptFactsService, n as DesignCandidate, o as DesignToken, p as TypeFact, r as DesignSystemContext, s as DesignTokenSource, t as EditorSnapshot, u as ModuleAnalysis, v as TypeScriptProject, w as TypeFactsBackend, x as CheckerSpan, y as resolveTypeFactsEnvironment } from "./index-DdFR_SNl.js";
|
|
2
2
|
import { BindingDiagnostic, BindingOutput, BindingRejectedIdentifier, BindingReport, NativeAssetRecord, NativeCompilerOptions, NativeCssResource, NativeDesignSystemLoader, NativeDiagnosticBatch, NativeEditorQuery, NativeModuleSummary, NativeProjectSession, NativeSkippedCss, NativeTypeFact } from "@stillwind/native";
|
|
3
3
|
import { PreparedSource as PreparedSource$1, ProjectInput, ScriptSyntax, SourceDocument } from "@stillwind/projection";
|
|
4
4
|
import { EncodedSourceMap } from "@jridgewell/gen-mapping";
|
|
@@ -42,6 +42,11 @@ export declare function cleanModuleId(id: string): string;
|
|
|
42
42
|
interface CompilerHost {
|
|
43
43
|
/** Requests checker import resolutions. A non-null host resolve result still takes precedence. */
|
|
44
44
|
typeFactsResolution?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Names the resolver that answers `resolve`. Hosts that share a CompilationProject and can
|
|
47
|
+
* resolve the same import differently must use different domains. Omission is one domain.
|
|
48
|
+
*/
|
|
49
|
+
resolverDomain?: string;
|
|
45
50
|
/**
|
|
46
51
|
* Loads source before or after preparation, including its original document and projection.
|
|
47
52
|
*
|
|
@@ -57,6 +62,16 @@ interface CompilerHost {
|
|
|
57
62
|
* @returns Whether source traversal can continue. Omission checks for supported JS/TS and SFC extensions.
|
|
58
63
|
*/
|
|
59
64
|
supports?(id: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the stylesheet modules that the host inserts at the macro import of a source that it
|
|
67
|
+
* compiles as an entry. A dependency that imports a macro module receives the same imports, so
|
|
68
|
+
* that the session reuses one compilation of the source in both roles.
|
|
69
|
+
*
|
|
70
|
+
* @param id - Full resolver identity of the source.
|
|
71
|
+
* @returns The imports that the entry options would supply for this source, or undefined when
|
|
72
|
+
* the host inserts none. Omission inserts none into dependencies.
|
|
73
|
+
*/
|
|
74
|
+
stylesheetImports?(id: string): string[] | undefined;
|
|
60
75
|
/**
|
|
61
76
|
* Describes one resolved source before it is scanned or compiled.
|
|
62
77
|
*
|
|
@@ -112,9 +127,40 @@ interface CompilerHost {
|
|
|
112
127
|
*/
|
|
113
128
|
warn(message: string): void;
|
|
114
129
|
}
|
|
115
|
-
/**
|
|
116
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Two resolver domains resolved the same import to different source targets, so they cannot share
|
|
132
|
+
* one project. Answers that analysis does not read, such as an external package and its runtime
|
|
133
|
+
* file, may differ. The project keeps the answer that it stored first.
|
|
134
|
+
*/
|
|
135
|
+
export declare class ResolutionMismatchError extends Error {
|
|
136
|
+
readonly importer: string;
|
|
137
|
+
readonly specifier: string;
|
|
138
|
+
readonly domain: string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* @param importer - Full resolver ID of the importing source.
|
|
141
|
+
* @param specifier - Authored module request.
|
|
142
|
+
* @param domain - Resolver domain whose answer differs from the stored answer.
|
|
143
|
+
*/
|
|
144
|
+
constructor(importer: string, specifier: string, domain: string | undefined);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Keeps prepared sources and checker inputs between analyses of one project.
|
|
148
|
+
*
|
|
149
|
+
* Hosts whose resolvers can answer differently, such as the client and server environments of one
|
|
150
|
+
* bundler, can share a project when each host sets its own `resolverDomain`. The project stores the
|
|
151
|
+
* first answer for an import, and every other domain checks that answer once before using it.
|
|
152
|
+
*/
|
|
153
|
+
export declare class CompilationProject {
|
|
117
154
|
#private;
|
|
155
|
+
/**
|
|
156
|
+
* Creates an empty project.
|
|
157
|
+
*
|
|
158
|
+
* @param fixedSources - True when no source text and no import resolution changes until
|
|
159
|
+
* invalidation. The project then keeps collected facts and host import resolutions. With every
|
|
160
|
+
* file that a source imports installed, the facts of a source depend only on its own text, so
|
|
161
|
+
* other analyses can reuse them.
|
|
162
|
+
*/
|
|
163
|
+
constructor(fixedSources?: boolean);
|
|
118
164
|
/** Revision that a pending load must still match before it stores a source. */
|
|
119
165
|
get revision(): number;
|
|
120
166
|
/**
|
|
@@ -135,6 +181,20 @@ declare class CompilationProject {
|
|
|
135
181
|
* @returns Shared scan results, or undefined when the source is not retained. Do not mutate them.
|
|
136
182
|
*/
|
|
137
183
|
summary(source: PreparedSource$1): NativeModuleSummary | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Finds facts that an earlier analysis collected for a checker source.
|
|
186
|
+
*
|
|
187
|
+
* @param source - Checker source that {@link install} returned.
|
|
188
|
+
* @returns Shared facts, or undefined when they are not kept. Do not mutate them.
|
|
189
|
+
*/
|
|
190
|
+
facts(source: TypeFactSource): readonly NativeTypeFact[] | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Keeps collected facts for reuse when the project was created with fixed sources.
|
|
193
|
+
*
|
|
194
|
+
* @param source - Checker source that {@link install} returned for the current revision.
|
|
195
|
+
* @param facts - Complete facts that the checker collected for that source.
|
|
196
|
+
*/
|
|
197
|
+
retainFacts(source: TypeFactSource, facts: NativeTypeFact[]): void;
|
|
138
198
|
/**
|
|
139
199
|
* Stores a source and its successful scan results, copying the source before retaining it.
|
|
140
200
|
*
|
|
@@ -145,7 +205,21 @@ declare class CompilationProject {
|
|
|
145
205
|
*/
|
|
146
206
|
retain(source: PreparedSource$1, summary: NativeModuleSummary, revision?: number): void;
|
|
147
207
|
/**
|
|
148
|
-
*
|
|
208
|
+
* Resolves an import through the host. A project with fixed sources asks the host once for each
|
|
209
|
+
* importer, specifier, and resolver domain.
|
|
210
|
+
*
|
|
211
|
+
* @param host - Host that resolves the import. Its `resolverDomain` selects the domain.
|
|
212
|
+
* @param specifier - Authored module request.
|
|
213
|
+
* @param importer - Full resolver ID of the importing source.
|
|
214
|
+
* @returns The stored answer. A failed resolution is not kept.
|
|
215
|
+
* @throws If the host resolution fails, or a ResolutionMismatchError if the host's domain
|
|
216
|
+
* resolves the import to a source target that differs from the stored answer.
|
|
217
|
+
*/
|
|
218
|
+
resolveImport(host: CompilerHost, specifier: string, importer: string): ReturnType<CompilerHost["resolve"]>;
|
|
219
|
+
/**
|
|
220
|
+
* Loads and scans targets together, then resolves the imports of the sources that the targets
|
|
221
|
+
* reach through the host. Sources that the targets do not reach keep their links, and stay
|
|
222
|
+
* unlinked or unverified for this host's domain until a later call reaches them.
|
|
149
223
|
* Analysis retries failed loads and scans so it can report each target's own error.
|
|
150
224
|
*
|
|
151
225
|
* @param ids - Full resolver IDs of the targets to prepare.
|
|
@@ -162,6 +236,36 @@ declare class CompilationProject {
|
|
|
162
236
|
* Advances the revision so pending loads cannot restore the removed sources.
|
|
163
237
|
*/
|
|
164
238
|
invalidate(ids?: string | Iterable<string>): void;
|
|
239
|
+
/**
|
|
240
|
+
* Removes every source read from a file, including query-qualified sources, and clears every
|
|
241
|
+
* collected fact. The next {@link prepare} call loads the removed sources again.
|
|
242
|
+
*
|
|
243
|
+
* A content change keeps the import links of other sources, because their resolved targets
|
|
244
|
+
* keep the same IDs. Adding or removing a file can change any resolution, so it also clears
|
|
245
|
+
* all import links and cached resolution answers.
|
|
246
|
+
*
|
|
247
|
+
* @param file - Absolute path of a file that changed, was added, or was removed. A file that
|
|
248
|
+
* no source reads still clears the facts, because the checker reads unprepared files from disk.
|
|
249
|
+
* @param entry - Whether the file was added or removed rather than changed.
|
|
250
|
+
*/
|
|
251
|
+
invalidateFile(file: string, entry: boolean): void;
|
|
252
|
+
/**
|
|
253
|
+
* Tests whether every source read from a changed file exposes the same exports as before the
|
|
254
|
+
* last {@link invalidateFile} call for that file. When it does, the facts and scans that other
|
|
255
|
+
* sources read from it are unchanged, so analyses of those sources may be kept.
|
|
256
|
+
*
|
|
257
|
+
* Call it after the reloaded sources were prepared again. The result does not cover checker
|
|
258
|
+
* diagnostics of the other sources, global declarations that the file adds, or module
|
|
259
|
+
* augmentation.
|
|
260
|
+
*
|
|
261
|
+
* @param file - Absolute path passed to {@link invalidateFile} with `entry` false.
|
|
262
|
+
* @param backend - Backend for later queries. Receives the current inputs if they changed.
|
|
263
|
+
* @param inputs - File overlays and ambient declarations of the current analyses.
|
|
264
|
+
* @returns False when no source was removed, a removed source is not prepared again, another
|
|
265
|
+
* source did not import it, or the backend cannot describe its exports before and after.
|
|
266
|
+
* @throws If checker input installation fails.
|
|
267
|
+
*/
|
|
268
|
+
keepsInterface(file: string, backend: TypeFactsBackend, inputs?: SemanticInputs): boolean;
|
|
165
269
|
/**
|
|
166
270
|
* Installs prepared checker inputs when their sources, import links, or supplied files change.
|
|
167
271
|
*
|
|
@@ -222,11 +326,13 @@ export declare function analyzeModule(session: NativeProjectSession, factsServic
|
|
|
222
326
|
* @param id - Full resolver identity of the entry source, including its query suffix.
|
|
223
327
|
* @param host - Source metadata, resolution, reading, dependency tracking, and warning operations.
|
|
224
328
|
* @param options - Diagnostic behavior, captured checker inputs, and generated imports for the entry.
|
|
329
|
+
* @param project - Optional sources shared across compilations whose dependency text does not
|
|
330
|
+
* change. When the project holds different text for the entry, this compilation does not use it.
|
|
225
331
|
* @returns A promise for the entry output and composition metadata, or undefined when normal mode
|
|
226
332
|
* produces no entry code.
|
|
227
333
|
* @throws If compilation rejects diagnostics, source preparation fails, or host or checker operations fail.
|
|
228
334
|
*/
|
|
229
|
-
export declare function compileModule(session: NativeProjectSession, factsService: () => TypeFactsBackend | undefined, code: string, id: string, host: CompilerHost, options?: ModuleCompileOptions): Promise<{
|
|
335
|
+
export declare function compileModule(session: NativeProjectSession, factsService: () => TypeFactsBackend | undefined, code: string, id: string, host: CompilerHost, options?: ModuleCompileOptions, project?: CompilationProject): Promise<{
|
|
230
336
|
hasModuleCssImport: boolean;
|
|
231
337
|
compositionModules: string[];
|
|
232
338
|
compositionTopology: string;
|
|
@@ -411,6 +517,42 @@ export declare function moduleSourceMap(source: string, compiled: string, id: st
|
|
|
411
517
|
/** Exclusive UTF-16 offset in the same compiled buffer. */
|
|
412
518
|
to: number;
|
|
413
519
|
}[], prefix: string): EncodedSourceMap;
|
|
520
|
+
/**
|
|
521
|
+
* Publishes elapsed times of host compilation phases for performance measurement.
|
|
522
|
+
*
|
|
523
|
+
* Messages go to the `stillwind:host:phase` channel of `node:diagnostics_channel`.
|
|
524
|
+
* Publishing does nothing when the runtime has no such module, such as a browser,
|
|
525
|
+
* or when the channel has no subscribers.
|
|
526
|
+
*/
|
|
527
|
+
/** One completed phase. */
|
|
528
|
+
interface PhaseMessage {
|
|
529
|
+
/** Phase name, such as `scan` or `native-compile`. */
|
|
530
|
+
phase: string;
|
|
531
|
+
/**
|
|
532
|
+
* Milliseconds from start to completion. An asynchronous phase also counts the time
|
|
533
|
+
* that it waits for other work, so durations of concurrent phases can overlap.
|
|
534
|
+
*/
|
|
535
|
+
duration: number;
|
|
536
|
+
/** Number of items that the phase processed, such as sources passed to one call. */
|
|
537
|
+
items: number;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Starts a phase measurement.
|
|
541
|
+
*
|
|
542
|
+
* @param phase - Phase name to publish.
|
|
543
|
+
* @returns A function that publishes the phase with its item count, which defaults to 1.
|
|
544
|
+
* The function does nothing when no subscriber was present at the start.
|
|
545
|
+
*/
|
|
546
|
+
export declare function startPhase(phase: string): (items?: number) => void;
|
|
547
|
+
/**
|
|
548
|
+
* Measures a synchronous or asynchronous operation as one phase.
|
|
549
|
+
*
|
|
550
|
+
* @param phase - Phase name to publish.
|
|
551
|
+
* @param items - Item count to publish.
|
|
552
|
+
* @param run - Operation to measure. A returned promise ends the phase when it settles.
|
|
553
|
+
* @returns The result of `run`. Failures are rethrown after the phase is published.
|
|
554
|
+
*/
|
|
555
|
+
export declare function tracePhase<T>(phase: string, items: number, run: () => T): T;
|
|
414
556
|
/**
|
|
415
557
|
* Adds notices before a CSS body without changing the body.
|
|
416
558
|
*
|
|
@@ -1281,5 +1423,5 @@ export declare class AnalysisWorkspace {
|
|
|
1281
1423
|
*/
|
|
1282
1424
|
close(): Promise<void>;
|
|
1283
1425
|
}
|
|
1284
|
-
export { type AnalysisHost, type AnalysisResult, type AvailableFacts, type CheckerSpan, type CompilerHost, type CompilerMapping, type CssHost, type CssLocations, type CssPluginInputs, type CssSourceMapInput, type CssUpstreamMap, type DecodedCssSourceMap, type DesignCandidate, type DesignSystemContext, type DesignSystemRequest, type DesignSystemResult, type DesignToken, type DesignTokenSource, type EditorAnalysis, type EditorColor, type EditorCompletion, type EditorCssGraph, type EditorDocument, type EditorEdit, type EditorRequest, type EditorResult, EditorSnapshot, type FinalizedModuleEdit, type LoadedCssGraph, type ModuleAnalysis, type ModuleCompileOptions, type ModuleDescriptor, type PluginHost, type PluginPathCompletion, PluginRuntime, type PreparedSource, type SemanticDependency, type SemanticInputs, type TailwindSettings, type TypeFact, type TypeFactSource, type TypeFactsBackend, type TypeFactsEnvironment, TypeFactsError, type TypeFactsInputs, TypeScriptFactsService, type TypeScriptFactsStats, type TypeScriptProject, type UnverifiedRange, type UpstreamSourceMap, type WorkspaceProject, type WorkspaceResult, defaultPluginExport, queryDesignSystem, resolveTypeFactsEnvironment };
|
|
1426
|
+
export { type AnalysisHost, type AnalysisResult, type AvailableFacts, type CheckerSpan, type CompilerHost, type CompilerMapping, type CssHost, type CssLocations, type CssPluginInputs, type CssSourceMapInput, type CssUpstreamMap, type DecodedCssSourceMap, type DesignCandidate, type DesignSystemContext, type DesignSystemRequest, type DesignSystemResult, type DesignToken, type DesignTokenSource, type EditorAnalysis, type EditorColor, type EditorCompletion, type EditorCssGraph, type EditorDocument, type EditorEdit, type EditorRequest, type EditorResult, EditorSnapshot, type FinalizedModuleEdit, type LoadedCssGraph, type ModuleAnalysis, type ModuleCompileOptions, type ModuleDescriptor, type PhaseMessage, type PluginHost, type PluginPathCompletion, PluginRuntime, type PreparedSource, type SemanticDependency, type SemanticInputs, type TailwindSettings, type TypeFact, type TypeFactSource, type TypeFactsBackend, type TypeFactsEnvironment, TypeFactsError, type TypeFactsInputs, TypeScriptFactsService, type TypeScriptFactsStats, type TypeScriptProject, type UnverifiedRange, type UpstreamSourceMap, type WorkspaceProject, type WorkspaceResult, defaultPluginExport, queryDesignSystem, resolveTypeFactsEnvironment };
|
|
1285
1427
|
//# sourceMappingURL=index.d.ts.map
|