@innovatorved/code-lab 0.1.7 → 0.1.9
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/ARCHITECTURE.md +34 -16
- package/README.md +17 -7
- package/dist/code-lab.css +683 -0
- package/dist/code-lab.d.ts +271 -1
- package/dist/code-lab.esm.js +3326 -193
- package/dist/code-lab.js +3286 -191
- package/dist/csp.d.ts +86 -0
- package/dist/diagnostics.d.ts +43 -0
- package/dist/extensions/guided-lab.esm.js +63 -0
- package/dist/extensions/guided-lab.js +63 -0
- package/dist/html.d.ts +24 -0
- package/dist/index.d.ts +9 -1
- package/dist/logger.d.ts +60 -0
- package/dist/preview-sw.js +604 -46
- package/dist/runtime.esm.js +169 -31
- package/dist/runtime.js +169 -31
- package/dist/schemas.d.ts +357 -25
- package/dist/schemas.esm.js +70 -0
- package/dist/schemas.js +70 -0
- package/dist/scm.d.ts +77 -0
- package/dist/search.d.ts +75 -0
- package/dist/shell.esm.js +333 -48
- package/dist/shell.js +333 -48
- package/dist/storage.d.ts +57 -0
- package/dist/terminal.esm.js +122 -7
- package/dist/terminal.js +122 -7
- package/dist/zip.d.ts +42 -0
- package/package.json +3 -1
- package/src/code-lab.css +683 -0
- package/src/csp.ts +588 -0
- package/src/diagnostics.ts +116 -0
- package/src/html.ts +88 -0
- package/src/index.ts +39 -1
- package/src/logger.ts +139 -0
- package/src/preview-sw.js +84 -46
- package/src/runtime.ts +67 -30
- package/src/schemas.ts +91 -1
- package/src/scm.ts +268 -0
- package/src/search.ts +389 -0
- package/src/shell.ts +231 -47
- package/src/storage.ts +377 -0
- package/src/terminal.ts +20 -6
- package/src/workbench.ts +1061 -107
- package/src/zip.ts +326 -0
package/dist/schemas.esm.js
CHANGED
|
@@ -4181,14 +4181,84 @@ var WorkbenchOptionsSchema = external_exports.object({
|
|
|
4181
4181
|
onStepComplete: external_exports.function().args(external_exports.any(), external_exports.number()).returns(external_exports.void()).optional(),
|
|
4182
4182
|
onLabComplete: external_exports.function().args(external_exports.string()).returns(external_exports.void()).optional()
|
|
4183
4183
|
});
|
|
4184
|
+
var SearchOptionsSchema = external_exports.object({
|
|
4185
|
+
query: external_exports.string().default(""),
|
|
4186
|
+
caseSensitive: external_exports.boolean().optional().default(false),
|
|
4187
|
+
wholeWord: external_exports.boolean().optional().default(false),
|
|
4188
|
+
regex: external_exports.boolean().optional().default(false),
|
|
4189
|
+
isRegex: external_exports.boolean().optional().default(false),
|
|
4190
|
+
include: external_exports.string().optional(),
|
|
4191
|
+
includeGlob: external_exports.string().optional(),
|
|
4192
|
+
includePattern: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional(),
|
|
4193
|
+
exclude: external_exports.string().optional(),
|
|
4194
|
+
excludeGlob: external_exports.string().optional(),
|
|
4195
|
+
excludePattern: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional(),
|
|
4196
|
+
maxMatches: external_exports.number().int().positive().optional(),
|
|
4197
|
+
maxMatchesPerFile: external_exports.number().int().positive().optional()
|
|
4198
|
+
});
|
|
4199
|
+
var DiagnosticSeveritySchema = external_exports.enum(["error", "warning", "info", "hint"]);
|
|
4200
|
+
var DiagnosticItemSchema = external_exports.object({
|
|
4201
|
+
id: external_exports.string(),
|
|
4202
|
+
file: external_exports.string(),
|
|
4203
|
+
line: external_exports.number().int(),
|
|
4204
|
+
col: external_exports.number().int().optional(),
|
|
4205
|
+
column: external_exports.number().int().optional(),
|
|
4206
|
+
endLine: external_exports.number().int().optional(),
|
|
4207
|
+
endCol: external_exports.number().int().optional(),
|
|
4208
|
+
endColumn: external_exports.number().int().optional(),
|
|
4209
|
+
message: external_exports.string(),
|
|
4210
|
+
severity: DiagnosticSeveritySchema,
|
|
4211
|
+
source: external_exports.string().optional(),
|
|
4212
|
+
code: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
|
|
4213
|
+
tags: external_exports.array(external_exports.string()).optional()
|
|
4214
|
+
});
|
|
4215
|
+
var StoredProjectSchema = external_exports.object({
|
|
4216
|
+
id: external_exports.string(),
|
|
4217
|
+
name: external_exports.string(),
|
|
4218
|
+
files: external_exports.record(external_exports.string()),
|
|
4219
|
+
updatedAt: external_exports.number(),
|
|
4220
|
+
createdAt: external_exports.number().optional(),
|
|
4221
|
+
entry: external_exports.string().optional(),
|
|
4222
|
+
testEntry: external_exports.string().optional(),
|
|
4223
|
+
version: external_exports.number().optional()
|
|
4224
|
+
});
|
|
4225
|
+
var GitFileChangeTypeSchema = external_exports.enum(["modified", "added", "deleted", "untracked"]);
|
|
4226
|
+
var GitFileStatusSchema = external_exports.object({
|
|
4227
|
+
path: external_exports.string(),
|
|
4228
|
+
status: GitFileChangeTypeSchema,
|
|
4229
|
+
staged: external_exports.boolean(),
|
|
4230
|
+
oldContent: external_exports.string().optional(),
|
|
4231
|
+
newContent: external_exports.string().optional()
|
|
4232
|
+
});
|
|
4233
|
+
var GitStateSummarySchema = external_exports.object({
|
|
4234
|
+
branch: external_exports.string().default("main"),
|
|
4235
|
+
headCommit: external_exports.string().optional(),
|
|
4236
|
+
branches: external_exports.array(external_exports.string()).default(["main"]),
|
|
4237
|
+
staged: external_exports.array(GitFileStatusSchema).default([]),
|
|
4238
|
+
unstaged: external_exports.array(GitFileStatusSchema).default([]),
|
|
4239
|
+
untracked: external_exports.array(GitFileStatusSchema).default([]),
|
|
4240
|
+
modified: external_exports.array(GitFileStatusSchema).optional(),
|
|
4241
|
+
deleted: external_exports.array(GitFileStatusSchema).optional(),
|
|
4242
|
+
hasChanges: external_exports.boolean().default(false),
|
|
4243
|
+
isClean: external_exports.boolean().default(true),
|
|
4244
|
+
ahead: external_exports.number().int().default(0),
|
|
4245
|
+
behind: external_exports.number().int().default(0)
|
|
4246
|
+
});
|
|
4184
4247
|
export {
|
|
4185
4248
|
CloneProgressEventSchema,
|
|
4186
4249
|
CloneProgressPhaseSchema,
|
|
4250
|
+
DiagnosticItemSchema,
|
|
4251
|
+
DiagnosticSeveritySchema,
|
|
4252
|
+
GitFileChangeTypeSchema,
|
|
4253
|
+
GitFileStatusSchema,
|
|
4187
4254
|
GitHubCloneOptionsSchema,
|
|
4255
|
+
GitStateSummarySchema,
|
|
4188
4256
|
GuidedLabExtensionOptionsSchema,
|
|
4189
4257
|
GuidedStepSchema,
|
|
4190
4258
|
LanguageBundleSchema,
|
|
4191
4259
|
RuntimeExecuteOptionsSchema,
|
|
4260
|
+
SearchOptionsSchema,
|
|
4261
|
+
StoredProjectSchema,
|
|
4192
4262
|
WorkbenchOptionsSchema,
|
|
4193
4263
|
WorkspaceSnapshotSchema
|
|
4194
4264
|
};
|
package/dist/schemas.js
CHANGED
|
@@ -21,11 +21,18 @@ var schemas_exports = {};
|
|
|
21
21
|
__export(schemas_exports, {
|
|
22
22
|
CloneProgressEventSchema: () => CloneProgressEventSchema,
|
|
23
23
|
CloneProgressPhaseSchema: () => CloneProgressPhaseSchema,
|
|
24
|
+
DiagnosticItemSchema: () => DiagnosticItemSchema,
|
|
25
|
+
DiagnosticSeveritySchema: () => DiagnosticSeveritySchema,
|
|
26
|
+
GitFileChangeTypeSchema: () => GitFileChangeTypeSchema,
|
|
27
|
+
GitFileStatusSchema: () => GitFileStatusSchema,
|
|
24
28
|
GitHubCloneOptionsSchema: () => GitHubCloneOptionsSchema,
|
|
29
|
+
GitStateSummarySchema: () => GitStateSummarySchema,
|
|
25
30
|
GuidedLabExtensionOptionsSchema: () => GuidedLabExtensionOptionsSchema,
|
|
26
31
|
GuidedStepSchema: () => GuidedStepSchema,
|
|
27
32
|
LanguageBundleSchema: () => LanguageBundleSchema,
|
|
28
33
|
RuntimeExecuteOptionsSchema: () => RuntimeExecuteOptionsSchema,
|
|
34
|
+
SearchOptionsSchema: () => SearchOptionsSchema,
|
|
35
|
+
StoredProjectSchema: () => StoredProjectSchema,
|
|
29
36
|
WorkbenchOptionsSchema: () => WorkbenchOptionsSchema,
|
|
30
37
|
WorkspaceSnapshotSchema: () => WorkspaceSnapshotSchema
|
|
31
38
|
});
|
|
@@ -4208,3 +4215,66 @@ var WorkbenchOptionsSchema = external_exports.object({
|
|
|
4208
4215
|
onStepComplete: external_exports.function().args(external_exports.any(), external_exports.number()).returns(external_exports.void()).optional(),
|
|
4209
4216
|
onLabComplete: external_exports.function().args(external_exports.string()).returns(external_exports.void()).optional()
|
|
4210
4217
|
});
|
|
4218
|
+
var SearchOptionsSchema = external_exports.object({
|
|
4219
|
+
query: external_exports.string().default(""),
|
|
4220
|
+
caseSensitive: external_exports.boolean().optional().default(false),
|
|
4221
|
+
wholeWord: external_exports.boolean().optional().default(false),
|
|
4222
|
+
regex: external_exports.boolean().optional().default(false),
|
|
4223
|
+
isRegex: external_exports.boolean().optional().default(false),
|
|
4224
|
+
include: external_exports.string().optional(),
|
|
4225
|
+
includeGlob: external_exports.string().optional(),
|
|
4226
|
+
includePattern: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional(),
|
|
4227
|
+
exclude: external_exports.string().optional(),
|
|
4228
|
+
excludeGlob: external_exports.string().optional(),
|
|
4229
|
+
excludePattern: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional(),
|
|
4230
|
+
maxMatches: external_exports.number().int().positive().optional(),
|
|
4231
|
+
maxMatchesPerFile: external_exports.number().int().positive().optional()
|
|
4232
|
+
});
|
|
4233
|
+
var DiagnosticSeveritySchema = external_exports.enum(["error", "warning", "info", "hint"]);
|
|
4234
|
+
var DiagnosticItemSchema = external_exports.object({
|
|
4235
|
+
id: external_exports.string(),
|
|
4236
|
+
file: external_exports.string(),
|
|
4237
|
+
line: external_exports.number().int(),
|
|
4238
|
+
col: external_exports.number().int().optional(),
|
|
4239
|
+
column: external_exports.number().int().optional(),
|
|
4240
|
+
endLine: external_exports.number().int().optional(),
|
|
4241
|
+
endCol: external_exports.number().int().optional(),
|
|
4242
|
+
endColumn: external_exports.number().int().optional(),
|
|
4243
|
+
message: external_exports.string(),
|
|
4244
|
+
severity: DiagnosticSeveritySchema,
|
|
4245
|
+
source: external_exports.string().optional(),
|
|
4246
|
+
code: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
|
|
4247
|
+
tags: external_exports.array(external_exports.string()).optional()
|
|
4248
|
+
});
|
|
4249
|
+
var StoredProjectSchema = external_exports.object({
|
|
4250
|
+
id: external_exports.string(),
|
|
4251
|
+
name: external_exports.string(),
|
|
4252
|
+
files: external_exports.record(external_exports.string()),
|
|
4253
|
+
updatedAt: external_exports.number(),
|
|
4254
|
+
createdAt: external_exports.number().optional(),
|
|
4255
|
+
entry: external_exports.string().optional(),
|
|
4256
|
+
testEntry: external_exports.string().optional(),
|
|
4257
|
+
version: external_exports.number().optional()
|
|
4258
|
+
});
|
|
4259
|
+
var GitFileChangeTypeSchema = external_exports.enum(["modified", "added", "deleted", "untracked"]);
|
|
4260
|
+
var GitFileStatusSchema = external_exports.object({
|
|
4261
|
+
path: external_exports.string(),
|
|
4262
|
+
status: GitFileChangeTypeSchema,
|
|
4263
|
+
staged: external_exports.boolean(),
|
|
4264
|
+
oldContent: external_exports.string().optional(),
|
|
4265
|
+
newContent: external_exports.string().optional()
|
|
4266
|
+
});
|
|
4267
|
+
var GitStateSummarySchema = external_exports.object({
|
|
4268
|
+
branch: external_exports.string().default("main"),
|
|
4269
|
+
headCommit: external_exports.string().optional(),
|
|
4270
|
+
branches: external_exports.array(external_exports.string()).default(["main"]),
|
|
4271
|
+
staged: external_exports.array(GitFileStatusSchema).default([]),
|
|
4272
|
+
unstaged: external_exports.array(GitFileStatusSchema).default([]),
|
|
4273
|
+
untracked: external_exports.array(GitFileStatusSchema).default([]),
|
|
4274
|
+
modified: external_exports.array(GitFileStatusSchema).optional(),
|
|
4275
|
+
deleted: external_exports.array(GitFileStatusSchema).optional(),
|
|
4276
|
+
hasChanges: external_exports.boolean().default(false),
|
|
4277
|
+
isClean: external_exports.boolean().default(true),
|
|
4278
|
+
ahead: external_exports.number().int().default(0),
|
|
4279
|
+
behind: external_exports.number().int().default(0)
|
|
4280
|
+
});
|
package/dist/scm.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @innovatorved/code-lab — Interactive Git Source Control (SCM) Engine
|
|
3
|
+
* ============================================================================
|
|
4
|
+
* Pure TypeScript in-browser Git status, staging, unstaging, and commit engine
|
|
5
|
+
* backed by workspace VFS state. Powers both the interactive Source Control UI
|
|
6
|
+
* and shell/CLI Git operations.
|
|
7
|
+
*
|
|
8
|
+
* Strict leaf module: fully typed, zero explicit any, zero empty catches.
|
|
9
|
+
*/
|
|
10
|
+
export type GitFileChangeType = 'modified' | 'added' | 'deleted' | 'untracked';
|
|
11
|
+
export interface GitFileStatus {
|
|
12
|
+
path: string;
|
|
13
|
+
status: GitFileChangeType;
|
|
14
|
+
staged: boolean;
|
|
15
|
+
oldContent?: string;
|
|
16
|
+
newContent?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GitCommitRecord {
|
|
19
|
+
hash: string;
|
|
20
|
+
message: string;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
author?: string;
|
|
23
|
+
files: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
export interface GitState {
|
|
26
|
+
branch: string;
|
|
27
|
+
branches?: string[];
|
|
28
|
+
headCommit: string;
|
|
29
|
+
headFiles: Record<string, string>;
|
|
30
|
+
staged: Map<string, string | null>;
|
|
31
|
+
commits: GitCommitRecord[];
|
|
32
|
+
}
|
|
33
|
+
export interface GitStatusResult {
|
|
34
|
+
branch: string;
|
|
35
|
+
headCommit: string;
|
|
36
|
+
untracked: GitFileStatus[];
|
|
37
|
+
modified: GitFileStatus[];
|
|
38
|
+
deleted: GitFileStatus[];
|
|
39
|
+
staged: GitFileStatus[];
|
|
40
|
+
unstaged: GitFileStatus[];
|
|
41
|
+
hasChanges: boolean;
|
|
42
|
+
isClean: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Computes a deterministic 7-character short hash for a commit payload.
|
|
46
|
+
*/
|
|
47
|
+
export declare function computeShortCommitHash(input: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Initializes a fresh in-memory Git repository state from initial VFS files.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createGitState(initialFiles?: Record<string, string>, branch?: string): GitState;
|
|
52
|
+
/**
|
|
53
|
+
* Computes working-tree and staging-area Git status against `gitState`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function computeGitStatus(vfsFiles: Record<string, string>, _repoRoot?: string, gitState?: GitState): GitStatusResult;
|
|
56
|
+
/**
|
|
57
|
+
* Stages a file addition, modification, or deletion (`currentContent === null`).
|
|
58
|
+
*/
|
|
59
|
+
export declare function stageFile(gitState: GitState, relativePath: string, currentContent: string | null): void;
|
|
60
|
+
/**
|
|
61
|
+
* Removes a file from the staging index.
|
|
62
|
+
*/
|
|
63
|
+
export declare function unstageFile(gitState: GitState, relativePath: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Commits all staged changes to `gitState`, advancing `headCommit` and `headFiles`,
|
|
66
|
+
* and clearing the staging area. Throws if message is empty or staging area is empty.
|
|
67
|
+
*/
|
|
68
|
+
export declare function commitChanges(gitState: GitState, message: string): string;
|
|
69
|
+
declare const _default: {
|
|
70
|
+
createGitState: typeof createGitState;
|
|
71
|
+
computeGitStatus: typeof computeGitStatus;
|
|
72
|
+
stageFile: typeof stageFile;
|
|
73
|
+
unstageFile: typeof unstageFile;
|
|
74
|
+
commitChanges: typeof commitChanges;
|
|
75
|
+
computeShortCommitHash: typeof computeShortCommitHash;
|
|
76
|
+
};
|
|
77
|
+
export default _default;
|
package/dist/search.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @innovatorved/code-lab — High-Performance Cross-File Search & Replace Core
|
|
3
|
+
* ============================================================================
|
|
4
|
+
* Pure TypeScript implementation of workspace-wide text search and atomic multi-file
|
|
5
|
+
* replacements. Supports regex, whole-word, case-sensitive matching, glob filtering,
|
|
6
|
+
* line/column coordinate extraction, and match highlight snippets.
|
|
7
|
+
*
|
|
8
|
+
* Strict leaf module: fully typed, zero explicit any, zero empty catches.
|
|
9
|
+
*/
|
|
10
|
+
export interface SearchOptions {
|
|
11
|
+
query?: string;
|
|
12
|
+
caseSensitive?: boolean;
|
|
13
|
+
wholeWord?: boolean;
|
|
14
|
+
regex?: boolean;
|
|
15
|
+
isRegex?: boolean;
|
|
16
|
+
include?: string;
|
|
17
|
+
includeGlob?: string;
|
|
18
|
+
includePattern?: string | string[];
|
|
19
|
+
exclude?: string;
|
|
20
|
+
excludeGlob?: string;
|
|
21
|
+
excludePattern?: string | string[];
|
|
22
|
+
maxMatches?: number;
|
|
23
|
+
maxMatchesPerFile?: number;
|
|
24
|
+
targetFiles?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface SearchMatchItem {
|
|
27
|
+
line: number;
|
|
28
|
+
col: number;
|
|
29
|
+
column?: number;
|
|
30
|
+
length: number;
|
|
31
|
+
matchText?: string;
|
|
32
|
+
lineText: string;
|
|
33
|
+
beforeSnippet?: string;
|
|
34
|
+
afterSnippet?: string;
|
|
35
|
+
matchIndex?: number;
|
|
36
|
+
matchEndIndex?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SearchMatchGroup {
|
|
39
|
+
file: string;
|
|
40
|
+
matches: SearchMatchItem[];
|
|
41
|
+
}
|
|
42
|
+
export interface SearchResult extends Array<SearchMatchGroup> {
|
|
43
|
+
matches: SearchMatchGroup[];
|
|
44
|
+
totalMatches: number;
|
|
45
|
+
fileCount: number;
|
|
46
|
+
filesCount: number;
|
|
47
|
+
query: string;
|
|
48
|
+
durationMs?: number;
|
|
49
|
+
error?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ReplaceResult {
|
|
52
|
+
updatedFiles: Record<string, string>;
|
|
53
|
+
replacedCount: number;
|
|
54
|
+
filesAffected: string[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Escapes regex special characters in a literal string.
|
|
58
|
+
*/
|
|
59
|
+
export declare function escapeRegex(text: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Normalizes a virtual workspace path (POSIX forward-slashes, no leading ./ or /).
|
|
62
|
+
*/
|
|
63
|
+
export declare function normalizeSearchPath(filePath: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Matches a file path against a glob or literal substring filter.
|
|
66
|
+
*/
|
|
67
|
+
export declare function matchesGlob(filePath: string, pattern: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Searches across a map of virtual files for matching text or regex patterns.
|
|
70
|
+
*/
|
|
71
|
+
export declare function searchInFiles(files: Record<string, string>, queryOrOptions: string | SearchOptions, optionsOrUndefined?: SearchOptions): SearchResult;
|
|
72
|
+
/**
|
|
73
|
+
* Replaces occurrences of a query pattern across virtual workspace files.
|
|
74
|
+
*/
|
|
75
|
+
export declare function replaceInFiles(files: Record<string, string>, arg2: string | SearchOptions, arg3: string, arg4?: SearchOptions | string[]): ReplaceResult;
|