@vcp-dev/site-edit-engine 0.10.70 → 0.11.2
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 +2897 -12
- package/dist/index.js +19 -14
- package/dist/internal/protocol/render.d.ts +2 -1
- package/package.json +4 -3
- package/dist/component-i18n-host-compatibility.d.ts +0 -18
- package/dist/history/file-history-store.d.ts +0 -130
- package/dist/history/index.d.ts +0 -2
- package/dist/materialization-style-policy.d.ts +0 -41
- package/dist/page-template-managed-source.d.ts +0 -56
- package/dist/preview-runtime.d.ts +0 -769
- package/dist/public-file-system.d.ts +0 -29
- package/dist/runtime.d.ts +0 -328
- package/dist/source-module.d.ts +0 -24
- package/dist/types.d.ts +0 -99
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SiteEditClassNameSourceStyleContext, SiteEditCompositionContext, SiteEditPageCompositionActionScope, SiteEditPageComposition, SiteEditProperties } from "@vcp-dev/contracts";
|
|
1
|
+
import type { BlockDirectory, SiteEditClassNameSourceStyleContext, SiteEditCompositionContext, SiteEditPageCompositionActionScope, SiteEditPageComposition, SiteEditProperties } from "@vcp-dev/contracts";
|
|
2
2
|
import type { NodeCapabilitySnapshot } from "./capability.js";
|
|
3
3
|
import type { BoundaryKind } from "./boundary.js";
|
|
4
4
|
import type { OperationType } from "./operation.js";
|
|
@@ -18,6 +18,7 @@ export interface RenderDocument {
|
|
|
18
18
|
version: number;
|
|
19
19
|
rootKeys: string[];
|
|
20
20
|
entries: RenderEntry[];
|
|
21
|
+
pageBlocks?: BlockDirectory;
|
|
21
22
|
styleContext?: SiteEditClassNameSourceStyleContext;
|
|
22
23
|
pageComposition: SiteEditPageComposition;
|
|
23
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcp-dev/site-edit-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"node": ">=24.0.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
|
-
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json && node -e \"const fs=require('node:fs'); fs.mkdirSync('dist', { recursive: true }); fs.copyFileSync('src/site-edit-instrumentation-loader.cjs', 'dist/site-edit-instrumentation-loader.cjs'); fs.copyFileSync('src/site-edit-instrumentation-loader.d.cts', 'dist/site-edit-instrumentation-loader.d.cts'); fs.copyFileSync('src/webpack-loader.cjs', 'dist/webpack-loader.cjs'); fs.copyFileSync('src/webpack-loader.d.cts', 'dist/webpack-loader.d.cts')\"",
|
|
54
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json && node scripts/bundle-declarations.ts && node -e \"const fs=require('node:fs'); fs.mkdirSync('dist', { recursive: true }); fs.copyFileSync('src/site-edit-instrumentation-loader.cjs', 'dist/site-edit-instrumentation-loader.cjs'); fs.copyFileSync('src/site-edit-instrumentation-loader.d.cts', 'dist/site-edit-instrumentation-loader.d.cts'); fs.copyFileSync('src/webpack-loader.cjs', 'dist/webpack-loader.cjs'); fs.copyFileSync('src/webpack-loader.d.cts', 'dist/webpack-loader.d.cts')\"",
|
|
55
55
|
"test": "vitest run --root ../.. packages/site-edit-engine/src",
|
|
56
56
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
57
57
|
},
|
|
@@ -60,13 +60,14 @@
|
|
|
60
60
|
"@babel/parser": "^7.29.3",
|
|
61
61
|
"@babel/traverse": "^7.29.0",
|
|
62
62
|
"@babel/types": "^7.29.0",
|
|
63
|
-
"@vcp-dev/contracts": "0.
|
|
63
|
+
"@vcp-dev/contracts": "0.11.2",
|
|
64
64
|
"yaml": "^2.9.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/babel__generator": "^7.27.0",
|
|
68
68
|
"@types/babel__traverse": "^7.28.0",
|
|
69
69
|
"@types/node": "^24.0.0",
|
|
70
|
+
"dts-bundle-generator": "9.5.1",
|
|
70
71
|
"typescript": "^5.8.0",
|
|
71
72
|
"vitest": "^3.2.0"
|
|
72
73
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type ComponentI18nHostCompatibilityResult = {
|
|
2
|
-
ok: true;
|
|
3
|
-
} | {
|
|
4
|
-
ok: false;
|
|
5
|
-
message: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function checkComponentI18nHostCompatibility(input: {
|
|
8
|
-
files: readonly {
|
|
9
|
-
path: string;
|
|
10
|
-
content: string;
|
|
11
|
-
}[];
|
|
12
|
-
exists: (path: string) => Promise<boolean>;
|
|
13
|
-
readFile: (path: string) => Promise<string>;
|
|
14
|
-
/** Working Set preparation only; schema/dependency/provider guards stay on. */
|
|
15
|
-
deferTargetLocale?: boolean;
|
|
16
|
-
/** When supplied, the host must agree with the authoritative site language. */
|
|
17
|
-
targetLocale?: string;
|
|
18
|
-
}): Promise<ComponentI18nHostCompatibilityResult>;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
export type Sha256Digest = `sha256:${string}`;
|
|
2
|
-
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
3
|
-
[key: string]: JsonValue;
|
|
4
|
-
};
|
|
5
|
-
export interface FileHistoryBlobInput {
|
|
6
|
-
readonly name: string;
|
|
7
|
-
readonly data: string | Uint8Array;
|
|
8
|
-
}
|
|
9
|
-
export interface FileHistoryAppendInput {
|
|
10
|
-
readonly kind: string;
|
|
11
|
-
readonly manifest: JsonValue;
|
|
12
|
-
readonly blobs?: ReadonlyArray<FileHistoryBlobInput>;
|
|
13
|
-
}
|
|
14
|
-
export interface FileHistoryBlobRef {
|
|
15
|
-
readonly name: string;
|
|
16
|
-
readonly digest: Sha256Digest;
|
|
17
|
-
readonly sizeBytes: number;
|
|
18
|
-
}
|
|
19
|
-
export interface FileHistoryEntryRecord {
|
|
20
|
-
readonly id: Sha256Digest;
|
|
21
|
-
readonly schemaVersion: 1;
|
|
22
|
-
readonly kind: string;
|
|
23
|
-
readonly manifest: JsonValue;
|
|
24
|
-
readonly blobs: ReadonlyArray<FileHistoryBlobRef>;
|
|
25
|
-
}
|
|
26
|
-
export interface FileHistoryIndexSnapshot {
|
|
27
|
-
readonly schemaVersion: 1;
|
|
28
|
-
readonly digest: Sha256Digest;
|
|
29
|
-
readonly entryIds: ReadonlyArray<Sha256Digest>;
|
|
30
|
-
readonly cursor: number;
|
|
31
|
-
readonly currentId: Sha256Digest | null;
|
|
32
|
-
readonly undoIds: ReadonlyArray<Sha256Digest>;
|
|
33
|
-
readonly redoIds: ReadonlyArray<Sha256Digest>;
|
|
34
|
-
readonly totalBytes: number;
|
|
35
|
-
}
|
|
36
|
-
export interface FileHistoryStageResult {
|
|
37
|
-
readonly stageId: string;
|
|
38
|
-
readonly entryId: Sha256Digest;
|
|
39
|
-
readonly blobIds: ReadonlyArray<Sha256Digest>;
|
|
40
|
-
}
|
|
41
|
-
export interface FileHistoryIndexTransition {
|
|
42
|
-
readonly expectedIndexDigest: Sha256Digest;
|
|
43
|
-
readonly publishedIndexDigest: Sha256Digest;
|
|
44
|
-
readonly publishedCursor: number;
|
|
45
|
-
readonly publishedCurrentId: Sha256Digest | null;
|
|
46
|
-
}
|
|
47
|
-
export interface FileHistoryStoreLimits {
|
|
48
|
-
readonly maxEntries: number;
|
|
49
|
-
readonly maxSessionBytes: number;
|
|
50
|
-
readonly maxEntryBytes: number;
|
|
51
|
-
}
|
|
52
|
-
export interface FileHistoryStoreOptions {
|
|
53
|
-
readonly limits?: Partial<FileHistoryStoreLimits>;
|
|
54
|
-
}
|
|
55
|
-
export interface FileHistoryStageOptions {
|
|
56
|
-
readonly durableManifest?: boolean;
|
|
57
|
-
}
|
|
58
|
-
export interface FileHistoryStatus {
|
|
59
|
-
readonly canUndo: boolean;
|
|
60
|
-
readonly canRedo: boolean;
|
|
61
|
-
readonly undoDepth: number;
|
|
62
|
-
readonly redoDepth: number;
|
|
63
|
-
readonly cursor: number;
|
|
64
|
-
readonly recoveryRequired: boolean;
|
|
65
|
-
}
|
|
66
|
-
export interface FileHistoryUndoRedoResult {
|
|
67
|
-
readonly undoIds: ReadonlyArray<Sha256Digest>;
|
|
68
|
-
readonly redoIds: ReadonlyArray<Sha256Digest>;
|
|
69
|
-
readonly currentId: Sha256Digest | null;
|
|
70
|
-
}
|
|
71
|
-
export interface FileHistoryTransactionJournalFile {
|
|
72
|
-
readonly path: string;
|
|
73
|
-
readonly preDigest: Sha256Digest | null;
|
|
74
|
-
readonly postDigest: Sha256Digest | null;
|
|
75
|
-
}
|
|
76
|
-
export interface FileHistoryTransactionJournal {
|
|
77
|
-
readonly schemaVersion: 2;
|
|
78
|
-
readonly transactionId: string;
|
|
79
|
-
readonly operationId: string;
|
|
80
|
-
readonly phase: "prepared" | "files-written" | "history-published";
|
|
81
|
-
readonly historyTransition: FileHistoryIndexTransition;
|
|
82
|
-
readonly files: ReadonlyArray<FileHistoryTransactionJournalFile>;
|
|
83
|
-
}
|
|
84
|
-
export interface FileHistoryStore {
|
|
85
|
-
readonly rootDir: string;
|
|
86
|
-
readonly recoveryRequired: boolean;
|
|
87
|
-
stageAppend(input: FileHistoryAppendInput, options?: FileHistoryStageOptions): Promise<FileHistoryStageResult>;
|
|
88
|
-
discardStage(stageId: string): Promise<void>;
|
|
89
|
-
previewStagedAppend(entryId: Sha256Digest, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexTransition>;
|
|
90
|
-
previewCursor(cursor: number, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexTransition>;
|
|
91
|
-
publishStagedAppend(entryId: Sha256Digest): Promise<FileHistoryIndexSnapshot>;
|
|
92
|
-
publishStagedAppend(entryId: Sha256Digest, expectedIndexDigest?: Sha256Digest, stageId?: string): Promise<FileHistoryIndexSnapshot>;
|
|
93
|
-
append(input: FileHistoryAppendInput): Promise<FileHistoryIndexSnapshot>;
|
|
94
|
-
readEntry(entryId: Sha256Digest): Promise<FileHistoryEntryRecord>;
|
|
95
|
-
readBlob(blobId: Sha256Digest): Promise<Uint8Array>;
|
|
96
|
-
readIndex(): Promise<FileHistoryIndexSnapshot>;
|
|
97
|
-
readStatus(): Promise<FileHistoryStatus>;
|
|
98
|
-
readUndoRedoIds(): Promise<FileHistoryUndoRedoResult>;
|
|
99
|
-
setCursor(cursor: number, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexSnapshot>;
|
|
100
|
-
markRecoveryRequired(reason: string): Promise<void>;
|
|
101
|
-
clearRecoveryRequired(): Promise<void>;
|
|
102
|
-
readTransactionJournal(): Promise<FileHistoryTransactionJournal | null>;
|
|
103
|
-
writeTransactionJournal(journal: FileHistoryTransactionJournal): Promise<void>;
|
|
104
|
-
clearTransactionJournal(transactionId: string): Promise<void>;
|
|
105
|
-
cleanupTmp(): Promise<void>;
|
|
106
|
-
readDocumentVersion?(): Promise<number>;
|
|
107
|
-
writeDocumentVersion?(version: number): Promise<void>;
|
|
108
|
-
}
|
|
109
|
-
export declare const FILE_HISTORY_DEFAULT_LIMITS: FileHistoryStoreLimits;
|
|
110
|
-
declare const HISTORY_ERROR_CODES: {
|
|
111
|
-
readonly INVALID_ROOT: "INVALID_ROOT";
|
|
112
|
-
readonly INVALID_PATH: "INVALID_PATH";
|
|
113
|
-
readonly INVALID_SCHEMA: "INVALID_SCHEMA";
|
|
114
|
-
readonly INVALID_JSON: "INVALID_JSON";
|
|
115
|
-
readonly INDEX_CORRUPT: "INDEX_CORRUPT";
|
|
116
|
-
readonly ENTRY_CORRUPT: "ENTRY_CORRUPT";
|
|
117
|
-
readonly BLOB_CORRUPT: "BLOB_CORRUPT";
|
|
118
|
-
readonly RECOVERY_PENDING: "RECOVERY_PENDING";
|
|
119
|
-
readonly CAPACITY_EXCEEDED: "CAPACITY_EXCEEDED";
|
|
120
|
-
readonly NOT_FOUND: "NOT_FOUND";
|
|
121
|
-
};
|
|
122
|
-
export type FileHistoryStoreErrorCode = (typeof HISTORY_ERROR_CODES)[keyof typeof HISTORY_ERROR_CODES];
|
|
123
|
-
export declare class FileHistoryStoreError extends Error {
|
|
124
|
-
readonly code: FileHistoryStoreErrorCode;
|
|
125
|
-
constructor(code: FileHistoryStoreErrorCode, message: string, options?: {
|
|
126
|
-
cause?: unknown;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
export declare function openFileHistoryStore(rootDir: string, options?: FileHistoryStoreOptions): Promise<FileHistoryStore>;
|
|
130
|
-
export {};
|
package/dist/history/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { FILE_HISTORY_DEFAULT_LIMITS, FileHistoryStoreError, openFileHistoryStore, } from "./file-history-store.js";
|
|
2
|
-
export type { FileHistoryAppendInput, FileHistoryBlobInput, FileHistoryBlobRef, FileHistoryEntryRecord, FileHistoryIndexSnapshot, FileHistoryIndexTransition, FileHistoryStageResult, FileHistoryStore, FileHistoryStoreErrorCode, FileHistoryStoreLimits, FileHistoryStoreOptions, FileHistoryTransactionJournal, FileHistoryTransactionJournalFile, FileHistoryUndoRedoResult, JsonValue, Sha256Digest, } from "./file-history-store.js";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export type SiteEditColorMixPolicy = "always" | "raw-literal-only";
|
|
2
|
-
export interface SiteEditThemeStyleScanOptions {
|
|
3
|
-
colorMixPolicy: SiteEditColorMixPolicy;
|
|
4
|
-
includeExtendedColorFunctions?: boolean;
|
|
5
|
-
includeRgbBackgroundImage?: boolean;
|
|
6
|
-
rejectAnyRawColorLiteral?: boolean;
|
|
7
|
-
rejectPrivateTokens?: boolean;
|
|
8
|
-
rejectTailwindPalette?: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* 一处硬编码主题色命中的完整坐标。
|
|
12
|
-
*
|
|
13
|
-
* `hardCodedSurfaceHits` 只给去重后的类名,修复方拿到「你用了 bg-white」却不知道
|
|
14
|
-
* 在哪一行——真实事故里模型因此三轮都在改文件里没有违规的那一段,命中原地未动、
|
|
15
|
-
* 三次诊断字字相同,最终 chrome 落确定性回退。这里保留每一处的行号与整行片段,
|
|
16
|
-
* 让诊断能点名到元素。
|
|
17
|
-
*/
|
|
18
|
-
export interface SiteEditThemeSurfaceOccurrence {
|
|
19
|
-
/** 命中的基础类名,例如 `bg-white`(不含变体前缀与透明度后缀)。 */
|
|
20
|
-
token: string;
|
|
21
|
-
/** 变体前缀,例如 `hover:` / `md:hover:`;无前缀时为空串。 */
|
|
22
|
-
variant: string;
|
|
23
|
-
/** 透明度后缀数值(`bg-white/10` ⇒ 10);无后缀时为 null。 */
|
|
24
|
-
alpha: number | null;
|
|
25
|
-
/** 1-based 行号。 */
|
|
26
|
-
line: number;
|
|
27
|
-
/** 该行去掉首尾空白后的片段,过长时截断。 */
|
|
28
|
-
snippet: string;
|
|
29
|
-
}
|
|
30
|
-
export interface SiteEditThemeStyleViolations {
|
|
31
|
-
hardCodedSurfaceHits: string[];
|
|
32
|
-
/**
|
|
33
|
-
* 与 `hardCodedSurfaceHits` 同源、逐处展开的坐标。前者保持去重字符串数组不变,
|
|
34
|
-
* 因为 `workspace-validation` 与 static-prefab 物化都在消费它。
|
|
35
|
-
*/
|
|
36
|
-
hardCodedSurfaceOccurrences: SiteEditThemeSurfaceOccurrence[];
|
|
37
|
-
rawColorHits: string[];
|
|
38
|
-
privateTokenHits: string[];
|
|
39
|
-
}
|
|
40
|
-
export declare const SITE_EDIT_RAW_COLOR_LITERAL_RE: RegExp;
|
|
41
|
-
export declare function scanSiteEditThemeStyleViolations(content: string, options: SiteEditThemeStyleScanOptions): SiteEditThemeStyleViolations;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type SiteEditCompositionContext, type SiteEditCompositionSelector } from "@vcp-dev/contracts";
|
|
2
|
-
import type { SiteEditSnapshotFile } from "./types.js";
|
|
3
|
-
export type PageTemplateAppRoot = "app" | "src/app";
|
|
4
|
-
export type SiteEditFileSystem = ReadonlyMap<string, string>;
|
|
5
|
-
export type SiteEditManagedSourceFiles = SiteEditFileSystem | readonly SiteEditSnapshotFile[];
|
|
6
|
-
export interface ManagedPageTemplatePaths {
|
|
7
|
-
appRoot: PageTemplateAppRoot;
|
|
8
|
-
routeRoot: string;
|
|
9
|
-
templateKey: string;
|
|
10
|
-
templateEntryFile: string;
|
|
11
|
-
}
|
|
12
|
-
export type SiteEditEngineComposition = {
|
|
13
|
-
context: SiteEditCompositionContext;
|
|
14
|
-
entryFile: string;
|
|
15
|
-
};
|
|
16
|
-
export type PageTemplateCompositionSelector = SiteEditCompositionSelector;
|
|
17
|
-
export type ManagedPageTemplateCompositionResolution = SiteEditEngineComposition & {
|
|
18
|
-
mode: "direct" | "candidate";
|
|
19
|
-
effectiveEntryFile: string;
|
|
20
|
-
};
|
|
21
|
-
export type PageTemplateManagedSourceErrorCode = "PAGE_TEMPLATE_MANAGED_SOURCE_INVALID" | "PAGE_TEMPLATE_ROUTE_AMBIGUOUS";
|
|
22
|
-
export interface PageTemplateManagedSourceErrorDetails {
|
|
23
|
-
reason: string;
|
|
24
|
-
routeId?: string;
|
|
25
|
-
path?: string;
|
|
26
|
-
templateId?: string;
|
|
27
|
-
candidates?: readonly string[];
|
|
28
|
-
issues?: readonly string[];
|
|
29
|
-
}
|
|
30
|
-
export declare class PageTemplateManagedSourceError extends Error {
|
|
31
|
-
readonly code: PageTemplateManagedSourceErrorCode;
|
|
32
|
-
readonly details: PageTemplateManagedSourceErrorDetails;
|
|
33
|
-
constructor(code: PageTemplateManagedSourceErrorCode, message: string, details: PageTemplateManagedSourceErrorDetails);
|
|
34
|
-
}
|
|
35
|
-
export declare function encodePageTemplateId(templateId: string): string;
|
|
36
|
-
export declare function decodePageTemplateKey(key: string): string;
|
|
37
|
-
export declare function computeManagedPageTemplatePaths(routeId: string, rawTemplateId: string, appRoot?: PageTemplateAppRoot): ManagedPageTemplatePaths;
|
|
38
|
-
export declare function isManagedPageTemplateSourcePath(path: string): boolean;
|
|
39
|
-
export interface ManagedPageTemplateCandidate {
|
|
40
|
-
routeId: string;
|
|
41
|
-
templateId: string;
|
|
42
|
-
entryFile: string;
|
|
43
|
-
canonicalEntryFile: string;
|
|
44
|
-
appRoot: PageTemplateAppRoot;
|
|
45
|
-
}
|
|
46
|
-
export declare function scanManagedPageTemplateCandidates(input: {
|
|
47
|
-
files: SiteEditManagedSourceFiles;
|
|
48
|
-
}): ManagedPageTemplateCandidate[];
|
|
49
|
-
export declare function scanSiteEditCompositionsFromFiles(input: {
|
|
50
|
-
files: SiteEditManagedSourceFiles;
|
|
51
|
-
}): SiteEditEngineComposition[];
|
|
52
|
-
export declare function resolveManagedPageTemplateComposition(input: {
|
|
53
|
-
selector: PageTemplateCompositionSelector;
|
|
54
|
-
files: SiteEditManagedSourceFiles;
|
|
55
|
-
canonicalEntryFile: string;
|
|
56
|
-
}): ManagedPageTemplateCompositionResolution;
|