@innovatorved/code-lab 0.2.0 → 0.3.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 +11 -6
- package/CHANGELOG.md +27 -0
- package/README.md +18 -8
- package/dist/code-lab.css +198 -0
- package/dist/code-lab.d.ts +27 -9
- package/dist/code-lab.esm.js +8248 -83
- package/dist/code-lab.js +8246 -81
- package/dist/extensions/cpp.d.ts +32 -6
- package/dist/extensions/cpp.esm.js +745 -6
- package/dist/extensions/cpp.js +745 -6
- package/dist/extensions/guided-lab.esm.js +39 -1
- package/dist/extensions/guided-lab.js +39 -1
- package/dist/extensions/python.d.ts +92 -0
- package/dist/extensions/python.esm.js +5476 -0
- package/dist/extensions/python.js +5495 -0
- package/dist/index.d.ts +7 -4
- package/dist/preview-sw.js +1 -1
- package/dist/runtime/index.d.ts +4 -0
- package/dist/runtime/module-loader.d.ts +11 -0
- package/dist/runtime/test-harness.d.ts +24 -0
- package/dist/runtime/vfs.d.ts +31 -0
- package/dist/runtime/wasi-host.d.ts +33 -0
- package/dist/runtime.esm.js +36 -4
- package/dist/runtime.js +36 -4
- package/dist/schemas.d.ts +134 -21
- package/dist/schemas.esm.js +43 -1
- package/dist/schemas.js +43 -1
- package/dist/shell/coreutils/compilers-cli.d.ts +24 -0
- package/dist/shell/index.d.ts +4 -0
- package/dist/shell/lexer-parser.d.ts +26 -0
- package/dist/shell.esm.js +113 -1
- package/dist/shell.js +113 -1
- package/dist/terminal.esm.js +1 -1
- package/dist/terminal.js +1 -1
- package/dist/workbench/command-palette.d.ts +10 -0
- package/dist/workbench/diff-editor.d.ts +26 -0
- package/dist/workbench/drawer.d.ts +18 -0
- package/dist/workbench/editor.d.ts +11 -0
- package/dist/workbench/file-tree.d.ts +11 -0
- package/dist/workbench/guided-pane.d.ts +11 -0
- package/dist/workbench/icons.d.ts +5 -0
- package/dist/workbench/index.d.ts +39 -0
- package/dist/workbench/share.d.ts +21 -0
- package/dist/workbench/styles.d.ts +4 -0
- package/dist/workbench/toolbar.d.ts +17 -0
- package/dist/workbench.d.ts +6 -1
- package/package.json +8 -2
- package/src/code-lab.css +198 -0
- package/src/extensions/cpp.ts +710 -5
- package/src/extensions/python.ts +1293 -0
- package/src/index.ts +35 -3
- package/src/runtime/index.ts +5 -0
- package/src/runtime/test-harness.ts +57 -0
- package/src/runtime.ts +35 -3
- package/src/schemas.ts +46 -1
- package/src/shell/coreutils/compilers-cli.ts +103 -0
- package/src/shell/index.ts +5 -0
- package/src/shell.ts +112 -0
- package/src/workbench/command-palette.ts +140 -0
- package/src/workbench/diff-editor.ts +216 -0
- package/src/workbench/drawer.ts +148 -0
- package/src/workbench/editor.ts +49 -0
- package/src/workbench/file-tree.ts +51 -0
- package/src/workbench/guided-pane.ts +33 -0
- package/src/workbench/icons.ts +48 -0
- package/src/workbench/index.ts +38 -0
- package/src/workbench/share.ts +99 -0
- package/src/workbench/styles.ts +200 -0
- package/src/workbench/toolbar.ts +171 -0
- package/src/workbench.ts +755 -70
|
@@ -4058,7 +4058,7 @@ var GuidedStepSchema = external_exports.object({
|
|
|
4058
4058
|
hint: external_exports.string().optional(),
|
|
4059
4059
|
testNames: external_exports.array(external_exports.string()).optional()
|
|
4060
4060
|
});
|
|
4061
|
-
var LanguageIdSchema = external_exports.enum(["js", "ts", "cpp"]);
|
|
4061
|
+
var LanguageIdSchema = external_exports.enum(["js", "ts", "cpp", "py"]);
|
|
4062
4062
|
var LanguageBundleSchema = external_exports.object({
|
|
4063
4063
|
language: LanguageIdSchema.default("js"),
|
|
4064
4064
|
files: external_exports.record(external_exports.string()).default({}),
|
|
@@ -4081,6 +4081,12 @@ var GuidedLabExtensionOptionsSchema = external_exports.object({
|
|
|
4081
4081
|
cppStarterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4082
4082
|
cppSolutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4083
4083
|
cppFiles: external_exports.record(external_exports.string()).optional(),
|
|
4084
|
+
pyStarterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4085
|
+
pySolutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4086
|
+
pyFiles: external_exports.record(external_exports.string()).optional(),
|
|
4087
|
+
pyEntry: external_exports.string().optional(),
|
|
4088
|
+
pyTestEntry: external_exports.string().optional(),
|
|
4089
|
+
pyTestCode: external_exports.string().optional(),
|
|
4084
4090
|
summary: external_exports.string().optional(),
|
|
4085
4091
|
onStepComplete: external_exports.function().args(GuidedStepSchema, external_exports.number()).returns(external_exports.void()).optional(),
|
|
4086
4092
|
onLabComplete: external_exports.function().args(external_exports.string()).returns(external_exports.void()).optional()
|
|
@@ -4112,6 +4118,30 @@ var CppExtensionOptionsSchema = external_exports.object({
|
|
|
4112
4118
|
solutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4113
4119
|
onProgress: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional()
|
|
4114
4120
|
});
|
|
4121
|
+
var PythonToolchainProgressSchema = external_exports.object({
|
|
4122
|
+
stage: external_exports.enum(["downloading", "caching", "extracting", "initializing", "ready"]),
|
|
4123
|
+
loadedBytes: external_exports.number().optional(),
|
|
4124
|
+
totalBytes: external_exports.number().optional(),
|
|
4125
|
+
percent: external_exports.number().optional(),
|
|
4126
|
+
message: external_exports.string().optional()
|
|
4127
|
+
});
|
|
4128
|
+
var PythonExtensionOptionsSchema = external_exports.object({
|
|
4129
|
+
cdnBaseUrl: external_exports.string().optional(),
|
|
4130
|
+
indexUrl: external_exports.string().optional(),
|
|
4131
|
+
pyodideIndexUrl: external_exports.string().optional(),
|
|
4132
|
+
cacheInIndexedDB: external_exports.boolean().default(true),
|
|
4133
|
+
preload: external_exports.boolean().default(false),
|
|
4134
|
+
activate: external_exports.boolean().optional(),
|
|
4135
|
+
entry: external_exports.string().default("main.py"),
|
|
4136
|
+
testEntry: external_exports.string().default("test.py"),
|
|
4137
|
+
packages: external_exports.array(external_exports.string()).optional(),
|
|
4138
|
+
preloadPackages: external_exports.array(external_exports.string()).optional(),
|
|
4139
|
+
compilerMemoryLimitMb: external_exports.number().optional(),
|
|
4140
|
+
files: external_exports.record(external_exports.string()).optional(),
|
|
4141
|
+
starterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4142
|
+
solutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4143
|
+
onProgress: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional()
|
|
4144
|
+
});
|
|
4115
4145
|
var CloneProgressPhaseSchema = external_exports.enum([
|
|
4116
4146
|
"connecting",
|
|
4117
4147
|
"metadata",
|
|
@@ -4207,6 +4237,14 @@ var WorkbenchOptionsSchema = external_exports.object({
|
|
|
4207
4237
|
cppFiles: external_exports.record(external_exports.string()).optional(),
|
|
4208
4238
|
cppStarterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4209
4239
|
cppSolutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4240
|
+
pyFiles: external_exports.record(external_exports.string()).optional(),
|
|
4241
|
+
pyStarterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4242
|
+
pySolutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4243
|
+
pyEntry: external_exports.string().optional().default("main.py"),
|
|
4244
|
+
pyTestEntry: external_exports.string().optional().default("test.py"),
|
|
4245
|
+
pyTestCode: external_exports.string().optional(),
|
|
4246
|
+
showWebPreview: external_exports.boolean().optional(),
|
|
4247
|
+
stdin: external_exports.string().optional(),
|
|
4210
4248
|
guided: external_exports.any().optional(),
|
|
4211
4249
|
mode: external_exports.enum(["guided", "sandbox"]).optional(),
|
|
4212
4250
|
language: LanguageIdSchema.optional(),
|
|
@@ -4078,7 +4078,7 @@ var CodeLabGuidedLab = (() => {
|
|
|
4078
4078
|
hint: external_exports.string().optional(),
|
|
4079
4079
|
testNames: external_exports.array(external_exports.string()).optional()
|
|
4080
4080
|
});
|
|
4081
|
-
var LanguageIdSchema = external_exports.enum(["js", "ts", "cpp"]);
|
|
4081
|
+
var LanguageIdSchema = external_exports.enum(["js", "ts", "cpp", "py"]);
|
|
4082
4082
|
var LanguageBundleSchema = external_exports.object({
|
|
4083
4083
|
language: LanguageIdSchema.default("js"),
|
|
4084
4084
|
files: external_exports.record(external_exports.string()).default({}),
|
|
@@ -4101,6 +4101,12 @@ var CodeLabGuidedLab = (() => {
|
|
|
4101
4101
|
cppStarterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4102
4102
|
cppSolutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4103
4103
|
cppFiles: external_exports.record(external_exports.string()).optional(),
|
|
4104
|
+
pyStarterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4105
|
+
pySolutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4106
|
+
pyFiles: external_exports.record(external_exports.string()).optional(),
|
|
4107
|
+
pyEntry: external_exports.string().optional(),
|
|
4108
|
+
pyTestEntry: external_exports.string().optional(),
|
|
4109
|
+
pyTestCode: external_exports.string().optional(),
|
|
4104
4110
|
summary: external_exports.string().optional(),
|
|
4105
4111
|
onStepComplete: external_exports.function().args(GuidedStepSchema, external_exports.number()).returns(external_exports.void()).optional(),
|
|
4106
4112
|
onLabComplete: external_exports.function().args(external_exports.string()).returns(external_exports.void()).optional()
|
|
@@ -4132,6 +4138,30 @@ var CodeLabGuidedLab = (() => {
|
|
|
4132
4138
|
solutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4133
4139
|
onProgress: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional()
|
|
4134
4140
|
});
|
|
4141
|
+
var PythonToolchainProgressSchema = external_exports.object({
|
|
4142
|
+
stage: external_exports.enum(["downloading", "caching", "extracting", "initializing", "ready"]),
|
|
4143
|
+
loadedBytes: external_exports.number().optional(),
|
|
4144
|
+
totalBytes: external_exports.number().optional(),
|
|
4145
|
+
percent: external_exports.number().optional(),
|
|
4146
|
+
message: external_exports.string().optional()
|
|
4147
|
+
});
|
|
4148
|
+
var PythonExtensionOptionsSchema = external_exports.object({
|
|
4149
|
+
cdnBaseUrl: external_exports.string().optional(),
|
|
4150
|
+
indexUrl: external_exports.string().optional(),
|
|
4151
|
+
pyodideIndexUrl: external_exports.string().optional(),
|
|
4152
|
+
cacheInIndexedDB: external_exports.boolean().default(true),
|
|
4153
|
+
preload: external_exports.boolean().default(false),
|
|
4154
|
+
activate: external_exports.boolean().optional(),
|
|
4155
|
+
entry: external_exports.string().default("main.py"),
|
|
4156
|
+
testEntry: external_exports.string().default("test.py"),
|
|
4157
|
+
packages: external_exports.array(external_exports.string()).optional(),
|
|
4158
|
+
preloadPackages: external_exports.array(external_exports.string()).optional(),
|
|
4159
|
+
compilerMemoryLimitMb: external_exports.number().optional(),
|
|
4160
|
+
files: external_exports.record(external_exports.string()).optional(),
|
|
4161
|
+
starterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4162
|
+
solutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4163
|
+
onProgress: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional()
|
|
4164
|
+
});
|
|
4135
4165
|
var CloneProgressPhaseSchema = external_exports.enum([
|
|
4136
4166
|
"connecting",
|
|
4137
4167
|
"metadata",
|
|
@@ -4227,6 +4257,14 @@ var CodeLabGuidedLab = (() => {
|
|
|
4227
4257
|
cppFiles: external_exports.record(external_exports.string()).optional(),
|
|
4228
4258
|
cppStarterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4229
4259
|
cppSolutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4260
|
+
pyFiles: external_exports.record(external_exports.string()).optional(),
|
|
4261
|
+
pyStarterFiles: external_exports.record(external_exports.string()).optional(),
|
|
4262
|
+
pySolutionFiles: external_exports.record(external_exports.string()).optional(),
|
|
4263
|
+
pyEntry: external_exports.string().optional().default("main.py"),
|
|
4264
|
+
pyTestEntry: external_exports.string().optional().default("test.py"),
|
|
4265
|
+
pyTestCode: external_exports.string().optional(),
|
|
4266
|
+
showWebPreview: external_exports.boolean().optional(),
|
|
4267
|
+
stdin: external_exports.string().optional(),
|
|
4230
4268
|
guided: external_exports.any().optional(),
|
|
4231
4269
|
mode: external_exports.enum(["guided", "sandbox"]).optional(),
|
|
4232
4270
|
language: LanguageIdSchema.optional(),
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { PythonExtensionOptions } from '../schemas';
|
|
2
|
+
import type { DiagnosticItem } from '../diagnostics';
|
|
3
|
+
import { type TestResultItem } from '../runtime/test-harness';
|
|
4
|
+
export declare const DEFAULT_PYTHON_CDN_BASE_URL = "https://cdn.jsdelivr.net/pyodide/v0.27.2/full/";
|
|
5
|
+
export declare const PYTHON_TOOLCHAIN_PRESETS: {
|
|
6
|
+
latest: string;
|
|
7
|
+
v0_26: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Built-in Python modules seeded into `/usr/lib/python` inside the VirtualFS.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BUILTIN_PYTHON_MODULES: Record<string, string>;
|
|
13
|
+
export declare const CODELAB_PYTHON_LIBS: Record<string, string>;
|
|
14
|
+
export interface ExtendedPythonExtensionOptions extends PythonExtensionOptions {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export interface PythonCompileResult {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
exitCode: number;
|
|
20
|
+
stdout: string;
|
|
21
|
+
stderr: string;
|
|
22
|
+
peakMemoryBytes: number;
|
|
23
|
+
durationMs: number;
|
|
24
|
+
testResults?: TestResultItem[];
|
|
25
|
+
}
|
|
26
|
+
export interface PythonSymbolDoc {
|
|
27
|
+
label: string;
|
|
28
|
+
kind?: string;
|
|
29
|
+
detail: string;
|
|
30
|
+
documentation: string;
|
|
31
|
+
insertText?: string;
|
|
32
|
+
module?: string;
|
|
33
|
+
complexity?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare const PYTHON_COMPLETIONS_AND_HOVERS: Record<string, PythonSymbolDoc>;
|
|
36
|
+
/**
|
|
37
|
+
* Registers Monaco Python completion and hover providers.
|
|
38
|
+
*/
|
|
39
|
+
export declare function registerMonacoPythonLanguageService(monacoInstance: any): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Tier-1 instant Python static AST and syntax checker.
|
|
42
|
+
*/
|
|
43
|
+
export declare function analyzePythonSource(source: string, filename?: string): DiagnosticItem[];
|
|
44
|
+
/**
|
|
45
|
+
* Parses Python tracebacks and SyntaxErrors from stderr and pushes into DiagnosticsStore & Monaco markers.
|
|
46
|
+
*/
|
|
47
|
+
export declare function applyPythonTracebackDiagnostics(stderrText: string, diagnosticsStore?: any, monacoInstance?: any, activeModel?: any): DiagnosticItem[];
|
|
48
|
+
/**
|
|
49
|
+
* Deterministic PEP 8 / 4-space indentation formatter.
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatPythonSource(code: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Pyodide (CPython 3.12 WebAssembly) Toolchain Manager with IndexedDB cache.
|
|
54
|
+
*/
|
|
55
|
+
export declare class PythonToolchainManager {
|
|
56
|
+
readonly options: ExtendedPythonExtensionOptions;
|
|
57
|
+
pyodide: any;
|
|
58
|
+
private _loadingPromise;
|
|
59
|
+
constructor(options?: ExtendedPythonExtensionOptions);
|
|
60
|
+
isLoaded(): boolean;
|
|
61
|
+
preload(): Promise<any>;
|
|
62
|
+
private _emitProgress;
|
|
63
|
+
ensureLoaded(): Promise<any>;
|
|
64
|
+
installPackages(packages: string[]): Promise<{
|
|
65
|
+
ok: boolean;
|
|
66
|
+
installed: string[];
|
|
67
|
+
error?: string;
|
|
68
|
+
}>;
|
|
69
|
+
execute(req: {
|
|
70
|
+
entry?: string;
|
|
71
|
+
source?: string;
|
|
72
|
+
vfs?: any;
|
|
73
|
+
stdin?: string;
|
|
74
|
+
testFilter?: string | string[];
|
|
75
|
+
onStdout?: (msg: string) => void;
|
|
76
|
+
onStderr?: (msg: string) => void;
|
|
77
|
+
}): Promise<PythonCompileResult>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Seeds `/usr/lib/python` headers and libraries into the VirtualFS.
|
|
81
|
+
*/
|
|
82
|
+
export declare function seedPythonModulesIntoVfs(vfs: any): void;
|
|
83
|
+
/**
|
|
84
|
+
* Registers the Python compiler toolchain on the global runtime.
|
|
85
|
+
*/
|
|
86
|
+
export declare function registerPythonCompilerOnRuntime(toolchain: PythonToolchainManager): (req: any) => Promise<PythonCompileResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Real Python 3.12 (CPython WebAssembly via Pyodide) Extension for CodeLab.
|
|
89
|
+
*/
|
|
90
|
+
export declare function pythonExtension(workbenchOrOptions?: any, maybeOptions?: ExtendedPythonExtensionOptions): any;
|
|
91
|
+
export declare function createPythonExtension(options?: ExtendedPythonExtensionOptions): any;
|
|
92
|
+
export default pythonExtension;
|