@trojanbox-vcp-test/site-edit-engine 0.1.0 → 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/dist/index.d.ts +3 -0
- package/dist/index.js +127 -2
- package/dist/internal/protocol/operation.d.ts +2 -0
- package/dist/internal/protocol/render.d.ts +3 -30
- package/dist/internal/protocol.d.ts +1 -1
- package/dist/next-app-router.js +1 -140
- package/dist/preview-runtime.d.ts +249 -303
- package/dist/runtime-sync.d.ts +8 -8
- package/dist/runtime.d.ts +1 -127
- package/dist/site-edit-instrumentation.d.ts +1 -1
- package/dist/source-watcher.js +1 -150
- package/dist/types.d.ts +12 -14
- package/dist/webpack-loader.cjs +50 -588
- package/package.json +2 -2
- package/dist/execute-integration/execute-fixture-harness.d.ts +0 -25
- package/dist/execute-integration/execute-fixture-harness.js +0 -37
- package/dist/internal/ast/diagnostics/index.d.ts +0 -5
- package/dist/internal/ast/diagnostics/index.js +0 -25
- package/dist/internal/ast/history/index.d.ts +0 -15
- package/dist/internal/ast/history/index.js +0 -62
- package/dist/internal/ast/index.d.ts +0 -8
- package/dist/internal/ast/index.js +0 -5
- package/dist/internal/ast/locators/index.d.ts +0 -1
- package/dist/internal/ast/locators/index.js +0 -1
- package/dist/internal/ast/locators/resolve-locator.d.ts +0 -16
- package/dist/internal/ast/locators/resolve-locator.js +0 -920
- package/dist/internal/ast/parser/SourceParser.d.ts +0 -30
- package/dist/internal/ast/parser/SourceParser.js +0 -49
- package/dist/internal/ast/parser/index.d.ts +0 -21
- package/dist/internal/ast/parser/index.js +0 -64
- package/dist/internal/ast/primitives/conditional/conditional-primitives.d.ts +0 -18
- package/dist/internal/ast/primitives/conditional/conditional-primitives.js +0 -237
- package/dist/internal/ast/primitives/conditional/index.d.ts +0 -1
- package/dist/internal/ast/primitives/conditional/index.js +0 -1
- package/dist/internal/ast/primitives/imports/add-import.d.ts +0 -18
- package/dist/internal/ast/primitives/imports/add-import.js +0 -111
- package/dist/internal/ast/primitives/imports/index.d.ts +0 -2
- package/dist/internal/ast/primitives/imports/index.js +0 -2
- package/dist/internal/ast/primitives/imports/remove-import.d.ts +0 -15
- package/dist/internal/ast/primitives/imports/remove-import.js +0 -72
- package/dist/internal/ast/primitives/index.d.ts +0 -10
- package/dist/internal/ast/primitives/index.js +0 -10
- package/dist/internal/ast/primitives/jsx/index.d.ts +0 -4
- package/dist/internal/ast/primitives/jsx/index.js +0 -4
- package/dist/internal/ast/primitives/jsx/insert-child.d.ts +0 -11
- package/dist/internal/ast/primitives/jsx/insert-child.js +0 -69
- package/dist/internal/ast/primitives/jsx/move-node.d.ts +0 -9
- package/dist/internal/ast/primitives/jsx/move-node.js +0 -76
- package/dist/internal/ast/primitives/jsx/remove-node.d.ts +0 -7
- package/dist/internal/ast/primitives/jsx/remove-node.js +0 -36
- package/dist/internal/ast/primitives/jsx/update-text.d.ts +0 -8
- package/dist/internal/ast/primitives/jsx/update-text.js +0 -81
- package/dist/internal/ast/primitives/next/index.d.ts +0 -1
- package/dist/internal/ast/primitives/next/index.js +0 -1
- package/dist/internal/ast/primitives/next/next-primitives.d.ts +0 -43
- package/dist/internal/ast/primitives/next/next-primitives.js +0 -211
- package/dist/internal/ast/primitives/shared.d.ts +0 -60
- package/dist/internal/ast/primitives/shared.js +0 -176
- package/dist/internal/ast/primitives/style/class-expression.d.ts +0 -23
- package/dist/internal/ast/primitives/style/class-expression.js +0 -174
- package/dist/internal/ast/primitives/style/index.d.ts +0 -1
- package/dist/internal/ast/primitives/style/index.js +0 -1
- package/dist/internal/ast/primitives/style/style-primitives.d.ts +0 -49
- package/dist/internal/ast/primitives/style/style-primitives.js +0 -555
- package/dist/internal/ast/primitives/values/index.d.ts +0 -1
- package/dist/internal/ast/primitives/values/index.js +0 -1
- package/dist/internal/ast/primitives/values/value-primitives.d.ts +0 -42
- package/dist/internal/ast/primitives/values/value-primitives.js +0 -158
- package/dist/internal/ast/printer/SourcePrinter.d.ts +0 -21
- package/dist/internal/ast/printer/SourcePrinter.js +0 -76
- package/dist/internal/ast/printer/index.d.ts +0 -6
- package/dist/internal/ast/printer/index.js +0 -126
- package/dist/internal/ast/types.d.ts +0 -190
- package/dist/internal/ast/types.js +0 -1
- package/dist/internal/capability/capability-resolver.d.ts +0 -16
- package/dist/internal/capability/capability-resolver.js +0 -127
- package/dist/internal/classname-source.d.ts +0 -24
- package/dist/internal/classname-source.js +0 -220
- package/dist/internal/contracts/IEditEngineRuntime.d.ts +0 -18
- package/dist/internal/contracts/IEditEngineRuntime.js +0 -1
- package/dist/internal/domain/EditDiagnostic.d.ts +0 -38
- package/dist/internal/domain/EditDiagnostic.js +0 -43
- package/dist/internal/events/event-bus.d.ts +0 -14
- package/dist/internal/events/event-bus.js +0 -21
- package/dist/internal/graph/graph-builder.d.ts +0 -12
- package/dist/internal/graph/graph-builder.js +0 -1371
- package/dist/internal/graph/import-resolver.d.ts +0 -31
- package/dist/internal/graph/import-resolver.js +0 -109
- package/dist/internal/graph/project-graph-builder.d.ts +0 -32
- package/dist/internal/graph/project-graph-builder.js +0 -133
- package/dist/internal/graph/types.d.ts +0 -114
- package/dist/internal/graph/types.js +0 -6
- package/dist/internal/history/undo-redo.d.ts +0 -28
- package/dist/internal/history/undo-redo.js +0 -42
- package/dist/internal/index.d.ts +0 -2
- package/dist/internal/index.js +0 -1
- package/dist/internal/planner/planner.d.ts +0 -104
- package/dist/internal/planner/planner.js +0 -2533
- package/dist/internal/planner/types.d.ts +0 -275
- package/dist/internal/planner/types.js +0 -6
- package/dist/internal/protocol/boundary.js +0 -3
- package/dist/internal/protocol/capability.js +0 -8
- package/dist/internal/protocol/error.js +0 -38
- package/dist/internal/protocol/event.js +0 -3
- package/dist/internal/protocol/identity.js +0 -30
- package/dist/internal/protocol/operation.js +0 -8
- package/dist/internal/protocol/render.js +0 -3
- package/dist/internal/protocol.js +0 -2
- package/dist/internal/provenance/binding-graph.d.ts +0 -39
- package/dist/internal/provenance/binding-graph.js +0 -184
- package/dist/internal/provenance/capability-policy.d.ts +0 -15
- package/dist/internal/provenance/capability-policy.js +0 -96
- package/dist/internal/provenance/data-source-classifier.d.ts +0 -14
- package/dist/internal/provenance/data-source-classifier.js +0 -281
- package/dist/internal/provenance/resolve-text-provenance.d.ts +0 -45
- package/dist/internal/provenance/resolve-text-provenance.js +0 -3090
- package/dist/internal/provenance/types.d.ts +0 -89
- package/dist/internal/provenance/types.js +0 -1
- package/dist/internal/render/component-semantic.d.ts +0 -11
- package/dist/internal/render/component-semantic.js +0 -141
- package/dist/internal/render/content-model.d.ts +0 -3
- package/dist/internal/render/content-model.js +0 -89
- package/dist/internal/render/media-model.d.ts +0 -3
- package/dist/internal/render/media-model.js +0 -45
- package/dist/internal/render/provenance-types.d.ts +0 -33
- package/dist/internal/render/provenance-types.js +0 -1
- package/dist/internal/render/render-projection.d.ts +0 -24
- package/dist/internal/render/render-projection.js +0 -281
- package/dist/internal/render/tailwind-style-model.d.ts +0 -19
- package/dist/internal/render/tailwind-style-model.js +0 -1187
- package/dist/internal/runtime/EditEngineRuntime.d.ts +0 -25
- package/dist/internal/runtime/EditEngineRuntime.js +0 -89
- package/dist/internal/runtime/EditEngineRuntimeSnapshot.d.ts +0 -31
- package/dist/internal/runtime/EditEngineRuntimeSnapshot.js +0 -15
- package/dist/internal/runtime/InternalEditEngine.d.ts +0 -44
- package/dist/internal/runtime/InternalEditEngine.js +0 -1391
- package/dist/internal/runtime.d.ts +0 -3
- package/dist/internal/runtime.js +0 -1
- package/dist/internal/topology/topology.d.ts +0 -6
- package/dist/internal/topology/topology.js +0 -98
- package/dist/internal/topology/types.d.ts +0 -35
- package/dist/internal/topology/types.js +0 -5
- package/dist/internal/types.d.ts +0 -1
- package/dist/internal/types.js +0 -1
- package/dist/internal/writeback/in-memory-fs.d.ts +0 -7
- package/dist/internal/writeback/in-memory-fs.js +0 -44
- package/dist/internal/writeback/types.d.ts +0 -45
- package/dist/internal/writeback/types.js +0 -7
- package/dist/internal/writeback/writeback-service.d.ts +0 -7
- package/dist/internal/writeback/writeback-service.js +0 -568
- package/dist/internal-adapter.d.ts +0 -18
- package/dist/internal-adapter.js +0 -350
- package/dist/next-app-router-fs.js +0 -64
- package/dist/preview-runtime.js +0 -102
- package/dist/public-file-system.js +0 -1
- package/dist/runtime-sync.js +0 -321
- package/dist/runtime.js +0 -134
- package/dist/site-edit-instrumentation.js +0 -322
- package/dist/snapshot-file-system.d.ts +0 -19
- package/dist/snapshot-file-system.js +0 -49
- package/dist/source-writeback-test-harness.d.ts +0 -244
- package/dist/source-writeback-test-harness.js +0 -119
- package/dist/types.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trojanbox-vcp-test/site-edit-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@babel/parser": "^7.29.3",
|
|
55
55
|
"@babel/traverse": "^7.29.0",
|
|
56
56
|
"@babel/types": "^7.29.0",
|
|
57
|
-
"@trojanbox-vcp-test/contracts": "^0.
|
|
57
|
+
"@trojanbox-vcp-test/contracts": "^0.2.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/babel__generator": "^7.27.0",
|
|
@@ -1,25 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
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;
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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";
|
|
@@ -1,5 +0,0 @@
|
|
|
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";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { resolveLocator, resolveLocatorPath, type InternalLocatorMatch, } from "./resolve-locator.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { resolveLocator, resolveLocatorPath, } from "./resolve-locator.js";
|
|
@@ -1,16 +0,0 @@
|
|
|
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 {};
|