@innovatorved/code-lab 0.1.13 → 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.
Files changed (80) hide show
  1. package/ARCHITECTURE.md +12 -7
  2. package/CHANGELOG.md +134 -0
  3. package/README.md +59 -9
  4. package/dist/code-lab.css +198 -0
  5. package/dist/code-lab.d.ts +37 -7
  6. package/dist/code-lab.esm.js +20444 -1278
  7. package/dist/code-lab.js +20439 -1276
  8. package/dist/extensions/cpp.d.ts +145 -0
  9. package/dist/extensions/cpp.esm.js +5932 -0
  10. package/dist/extensions/cpp.js +5951 -0
  11. package/dist/extensions/guided-lab.esm.js +86 -6
  12. package/dist/extensions/guided-lab.js +87 -6
  13. package/dist/extensions/javascript.d.ts +24 -0
  14. package/dist/extensions/javascript.esm.js +36 -0
  15. package/dist/extensions/javascript.js +59 -0
  16. package/dist/extensions/python.d.ts +92 -0
  17. package/dist/extensions/python.esm.js +5476 -0
  18. package/dist/extensions/python.js +5495 -0
  19. package/dist/extensions/typescript.d.ts +36 -0
  20. package/dist/extensions/typescript.esm.js +55 -0
  21. package/dist/extensions/typescript.js +78 -0
  22. package/dist/index.d.ts +9 -3
  23. package/dist/preview-sw.js +1 -1
  24. package/dist/runtime/index.d.ts +4 -0
  25. package/dist/runtime/module-loader.d.ts +11 -0
  26. package/dist/runtime/test-harness.d.ts +24 -0
  27. package/dist/runtime/vfs.d.ts +31 -0
  28. package/dist/runtime/wasi-host.d.ts +33 -0
  29. package/dist/runtime.d.ts +6 -0
  30. package/dist/runtime.esm.js +920 -15
  31. package/dist/runtime.js +914 -15
  32. package/dist/schemas.d.ts +237 -25
  33. package/dist/schemas.esm.js +85 -6
  34. package/dist/schemas.js +85 -6
  35. package/dist/shell/coreutils/compilers-cli.d.ts +24 -0
  36. package/dist/shell/index.d.ts +4 -0
  37. package/dist/shell/lexer-parser.d.ts +26 -0
  38. package/dist/shell.esm.js +289 -4
  39. package/dist/shell.js +289 -4
  40. package/dist/terminal.esm.js +1 -1
  41. package/dist/terminal.js +1 -1
  42. package/dist/workbench/command-palette.d.ts +10 -0
  43. package/dist/workbench/diff-editor.d.ts +26 -0
  44. package/dist/workbench/drawer.d.ts +18 -0
  45. package/dist/workbench/editor.d.ts +11 -0
  46. package/dist/workbench/file-tree.d.ts +11 -0
  47. package/dist/workbench/guided-pane.d.ts +11 -0
  48. package/dist/workbench/icons.d.ts +5 -0
  49. package/dist/workbench/index.d.ts +39 -0
  50. package/dist/workbench/share.d.ts +21 -0
  51. package/dist/workbench/styles.d.ts +4 -0
  52. package/dist/workbench/toolbar.d.ts +17 -0
  53. package/dist/workbench.d.ts +6 -1
  54. package/package.json +33 -3
  55. package/src/code-lab.css +198 -0
  56. package/src/extensions/cpp.ts +1786 -0
  57. package/src/extensions/guided-lab.ts +10 -0
  58. package/src/extensions/javascript.ts +54 -0
  59. package/src/extensions/python.ts +1293 -0
  60. package/src/extensions/typescript.ts +85 -0
  61. package/src/index.ts +66 -3
  62. package/src/runtime/index.ts +5 -0
  63. package/src/runtime/test-harness.ts +57 -0
  64. package/src/runtime.ts +915 -14
  65. package/src/schemas.ts +94 -7
  66. package/src/shell/coreutils/compilers-cli.ts +103 -0
  67. package/src/shell/index.ts +5 -0
  68. package/src/shell.ts +288 -3
  69. package/src/workbench/command-palette.ts +140 -0
  70. package/src/workbench/diff-editor.ts +216 -0
  71. package/src/workbench/drawer.ts +148 -0
  72. package/src/workbench/editor.ts +49 -0
  73. package/src/workbench/file-tree.ts +51 -0
  74. package/src/workbench/guided-pane.ts +33 -0
  75. package/src/workbench/icons.ts +48 -0
  76. package/src/workbench/index.ts +38 -0
  77. package/src/workbench/share.ts +99 -0
  78. package/src/workbench/styles.ts +200 -0
  79. package/src/workbench/toolbar.ts +171 -0
  80. package/src/workbench.ts +1016 -78
@@ -34,7 +34,17 @@ export function guidedLabExtension(workbench: any, options: Partial<GuidedLabExt
34
34
  steps: workbench.steps
35
35
  };
36
36
 
37
+ if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
38
+ workbench.enabledLanguages = new Set(['js']);
39
+ }
40
+
37
41
  if (parsed.tsStarterFiles || parsed.tsSolutionFiles || parsed.tsFiles) {
42
+ workbench.enabledLanguages.add('ts');
43
+ workbench.hasMultipleLanguages = true;
44
+ }
45
+
46
+ if (parsed.cppStarterFiles || parsed.cppSolutionFiles || parsed.cppFiles) {
47
+ workbench.enabledLanguages.add('cpp');
38
48
  workbench.hasMultipleLanguages = true;
39
49
  }
40
50
 
@@ -0,0 +1,54 @@
1
+ /**
2
+ * JavaScript Language Extension for CodeLab
3
+ *
4
+ * Enabled by default in CodeLab. Uses the browser's built-in JavaScript engine
5
+ * and CodeLab's zero-dependency virtual Node.js + Bun runtime (`node`, `bun`, `npm`).
6
+ */
7
+
8
+ export interface JavaScriptExtensionOptions {
9
+ /**
10
+ * Optional starter files to seed when JavaScript is selected.
11
+ */
12
+ files?: Record<string, string>;
13
+ /**
14
+ * Default entry file for JavaScript runs (e.g. 'src/demo.js' or 'index.js').
15
+ */
16
+ entry?: string;
17
+ }
18
+
19
+ export function javascriptExtension(workbench: any, options: JavaScriptExtensionOptions = {}) {
20
+ if (!workbench) return workbench;
21
+
22
+ if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
23
+ workbench.enabledLanguages = new Set(['js']);
24
+ } else {
25
+ workbench.enabledLanguages.add('js');
26
+ }
27
+
28
+ if (options.files && typeof options.files === 'object') {
29
+ workbench.jsFiles = { ...(workbench.jsFiles || {}), ...options.files };
30
+ }
31
+ if (options.entry && !workbench.entry) {
32
+ workbench.entry = options.entry;
33
+ }
34
+
35
+ workbench.hasMultipleLanguages = workbench.enabledLanguages.size > 1;
36
+
37
+ if (typeof workbench._renderShell === 'function' && workbench.container) {
38
+ workbench._renderShell();
39
+ if (typeof workbench._bindEvents === 'function') workbench._bindEvents();
40
+ if (typeof workbench._renderFileLists === 'function') workbench._renderFileLists();
41
+ }
42
+
43
+ return workbench;
44
+ }
45
+
46
+ export function createJavaScriptExtension(options: JavaScriptExtensionOptions = {}) {
47
+ const plugin = (workbench: any) => javascriptExtension(workbench, options);
48
+ plugin.extensionName = 'javascript';
49
+ plugin.languageId = 'js' as const;
50
+ return plugin;
51
+ }
52
+
53
+ export const jsExtension = javascriptExtension;
54
+ export default javascriptExtension;