@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.
- package/ARCHITECTURE.md +2 -2
- package/CHANGELOG.md +30 -0
- package/README.md +6 -6
- package/dist/code-lab-sql.esm.js +19 -19
- package/dist/code-lab-sql.umd.js +20 -20
- package/dist/code-lab.css +1 -1
- package/dist/code-lab.d.ts +47 -38
- package/dist/code-lab.esm.js +1183 -1909
- package/dist/code-lab.js +1182 -1906
- package/dist/extensions/cpp.esm.js +132 -8760
- package/dist/extensions/cpp.js +124 -8770
- package/dist/extensions/guided-lab.esm.js +33 -6836
- package/dist/extensions/guided-lab.js +33 -6854
- package/dist/extensions/javascript.esm.js +1 -36
- package/dist/extensions/javascript.js +1 -58
- package/dist/extensions/python.esm.js +113 -8122
- package/dist/extensions/python.js +113 -8140
- package/dist/extensions/typescript.esm.js +1 -55
- package/dist/extensions/typescript.js +1 -77
- package/dist/index.d.ts +1 -1
- package/dist/logger.d.ts +4 -20
- package/dist/modular-kernel.d.ts +0 -5
- package/dist/packages/core/src/errors.d.ts +5 -1
- package/dist/packages/fs/src/backends.d.ts +0 -27
- package/dist/packages/fs/src/index.d.ts +1 -1
- package/dist/packages/ui/src/html.d.ts +1 -0
- package/dist/packages/ui/src/index.d.ts +1 -0
- package/dist/{apps/web/src/index.d.ts → packages/ui/src/kernel.d.ts} +3 -11
- package/dist/packages/ui/src/observability.d.ts +1 -1
- package/dist/packages/ui/src/settings-dialog.d.ts +0 -1
- package/dist/preview-sw.js +1 -1
- package/dist/runtime.d.ts +3 -0
- package/dist/runtime.esm.js +78 -78
- package/dist/runtime.js +78 -78
- package/dist/schemas.d.ts +10 -1
- package/dist/schemas.esm.js +33 -6815
- package/dist/schemas.js +33 -6831
- package/dist/shell.esm.js +277 -285
- package/dist/shell.js +277 -285
- package/dist/terminal.esm.js +9 -7
- package/dist/terminal.js +7 -7
- package/dist/workbench/command-palette.d.ts +0 -4
- package/dist/workbench/editor.d.ts +0 -4
- package/dist/workbench/index.d.ts +0 -22
- package/dist/workbench/intellisense.d.ts +1 -8
- package/dist/workbench/xterm-adapter.d.ts +0 -1
- package/package.json +4 -13
- package/dist/code-lab.umd.js +0 -6117
- package/dist/packages/editor/src/index.d.ts +0 -118
- package/dist/packages/preview/src/index.d.ts +0 -34
- package/dist/packages/runtime/src/index.d.ts +0 -47
- package/dist/packages/terminal/src/index.d.ts +0 -54
- package/dist/workbench/drawer.d.ts +0 -18
- package/dist/workbench/file-tree.d.ts +0 -11
- package/dist/workbench/guided-pane.d.ts +0 -11
- package/dist/workbench/styles.d.ts +0 -4
- package/dist/workbench/toolbar.d.ts +0 -17
- package/packages/commands/README.md +0 -7
- package/packages/commands/package.json +0 -16
- package/packages/commands/src/index.ts +0 -467
- package/packages/commands/tsconfig.json +0 -22
- package/packages/core/README.md +0 -12
- package/packages/core/package.json +0 -13
- package/packages/core/src/di.ts +0 -147
- package/packages/core/src/disposable.ts +0 -112
- package/packages/core/src/errors.ts +0 -205
- package/packages/core/src/events.ts +0 -157
- package/packages/core/src/index.ts +0 -49
- package/packages/core/src/path.ts +0 -118
- package/packages/core/src/registry.ts +0 -61
- package/packages/core/tsconfig.json +0 -19
- package/packages/editor/README.md +0 -9
- package/packages/editor/package.json +0 -18
- package/packages/editor/src/index.ts +0 -344
- package/packages/editor/tsconfig.json +0 -24
- package/packages/fs/README.md +0 -7
- package/packages/fs/package.json +0 -16
- package/packages/fs/src/backends.ts +0 -301
- package/packages/fs/src/index.ts +0 -18
- package/packages/fs/src/types.ts +0 -44
- package/packages/fs/src/vfs-service.ts +0 -257
- package/packages/fs/tsconfig.json +0 -22
- package/packages/preview/README.md +0 -3
- package/packages/preview/package.json +0 -16
- package/packages/preview/src/index.ts +0 -125
- package/packages/preview/tsconfig.json +0 -22
- package/packages/runtime/README.md +0 -3
- package/packages/runtime/package.json +0 -17
- package/packages/runtime/src/index.ts +0 -134
- package/packages/runtime/tsconfig.json +0 -23
- package/packages/settings/README.md +0 -7
- package/packages/settings/package.json +0 -16
- package/packages/settings/src/builtin-schemas.ts +0 -262
- package/packages/settings/src/configuration-service.ts +0 -609
- package/packages/settings/src/index.ts +0 -38
- package/packages/settings/src/jsonc.ts +0 -189
- package/packages/settings/src/schema.ts +0 -164
- package/packages/settings/tsconfig.json +0 -22
- package/packages/sql/README.md +0 -12
- package/packages/sql/package.json +0 -13
- package/packages/sql/src/completions.ts +0 -359
- package/packages/sql/src/diagnostics.ts +0 -200
- package/packages/sql/src/formatter.ts +0 -271
- package/packages/sql/src/index.ts +0 -54
- package/packages/sql/src/sql-editor.ts +0 -802
- package/packages/sql/src/styles.ts +0 -524
- package/packages/sql/src/tokenizer.ts +0 -457
- package/packages/sql/src/types.ts +0 -148
- package/packages/sql/tsconfig.json +0 -19
- package/packages/terminal/README.md +0 -3
- package/packages/terminal/package.json +0 -16
- package/packages/terminal/src/index.ts +0 -183
- package/packages/terminal/tsconfig.json +0 -22
- package/packages/ui/README.md +0 -8
- package/packages/ui/package.json +0 -18
- package/packages/ui/src/index.ts +0 -40
- package/packages/ui/src/observability.ts +0 -173
- package/packages/ui/src/plugin-registry.ts +0 -289
- package/packages/ui/src/settings-dialog.ts +0 -939
- package/packages/ui/src/themes.ts +0 -333
- package/packages/ui/tsconfig.json +0 -24
- package/src/code-lab.css +0 -8584
- package/src/csp.ts +0 -590
- package/src/diagnostics.ts +0 -287
- package/src/extensions/cpp.ts +0 -2389
- package/src/extensions/guided-lab.ts +0 -64
- package/src/extensions/javascript.ts +0 -54
- package/src/extensions/python.ts +0 -1737
- package/src/extensions/typescript.ts +0 -85
- package/src/extensions/umbrella.ts +0 -5
- package/src/html.ts +0 -88
- package/src/index.ts +0 -129
- package/src/logger.ts +0 -139
- package/src/modular-kernel.ts +0 -11
- package/src/preview-sw.js +0 -296
- package/src/runtime/test-harness.ts +0 -57
- package/src/runtime.ts +0 -10480
- package/src/sample.html +0 -304
- package/src/schemas.ts +0 -366
- package/src/scm.ts +0 -2453
- package/src/search.ts +0 -433
- package/src/shell.ts +0 -10987
- package/src/storage.ts +0 -773
- package/src/terminal.ts +0 -1400
- package/src/workbench/command-palette.ts +0 -381
- package/src/workbench/diff-editor.ts +0 -470
- package/src/workbench/drawer.ts +0 -157
- package/src/workbench/editor.ts +0 -49
- package/src/workbench/file-tree.ts +0 -51
- package/src/workbench/guided-pane.ts +0 -43
- package/src/workbench/icons.ts +0 -255
- package/src/workbench/index.ts +0 -44
- package/src/workbench/intellisense.ts +0 -1871
- package/src/workbench/share.ts +0 -128
- package/src/workbench/styles.ts +0 -211
- package/src/workbench/toolbar.ts +0 -182
- package/src/workbench/xterm-adapter.ts +0 -1571
- package/src/workbench.ts +0 -22132
- package/src/zip.ts +0 -348
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @code-lab/settings — Resilient JSON with Comments (JSONC) parser.
|
|
3
|
-
* Supports `//` line comments, `/* ... * /` block comments, and trailing commas,
|
|
4
|
-
* returning structured 1-based line/column diagnostics instead of throwing.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface JsoncParseError {
|
|
8
|
-
readonly message: string;
|
|
9
|
-
readonly offset: number;
|
|
10
|
-
readonly line: number;
|
|
11
|
-
readonly column: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface JsoncParseResult<T = unknown> {
|
|
15
|
-
readonly value: T | undefined;
|
|
16
|
-
readonly errors: readonly JsoncParseError[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function offsetToLineCol(text: string, offset: number): { line: number; column: number } {
|
|
20
|
-
let line = 1;
|
|
21
|
-
let col = 1;
|
|
22
|
-
const limit = Math.min(Math.max(0, offset), text.length);
|
|
23
|
-
for (let i = 0; i < limit; i++) {
|
|
24
|
-
if (text[i] === '\n') {
|
|
25
|
-
line++;
|
|
26
|
-
col = 1;
|
|
27
|
-
} else {
|
|
28
|
-
col++;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return { line, column: col };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function stripJsonCommentsAndTrailingCommas(input: string): {
|
|
35
|
-
cleaned: string;
|
|
36
|
-
errors: JsoncParseError[];
|
|
37
|
-
} {
|
|
38
|
-
const errors: JsoncParseError[] = [];
|
|
39
|
-
const chars: string[] = [];
|
|
40
|
-
let i = 0;
|
|
41
|
-
const len = input.length;
|
|
42
|
-
|
|
43
|
-
while (i < len) {
|
|
44
|
-
const ch = input[i];
|
|
45
|
-
const next = input[i + 1];
|
|
46
|
-
|
|
47
|
-
// String literal — preserve verbatim (handling escapes)
|
|
48
|
-
if (ch === '"') {
|
|
49
|
-
const start = i;
|
|
50
|
-
chars.push(ch);
|
|
51
|
-
i++;
|
|
52
|
-
let closed = false;
|
|
53
|
-
while (i < len) {
|
|
54
|
-
const c = input[i];
|
|
55
|
-
if (c === '\\') {
|
|
56
|
-
chars.push(c);
|
|
57
|
-
if (i + 1 < len) {
|
|
58
|
-
chars.push(input[i + 1]);
|
|
59
|
-
i += 2;
|
|
60
|
-
} else {
|
|
61
|
-
i++;
|
|
62
|
-
}
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
chars.push(c);
|
|
66
|
-
i++;
|
|
67
|
-
if (c === '"') {
|
|
68
|
-
closed = true;
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
if (c === '\n' || c === '\r') {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (!closed) {
|
|
76
|
-
const lc = offsetToLineCol(input, start);
|
|
77
|
-
errors.push({
|
|
78
|
-
message: 'Unterminated string literal in JSONC',
|
|
79
|
-
offset: start,
|
|
80
|
-
line: lc.line,
|
|
81
|
-
column: lc.column
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Line comment //
|
|
88
|
-
if (ch === '/' && next === '/') {
|
|
89
|
-
chars.push(' ', ' ');
|
|
90
|
-
i += 2;
|
|
91
|
-
while (i < len && input[i] !== '\n') {
|
|
92
|
-
chars.push(input[i] === '\r' ? '\r' : ' ');
|
|
93
|
-
i++;
|
|
94
|
-
}
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Block comment /* ... */
|
|
99
|
-
if (ch === '/' && next === '*') {
|
|
100
|
-
const start = i;
|
|
101
|
-
chars.push(' ', ' ');
|
|
102
|
-
i += 2;
|
|
103
|
-
let closed = false;
|
|
104
|
-
while (i < len) {
|
|
105
|
-
if (input[i] === '*' && input[i + 1] === '/') {
|
|
106
|
-
chars.push(' ', ' ');
|
|
107
|
-
i += 2;
|
|
108
|
-
closed = true;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
chars.push(input[i] === '\n' ? '\n' : input[i] === '\r' ? '\r' : ' ');
|
|
112
|
-
i++;
|
|
113
|
-
}
|
|
114
|
-
if (!closed) {
|
|
115
|
-
const lc = offsetToLineCol(input, start);
|
|
116
|
-
errors.push({
|
|
117
|
-
message: 'Unterminated block comment in JSONC',
|
|
118
|
-
offset: start,
|
|
119
|
-
line: lc.line,
|
|
120
|
-
column: lc.column
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
chars.push(ch);
|
|
127
|
-
i++;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Second pass: replace trailing commas before `}` or `]` with spaces (preserving offsets)
|
|
131
|
-
for (let idx = 0; idx < chars.length; idx++) {
|
|
132
|
-
if (chars[idx] === '"') {
|
|
133
|
-
idx++;
|
|
134
|
-
while (idx < chars.length) {
|
|
135
|
-
if (chars[idx] === '\\') {
|
|
136
|
-
idx += 2;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if (chars[idx] === '"') break;
|
|
140
|
-
idx++;
|
|
141
|
-
}
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
if (chars[idx] === ',') {
|
|
145
|
-
let look = idx + 1;
|
|
146
|
-
while (look < chars.length && /\s/.test(chars[look])) {
|
|
147
|
-
look++;
|
|
148
|
-
}
|
|
149
|
-
if (look < chars.length && (chars[look] === '}' || chars[look] === ']')) {
|
|
150
|
-
chars[idx] = ' ';
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return { cleaned: chars.join(''), errors };
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export function parseJsonc<T = unknown>(raw: string): JsoncParseResult<T> {
|
|
159
|
-
if (!raw || !raw.trim()) {
|
|
160
|
-
return { value: undefined, errors: [] };
|
|
161
|
-
}
|
|
162
|
-
const { cleaned, errors } = stripJsonCommentsAndTrailingCommas(raw);
|
|
163
|
-
try {
|
|
164
|
-
const parsed = JSON.parse(cleaned) as T;
|
|
165
|
-
return { value: parsed, errors };
|
|
166
|
-
} catch (err) {
|
|
167
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
168
|
-
const posMatch = /position\s+(\d+)/i.exec(msg);
|
|
169
|
-
const lineColMatch = /line\s+(\d+)\s+column\s+(\d+)/i.exec(msg);
|
|
170
|
-
const offset = posMatch ? Number(posMatch[1]) : 0;
|
|
171
|
-
const lc = posMatch
|
|
172
|
-
? offsetToLineCol(raw, offset)
|
|
173
|
-
: lineColMatch
|
|
174
|
-
? { line: Number(lineColMatch[1]), column: Number(lineColMatch[2]) }
|
|
175
|
-
: offsetToLineCol(raw, raw.length);
|
|
176
|
-
return {
|
|
177
|
-
value: undefined,
|
|
178
|
-
errors: [
|
|
179
|
-
...errors,
|
|
180
|
-
{
|
|
181
|
-
message: msg,
|
|
182
|
-
offset,
|
|
183
|
-
line: lc.line,
|
|
184
|
-
column: lc.column
|
|
185
|
-
}
|
|
186
|
-
]
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @code-lab/settings — CSP-safe zero-dependency JSON Schema (Draft-07 subset) validator.
|
|
3
|
-
* Never uses `new Function` or `eval`.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
7
|
-
|
|
8
|
-
export interface JsonSchema {
|
|
9
|
-
readonly $schema?: string;
|
|
10
|
-
readonly title?: string;
|
|
11
|
-
readonly description?: string;
|
|
12
|
-
readonly type?: JsonSchemaType | readonly JsonSchemaType[];
|
|
13
|
-
readonly enum?: readonly unknown[];
|
|
14
|
-
readonly default?: unknown;
|
|
15
|
-
readonly minimum?: number;
|
|
16
|
-
readonly maximum?: number;
|
|
17
|
-
readonly minLength?: number;
|
|
18
|
-
readonly maxLength?: number;
|
|
19
|
-
readonly pattern?: string;
|
|
20
|
-
readonly items?: JsonSchema;
|
|
21
|
-
readonly properties?: Readonly<Record<string, JsonSchema>>;
|
|
22
|
-
readonly required?: readonly string[];
|
|
23
|
-
readonly additionalProperties?: boolean | JsonSchema;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface SchemaValidationIssue {
|
|
27
|
-
readonly path: string;
|
|
28
|
-
readonly message: string;
|
|
29
|
-
readonly expected?: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function matchesSingleType(value: unknown, expected: JsonSchemaType): boolean {
|
|
33
|
-
switch (expected) {
|
|
34
|
-
case 'null':
|
|
35
|
-
return value === null;
|
|
36
|
-
case 'boolean':
|
|
37
|
-
return typeof value === 'boolean';
|
|
38
|
-
case 'string':
|
|
39
|
-
return typeof value === 'string';
|
|
40
|
-
case 'number':
|
|
41
|
-
return typeof value === 'number' && Number.isFinite(value);
|
|
42
|
-
case 'integer':
|
|
43
|
-
return typeof value === 'number' && Number.isInteger(value);
|
|
44
|
-
case 'array':
|
|
45
|
-
return Array.isArray(value);
|
|
46
|
-
case 'object':
|
|
47
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function validateJsonSchema(
|
|
52
|
-
value: unknown,
|
|
53
|
-
schema: JsonSchema,
|
|
54
|
-
path = '$'
|
|
55
|
-
): SchemaValidationIssue[] {
|
|
56
|
-
const issues: SchemaValidationIssue[] = [];
|
|
57
|
-
|
|
58
|
-
if (schema.type !== undefined) {
|
|
59
|
-
const allowed = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
60
|
-
const ok = allowed.some((t) => matchesSingleType(value, t as JsonSchemaType));
|
|
61
|
-
if (!ok) {
|
|
62
|
-
issues.push({
|
|
63
|
-
path,
|
|
64
|
-
message: `Expected type ${allowed.join(' | ')}, received ${value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value}`,
|
|
65
|
-
expected: allowed.join(' | ')
|
|
66
|
-
});
|
|
67
|
-
return issues;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (schema.enum !== undefined) {
|
|
72
|
-
const matched = schema.enum.some((candidate) => Object.is(candidate, value));
|
|
73
|
-
if (!matched) {
|
|
74
|
-
const formatted = schema.enum.map((v) => JSON.stringify(v)).join(', ');
|
|
75
|
-
issues.push({
|
|
76
|
-
path,
|
|
77
|
-
message: `Value ${JSON.stringify(value)} must be one of: ${formatted}`,
|
|
78
|
-
expected: formatted
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (typeof value === 'number') {
|
|
84
|
-
if (schema.minimum !== undefined && value < schema.minimum) {
|
|
85
|
-
issues.push({
|
|
86
|
-
path,
|
|
87
|
-
message: `Value ${value} is less than minimum ${schema.minimum}`,
|
|
88
|
-
expected: `>= ${schema.minimum}`
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (schema.maximum !== undefined && value > schema.maximum) {
|
|
92
|
-
issues.push({
|
|
93
|
-
path,
|
|
94
|
-
message: `Value ${value} exceeds maximum ${schema.maximum}`,
|
|
95
|
-
expected: `<= ${schema.maximum}`
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (typeof value === 'string') {
|
|
101
|
-
if (schema.minLength !== undefined && value.length < schema.minLength) {
|
|
102
|
-
issues.push({
|
|
103
|
-
path,
|
|
104
|
-
message: `String length ${value.length} is shorter than minLength ${schema.minLength}`
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (schema.maxLength !== undefined && value.length > schema.maxLength) {
|
|
108
|
-
issues.push({
|
|
109
|
-
path,
|
|
110
|
-
message: `String length ${value.length} exceeds maxLength ${schema.maxLength}`
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
if (schema.pattern !== undefined) {
|
|
114
|
-
try {
|
|
115
|
-
if (!new RegExp(schema.pattern).test(value)) {
|
|
116
|
-
issues.push({
|
|
117
|
-
path,
|
|
118
|
-
message: `String does not match pattern /${schema.pattern}/`
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
} catch (err) {
|
|
122
|
-
issues.push({
|
|
123
|
-
path,
|
|
124
|
-
message: `Invalid schema pattern /${schema.pattern}/: ${err instanceof Error ? err.message : String(err)}`
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (Array.isArray(value) && schema.items) {
|
|
131
|
-
for (let i = 0; i < value.length; i++) {
|
|
132
|
-
issues.push(...validateJsonSchema(value[i], schema.items, `${path}[${i}]`));
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
137
|
-
const record = value as Record<string, unknown>;
|
|
138
|
-
if (schema.required) {
|
|
139
|
-
for (const reqKey of schema.required) {
|
|
140
|
-
if (!(reqKey in record) || record[reqKey] === undefined) {
|
|
141
|
-
issues.push({
|
|
142
|
-
path: `${path}.${reqKey}`,
|
|
143
|
-
message: `Missing required property "${reqKey}"`
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
for (const [k, propVal] of Object.entries(record)) {
|
|
149
|
-
const propSchema = schema.properties?.[k];
|
|
150
|
-
if (propSchema) {
|
|
151
|
-
issues.push(...validateJsonSchema(propVal, propSchema, `${path}.${k}`));
|
|
152
|
-
} else if (schema.additionalProperties === false) {
|
|
153
|
-
issues.push({
|
|
154
|
-
path: `${path}.${k}`,
|
|
155
|
-
message: `Unknown property "${k}" is not allowed`
|
|
156
|
-
});
|
|
157
|
-
} else if (typeof schema.additionalProperties === 'object' && schema.additionalProperties !== null) {
|
|
158
|
-
issues.push(...validateJsonSchema(propVal, schema.additionalProperties, `${path}.${k}`));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return issues;
|
|
164
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"lib": ["ES2022"],
|
|
7
|
-
"strict": true,
|
|
8
|
-
"noImplicitAny": true,
|
|
9
|
-
"strictNullChecks": true,
|
|
10
|
-
"noUnusedLocals": true,
|
|
11
|
-
"noUnusedParameters": true,
|
|
12
|
-
"noImplicitReturns": true,
|
|
13
|
-
"noFallthroughCasesInSwitch": true,
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"forceConsistentCasingInFileNames": true,
|
|
17
|
-
"paths": {
|
|
18
|
-
"@code-lab/core": ["../core/src/index.ts"]
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"include": ["src/**/*.ts"]
|
|
22
|
-
}
|
package/packages/sql/README.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# `@code-lab/sql` (`@innovatorved/code-lab/sql`)
|
|
2
|
-
|
|
3
|
-
Zero-dependency lightweight SQL playground & inline editor (`< 35 KB` gzipped JS + CSS combined, zero WASM boot of its own) built for **PostgreSQL 18** and **SQLite 3**.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Chrome Modes**: `'inline'` (compact auto-height lesson blocks, safe for 5+ mounts per page) and `'playground'` (responsive split pane stacking `< 768px`, `>= 16px` touch font size on `pointer: coarse` devices).
|
|
8
|
-
- **Dialect Language Pack**: PostgreSQL 18 (`::type`, `$1`, `$$` dollar quotes, `ILIKE`, `LATERAL`, `RETURNING`, `FILTER`, JSONB `->`/`->>`/`@>`) and SQLite 3 (`PRAGMA`, `WITHOUT ROWID`, `ON CONFLICT DO UPDATE`, `GLOB`, backtick/bracket identifiers).
|
|
9
|
-
- **Zero-Dep Formatter**: `formatSql(sql, { dialect, indent: 2, keywordCase: 'upper' })`.
|
|
10
|
-
- **Schema-Aware Alias Autocomplete**: Resolves `FROM customers c JOIN orders o` so typing `o.` suggests `orders` columns with `type`, `PK`, and `FK→...` badges.
|
|
11
|
-
- **Inline Error Diagnostics**: `parseSqlEngineError(err, sql, dialect)` + `setDiagnostics()` renders wavy token underlines, gutter dots, and `aria-describedby` / `aria-invalid` status banners.
|
|
12
|
-
- **WCAG 2.1 AA Keyboard Navigation**: `Esc` toggles `Tab moves focus` mode (zero keyboard trap) + IME-safe `Enter` handling.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@code-lab/sql",
|
|
3
|
-
"version": "0.7.0",
|
|
4
|
-
"description": "Zero-dependency lightweight SQL editor & PostgreSQL 18 / SQLite 3 language pack (<35 KB gzipped) with schema-aware alias autocomplete, formatter, and inline error diagnostics.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./src/index.ts",
|
|
7
|
-
"types": "./src/index.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": "./src/index.ts"
|
|
10
|
-
},
|
|
11
|
-
"sideEffects": false,
|
|
12
|
-
"license": "MIT"
|
|
13
|
-
}
|