@innovatorved/code-lab 0.7.0 → 0.7.2

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 (159) hide show
  1. package/ARCHITECTURE.md +2 -2
  2. package/CHANGELOG.md +30 -0
  3. package/README.md +6 -6
  4. package/dist/code-lab-sql.esm.js +19 -19
  5. package/dist/code-lab-sql.umd.js +20 -20
  6. package/dist/code-lab.css +1 -1
  7. package/dist/code-lab.d.ts +47 -38
  8. package/dist/code-lab.esm.js +1183 -1909
  9. package/dist/code-lab.js +1182 -1906
  10. package/dist/extensions/cpp.esm.js +132 -8760
  11. package/dist/extensions/cpp.js +124 -8770
  12. package/dist/extensions/guided-lab.esm.js +33 -6836
  13. package/dist/extensions/guided-lab.js +33 -6854
  14. package/dist/extensions/javascript.esm.js +1 -36
  15. package/dist/extensions/javascript.js +1 -58
  16. package/dist/extensions/python.esm.js +113 -8122
  17. package/dist/extensions/python.js +113 -8140
  18. package/dist/extensions/typescript.esm.js +1 -55
  19. package/dist/extensions/typescript.js +1 -77
  20. package/dist/index.d.ts +1 -1
  21. package/dist/logger.d.ts +4 -20
  22. package/dist/modular-kernel.d.ts +0 -5
  23. package/dist/packages/core/src/errors.d.ts +5 -1
  24. package/dist/packages/fs/src/backends.d.ts +0 -27
  25. package/dist/packages/fs/src/index.d.ts +1 -1
  26. package/dist/packages/ui/src/html.d.ts +1 -0
  27. package/dist/packages/ui/src/index.d.ts +1 -0
  28. package/dist/{apps/web/src/index.d.ts → packages/ui/src/kernel.d.ts} +3 -11
  29. package/dist/packages/ui/src/observability.d.ts +1 -1
  30. package/dist/packages/ui/src/settings-dialog.d.ts +0 -1
  31. package/dist/preview-sw.js +1 -1
  32. package/dist/runtime.d.ts +3 -0
  33. package/dist/runtime.esm.js +78 -78
  34. package/dist/runtime.js +78 -78
  35. package/dist/schemas.d.ts +10 -1
  36. package/dist/schemas.esm.js +33 -6815
  37. package/dist/schemas.js +33 -6831
  38. package/dist/shell.esm.js +277 -285
  39. package/dist/shell.js +277 -285
  40. package/dist/terminal.esm.js +9 -7
  41. package/dist/terminal.js +7 -7
  42. package/dist/workbench/command-palette.d.ts +0 -4
  43. package/dist/workbench/editor.d.ts +0 -4
  44. package/dist/workbench/index.d.ts +0 -22
  45. package/dist/workbench/intellisense.d.ts +1 -8
  46. package/dist/workbench/xterm-adapter.d.ts +0 -1
  47. package/package.json +4 -13
  48. package/dist/code-lab.umd.js +0 -6117
  49. package/dist/packages/editor/src/index.d.ts +0 -118
  50. package/dist/packages/preview/src/index.d.ts +0 -34
  51. package/dist/packages/runtime/src/index.d.ts +0 -47
  52. package/dist/packages/terminal/src/index.d.ts +0 -54
  53. package/dist/workbench/drawer.d.ts +0 -18
  54. package/dist/workbench/file-tree.d.ts +0 -11
  55. package/dist/workbench/guided-pane.d.ts +0 -11
  56. package/dist/workbench/styles.d.ts +0 -4
  57. package/dist/workbench/toolbar.d.ts +0 -17
  58. package/packages/commands/README.md +0 -7
  59. package/packages/commands/package.json +0 -16
  60. package/packages/commands/src/index.ts +0 -467
  61. package/packages/commands/tsconfig.json +0 -22
  62. package/packages/core/README.md +0 -12
  63. package/packages/core/package.json +0 -13
  64. package/packages/core/src/di.ts +0 -147
  65. package/packages/core/src/disposable.ts +0 -112
  66. package/packages/core/src/errors.ts +0 -205
  67. package/packages/core/src/events.ts +0 -157
  68. package/packages/core/src/index.ts +0 -49
  69. package/packages/core/src/path.ts +0 -118
  70. package/packages/core/src/registry.ts +0 -61
  71. package/packages/core/tsconfig.json +0 -19
  72. package/packages/editor/README.md +0 -9
  73. package/packages/editor/package.json +0 -18
  74. package/packages/editor/src/index.ts +0 -344
  75. package/packages/editor/tsconfig.json +0 -24
  76. package/packages/fs/README.md +0 -7
  77. package/packages/fs/package.json +0 -16
  78. package/packages/fs/src/backends.ts +0 -301
  79. package/packages/fs/src/index.ts +0 -18
  80. package/packages/fs/src/types.ts +0 -44
  81. package/packages/fs/src/vfs-service.ts +0 -257
  82. package/packages/fs/tsconfig.json +0 -22
  83. package/packages/preview/README.md +0 -3
  84. package/packages/preview/package.json +0 -16
  85. package/packages/preview/src/index.ts +0 -125
  86. package/packages/preview/tsconfig.json +0 -22
  87. package/packages/runtime/README.md +0 -3
  88. package/packages/runtime/package.json +0 -17
  89. package/packages/runtime/src/index.ts +0 -134
  90. package/packages/runtime/tsconfig.json +0 -23
  91. package/packages/settings/README.md +0 -7
  92. package/packages/settings/package.json +0 -16
  93. package/packages/settings/src/builtin-schemas.ts +0 -262
  94. package/packages/settings/src/configuration-service.ts +0 -609
  95. package/packages/settings/src/index.ts +0 -38
  96. package/packages/settings/src/jsonc.ts +0 -189
  97. package/packages/settings/src/schema.ts +0 -164
  98. package/packages/settings/tsconfig.json +0 -22
  99. package/packages/sql/README.md +0 -12
  100. package/packages/sql/package.json +0 -13
  101. package/packages/sql/src/completions.ts +0 -359
  102. package/packages/sql/src/diagnostics.ts +0 -200
  103. package/packages/sql/src/formatter.ts +0 -271
  104. package/packages/sql/src/index.ts +0 -54
  105. package/packages/sql/src/sql-editor.ts +0 -802
  106. package/packages/sql/src/styles.ts +0 -524
  107. package/packages/sql/src/tokenizer.ts +0 -457
  108. package/packages/sql/src/types.ts +0 -148
  109. package/packages/sql/tsconfig.json +0 -19
  110. package/packages/terminal/README.md +0 -3
  111. package/packages/terminal/package.json +0 -16
  112. package/packages/terminal/src/index.ts +0 -183
  113. package/packages/terminal/tsconfig.json +0 -22
  114. package/packages/ui/README.md +0 -8
  115. package/packages/ui/package.json +0 -18
  116. package/packages/ui/src/index.ts +0 -40
  117. package/packages/ui/src/observability.ts +0 -173
  118. package/packages/ui/src/plugin-registry.ts +0 -289
  119. package/packages/ui/src/settings-dialog.ts +0 -939
  120. package/packages/ui/src/themes.ts +0 -333
  121. package/packages/ui/tsconfig.json +0 -24
  122. package/src/code-lab.css +0 -8584
  123. package/src/csp.ts +0 -590
  124. package/src/diagnostics.ts +0 -287
  125. package/src/extensions/cpp.ts +0 -2389
  126. package/src/extensions/guided-lab.ts +0 -64
  127. package/src/extensions/javascript.ts +0 -54
  128. package/src/extensions/python.ts +0 -1737
  129. package/src/extensions/typescript.ts +0 -85
  130. package/src/extensions/umbrella.ts +0 -5
  131. package/src/html.ts +0 -88
  132. package/src/index.ts +0 -129
  133. package/src/logger.ts +0 -139
  134. package/src/modular-kernel.ts +0 -11
  135. package/src/preview-sw.js +0 -296
  136. package/src/runtime/test-harness.ts +0 -57
  137. package/src/runtime.ts +0 -10480
  138. package/src/sample.html +0 -304
  139. package/src/schemas.ts +0 -366
  140. package/src/scm.ts +0 -2453
  141. package/src/search.ts +0 -433
  142. package/src/shell.ts +0 -10987
  143. package/src/storage.ts +0 -773
  144. package/src/terminal.ts +0 -1400
  145. package/src/workbench/command-palette.ts +0 -381
  146. package/src/workbench/diff-editor.ts +0 -470
  147. package/src/workbench/drawer.ts +0 -157
  148. package/src/workbench/editor.ts +0 -49
  149. package/src/workbench/file-tree.ts +0 -51
  150. package/src/workbench/guided-pane.ts +0 -43
  151. package/src/workbench/icons.ts +0 -255
  152. package/src/workbench/index.ts +0 -44
  153. package/src/workbench/intellisense.ts +0 -1871
  154. package/src/workbench/share.ts +0 -128
  155. package/src/workbench/styles.ts +0 -211
  156. package/src/workbench/toolbar.ts +0 -182
  157. package/src/workbench/xterm-adapter.ts +0 -1571
  158. package/src/workbench.ts +0 -22132
  159. package/src/zip.ts +0 -348
@@ -1,85 +0,0 @@
1
- /**
2
- * TypeScript Language Extension for CodeLab
3
- *
4
- * Zero-dependency browser TypeScript extension powered by CodeLab's built-in
5
- * `transpileTS` compiler and virtual Node.js / Bun runtime.
6
- */
7
-
8
- export interface TypeScriptExtensionOptions {
9
- /**
10
- * Optional TypeScript workspace files (`tsFiles`).
11
- */
12
- files?: Record<string, string>;
13
- /**
14
- * Optional Guided Lab TypeScript starter files (`tsStarterFiles`).
15
- */
16
- starterFiles?: Record<string, string>;
17
- /**
18
- * Optional Guided Lab TypeScript reference solution files (`tsSolutionFiles`).
19
- */
20
- solutionFiles?: Record<string, string>;
21
- /**
22
- * Optional entry file when TypeScript is active (e.g. 'src/demo.ts').
23
- */
24
- entry?: string;
25
- /**
26
- * Immediately switch the active workbench language to 'ts'.
27
- */
28
- activate?: boolean;
29
- }
30
-
31
- export function typescriptExtension(workbench: any, options: TypeScriptExtensionOptions = {}) {
32
- if (!workbench) return workbench;
33
-
34
- if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
35
- workbench.enabledLanguages = new Set(['js', 'ts']);
36
- } else {
37
- workbench.enabledLanguages.add('ts');
38
- }
39
-
40
- if (options.files && typeof options.files === 'object') {
41
- workbench.tsFiles = { ...(workbench.tsFiles || {}), ...options.files };
42
- if (workbench.guidedConfig) {
43
- workbench.guidedConfig.tsFiles = { ...(workbench.guidedConfig.tsFiles || {}), ...options.files };
44
- }
45
- }
46
- if (options.starterFiles && typeof options.starterFiles === 'object') {
47
- if (!workbench.guidedConfig) workbench.guidedConfig = {};
48
- workbench.guidedConfig.tsStarterFiles = {
49
- ...(workbench.guidedConfig.tsStarterFiles || {}),
50
- ...options.starterFiles
51
- };
52
- }
53
- if (options.solutionFiles && typeof options.solutionFiles === 'object') {
54
- if (!workbench.guidedConfig) workbench.guidedConfig = {};
55
- workbench.guidedConfig.tsSolutionFiles = {
56
- ...(workbench.guidedConfig.tsSolutionFiles || {}),
57
- ...options.solutionFiles
58
- };
59
- }
60
- if (options.entry) {
61
- workbench.tsEntry = options.entry;
62
- }
63
-
64
- workbench.hasMultipleLanguages = workbench.enabledLanguages.size > 1;
65
-
66
- if (options.activate && typeof workbench.setLanguage === 'function') {
67
- workbench.setLanguage('ts');
68
- } else if (typeof workbench._renderShell === 'function' && workbench.container) {
69
- workbench._renderShell();
70
- if (typeof workbench._bindEvents === 'function') workbench._bindEvents();
71
- if (typeof workbench._renderFileLists === 'function') workbench._renderFileLists();
72
- }
73
-
74
- return workbench;
75
- }
76
-
77
- export function createTypeScriptExtension(options: TypeScriptExtensionOptions = {}) {
78
- const plugin = (workbench: any) => typescriptExtension(workbench, options);
79
- plugin.extensionName = 'typescript';
80
- plugin.languageId = 'ts' as const;
81
- return plugin;
82
- }
83
-
84
- export const tsExtension = typescriptExtension;
85
- export default typescriptExtension;
@@ -1,5 +0,0 @@
1
- export { guidedLabExtension } from './guided-lab';
2
- export { javascriptExtension } from './javascript';
3
- export { typescriptExtension } from './typescript';
4
- export { cppExtension } from './cpp';
5
- export { pythonExtension } from './python';
package/src/html.ts DELETED
@@ -1,88 +0,0 @@
1
- /**
2
- * @innovatorved/code-lab — Safe HTML Tagged Template & Escaping Primitives
3
- * ============================================================================
4
- * Strict TypeScript leaf module. Every interpolated value in `html\`...\`` is
5
- * HTML-escaped by default unless explicitly wrapped with `raw(...)` or
6
- * produced by nested `html\`...\`` calls.
7
- */
8
-
9
- const SAFE_HTML_BRAND = Symbol.for('codelab.SafeHtml');
10
-
11
- export interface SafeHtml {
12
- readonly [SAFE_HTML_BRAND]: true;
13
- readonly __html: string;
14
- toString(): string;
15
- }
16
-
17
- class SafeHtmlImpl implements SafeHtml {
18
- readonly [SAFE_HTML_BRAND] = true as const;
19
- readonly __html: string;
20
-
21
- constructor(trusted: string) {
22
- this.__html = String(trusted);
23
- }
24
-
25
- toString(): string {
26
- return this.__html;
27
- }
28
- }
29
-
30
- export function isSafeHtml(value: unknown): value is SafeHtml {
31
- return Boolean(
32
- value &&
33
- typeof value === 'object' &&
34
- (value as Record<symbol, unknown>)[SAFE_HTML_BRAND] === true &&
35
- typeof (value as { __html?: unknown }).__html === 'string'
36
- );
37
- }
38
-
39
- export function escapeHtml(value: unknown): string {
40
- if (value === null || value === undefined) return '';
41
- if (isSafeHtml(value)) return value.__html;
42
- return String(value)
43
- .replace(/&/g, '&amp;')
44
- .replace(/</g, '&lt;')
45
- .replace(/>/g, '&gt;')
46
- .replace(/"/g, '&quot;')
47
- .replace(/'/g, '&#39;');
48
- }
49
-
50
- export function raw(trustedHtml: string): SafeHtml {
51
- return new SafeHtmlImpl(trustedHtml);
52
- }
53
-
54
- function renderInterpolation(value: unknown): string {
55
- if (value === null || value === undefined || value === false) return '';
56
- if (isSafeHtml(value)) return value.__html;
57
- if (Array.isArray(value)) {
58
- let out = '';
59
- for (let i = 0; i < value.length; i++) {
60
- out += renderInterpolation(value[i]);
61
- }
62
- return out;
63
- }
64
- return escapeHtml(value);
65
- }
66
-
67
- export function html(strings: TemplateStringsArray, ...values: unknown[]): SafeHtml {
68
- let out = strings[0] ?? '';
69
- for (let i = 0; i < values.length; i++) {
70
- out += renderInterpolation(values[i]);
71
- out += strings[i + 1] ?? '';
72
- }
73
- return new SafeHtmlImpl(out);
74
- }
75
-
76
- const _htmlNamespace = {
77
- escapeHtml,
78
- raw,
79
- isSafeHtml,
80
- html
81
- };
82
-
83
- const _globalRoot = typeof globalThis !== 'undefined' ? (globalThis as Record<string, unknown>) : null;
84
- if (_globalRoot && !_globalRoot.CodeLabHtml) {
85
- _globalRoot.CodeLabHtml = _htmlNamespace;
86
- }
87
-
88
- export default _htmlNamespace;
package/src/index.ts DELETED
@@ -1,129 +0,0 @@
1
- /**
2
- * @innovatorved/code-lab v0.7.0
3
- * Browser-native IDE, POSIX Shell, Web Worker Node.js/Bun Runtime, WASI C++20 Toolchain, Python 3.12 WebAssembly, and Git Engine.
4
- */
5
-
6
- export * from './schemas';
7
- export * from './logger';
8
- export { type SafeHtml, isSafeHtml, raw, html } from './html';
9
- export * from './csp';
10
- export * from './zip';
11
- export {
12
- type StorageBackendType,
13
- type ProjectSummary,
14
- type WorkspaceStorageOptions,
15
- WorkspaceStorage,
16
- createWorkspaceStorage
17
- } from './storage';
18
- export {
19
- type SearchMatchItem,
20
- type SearchMatchGroup,
21
- type SearchResult,
22
- type ReplaceResult,
23
- escapeRegex,
24
- normalizeSearchPath,
25
- matchesGlob,
26
- searchInFiles,
27
- replaceInFiles
28
- } from './search';
29
- export {
30
- type DiagnosticListener,
31
- DiagnosticsStore,
32
- createDiagnosticsStore
33
- } from './diagnostics';
34
- export {
35
- type GitCommitRecord,
36
- type GitState,
37
- type GitStatusResult,
38
- computeShortCommitHash,
39
- createGitState,
40
- computeGitStatus,
41
- stageFile,
42
- unstageFile,
43
- commitChanges
44
- } from './scm';
45
- export * from './runtime';
46
- export {
47
- createPosixShell,
48
- cloneGitHubRepository,
49
- parseGitHubRepoUrl,
50
- CodeLabShell
51
- } from './shell';
52
- export * from './terminal';
53
- export {
54
- CodeLabWorkbench,
55
- Workbench,
56
- CodeLabElement,
57
- CodeLab
58
- } from './workbench';
59
- export * from './workbench/index';
60
- export { guidedLabExtension } from './extensions/guided-lab';
61
- export {
62
- type JavaScriptExtensionOptions,
63
- javascriptExtension,
64
- createJavaScriptExtension
65
- } from './extensions/javascript';
66
- export {
67
- type TypeScriptExtensionOptions,
68
- typescriptExtension,
69
- createTypeScriptExtension
70
- } from './extensions/typescript';
71
- export {
72
- type CppCompileOptions,
73
- type CppCompileResult,
74
- type CppCompilerAdapter,
75
- type CppSymbolDoc,
76
- DEFAULT_CPP_CDN_BASE_URL,
77
- BUILTIN_CPP_HEADERS,
78
- STANDARD_CPP20_HEADERS,
79
- CPP_COMPLETIONS_AND_HOVERS,
80
- extractTarToVfs,
81
- createTarArchive,
82
- seedCppHeadersIntoVfs,
83
- parseCppCompilerFlags,
84
- CppToolchainManager,
85
- registerCppCompilerOnRuntime,
86
- registerMonacoCppLanguageService,
87
- analyzeCppSource,
88
- applyClangStderrDiagnostics,
89
- cppExtension,
90
- createCppExtension
91
- } from './extensions/cpp';
92
- export {
93
- type ExtendedPythonExtensionOptions,
94
- type PythonCompileResult,
95
- type PythonSymbolDoc,
96
- DEFAULT_PYTHON_CDN_BASE_URL,
97
- BUILTIN_PYTHON_MODULES,
98
- PYTHON_COMPLETIONS_AND_HOVERS,
99
- PythonToolchainManager,
100
- seedPythonModulesIntoVfs,
101
- registerPythonCompilerOnRuntime,
102
- registerMonacoPythonLanguageService,
103
- analyzePythonSource,
104
- applyPythonTracebackDiagnostics,
105
- formatPythonSource,
106
- pythonExtension,
107
- createPythonExtension
108
- } from './extensions/python';
109
-
110
- import { guidedLabExtension } from './extensions/guided-lab';
111
- import { javascriptExtension } from './extensions/javascript';
112
- import { typescriptExtension } from './extensions/typescript';
113
- import { cppExtension } from './extensions/cpp';
114
- import { pythonExtension } from './extensions/python';
115
-
116
- declare const globalThis: any;
117
- const root = typeof window !== 'undefined' ? window : (typeof globalThis !== 'undefined' ? globalThis : {});
118
-
119
- // Attach extensions to CodeLab SDK
120
- if (root.CodeLab) {
121
- root.CodeLab.extensions = root.CodeLab.extensions || {};
122
- root.CodeLab.extensions.guidedLab = guidedLabExtension;
123
- root.CodeLab.extensions.javascript = javascriptExtension;
124
- root.CodeLab.extensions.typescript = typescriptExtension;
125
- root.CodeLab.extensions.cpp = cppExtension;
126
- root.CodeLab.extensions.python = pythonExtension;
127
- }
128
-
129
- export default (root.CodeLab || {});
package/src/logger.ts DELETED
@@ -1,139 +0,0 @@
1
- /**
2
- * @innovatorved/code-lab — Shared Leveled Logger & Typed Error Hierarchy
3
- * ============================================================================
4
- * Bundled as `CodeLabLogger` into the runtime, shell, terminal, and workbench
5
- * bundles so no subsystem needs empty `catch` blocks or ad-hoc console calls.
6
- */
7
-
8
- export const LOG_PREFIX = '[code-lab]';
9
-
10
- export type CodeLabLogLevel = 'debug' | 'info' | 'warn' | 'error';
11
-
12
- export interface CodeLabLogSink {
13
- debug?: (...args: unknown[]) => void;
14
- info?: (...args: unknown[]) => void;
15
- warn?: (...args: unknown[]) => void;
16
- error?: (...args: unknown[]) => void;
17
- }
18
-
19
- export interface CodeLabLoggerOptions {
20
- logger?: CodeLabLogSink | null;
21
- debug?: boolean;
22
- prefix?: string;
23
- }
24
-
25
- export interface CodeLabLogger {
26
- debug: (...args: unknown[]) => void;
27
- info: (...args: unknown[]) => void;
28
- warn: (...args: unknown[]) => void;
29
- error: (...args: unknown[]) => void;
30
- }
31
-
32
- export type CodeLabErrorCode =
33
- | 'E_SAVE'
34
- | 'E_PERSISTENCE'
35
- | 'E_INSTALL'
36
- | 'E_PREVIEW'
37
- | 'E_RUNTIME'
38
- | 'E_SHELL'
39
- | 'E_CLONE'
40
- | 'E_CONFIG';
41
-
42
- export interface CodeLabErrorOptions {
43
- cause?: unknown;
44
- recoverable?: boolean;
45
- details?: Record<string, unknown>;
46
- context?: Record<string, unknown>;
47
- }
48
-
49
- /**
50
- * Structured error surfaced through `wb.on('error', ...)` and `wb.on('save-state', ...)`.
51
- */
52
- export class CodeLabError extends Error {
53
- readonly code: CodeLabErrorCode;
54
- readonly options: CodeLabErrorOptions;
55
- override readonly cause?: unknown;
56
- readonly recoverable: boolean;
57
- readonly details?: Record<string, unknown>;
58
- readonly context?: Record<string, unknown>;
59
-
60
- constructor(code: CodeLabErrorCode, message: string, options: CodeLabErrorOptions = {}) {
61
- super(message);
62
- this.name = 'CodeLabError';
63
- this.code = code;
64
- this.options = options;
65
- this.cause = options.cause;
66
- this.recoverable = options.recoverable !== false;
67
- const meta = options.details ?? options.context;
68
- if (meta !== undefined) {
69
- this.details = meta;
70
- this.context = meta;
71
- }
72
- Object.setPrototypeOf(this, new.target.prototype);
73
- }
74
- }
75
-
76
- export function isCodeLabError(value: unknown): value is CodeLabError {
77
- return Boolean(
78
- value &&
79
- typeof value === 'object' &&
80
- (value instanceof CodeLabError ||
81
- ((value as { name?: unknown }).name === 'CodeLabError' &&
82
- typeof (value as { code?: unknown }).code === 'string'))
83
- );
84
- }
85
-
86
- /**
87
- * Small leveled logger. Hosts can pass `options.logger` to route diagnostics
88
- * into their own telemetry; `options.debug` enables verbose output. Errors and
89
- * warnings are never silently discarded.
90
- */
91
- export function createLogger(options: CodeLabLoggerOptions = {}): CodeLabLogger {
92
- const sink = options.logger ?? null;
93
- const debugEnabled = options.debug === true;
94
- const prefix = options.prefix || LOG_PREFIX;
95
-
96
- const write = (level: CodeLabLogLevel, args: unknown[]): void => {
97
- if (level === 'debug' && !debugEnabled) return;
98
- if (sink && typeof sink[level] === 'function') {
99
- let sinkError: unknown = null;
100
- try {
101
- (sink[level] as (...a: unknown[]) => void)(...args);
102
- return;
103
- } catch (err) {
104
- // A broken host logger must not break the IDE; fall through to console.
105
- sinkError = err;
106
- }
107
- void sinkError;
108
- }
109
- const consoleObj = typeof console !== 'undefined' ? console : null;
110
- const fn = consoleObj ? consoleObj[level] : null;
111
- if (typeof fn === 'function') {
112
- fn.call(consoleObj, prefix, ...args);
113
- }
114
- };
115
-
116
- return {
117
- debug: (...args: unknown[]) => write('debug', args),
118
- info: (...args: unknown[]) => write('info', args),
119
- warn: (...args: unknown[]) => write('warn', args),
120
- error: (...args: unknown[]) => write('error', args)
121
- };
122
- }
123
-
124
- export const DEFAULT_LOGGER: CodeLabLogger = createLogger();
125
-
126
- const _loggerNamespace = {
127
- LOG_PREFIX,
128
- CodeLabError,
129
- isCodeLabError,
130
- createLogger,
131
- DEFAULT_LOGGER
132
- };
133
-
134
- const _globalRoot = typeof globalThis !== 'undefined' ? (globalThis as Record<string, unknown>) : null;
135
- if (_globalRoot && !_globalRoot.CodeLabLogger) {
136
- _globalRoot.CodeLabLogger = _loggerNamespace;
137
- }
138
-
139
- export default _loggerNamespace;
@@ -1,11 +0,0 @@
1
- export * from '../packages/core/src/index';
2
- export * from '../packages/fs/src/index';
3
- export * from '../packages/settings/src/index';
4
- export * from '../packages/commands/src/index';
5
- export * from '../packages/sql/src/index';
6
- export * from '../packages/editor/src/index';
7
- export * from '../packages/runtime/src/index';
8
- export * from '../packages/terminal/src/index';
9
- export * from '../packages/preview/src/index';
10
- export * from '../packages/ui/src/index';
11
- export * from '../apps/web/src/index';