@trojanbox-vcp-test/site-edit-engine 0.1.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.
Files changed (174) hide show
  1. package/README.md +85 -0
  2. package/dist/execute-integration/execute-fixture-harness.d.ts +25 -0
  3. package/dist/execute-integration/execute-fixture-harness.js +37 -0
  4. package/dist/index.d.ts +3 -0
  5. package/dist/index.js +2 -0
  6. package/dist/internal/ast/diagnostics/index.d.ts +5 -0
  7. package/dist/internal/ast/diagnostics/index.js +25 -0
  8. package/dist/internal/ast/history/index.d.ts +15 -0
  9. package/dist/internal/ast/history/index.js +62 -0
  10. package/dist/internal/ast/index.d.ts +8 -0
  11. package/dist/internal/ast/index.js +5 -0
  12. package/dist/internal/ast/locators/index.d.ts +1 -0
  13. package/dist/internal/ast/locators/index.js +1 -0
  14. package/dist/internal/ast/locators/resolve-locator.d.ts +16 -0
  15. package/dist/internal/ast/locators/resolve-locator.js +920 -0
  16. package/dist/internal/ast/parser/SourceParser.d.ts +30 -0
  17. package/dist/internal/ast/parser/SourceParser.js +49 -0
  18. package/dist/internal/ast/parser/index.d.ts +21 -0
  19. package/dist/internal/ast/parser/index.js +64 -0
  20. package/dist/internal/ast/primitives/conditional/conditional-primitives.d.ts +18 -0
  21. package/dist/internal/ast/primitives/conditional/conditional-primitives.js +237 -0
  22. package/dist/internal/ast/primitives/conditional/index.d.ts +1 -0
  23. package/dist/internal/ast/primitives/conditional/index.js +1 -0
  24. package/dist/internal/ast/primitives/imports/add-import.d.ts +18 -0
  25. package/dist/internal/ast/primitives/imports/add-import.js +111 -0
  26. package/dist/internal/ast/primitives/imports/index.d.ts +2 -0
  27. package/dist/internal/ast/primitives/imports/index.js +2 -0
  28. package/dist/internal/ast/primitives/imports/remove-import.d.ts +15 -0
  29. package/dist/internal/ast/primitives/imports/remove-import.js +72 -0
  30. package/dist/internal/ast/primitives/index.d.ts +10 -0
  31. package/dist/internal/ast/primitives/index.js +10 -0
  32. package/dist/internal/ast/primitives/jsx/index.d.ts +4 -0
  33. package/dist/internal/ast/primitives/jsx/index.js +4 -0
  34. package/dist/internal/ast/primitives/jsx/insert-child.d.ts +11 -0
  35. package/dist/internal/ast/primitives/jsx/insert-child.js +69 -0
  36. package/dist/internal/ast/primitives/jsx/move-node.d.ts +9 -0
  37. package/dist/internal/ast/primitives/jsx/move-node.js +76 -0
  38. package/dist/internal/ast/primitives/jsx/remove-node.d.ts +7 -0
  39. package/dist/internal/ast/primitives/jsx/remove-node.js +36 -0
  40. package/dist/internal/ast/primitives/jsx/update-text.d.ts +8 -0
  41. package/dist/internal/ast/primitives/jsx/update-text.js +81 -0
  42. package/dist/internal/ast/primitives/next/index.d.ts +1 -0
  43. package/dist/internal/ast/primitives/next/index.js +1 -0
  44. package/dist/internal/ast/primitives/next/next-primitives.d.ts +43 -0
  45. package/dist/internal/ast/primitives/next/next-primitives.js +211 -0
  46. package/dist/internal/ast/primitives/shared.d.ts +60 -0
  47. package/dist/internal/ast/primitives/shared.js +176 -0
  48. package/dist/internal/ast/primitives/style/class-expression.d.ts +23 -0
  49. package/dist/internal/ast/primitives/style/class-expression.js +174 -0
  50. package/dist/internal/ast/primitives/style/index.d.ts +1 -0
  51. package/dist/internal/ast/primitives/style/index.js +1 -0
  52. package/dist/internal/ast/primitives/style/style-primitives.d.ts +49 -0
  53. package/dist/internal/ast/primitives/style/style-primitives.js +555 -0
  54. package/dist/internal/ast/primitives/values/index.d.ts +1 -0
  55. package/dist/internal/ast/primitives/values/index.js +1 -0
  56. package/dist/internal/ast/primitives/values/value-primitives.d.ts +42 -0
  57. package/dist/internal/ast/primitives/values/value-primitives.js +158 -0
  58. package/dist/internal/ast/printer/SourcePrinter.d.ts +21 -0
  59. package/dist/internal/ast/printer/SourcePrinter.js +76 -0
  60. package/dist/internal/ast/printer/index.d.ts +6 -0
  61. package/dist/internal/ast/printer/index.js +126 -0
  62. package/dist/internal/ast/types.d.ts +190 -0
  63. package/dist/internal/ast/types.js +1 -0
  64. package/dist/internal/capability/capability-resolver.d.ts +16 -0
  65. package/dist/internal/capability/capability-resolver.js +127 -0
  66. package/dist/internal/classname-source.d.ts +24 -0
  67. package/dist/internal/classname-source.js +220 -0
  68. package/dist/internal/contracts/IEditEngineRuntime.d.ts +18 -0
  69. package/dist/internal/contracts/IEditEngineRuntime.js +1 -0
  70. package/dist/internal/domain/EditDiagnostic.d.ts +38 -0
  71. package/dist/internal/domain/EditDiagnostic.js +43 -0
  72. package/dist/internal/events/event-bus.d.ts +14 -0
  73. package/dist/internal/events/event-bus.js +21 -0
  74. package/dist/internal/graph/graph-builder.d.ts +12 -0
  75. package/dist/internal/graph/graph-builder.js +1371 -0
  76. package/dist/internal/graph/import-resolver.d.ts +31 -0
  77. package/dist/internal/graph/import-resolver.js +109 -0
  78. package/dist/internal/graph/project-graph-builder.d.ts +32 -0
  79. package/dist/internal/graph/project-graph-builder.js +133 -0
  80. package/dist/internal/graph/types.d.ts +114 -0
  81. package/dist/internal/graph/types.js +6 -0
  82. package/dist/internal/history/undo-redo.d.ts +28 -0
  83. package/dist/internal/history/undo-redo.js +42 -0
  84. package/dist/internal/index.d.ts +2 -0
  85. package/dist/internal/index.js +1 -0
  86. package/dist/internal/planner/planner.d.ts +104 -0
  87. package/dist/internal/planner/planner.js +2533 -0
  88. package/dist/internal/planner/types.d.ts +275 -0
  89. package/dist/internal/planner/types.js +6 -0
  90. package/dist/internal/protocol/boundary.d.ts +10 -0
  91. package/dist/internal/protocol/boundary.js +3 -0
  92. package/dist/internal/protocol/capability.d.ts +47 -0
  93. package/dist/internal/protocol/capability.js +8 -0
  94. package/dist/internal/protocol/error.d.ts +43 -0
  95. package/dist/internal/protocol/error.js +38 -0
  96. package/dist/internal/protocol/event.d.ts +39 -0
  97. package/dist/internal/protocol/event.js +3 -0
  98. package/dist/internal/protocol/identity.d.ts +26 -0
  99. package/dist/internal/protocol/identity.js +30 -0
  100. package/dist/internal/protocol/operation.d.ts +224 -0
  101. package/dist/internal/protocol/operation.js +8 -0
  102. package/dist/internal/protocol/render.d.ts +212 -0
  103. package/dist/internal/protocol/render.js +3 -0
  104. package/dist/internal/protocol.d.ts +9 -0
  105. package/dist/internal/protocol.js +2 -0
  106. package/dist/internal/provenance/binding-graph.d.ts +39 -0
  107. package/dist/internal/provenance/binding-graph.js +184 -0
  108. package/dist/internal/provenance/capability-policy.d.ts +15 -0
  109. package/dist/internal/provenance/capability-policy.js +96 -0
  110. package/dist/internal/provenance/data-source-classifier.d.ts +14 -0
  111. package/dist/internal/provenance/data-source-classifier.js +281 -0
  112. package/dist/internal/provenance/resolve-text-provenance.d.ts +45 -0
  113. package/dist/internal/provenance/resolve-text-provenance.js +3090 -0
  114. package/dist/internal/provenance/types.d.ts +89 -0
  115. package/dist/internal/provenance/types.js +1 -0
  116. package/dist/internal/render/component-semantic.d.ts +11 -0
  117. package/dist/internal/render/component-semantic.js +141 -0
  118. package/dist/internal/render/content-model.d.ts +3 -0
  119. package/dist/internal/render/content-model.js +89 -0
  120. package/dist/internal/render/media-model.d.ts +3 -0
  121. package/dist/internal/render/media-model.js +45 -0
  122. package/dist/internal/render/provenance-types.d.ts +33 -0
  123. package/dist/internal/render/provenance-types.js +1 -0
  124. package/dist/internal/render/render-projection.d.ts +24 -0
  125. package/dist/internal/render/render-projection.js +281 -0
  126. package/dist/internal/render/tailwind-style-model.d.ts +19 -0
  127. package/dist/internal/render/tailwind-style-model.js +1187 -0
  128. package/dist/internal/runtime/EditEngineRuntime.d.ts +25 -0
  129. package/dist/internal/runtime/EditEngineRuntime.js +89 -0
  130. package/dist/internal/runtime/EditEngineRuntimeSnapshot.d.ts +31 -0
  131. package/dist/internal/runtime/EditEngineRuntimeSnapshot.js +15 -0
  132. package/dist/internal/runtime/InternalEditEngine.d.ts +44 -0
  133. package/dist/internal/runtime/InternalEditEngine.js +1391 -0
  134. package/dist/internal/runtime.d.ts +3 -0
  135. package/dist/internal/runtime.js +1 -0
  136. package/dist/internal/topology/topology.d.ts +6 -0
  137. package/dist/internal/topology/topology.js +98 -0
  138. package/dist/internal/topology/types.d.ts +35 -0
  139. package/dist/internal/topology/types.js +5 -0
  140. package/dist/internal/types.d.ts +1 -0
  141. package/dist/internal/types.js +1 -0
  142. package/dist/internal/writeback/in-memory-fs.d.ts +7 -0
  143. package/dist/internal/writeback/in-memory-fs.js +44 -0
  144. package/dist/internal/writeback/types.d.ts +45 -0
  145. package/dist/internal/writeback/types.js +7 -0
  146. package/dist/internal/writeback/writeback-service.d.ts +7 -0
  147. package/dist/internal/writeback/writeback-service.js +568 -0
  148. package/dist/internal-adapter.d.ts +18 -0
  149. package/dist/internal-adapter.js +350 -0
  150. package/dist/next-app-router-fs.d.ts +2 -0
  151. package/dist/next-app-router-fs.js +64 -0
  152. package/dist/next-app-router.d.ts +11 -0
  153. package/dist/next-app-router.js +140 -0
  154. package/dist/preview-runtime.d.ts +394 -0
  155. package/dist/preview-runtime.js +102 -0
  156. package/dist/public-file-system.d.ts +7 -0
  157. package/dist/public-file-system.js +1 -0
  158. package/dist/runtime-sync.d.ts +95 -0
  159. package/dist/runtime-sync.js +321 -0
  160. package/dist/runtime.d.ts +340 -0
  161. package/dist/runtime.js +134 -0
  162. package/dist/site-edit-instrumentation.d.ts +19 -0
  163. package/dist/site-edit-instrumentation.js +322 -0
  164. package/dist/snapshot-file-system.d.ts +19 -0
  165. package/dist/snapshot-file-system.js +49 -0
  166. package/dist/source-watcher.d.ts +20 -0
  167. package/dist/source-watcher.js +150 -0
  168. package/dist/source-writeback-test-harness.d.ts +244 -0
  169. package/dist/source-writeback-test-harness.js +119 -0
  170. package/dist/types.d.ts +68 -0
  171. package/dist/types.js +1 -0
  172. package/dist/webpack-loader.cjs +592 -0
  173. package/dist/webpack-loader.d.ts +27 -0
  174. package/package.json +66 -0
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # `@trojanbox-vcp-test/site-edit-engine`
2
+
3
+ VCP 的源码级 site edit 引擎。它读取 snapshot 或项目文件,构建 render
4
+ document / object detail,并把高层编辑操作规划为 patch plan 或直接执行到预览工作区。
5
+
6
+ ## 环境要求
7
+
8
+ - Node.js `>=24`
9
+
10
+ ## 安装
11
+
12
+ ```bash
13
+ npm install @trojanbox-vcp-test/contracts @trojanbox-vcp-test/site-edit-engine
14
+ ```
15
+
16
+ ## 主入口能力
17
+
18
+ 主入口 `@trojanbox-vcp-test/site-edit-engine` 只暴露稳定 runtime facade:
19
+
20
+ - `createSiteEditEngineRuntime`
21
+ - `SnapshotSiteEditEngineRuntime`
22
+ - `createPreviewSiteEditEngineRuntime`
23
+ - `PreviewFileSystemSiteEditEngineRuntime`
24
+ - 相关 runtime public types
25
+
26
+ ## 子路径
27
+
28
+ - `@trojanbox-vcp-test/site-edit-engine/next-app-router`
29
+ Next App Router 路由扫描与 routeId 解析工具。
30
+ - `@trojanbox-vcp-test/site-edit-engine/source-watcher`
31
+ 预览场景使用的源码监听器。
32
+ - `@trojanbox-vcp-test/site-edit-engine/webpack-loader`
33
+ 仅用于 preview / instrumentation 的 webpack loader。
34
+
35
+ ## Snapshot runtime 示例
36
+
37
+ ```ts
38
+ import { createSiteEditEngineRuntime } from "@trojanbox-vcp-test/site-edit-engine";
39
+
40
+ const runtime = createSiteEditEngineRuntime({
41
+ siteId: "site_123",
42
+ snapshotId: "snapshot_123",
43
+ files: [
44
+ {
45
+ path: "app/page.tsx",
46
+ content: "export default function Page(){return <main>Hello</main>}",
47
+ },
48
+ ],
49
+ routes: [{ routeId: "/", entryFile: "app/page.tsx" }],
50
+ });
51
+
52
+ const document = runtime.getDocument("/");
53
+ runtime.dispose();
54
+ ```
55
+
56
+ ## Preview runtime 示例
57
+
58
+ ```ts
59
+ import { createPreviewSiteEditEngineRuntime } from "@trojanbox-vcp-test/site-edit-engine";
60
+
61
+ const runtime = createPreviewSiteEditEngineRuntime({
62
+ siteId: "site_123",
63
+ snapshotId: "snapshot_123",
64
+ projectRoot: "/tmp/site",
65
+ routes: [{ routeId: "/", entryFile: "app/page.tsx" }],
66
+ });
67
+
68
+ await runtime.setActiveRoute("/");
69
+ runtime.dispose();
70
+ ```
71
+
72
+ ## `webpack-loader` 说明
73
+
74
+ `@trojanbox-vcp-test/site-edit-engine/webpack-loader` 只用于开发态 preview instrumentation,
75
+ 负责给 JSX / TSX 注入 VCP 编辑运行时属性。它不是通用的 Webpack / Next.js 插件平台,
76
+ 也不承诺覆盖 preview instrumentation 之外的构建场景。
77
+
78
+ ## 非目标
79
+
80
+ `@trojanbox-vcp-test/site-edit-engine` 不负责:
81
+
82
+ - 持久化 snapshot 或管理数据库记录
83
+ - 启动或管理 sandbox 生命周期
84
+ - 直接执行生产发布
85
+ - 暴露 `site-edit-bridge` 的 transport / WebSocket server API
@@ -0,0 +1,25 @@
1
+ import type { SiteEditOperationErrorCode, SiteEditOperationParams } from "@trojanbox-vcp-test/contracts";
2
+ type FixtureFile = {
3
+ path: string;
4
+ content: string;
5
+ };
6
+ type ExecuteFixtureTarget = {
7
+ kind: "tag";
8
+ tag: string;
9
+ index?: number;
10
+ } | {
11
+ kind: "key";
12
+ key: string;
13
+ } | {
14
+ kind: "route";
15
+ routeId?: string;
16
+ };
17
+ export declare function expectExecuteFixture(input: {
18
+ files: readonly FixtureFile[];
19
+ routeId?: string;
20
+ target: ExecuteFixtureTarget;
21
+ operation: SiteEditOperationParams;
22
+ expectedFiles?: readonly FixtureFile[];
23
+ expectedErrorCode?: SiteEditOperationErrorCode;
24
+ }): Promise<void>;
25
+ export {};
@@ -0,0 +1,37 @@
1
+ import { expect } from "vitest";
2
+ import { createSourceWritebackHarness } from "../source-writeback-test-harness.js";
3
+ export async function expectExecuteFixture(input) {
4
+ const harness = createSourceWritebackHarness({
5
+ files: [...input.files],
6
+ routeId: input.routeId,
7
+ });
8
+ await harness.setActiveRoute(input.routeId ?? "/");
9
+ const before = new Map(input.files.map((file) => [file.path, harness.getSource(file.path)]));
10
+ const result = await executeByTarget(harness, input.target, input.operation);
11
+ if (input.expectedErrorCode) {
12
+ expect(result).toMatchObject({
13
+ ok: false,
14
+ error: { code: input.expectedErrorCode },
15
+ });
16
+ for (const file of input.files) {
17
+ expect(harness.getSource(file.path)).toBe(before.get(file.path));
18
+ }
19
+ return;
20
+ }
21
+ expect(result).toMatchObject({ ok: true });
22
+ for (const expectedFile of input.expectedFiles ?? []) {
23
+ expect(harness.getSource(expectedFile.path)).toBe(expectedFile.content);
24
+ }
25
+ }
26
+ async function executeByTarget(harness, target, operation) {
27
+ if (target.kind === "route") {
28
+ return harness.executeRouteOperation({
29
+ routeId: target.routeId,
30
+ params: operation,
31
+ });
32
+ }
33
+ const key = target.kind === "key"
34
+ ? target.key
35
+ : harness.findEntryByTag(target.tag, target.index ?? 0).key;
36
+ return harness.executeNodeOperation({ key, params: operation });
37
+ }
@@ -0,0 +1,3 @@
1
+ export { createSiteEditEngineRuntime, SnapshotSiteEditEngineRuntime, } from "./runtime.js";
2
+ export { createPreviewSiteEditEngineRuntime, PreviewFileSystemSiteEditEngineRuntime, } from "./preview-runtime.js";
3
+ export type { PreviewSiteEditEngineRuntime, PreviewSiteEditEngineRuntimeOptions, SiteEditProjectFileSystem, SiteEditEngineRoute, SiteEditEngineRuntime, SiteEditEngineRuntimeOptions, SiteEditPlanOperationResult, SiteEditSnapshotFile, } from "./types.js";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { createSiteEditEngineRuntime, SnapshotSiteEditEngineRuntime, } from "./runtime.js";
2
+ export { createPreviewSiteEditEngineRuntime, PreviewFileSystemSiteEditEngineRuntime, } from "./preview-runtime.js";
@@ -0,0 +1,5 @@
1
+ import type { AstDiagnostic, AstDiagnosticCode, AstLocatorKind, AstPrimitiveResult, ResolveLocatorResult } from "../types.js";
2
+ export declare function createDiagnostic(code: AstDiagnosticCode, message: string, locatorKind?: AstLocatorKind, details?: Record<string, unknown>): AstDiagnostic;
3
+ export declare function primitiveFailure(source: string, code: AstDiagnosticCode, message: string, locatorKind?: AstLocatorKind, details?: Record<string, unknown>): AstPrimitiveResult;
4
+ export declare function locatorFailure(source: string, code: AstDiagnosticCode, message: string, locatorKind?: AstLocatorKind, details?: Record<string, unknown>): ResolveLocatorResult;
5
+ export declare function parseFailure(source: string, message: string, locatorKind?: AstLocatorKind): AstPrimitiveResult;
@@ -0,0 +1,25 @@
1
+ export function createDiagnostic(code, message, locatorKind, details) {
2
+ return {
3
+ code,
4
+ message,
5
+ locatorKind,
6
+ details,
7
+ };
8
+ }
9
+ export function primitiveFailure(source, code, message, locatorKind, details) {
10
+ return {
11
+ ok: false,
12
+ source,
13
+ diagnostic: createDiagnostic(code, message, locatorKind, details),
14
+ };
15
+ }
16
+ export function locatorFailure(source, code, message, locatorKind, details) {
17
+ return {
18
+ ok: false,
19
+ source,
20
+ diagnostic: createDiagnostic(code, message, locatorKind, details),
21
+ };
22
+ }
23
+ export function parseFailure(source, message, locatorKind) {
24
+ return primitiveFailure(source, "parse-failed", message, locatorKind);
25
+ }
@@ -0,0 +1,15 @@
1
+ import type { HistoryEntry, OperationDescription } from "../types.js";
2
+ export type { HistoryEntry, OperationDescription } from "../types.js";
3
+ export interface HistoryPushOptions {
4
+ coalesce?: boolean;
5
+ }
6
+ export interface History {
7
+ readonly length: number;
8
+ canUndo(): boolean;
9
+ canRedo(): boolean;
10
+ push(operation: OperationDescription, options?: HistoryPushOptions): void;
11
+ undo(): HistoryEntry | undefined;
12
+ redo(): HistoryEntry | undefined;
13
+ current(): HistoryEntry | undefined;
14
+ }
15
+ export declare function createHistory(): History;
@@ -0,0 +1,62 @@
1
+ const DEFAULT_COALESCE_WINDOW_MS = 1000;
2
+ export function createHistory() {
3
+ const past = [];
4
+ const future = [];
5
+ return {
6
+ get length() {
7
+ return past.length;
8
+ },
9
+ canUndo() {
10
+ return past.length > 0;
11
+ },
12
+ canRedo() {
13
+ return future.length > 0;
14
+ },
15
+ push(operation, options) {
16
+ const timestamp = Date.now();
17
+ const entry = {
18
+ operation: { ...operation, timestamp },
19
+ timestamp,
20
+ };
21
+ if (options?.coalesce && past.length > 0) {
22
+ const lastEntry = past[past.length - 1];
23
+ if (lastEntry && shouldCoalesce(lastEntry, entry)) {
24
+ past[past.length - 1] = entry;
25
+ return;
26
+ }
27
+ }
28
+ past.push(entry);
29
+ future.length = 0;
30
+ },
31
+ undo() {
32
+ const entry = past.pop();
33
+ if (!entry)
34
+ return undefined;
35
+ future.push(entry);
36
+ return entry;
37
+ },
38
+ redo() {
39
+ const entry = future.pop();
40
+ if (!entry)
41
+ return undefined;
42
+ past.push(entry);
43
+ return entry;
44
+ },
45
+ current() {
46
+ return past[past.length - 1];
47
+ },
48
+ };
49
+ }
50
+ function shouldCoalesce(lastEntry, newEntry) {
51
+ const lastOperation = lastEntry.operation;
52
+ const newOperation = newEntry.operation;
53
+ if (lastOperation.type !== "text-update")
54
+ return false;
55
+ if (newOperation.type !== "text-update")
56
+ return false;
57
+ if (lastOperation.target !== newOperation.target)
58
+ return false;
59
+ if (lastOperation.kind !== newOperation.kind)
60
+ return false;
61
+ return newEntry.timestamp - lastEntry.timestamp <= DEFAULT_COALESCE_WINDOW_MS;
62
+ }
@@ -0,0 +1,8 @@
1
+ export type { AstLocator, AstLocatorKind, JsxNodeLocator, JsxAttributeLocator, ValueLocator, ExpressionLocator, DirectiveLocator, ExportLocator, ValuePathSegment, ValueRootSelector, AstDiagnosticCode, AstDiagnostic, AstPrimitiveResult, LocatorMatch, ResolveLocatorResult, PrimitiveValue, SourceRange, Placement, OperationDescription, HistoryEntry, } from "./types.js";
2
+ export type { History, HistoryPushOptions } from "./history/index.js";
3
+ export { resolveLocator } from "./locators/index.js";
4
+ export { printAst } from "./printer/index.js";
5
+ export * from "./primitives/index.js";
6
+ export { createHistory } from "./history/index.js";
7
+ export { detectParserProfile, parseWithProfile, parseForLocator, parseForMutation, } from "./parser/index.js";
8
+ export type { ParseResult, ParserProfile } from "./parser/index.js";
@@ -0,0 +1,5 @@
1
+ export { resolveLocator } from "./locators/index.js";
2
+ export { printAst } from "./printer/index.js";
3
+ export * from "./primitives/index.js";
4
+ export { createHistory } from "./history/index.js";
5
+ export { detectParserProfile, parseWithProfile, parseForLocator, parseForMutation, } from "./parser/index.js";
@@ -0,0 +1 @@
1
+ export { resolveLocator, resolveLocatorPath, type InternalLocatorMatch, } from "./resolve-locator.js";
@@ -0,0 +1 @@
1
+ export { resolveLocator, resolveLocatorPath, } from "./resolve-locator.js";
@@ -0,0 +1,16 @@
1
+ import { type NodePath } from "@babel/traverse";
2
+ import type * as t from "@babel/types";
3
+ import type { AstDiagnostic, AstLocator, LocatorMatch, ResolveLocatorResult } from "../types.js";
4
+ export interface InternalLocatorMatch extends LocatorMatch {
5
+ path: NodePath<any>;
6
+ }
7
+ type InternalResolveResult = {
8
+ ok: true;
9
+ match: InternalLocatorMatch;
10
+ } | {
11
+ ok: false;
12
+ diagnostic: AstDiagnostic;
13
+ };
14
+ export declare function resolveLocator(source: string, locator: AstLocator): ResolveLocatorResult;
15
+ export declare function resolveLocatorPath(ast: t.File, locator: AstLocator): InternalResolveResult;
16
+ export {};