@innovatorved/code-lab 0.1.7 → 0.1.9

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.
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @innovatorved/code-lab — Unified Diagnostics & Problems Aggregator Store
3
+ * ============================================================================
4
+ * Aggregates diagnostics from Monaco TypeScript/JavaScript workers, runtime
5
+ * execution exceptions, preview errors, and linters into a reactive store
6
+ * driving editor markers and the bottom drawer Problems panel.
7
+ *
8
+ * Strict leaf module: fully typed, zero explicit any, zero empty catches.
9
+ */
10
+
11
+ export type DiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint';
12
+
13
+ export interface DiagnosticItem {
14
+ id: string;
15
+ file: string;
16
+ line: number;
17
+ col?: number;
18
+ column?: number;
19
+ endLine?: number;
20
+ endCol?: number;
21
+ endColumn?: number;
22
+ message: string;
23
+ severity: DiagnosticSeverity;
24
+ source?: string;
25
+ code?: string | number;
26
+ tags?: string[];
27
+ }
28
+
29
+ export type DiagnosticListener = (items: DiagnosticItem[]) => void;
30
+
31
+ export class DiagnosticsStore {
32
+ private readonly items: Map<string, DiagnosticItem> = new Map();
33
+ private readonly listeners: Set<DiagnosticListener> = new Set();
34
+
35
+ public add(item: DiagnosticItem): void {
36
+ if (!item || typeof item.id !== 'string' || !item.id) return;
37
+ const normalized: DiagnosticItem = {
38
+ ...item,
39
+ file: String(item.file || ''),
40
+ line: typeof item.line === 'number' && item.line > 0 ? Math.floor(item.line) : 1,
41
+ col: typeof item.col === 'number' && item.col > 0
42
+ ? Math.floor(item.col)
43
+ : (typeof item.column === 'number' && item.column > 0 ? Math.floor(item.column) : 1),
44
+ message: String(item.message || ''),
45
+ severity: item.severity || 'error'
46
+ };
47
+ this.items.set(normalized.id, normalized);
48
+ this.notify();
49
+ }
50
+
51
+ public remove(id: string): void {
52
+ if (this.items.delete(id)) {
53
+ this.notify();
54
+ }
55
+ }
56
+
57
+ public clear(source?: string): void {
58
+ if (source !== undefined && source !== '') {
59
+ let changed = false;
60
+ for (const [id, item] of this.items.entries()) {
61
+ if (item.source === source) {
62
+ this.items.delete(id);
63
+ changed = true;
64
+ }
65
+ }
66
+ if (changed) {
67
+ this.notify();
68
+ }
69
+ } else if (this.items.size > 0) {
70
+ this.items.clear();
71
+ this.notify();
72
+ }
73
+ }
74
+
75
+ public getAll(): DiagnosticItem[] {
76
+ return Array.from(this.items.values());
77
+ }
78
+
79
+ public getByFile(file: string): DiagnosticItem[] {
80
+ const out: DiagnosticItem[] = [];
81
+ for (const item of this.items.values()) {
82
+ if (item.file === file) {
83
+ out.push(item);
84
+ }
85
+ }
86
+ return out;
87
+ }
88
+
89
+ public subscribe(listener: DiagnosticListener): () => void {
90
+ this.listeners.add(listener);
91
+ return () => {
92
+ this.listeners.delete(listener);
93
+ };
94
+ }
95
+
96
+ private notify(): void {
97
+ if (this.listeners.size === 0) return;
98
+ const snapshot = this.getAll();
99
+ for (const listener of this.listeners) {
100
+ try {
101
+ listener(snapshot);
102
+ } catch (err) {
103
+ console.warn('[code-lab] diagnostics subscriber error:', err);
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ export function createDiagnosticsStore(): DiagnosticsStore {
110
+ return new DiagnosticsStore();
111
+ }
112
+
113
+ export default {
114
+ DiagnosticsStore,
115
+ createDiagnosticsStore
116
+ };
package/src/html.ts ADDED
@@ -0,0 +1,88 @@
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 CHANGED
@@ -1,9 +1,47 @@
1
1
  /**
2
- * @innovatorved/code-lab v0.1.7
2
+ * @innovatorved/code-lab v0.1.9
3
3
  * Browser-native IDE, POSIX Shell, Web Worker Node.js/Bun Runtime, and Git Engine.
4
4
  */
5
5
 
6
6
  export * from './schemas';
7
+ export * from './logger';
8
+ export { 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';
7
45
  export * from './runtime';
8
46
  export {
9
47
  createPosixShell,
package/src/logger.ts ADDED
@@ -0,0 +1,139 @@
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;
package/src/preview-sw.js CHANGED
@@ -8,6 +8,10 @@
8
8
  * This enables "pop out to tab" Web Preview for virtual HTTP / Bun servers that
9
9
  * exist only inside the workbench's in-memory runtime (no real OS socket).
10
10
  *
11
+ * The Content-Security-Policy, the storage shims and the violation reporter all
12
+ * come from `src/csp.ts`, which the build prepends to this file. The workbench
13
+ * embeds the same module, so the two can never drift.
14
+ *
11
15
  * Zero dependencies. Plain Service Worker script (no module imports) so it can
12
16
  * be registered directly from any host origin.
13
17
  */
@@ -16,49 +20,32 @@
16
20
 
17
21
  const PREVIEW_PREFIX = '/__preview/';
18
22
  const DISPATCH_TIMEOUT_MS = 15000;
23
+ const MAX_CONFIG_LENGTH = 8192;
19
24
 
20
- // Content-Security-Policy applied to every HTML preview response.
21
- //
22
- // The preview is untrusted user code. Inline/eval are allowed because previews
23
- // are built from arbitrary user source, but network access is restricted to
24
- // the preview origin plus data:/blob: so a preview cannot exfiltrate host data
25
- // to a third party. Keep this string in sync with PREVIEW_CSP in workbench.js.
26
- const PREVIEW_CSP = [
27
- "default-src 'self' data: blob:",
28
- "base-uri 'self'",
29
- "object-src 'none'",
30
- "script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:",
31
- "style-src 'self' 'unsafe-inline'",
32
- "img-src 'self' data: blob:",
33
- "font-src 'self' data:",
34
- "connect-src 'self' data: blob:",
35
- "media-src 'self' data: blob:",
36
- "worker-src 'self' blob:",
37
- "frame-src 'self' data: blob:",
38
- "form-action 'self'",
39
- "frame-ancestors 'self'"
40
- ].join('; ');
25
+ // Policy configured by the workbench via postMessage. The worker cannot read the
26
+ // host's options, so the host pushes the resolved policy after registering.
27
+ let configuredCsp = null;
41
28
 
42
- function injectPreviewHead(html, port) {
43
- const tags = [];
44
- if (!/<meta[^>]+http-equiv=["']?content-security-policy/i.test(html)) {
45
- tags.push(`<meta http-equiv="Content-Security-Policy" content="${PREVIEW_CSP}">`);
46
- }
47
- if (!/<base\b/i.test(html)) {
48
- tags.push(`<base href="${PREVIEW_PREFIX}${port}/">`);
49
- }
50
- if (tags.length === 0) return html;
29
+ function cspModule() {
30
+ // `CodeLabCsp` is declared by the prepended csp bundle (src/csp.ts).
31
+ return typeof CodeLabCsp !== 'undefined' ? CodeLabCsp : null;
32
+ }
51
33
 
52
- const injection = tags.join('');
53
- if (/<head\b[^>]*>/i.test(html)) {
54
- return html.replace(/<head\b[^>]*>/i, (match) => match + injection);
55
- }
56
- if (/<html\b[^>]*>/i.test(html)) {
57
- return html.replace(/<html\b[^>]*>/i, (match) => `${match}<head>${injection}</head>`);
58
- }
59
- return `<head>${injection}</head>${html}`;
34
+ function previewPolicy() {
35
+ if (configuredCsp) return configuredCsp;
36
+ const csp = cspModule();
37
+ if (!csp) return "default-src 'self'; object-src 'none'";
38
+ // The workbench pushes its resolved policy on registration, so this branch
39
+ // only runs in the brief window before that message arrives. Use the
40
+ // documented default (`balanced`) rather than a stricter one, otherwise the
41
+ // very first preview of a CDN-based app can be blocked by a race.
42
+ return csp.buildPreviewPolicy({ hostOrigin: self.location.origin, mode: 'balanced' });
60
43
  }
61
44
 
45
+ function previewShims() {
46
+ const csp = cspModule();
47
+ return csp ? csp.buildPreviewShims() : '';
48
+ }
62
49
 
63
50
  self.addEventListener('install', () => {
64
51
  self.skipWaiting();
@@ -68,6 +55,25 @@ self.addEventListener('activate', (event) => {
68
55
  event.waitUntil(self.clients.claim());
69
56
  });
70
57
 
58
+ self.addEventListener('message', (event) => {
59
+ const data = event && event.data;
60
+ if (!data || data.type !== 'codelab:config') return;
61
+ const csp = typeof data.csp === 'string' ? data.csp.trim() : '';
62
+ if (!csp || csp.length > MAX_CONFIG_LENGTH) return;
63
+ configuredCsp = csp;
64
+ // Acknowledge so the host can wait for confirmation before loading a frame.
65
+ try {
66
+ if (event.ports && event.ports[0]) {
67
+ event.ports[0].postMessage({ type: 'codelab:config-ready' });
68
+ } else if (event.source && typeof event.source.postMessage === 'function') {
69
+ event.source.postMessage({ type: 'codelab:config-ready' });
70
+ }
71
+ } catch (err) {
72
+ // The client may have navigated away between postMessage and reply.
73
+ console.warn('[code-lab] preview-sw: config acknowledgement failed', err);
74
+ }
75
+ });
76
+
71
77
  function parsePreviewPath(pathname) {
72
78
  const match = pathname.match(/^\/__preview\/(\d+)(\/.*)?$/);
73
79
  if (!match) return null;
@@ -75,8 +81,9 @@ function parsePreviewPath(pathname) {
75
81
  }
76
82
 
77
83
  function previewErrorResponse(status, title, message) {
84
+ const csp = previewPolicy();
78
85
  const body = `<!doctype html><meta charset="utf-8">` +
79
- `<meta http-equiv="Content-Security-Policy" content="${PREVIEW_CSP}">` +
86
+ `<meta http-equiv="Content-Security-Policy" content="${csp}">` +
80
87
  `<title>${title}</title>` +
81
88
  `<body style="font-family:system-ui,-apple-system,sans-serif;padding:32px;color:#666;background:#0a0a0a">` +
82
89
  `<h1 style="color:#e5e5e5;font-size:18px">${title}</h1><p>${message}</p></body>`;
@@ -84,12 +91,36 @@ function previewErrorResponse(status, title, message) {
84
91
  status,
85
92
  headers: {
86
93
  'Content-Type': 'text/html; charset=utf-8',
87
- 'Content-Security-Policy': PREVIEW_CSP,
94
+ 'Content-Security-Policy': csp,
88
95
  'X-Content-Type-Options': 'nosniff'
89
96
  }
90
97
  });
91
98
  }
92
99
 
100
+ /** Inject the policy, a base URL and the sandbox shims into an HTML response. */
101
+ function injectPreviewHead(html, port) {
102
+ const csp = previewPolicy();
103
+ const shims = previewShims();
104
+ const tags = [];
105
+ const hasCsp = /<meta[^>]+http-equiv=["']?content-security-policy/i.test(html);
106
+ const hasBase = /<base\b/i.test(html);
107
+ const hasShims = html.indexOf('data-codelab-preview-shims') !== -1;
108
+
109
+ if (!hasCsp) tags.push(`<meta http-equiv="Content-Security-Policy" content="${csp}">`);
110
+ if (!hasBase) tags.push(`<base href="${PREVIEW_PREFIX}${port}/">`);
111
+ if (!hasShims && shims) tags.push(shims);
112
+ if (tags.length === 0) return html;
113
+
114
+ const injection = tags.join('');
115
+ if (/<head\b[^>]*>/i.test(html)) {
116
+ return html.replace(/<head\b[^>]*>/i, (match) => match + injection);
117
+ }
118
+ if (/<html\b[^>]*>/i.test(html)) {
119
+ return html.replace(/<html\b[^>]*>/i, (match) => `${match}<head>${injection}</head>`);
120
+ }
121
+ return `<head>${injection}</head>${html}`;
122
+ }
123
+
93
124
  async function proxyVirtualRequest(event, port, targetPath) {
94
125
  const clients = await self.clients.matchAll({ type: 'window', includeUncontrolled: true });
95
126
  if (!clients || !clients.length) {
@@ -110,13 +141,18 @@ async function proxyVirtualRequest(event, port, targetPath) {
110
141
  for (const [key, value] of request.headers.entries()) {
111
142
  headers[key.toLowerCase()] = value;
112
143
  }
113
- } catch (_) {}
144
+ } catch (err) {
145
+ // Opaque or unsupported header collection; forward without request headers.
146
+ console.warn('[code-lab] preview-sw: could not read request headers', err);
147
+ }
114
148
 
115
149
  let body = null;
116
150
  if (!['GET', 'HEAD'].includes(method)) {
117
151
  try {
118
152
  body = await request.arrayBuffer();
119
- } catch (_) {}
153
+ } catch (err) {
154
+ console.warn('[code-lab] preview-sw: could not read request body', err);
155
+ }
120
156
  }
121
157
 
122
158
  const response = await new Promise((resolve) => {
@@ -151,11 +187,11 @@ async function proxyVirtualRequest(event, port, targetPath) {
151
187
  const responseHeaders = new Headers((response && response.headers) || {});
152
188
  const contentType = responseHeaders.get('content-type') || '';
153
189
 
154
- // Inject a CSP and a <base> so relative asset URLs in HTML responses resolve
155
- // under the `/__preview/:port/` namespace rather than the host document root.
190
+ // Inject the policy and a <base> so relative asset URLs in HTML responses
191
+ // resolve under the `/__preview/:port/` namespace rather than the host root.
156
192
  if (/text\/html/i.test(contentType) && typeof responseBody === 'string') {
157
193
  responseBody = injectPreviewHead(responseBody, port);
158
- responseHeaders.set('Content-Security-Policy', PREVIEW_CSP);
194
+ responseHeaders.set('Content-Security-Policy', previewPolicy());
159
195
  responseHeaders.set('X-Content-Type-Options', 'nosniff');
160
196
  }
161
197
 
@@ -170,7 +206,9 @@ self.addEventListener('fetch', (event) => {
170
206
  let url;
171
207
  try {
172
208
  url = new URL(event.request.url);
173
- } catch (_) {
209
+ } catch (err) {
210
+ // Non-standard request URL; let the network handle it.
211
+ console.warn('[code-lab] preview-sw: unparsable request URL', err);
174
212
  return;
175
213
  }
176
214