@skastr0/quartz-engine 0.2.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/LICENSE +21 -0
- package/dist/analyzer.d.ts +48 -0
- package/dist/context.d.ts +21 -0
- package/dist/contracts.d.ts +440 -0
- package/dist/diagnostics.d.ts +3 -0
- package/dist/discovery.d.ts +2 -0
- package/dist/errors.d.ts +6 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2949 -0
- package/dist/leaf-operations.d.ts +26 -0
- package/dist/reference-operations.d.ts +11 -0
- package/dist/transform-search/index.d.ts +8 -0
- package/dist/types.d.ts +30 -0
- package/dist/verification-operations.d.ts +19 -0
- package/dist/virtual-files.d.ts +43 -0
- package/dist/workspace.d.ts +25 -0
- package/package.json +48 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ErrorExplanationIssue, ExpandedType, FileInspectionResult, ListSymbolsOptions, PackageInfo, SearchTypesOptions, SymbolListResult, TypeAnalyzer, TypeAtPositionResult, TypeEvaluationResult, TypeExplanationResult, TypeInfo } from "./contracts";
|
|
2
|
+
import { AnalyzerContext } from "./context";
|
|
3
|
+
export interface LeafOperations {
|
|
4
|
+
readonly getPackages: () => Promise<readonly PackageInfo[]>;
|
|
5
|
+
readonly listSymbols: (options?: ListSymbolsOptions) => Promise<SymbolListResult>;
|
|
6
|
+
readonly getTypeInfo: (symbolName: string, packageName?: string) => Promise<TypeInfo | null>;
|
|
7
|
+
readonly expandType: (symbolName: string, packageName?: string) => Promise<ExpandedType | null>;
|
|
8
|
+
readonly searchTypes: (options: SearchTypesOptions) => Promise<readonly TypeInfo[]>;
|
|
9
|
+
readonly evalType: (expression: string, packageName?: string) => Promise<TypeEvaluationResult>;
|
|
10
|
+
readonly getFileDeclarations: (file: string, options?: {
|
|
11
|
+
readonly symbol?: string;
|
|
12
|
+
readonly includePrivate?: boolean;
|
|
13
|
+
readonly packageName?: string;
|
|
14
|
+
}) => Promise<FileInspectionResult | null>;
|
|
15
|
+
readonly checkCompatibility: (from: string, to: string, packageName?: string) => Promise<{
|
|
16
|
+
readonly compatible: boolean;
|
|
17
|
+
readonly from: string;
|
|
18
|
+
readonly to: string;
|
|
19
|
+
readonly reason?: string;
|
|
20
|
+
readonly issues?: readonly ErrorExplanationIssue[];
|
|
21
|
+
}>;
|
|
22
|
+
readonly getDiagnostics: TypeAnalyzer["getDiagnostics"];
|
|
23
|
+
readonly getTypeAtPosition: (filePath: string, line: number, column: number, packageName?: string) => Promise<TypeAtPositionResult | null>;
|
|
24
|
+
readonly explainType: (expression: string, packageName?: string) => Promise<TypeExplanationResult>;
|
|
25
|
+
}
|
|
26
|
+
export declare const createLeafOperations: (context: AnalyzerContext) => LeafOperations;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AnalyzerContext } from "./context";
|
|
2
|
+
import type { GraphResult, RefactorPreviewResult, RefactorPreviewOptions, RelatedInfo } from "./contracts";
|
|
3
|
+
export declare const createReferenceOperations: (context: AnalyzerContext) => {
|
|
4
|
+
findRelated: (symbolName: string, packageName?: string) => Promise<RelatedInfo | null>;
|
|
5
|
+
generateGraph: (symbolName: string, options?: {
|
|
6
|
+
readonly depth?: number;
|
|
7
|
+
readonly format?: "mermaid" | "dot";
|
|
8
|
+
readonly packageName?: string;
|
|
9
|
+
}) => Promise<GraphResult | null>;
|
|
10
|
+
previewRefactor: (options: RefactorPreviewOptions) => Promise<RefactorPreviewResult>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnalyzerContext } from "../context";
|
|
2
|
+
import type { TransformSearchOptions, TransformSearchResponse } from "../contracts";
|
|
3
|
+
export type TransformSearchOperation = (options: TransformSearchOptions & {
|
|
4
|
+
readonly packageName?: string;
|
|
5
|
+
}) => Promise<TransformSearchResponse>;
|
|
6
|
+
export declare const createTransformSearchOperation: (context: AnalyzerContext) => (options: TransformSearchOptions & {
|
|
7
|
+
readonly packageName?: string;
|
|
8
|
+
}) => Promise<TransformSearchResponse>;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type DiagnosticSeverity = "error" | "warning" | "suggestion" | "message";
|
|
2
|
+
export interface EngineDiagnostic {
|
|
3
|
+
readonly file: string | null;
|
|
4
|
+
readonly line: number | null;
|
|
5
|
+
readonly column: number | null;
|
|
6
|
+
readonly endLine: number | null;
|
|
7
|
+
readonly endColumn: number | null;
|
|
8
|
+
readonly code: number;
|
|
9
|
+
readonly severity: DiagnosticSeverity;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WorkspaceFileChanges {
|
|
13
|
+
readonly changed?: readonly string[];
|
|
14
|
+
readonly created?: readonly string[];
|
|
15
|
+
readonly deleted?: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
export interface WorkspaceMetadata {
|
|
18
|
+
readonly root: string;
|
|
19
|
+
readonly configFile: string;
|
|
20
|
+
readonly configFiles: readonly string[];
|
|
21
|
+
readonly revision: number;
|
|
22
|
+
readonly analysisTypescriptVersion: string;
|
|
23
|
+
readonly closed: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface WorkspaceOptions {
|
|
26
|
+
readonly tsconfigPath?: string;
|
|
27
|
+
readonly tsconfigPaths?: readonly string[];
|
|
28
|
+
readonly collectTiming?: boolean;
|
|
29
|
+
readonly tsserverPath?: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Project } from "typescript/unstable/async";
|
|
2
|
+
import type { AnalyzerContext } from "./context";
|
|
3
|
+
import type { TypeAnalyzer } from "./contracts";
|
|
4
|
+
import { type VirtualFileRegistry } from "./virtual-files";
|
|
5
|
+
export interface VirtualWorkspace {
|
|
6
|
+
withVirtualFile<T>(tsconfigPath: string, filePath: string, content: string, operation: (project: Project, filePath: string) => Promise<T>): Promise<T>;
|
|
7
|
+
}
|
|
8
|
+
export interface VerificationOperationDependencies {
|
|
9
|
+
readonly compatibility: TypeAnalyzer["checkCompatibility"];
|
|
10
|
+
readonly diagnostics: TypeAnalyzer["getDiagnostics"];
|
|
11
|
+
readonly transformSearch: TypeAnalyzer["transformSearch"];
|
|
12
|
+
readonly virtualFiles?: VirtualFileRegistry;
|
|
13
|
+
}
|
|
14
|
+
export interface VerificationOperations {
|
|
15
|
+
readonly checkSnippet: TypeAnalyzer["checkSnippet"];
|
|
16
|
+
readonly explainError: TypeAnalyzer["explainError"];
|
|
17
|
+
readonly verifyContract: TypeAnalyzer["verifyContract"];
|
|
18
|
+
}
|
|
19
|
+
export declare const createVerificationOperations: (context: AnalyzerContext, dependencies: VerificationOperationDependencies) => VerificationOperations;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Project } from "typescript/unstable/async";
|
|
2
|
+
/**
|
|
3
|
+
* Prefer a source directory that is typically covered by tsconfig include
|
|
4
|
+
* globs (`types/**`, `src/**`, …). Temporary file updates for paths outside
|
|
5
|
+
* include patterns work but are dramatically slower in TS-Go.
|
|
6
|
+
*/
|
|
7
|
+
export declare const resolveVirtualFileDirectory: (packageRoot: string) => string;
|
|
8
|
+
export interface VirtualPackageImports {
|
|
9
|
+
readonly content: string;
|
|
10
|
+
readonly lineOffset: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Render imports for the package's public entrypoint into an ephemeral source.
|
|
14
|
+
* Type-only exports are kept type-only so verbatimModuleSyntax remains valid.
|
|
15
|
+
*/
|
|
16
|
+
export declare const synthesizePackageImports: (project: Project, packageRoot: string, virtualFilePath: string) => Promise<VirtualPackageImports>;
|
|
17
|
+
export interface VirtualFileLease {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly content: string;
|
|
20
|
+
readonly token: symbol;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
export interface VirtualFileEntry {
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly content: string;
|
|
26
|
+
readonly token: symbol;
|
|
27
|
+
}
|
|
28
|
+
export interface VirtualFileRegistry {
|
|
29
|
+
acquire(content: string, extension?: ".ts" | ".tsx"): VirtualFileLease;
|
|
30
|
+
create(content: string, extension?: ".ts" | ".tsx"): VirtualFileLease;
|
|
31
|
+
get(path: string): string | undefined;
|
|
32
|
+
has(path: string): boolean;
|
|
33
|
+
entries(): readonly VirtualFileEntry[];
|
|
34
|
+
readonly size: number;
|
|
35
|
+
clear(): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A per-context registry for ephemeral source files. A lease owns exactly one
|
|
39
|
+
* entry; disposing an old lease can never remove a newer entry at the same
|
|
40
|
+
* path, which makes cleanup safe even when callers race.
|
|
41
|
+
*/
|
|
42
|
+
export declare const createVirtualFileRegistry: (root: string, prefix?: string) => VirtualFileRegistry;
|
|
43
|
+
export declare const withVirtualFile: <T>(registry: VirtualFileRegistry, content: string, operation: (lease: VirtualFileLease) => Promise<T>, extension?: ".ts" | ".tsx") => Promise<T>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Project } from "typescript/unstable/async";
|
|
2
|
+
import type { EngineDiagnostic, WorkspaceFileChanges, WorkspaceMetadata, WorkspaceOptions } from "./types";
|
|
3
|
+
export declare class QuartzWorkspace {
|
|
4
|
+
#private;
|
|
5
|
+
readonly root: string;
|
|
6
|
+
readonly configFile: string;
|
|
7
|
+
readonly configFiles: readonly string[];
|
|
8
|
+
private constructor();
|
|
9
|
+
static open(root: string, options?: WorkspaceOptions): Promise<QuartzWorkspace>;
|
|
10
|
+
get metadata(): WorkspaceMetadata;
|
|
11
|
+
diagnostics(configFile?: string): Promise<readonly EngineDiagnostic[]>;
|
|
12
|
+
/** TS-Go client/server timing snapshot when collectTiming was enabled at open. */
|
|
13
|
+
getTimingInfo(): Promise<unknown>;
|
|
14
|
+
resetTimingInfo(): Promise<void>;
|
|
15
|
+
withProject<T>(operation: (project: Project, revision: number) => Promise<T>, configFile?: string): Promise<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Run analysis against a temporary file update without mutating the base
|
|
18
|
+
* snapshot or revision. Concurrent temporary operations are isolated and may
|
|
19
|
+
* proceed in parallel against the same immutable base.
|
|
20
|
+
*/
|
|
21
|
+
withVirtualFile<T>(tsconfigPath: string, filePath: string, content: string, operation: (project: Project, filePath: string) => Promise<T>): Promise<T>;
|
|
22
|
+
refresh(changes?: WorkspaceFileChanges): Promise<WorkspaceMetadata>;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare const openQuartzWorkspace: (root: string, options?: WorkspaceOptions) => Promise<QuartzWorkspace>;
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@skastr0/quartz-engine",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "bun ../../scripts/clean-build-output.ts engine && bun build ./src/index.ts --outdir ./dist --target bun --format esm --external typescript && tsc -p tsconfig.build.json",
|
|
20
|
+
"prepack": "bun run build"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"typescript": "7.1.0-dev.20260723.1"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"description": "Persistent TypeScript 7 native workspace engine for Quartz.",
|
|
27
|
+
"keywords": [
|
|
28
|
+
"quartz",
|
|
29
|
+
"typescript",
|
|
30
|
+
"type-analysis",
|
|
31
|
+
"code-intelligence"
|
|
32
|
+
],
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/skastr0/quartz.git",
|
|
36
|
+
"directory": "packages/engine"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/skastr0/quartz#readme",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/skastr0/quartz/issues"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"bun": ">=1.3.0"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|