@innovatorved/code-lab 0.1.12 → 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/ARCHITECTURE.md +8 -8
- package/CHANGELOG.md +107 -0
- package/README.md +48 -8
- package/dist/code-lab.css +165 -0
- package/dist/code-lab.d.ts +19 -7
- package/dist/code-lab.esm.js +29988 -17401
- package/dist/code-lab.js +22940 -10357
- package/dist/extensions/cpp.d.ts +119 -0
- package/dist/extensions/cpp.esm.js +5193 -0
- package/dist/extensions/cpp.js +5212 -0
- package/dist/extensions/guided-lab.esm.js +48 -6
- package/dist/extensions/guided-lab.js +49 -6
- package/dist/extensions/javascript.d.ts +24 -0
- package/dist/extensions/javascript.esm.js +36 -0
- package/dist/extensions/javascript.js +59 -0
- package/dist/extensions/typescript.d.ts +36 -0
- package/dist/extensions/typescript.esm.js +55 -0
- package/dist/extensions/typescript.js +78 -0
- package/dist/index.d.ts +5 -2
- package/dist/preview-sw.js +1 -1
- package/dist/runtime.d.ts +7 -0
- package/dist/runtime.esm.js +4001 -2563
- package/dist/runtime.js +3993 -2563
- package/dist/schemas.d.ts +122 -23
- package/dist/schemas.esm.js +43 -6
- package/dist/schemas.js +43 -6
- package/dist/shell.esm.js +982 -4
- package/dist/shell.js +982 -4
- package/dist/terminal.esm.js +1 -1
- package/dist/terminal.js +1 -1
- package/package.json +27 -3
- package/src/code-lab.css +165 -0
- package/src/extensions/cpp.ts +1081 -0
- package/src/extensions/guided-lab.ts +10 -0
- package/src/extensions/javascript.ts +54 -0
- package/src/extensions/typescript.ts +85 -0
- package/src/index.ts +33 -2
- package/src/runtime.ts +3995 -2562
- package/src/schemas.ts +49 -7
- package/src/shell.ts +981 -3
- package/src/workbench.ts +535 -66
package/src/schemas.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Zod Schemas and Inferred TypeScript Types for code-lab v0.
|
|
4
|
+
* Zod Schemas and Inferred TypeScript Types for code-lab v0.2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// ── 1. Guided Step ──────────────────────────────────────────────────────────
|
|
@@ -22,8 +22,11 @@ export type GuidedStep = z.infer<typeof GuidedStepSchema>;
|
|
|
22
22
|
|
|
23
23
|
// ── 2. Language Bundle ──────────────────────────────────────────────────────
|
|
24
24
|
|
|
25
|
+
export const LanguageIdSchema = z.enum(['js', 'ts', 'cpp']);
|
|
26
|
+
export type LanguageId = z.infer<typeof LanguageIdSchema>;
|
|
27
|
+
|
|
25
28
|
export const LanguageBundleSchema = z.object({
|
|
26
|
-
language:
|
|
29
|
+
language: LanguageIdSchema.default('js'),
|
|
27
30
|
files: z.record(z.string()).default({}),
|
|
28
31
|
starterFiles: z.record(z.string()).optional(),
|
|
29
32
|
solutionFiles: z.record(z.string()).optional(),
|
|
@@ -39,13 +42,16 @@ export const GuidedLabExtensionOptionsSchema = z.object({
|
|
|
39
42
|
steps: z.array(GuidedStepSchema).default([]),
|
|
40
43
|
stepIndex: z.number().int().nonnegative().default(0),
|
|
41
44
|
mode: z.enum(['guided', 'sandbox']).default('guided'),
|
|
42
|
-
language:
|
|
43
|
-
lang:
|
|
45
|
+
language: LanguageIdSchema.optional(),
|
|
46
|
+
lang: LanguageIdSchema.optional(),
|
|
44
47
|
starterFiles: z.record(z.string()).optional(),
|
|
45
48
|
solutionFiles: z.record(z.string()).optional(),
|
|
46
49
|
tsStarterFiles: z.record(z.string()).optional(),
|
|
47
50
|
tsSolutionFiles: z.record(z.string()).optional(),
|
|
48
51
|
tsFiles: z.record(z.string()).optional(),
|
|
52
|
+
cppStarterFiles: z.record(z.string()).optional(),
|
|
53
|
+
cppSolutionFiles: z.record(z.string()).optional(),
|
|
54
|
+
cppFiles: z.record(z.string()).optional(),
|
|
49
55
|
summary: z.string().optional(),
|
|
50
56
|
onStepComplete: z.function().args(GuidedStepSchema, z.number()).returns(z.void()).optional(),
|
|
51
57
|
onLabComplete: z.function().args(z.string()).returns(z.void()).optional()
|
|
@@ -53,6 +59,39 @@ export const GuidedLabExtensionOptionsSchema = z.object({
|
|
|
53
59
|
|
|
54
60
|
export type GuidedLabExtensionOptions = z.infer<typeof GuidedLabExtensionOptionsSchema>;
|
|
55
61
|
|
|
62
|
+
export const CppToolchainProgressSchema = z.object({
|
|
63
|
+
stage: z.enum(['downloading', 'caching', 'extracting', 'compiling', 'linking', 'ready']),
|
|
64
|
+
loadedBytes: z.number().optional(),
|
|
65
|
+
totalBytes: z.number().optional(),
|
|
66
|
+
percent: z.number().optional(),
|
|
67
|
+
message: z.string().optional()
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export type CppToolchainProgress = z.infer<typeof CppToolchainProgressSchema>;
|
|
71
|
+
|
|
72
|
+
export const CppExtensionOptionsSchema = z.object({
|
|
73
|
+
toolchainUrl: z.string().optional(),
|
|
74
|
+
clangWasmUrl: z.string().optional(),
|
|
75
|
+
clangUrl: z.string().optional(),
|
|
76
|
+
lldWasmUrl: z.string().optional(),
|
|
77
|
+
lldUrl: z.string().optional(),
|
|
78
|
+
sysrootTarUrl: z.string().optional(),
|
|
79
|
+
sysrootUrl: z.string().optional(),
|
|
80
|
+
cacheInIndexedDB: z.boolean().default(true),
|
|
81
|
+
preload: z.boolean().default(false),
|
|
82
|
+
std: z.enum(['c++17', 'c++20', 'c++23']).default('c++20'),
|
|
83
|
+
optLevel: z.enum(['-O0', '-O1', '-O2', '-O3']).default('-O2'),
|
|
84
|
+
flags: z.array(z.string()).default(['-O2', '-Wall', '-Wextra']),
|
|
85
|
+
headers: z.record(z.string()).optional(),
|
|
86
|
+
extraHeaders: z.record(z.string()).optional(),
|
|
87
|
+
files: z.record(z.string()).optional(),
|
|
88
|
+
starterFiles: z.record(z.string()).optional(),
|
|
89
|
+
solutionFiles: z.record(z.string()).optional(),
|
|
90
|
+
onProgress: z.function().args(z.any()).returns(z.void()).optional()
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export type CppExtensionOptions = z.infer<typeof CppExtensionOptionsSchema>;
|
|
94
|
+
|
|
56
95
|
// ── 4. GitHub Clone Options & Progress ──────────────────────────────────────
|
|
57
96
|
|
|
58
97
|
export const CloneProgressPhaseSchema = z.enum([
|
|
@@ -127,7 +166,7 @@ export const WorkspaceSnapshotSchema = z.object({
|
|
|
127
166
|
openTabs: z.array(z.string()).default([]),
|
|
128
167
|
activeFile: z.string().nullable().optional(),
|
|
129
168
|
mode: z.enum(['guided', 'sandbox']).optional(),
|
|
130
|
-
lang:
|
|
169
|
+
lang: LanguageIdSchema.optional(),
|
|
131
170
|
labId: z.string().optional()
|
|
132
171
|
});
|
|
133
172
|
|
|
@@ -168,10 +207,13 @@ export const WorkbenchOptionsSchema = z.object({
|
|
|
168
207
|
tsFiles: z.record(z.string()).optional(),
|
|
169
208
|
tsStarterFiles: z.record(z.string()).optional(),
|
|
170
209
|
tsSolutionFiles: z.record(z.string()).optional(),
|
|
210
|
+
cppFiles: z.record(z.string()).optional(),
|
|
211
|
+
cppStarterFiles: z.record(z.string()).optional(),
|
|
212
|
+
cppSolutionFiles: z.record(z.string()).optional(),
|
|
171
213
|
guided: z.any().optional(),
|
|
172
214
|
mode: z.enum(['guided', 'sandbox']).optional(),
|
|
173
|
-
language:
|
|
174
|
-
lang:
|
|
215
|
+
language: LanguageIdSchema.optional(),
|
|
216
|
+
lang: LanguageIdSchema.optional(),
|
|
175
217
|
stepIndex: z.number().int().optional(),
|
|
176
218
|
onStepComplete: z.function().args(z.any(), z.number()).returns(z.void()).optional(),
|
|
177
219
|
onLabComplete: z.function().args(z.string()).returns(z.void()).optional()
|