@innovatorved/code-lab 0.2.0 → 0.3.1

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.
Files changed (66) hide show
  1. package/ARCHITECTURE.md +11 -6
  2. package/CHANGELOG.md +40 -0
  3. package/README.md +18 -8
  4. package/dist/code-lab.css +198 -0
  5. package/dist/code-lab.d.ts +27 -9
  6. package/dist/code-lab.esm.js +8516 -84
  7. package/dist/code-lab.js +8514 -82
  8. package/dist/extensions/cpp.d.ts +40 -6
  9. package/dist/extensions/cpp.esm.js +1027 -7
  10. package/dist/extensions/cpp.js +1027 -7
  11. package/dist/extensions/guided-lab.esm.js +40 -2
  12. package/dist/extensions/guided-lab.js +40 -2
  13. package/dist/extensions/python.d.ts +92 -0
  14. package/dist/extensions/python.esm.js +5476 -0
  15. package/dist/extensions/python.js +5495 -0
  16. package/dist/index.d.ts +7 -4
  17. package/dist/preview-sw.js +1 -1
  18. package/dist/runtime/index.d.ts +4 -0
  19. package/dist/runtime/test-harness.d.ts +24 -0
  20. package/dist/runtime.esm.js +36 -4
  21. package/dist/runtime.js +36 -4
  22. package/dist/schemas.d.ts +137 -24
  23. package/dist/schemas.esm.js +44 -2
  24. package/dist/schemas.js +44 -2
  25. package/dist/shell/coreutils/compilers-cli.d.ts +24 -0
  26. package/dist/shell/index.d.ts +4 -0
  27. package/dist/shell.esm.js +113 -1
  28. package/dist/shell.js +113 -1
  29. package/dist/terminal.esm.js +1 -1
  30. package/dist/terminal.js +1 -1
  31. package/dist/workbench/command-palette.d.ts +10 -0
  32. package/dist/workbench/diff-editor.d.ts +26 -0
  33. package/dist/workbench/drawer.d.ts +18 -0
  34. package/dist/workbench/editor.d.ts +11 -0
  35. package/dist/workbench/file-tree.d.ts +11 -0
  36. package/dist/workbench/guided-pane.d.ts +11 -0
  37. package/dist/workbench/icons.d.ts +5 -0
  38. package/dist/workbench/index.d.ts +39 -0
  39. package/dist/workbench/share.d.ts +21 -0
  40. package/dist/workbench/styles.d.ts +4 -0
  41. package/dist/workbench/toolbar.d.ts +17 -0
  42. package/dist/workbench.d.ts +6 -1
  43. package/package.json +8 -2
  44. package/src/code-lab.css +198 -0
  45. package/src/extensions/cpp.ts +966 -5
  46. package/src/extensions/python.ts +1293 -0
  47. package/src/index.ts +35 -3
  48. package/src/runtime/index.ts +5 -0
  49. package/src/runtime/test-harness.ts +57 -0
  50. package/src/runtime.ts +35 -3
  51. package/src/schemas.ts +47 -2
  52. package/src/shell/coreutils/compilers-cli.ts +103 -0
  53. package/src/shell/index.ts +5 -0
  54. package/src/shell.ts +112 -0
  55. package/src/workbench/command-palette.ts +140 -0
  56. package/src/workbench/diff-editor.ts +216 -0
  57. package/src/workbench/drawer.ts +144 -0
  58. package/src/workbench/editor.ts +49 -0
  59. package/src/workbench/file-tree.ts +51 -0
  60. package/src/workbench/guided-pane.ts +33 -0
  61. package/src/workbench/icons.ts +48 -0
  62. package/src/workbench/index.ts +38 -0
  63. package/src/workbench/share.ts +99 -0
  64. package/src/workbench/styles.ts +200 -0
  65. package/src/workbench/toolbar.ts +171 -0
  66. package/src/workbench.ts +744 -69
@@ -1,4 +1,5 @@
1
1
  import { CppExtensionOptions } from '../schemas';
2
+ import type { DiagnosticItem } from '../diagnostics';
2
3
  /**
3
4
  * Built-in competitive programming & DSA headers seeded into `/usr/include`
4
5
  * inside the VirtualFS alongside the WASI sysroot.
@@ -40,6 +41,11 @@ export interface CppCompileResult {
40
41
  export declare const DEFAULT_CPP_CDN_BASE_URL = "https://cdn.jsdelivr.net/npm/@yowasp/clang";
41
42
  export type CppCompileOptions = CppCompileRequest;
42
43
  export type CppCompilerAdapter = CppToolchainManager;
44
+ /**
45
+ * Builds a valid WASI WebAssembly binary that writes `stdoutText` to stdout (and optionally `stderrText`)
46
+ * via `wasi_snapshot_preview1.fd_write` and exits cleanly with `exitCode`.
47
+ */
48
+ export declare function buildWasiPrintWasm(stdoutText: string, exitCode?: number, stderrText?: string): Uint8Array;
43
49
  export interface ExtendedCppExtensionOptions extends Partial<CppExtensionOptions> {
44
50
  /**
45
51
  * Pre-loaded `clang.wasm` binary (optional; bypasses network download).
@@ -71,6 +77,8 @@ export declare class CppToolchainManager {
71
77
  clangWasm: Uint8Array | null;
72
78
  lldWasm: Uint8Array | null;
73
79
  sysrootTar: Uint8Array | null;
80
+ nativeToolchainUnavailable: boolean;
81
+ loadError: any;
74
82
  private _loadingPromise;
75
83
  constructor(options?: ExtendedCppExtensionOptions);
76
84
  private _emitProgress;
@@ -78,6 +86,7 @@ export declare class CppToolchainManager {
78
86
  ensureLoaded(): Promise<void>;
79
87
  prepareVfs(vfs: any): void;
80
88
  compile(req: CppCompileRequest): Promise<CppCompileResult>;
89
+ private _compileVirtualFallback;
81
90
  }
82
91
  /**
83
92
  * Parses POSIX shell arguments for `g++` / `clang++` / `c++` commands.
@@ -100,6 +109,33 @@ export declare function registerCppCompilerOnRuntime(toolchain: CppToolchainMana
100
109
  wasmBinary: Uint8Array<ArrayBufferLike>;
101
110
  outputPath: string;
102
111
  }>;
112
+ /**
113
+ * Full C++20 standard library header set + built-in CodeLab headers.
114
+ */
115
+ export declare const STANDARD_CPP20_HEADERS: ReadonlySet<string>;
116
+ export interface CppSymbolDoc {
117
+ label: string;
118
+ kind?: string;
119
+ detail: string;
120
+ documentation: string;
121
+ insertText?: string;
122
+ header?: string;
123
+ complexity?: string;
124
+ }
125
+ export declare const CPP_COMPLETIONS_AND_HOVERS: Record<string, CppSymbolDoc>;
126
+ /**
127
+ * Registers Monaco C++20 completion and hover providers.
128
+ */
129
+ export declare function registerMonacoCppLanguageService(monacoInstance: any): boolean;
130
+ /**
131
+ * Real-time C++20 static AST/syntax linter.
132
+ * Debounced on keystroke in `.cpp`, `.cc`, `.cxx`, `.hpp`, `.h` files.
133
+ */
134
+ export declare function analyzeCppSource(source: string, filename?: string, vfs?: any): DiagnosticItem[];
135
+ /**
136
+ * Parses Clang / LLVM WASI compiler stderr and applies diagnostics to Monaco and DiagnosticsStore.
137
+ */
138
+ export declare function applyClangStderrDiagnostics(stderrText: string, diagnosticsStore?: any, monacoInstance?: any, activeModel?: any): DiagnosticItem[];
103
139
  /**
104
140
  * Real C++20 in WebAssembly Extension for CodeLab (`@innovatorved/code-lab/extensions/cpp`).
105
141
  *
@@ -109,11 +145,9 @@ export declare function registerCppCompilerOnRuntime(toolchain: CppToolchainMana
109
145
  * - `JS | TS | C++` language switcher in the CodeLab workbench
110
146
  * - `g++`, `clang++`, `c++`, and `./a.out` binary execution in the POSIX shell
111
147
  * - Guided Lab `cppStarterFiles`, `cppSolutionFiles`, and `cppFiles` curriculum support
148
+ * - Monaco IntelliSense, hovers, debounced C++20 static linter, and Clang compiler squiggles
112
149
  */
113
- export declare function cppExtension(workbench: any, options?: ExtendedCppExtensionOptions): any;
114
- export declare function createCppExtension(options?: ExtendedCppExtensionOptions): {
115
- (workbench: any): any;
116
- extensionName: string;
117
- languageId: "cpp";
118
- };
150
+ export declare function installCppExtension(workbench: any, options?: ExtendedCppExtensionOptions): any;
151
+ export declare function cppExtension(workbenchOrOptions?: any, maybeOptions?: ExtendedCppExtensionOptions): any;
152
+ export declare function createCppExtension(options?: ExtendedCppExtensionOptions): any;
119
153
  export default cppExtension;