@somewhere-tech/cli 0.28.5 → 0.29.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 (59) hide show
  1. package/README.md +58 -13
  2. package/dist/commands/deploy.js +33 -8
  3. package/dist/commands/deploy.js.map +1 -1
  4. package/dist/commands/dev.js +298 -43
  5. package/dist/commands/dev.js.map +1 -1
  6. package/dist/commands/env.js +1 -1
  7. package/dist/commands/env.js.map +1 -1
  8. package/dist/commands/init.js +1 -1
  9. package/dist/commands/init.js.map +1 -1
  10. package/dist/commands/project.js +2 -1
  11. package/dist/commands/project.js.map +1 -1
  12. package/dist/commands/promote.js +11 -12
  13. package/dist/commands/promote.js.map +1 -1
  14. package/dist/commands/rollback.js +1 -1
  15. package/dist/commands/rollback.js.map +1 -1
  16. package/dist/commands/status.js +2 -2
  17. package/dist/commands/status.js.map +1 -1
  18. package/dist/lib/envfile-write.js +1 -1
  19. package/dist/lib/envfile-write.js.map +1 -1
  20. package/dist/lib/output.js +2 -2
  21. package/dist/lib/output.js.map +1 -1
  22. package/dist/local/compiler-core.js +24 -0
  23. package/dist/local/compiler-core.js.map +1 -0
  24. package/dist/local/compiler.js +444 -0
  25. package/dist/local/compiler.js.map +1 -0
  26. package/dist/local/dev-server.js +487 -0
  27. package/dist/local/dev-server.js.map +1 -0
  28. package/dist/local/loader.js +70 -9
  29. package/dist/local/loader.js.map +1 -1
  30. package/dist/local/loopback.js +54 -0
  31. package/dist/local/loopback.js.map +1 -0
  32. package/dist/local/runtime.js +1 -1
  33. package/dist/local/runtime.js.map +1 -1
  34. package/dist/local/server.js +12 -22
  35. package/dist/local/server.js.map +1 -1
  36. package/node_modules/esbuild-wasm/LICENSE.md +21 -0
  37. package/node_modules/esbuild-wasm/README.md +3 -0
  38. package/node_modules/esbuild-wasm/bin/esbuild +91 -0
  39. package/node_modules/esbuild-wasm/esbuild.wasm +0 -0
  40. package/node_modules/esbuild-wasm/esm/browser.d.ts +705 -0
  41. package/node_modules/esbuild-wasm/esm/browser.js +2393 -0
  42. package/node_modules/esbuild-wasm/esm/browser.min.js +20 -0
  43. package/node_modules/esbuild-wasm/lib/browser.d.ts +705 -0
  44. package/node_modules/esbuild-wasm/lib/browser.js +2438 -0
  45. package/node_modules/esbuild-wasm/lib/browser.min.js +22 -0
  46. package/node_modules/esbuild-wasm/lib/main.d.ts +705 -0
  47. package/node_modules/esbuild-wasm/lib/main.js +2051 -0
  48. package/node_modules/esbuild-wasm/package.json +19 -0
  49. package/node_modules/esbuild-wasm/wasm_exec.js +561 -0
  50. package/node_modules/esbuild-wasm/wasm_exec_node.js +39 -0
  51. package/npm-shrinkwrap.json +17 -2
  52. package/package.json +7 -5
  53. package/runtime/VENDOR.json +7 -0
  54. package/runtime/compiler/VENDOR.json +27 -0
  55. package/runtime/compiler/compile-core.cjs +1775 -0
  56. package/runtime/compiler/graph-contract.cjs +124 -0
  57. package/runtime/compiler/typed-functions.cjs +545 -0
  58. package/runtime/platform-context.mjs +5422 -1802
  59. package/runtime/sw-init.mjs +51 -5
@@ -0,0 +1,444 @@
1
+ /**
2
+ * The platform's compiler, running on your machine.
3
+ *
4
+ * `somewhere dev` does not build your app with a second toolchain that
5
+ * resembles the platform's. It runs the SAME compiler the compile container
6
+ * runs on deploy — `runtime/compiler/compile-core.cjs`, vendored verbatim out
7
+ * of the monorepo with a drift guard (scripts/extract-runtime.mjs,
8
+ * test/compiler-vendor.test.mjs) — so what renders on localhost is the deploy
9
+ * artifact, not an approximation of it. The parity fixture
10
+ * (test/compiler-parity.test.mjs) asserts that byte for byte.
11
+ *
12
+ * The compiler is host-parameterized: everything that differs between the
13
+ * container and this machine goes in one `host` object. Concretely, three
14
+ * things differ.
15
+ *
16
+ * esbuild. The container runs native esbuild; the CLI runs esbuild-wasm at
17
+ * the SAME pinned version. Not a preference — the published CLI's
18
+ * supply-chain rule is that every production dependency sits inside the
19
+ * signed artifact, and native esbuild ships 24 optional platform packages of
20
+ * which only the build machine's own can ever be installed. esbuild-wasm is
21
+ * one platform-independent package. Same version in, same bytes out; the
22
+ * parity fixture proves it every run.
23
+ *
24
+ * Where the app's dependencies come from. The container has a baked
25
+ * node_modules; you have YOUR node_modules, which is better — it is the
26
+ * exact tree you installed. When it is absent or does not satisfy a pin, the
27
+ * CLI resolves the way the container does, into a cache under
28
+ * ~/.somewhere/dev-deps, silently. See resolveAppDependencies below.
29
+ *
30
+ * Where the BUILD toolchain comes from. Never your project. The compiler
31
+ * treats typescript / postcss / autoprefixer / tailwind as its own
32
+ * machinery, not your app's (it deliberately refuses to install them from
33
+ * your package.json), so the CLI runs the container's EXACT pins from
34
+ * runtime/compiler/VENDOR.json into ~/.somewhere/dev-toolchain. Borrowing
35
+ * your tailwind 3.3 or typescript 5.2 would compile different CSS and
36
+ * resolve aliases differently — the precise local-vs-deploy divergence this
37
+ * whole loop exists to remove.
38
+ */
39
+ import { execFile } from 'node:child_process';
40
+ import { createHash } from 'node:crypto';
41
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
42
+ import { createRequire } from 'node:module';
43
+ import { homedir } from 'node:os';
44
+ import { dirname, join, resolve } from 'node:path';
45
+ import { fileURLToPath } from 'node:url';
46
+ import { promisify } from 'node:util';
47
+ const execFileAsync = promisify(execFile);
48
+ /** A compile that failed, located in the developer's own source. */
49
+ export class CompileFailure extends Error {
50
+ locations;
51
+ constructor(message, locations) {
52
+ super(message);
53
+ this.locations = locations;
54
+ this.name = 'CompileFailure';
55
+ }
56
+ }
57
+ function packageRoot() {
58
+ // dist/local/compiler.js → package root is two levels up.
59
+ return join(dirname(fileURLToPath(import.meta.url)), '..', '..');
60
+ }
61
+ export function readVendorManifest(root = packageRoot()) {
62
+ return JSON.parse(readFileSync(join(root, 'runtime', 'compiler', 'VENDOR.json'), 'utf8'));
63
+ }
64
+ // ─── Dependency resolution, with zero steps for the developer ───────────────
65
+ function cacheHome() {
66
+ return join(process.env.SOMEWHERE_DEV_CACHE ?? join(homedir(), '.somewhere'), '');
67
+ }
68
+ /**
69
+ * Install `specs` into `dir` as a bare node_modules tree.
70
+ *
71
+ * `--ignore-scripts` is the same supply-chain guard the container uses, and it
72
+ * matters MORE here: this runs on your machine, not in a throwaway container.
73
+ * A dependency's postinstall never executes. esbuild bundles a package's files
74
+ * without running them, so frontend dependencies do not need install scripts.
75
+ */
76
+ async function installInto(dir, specs) {
77
+ mkdirSync(dir, { recursive: true });
78
+ const manifest = join(dir, 'package.json');
79
+ if (!existsSync(manifest)) {
80
+ writeFileSync(manifest, JSON.stringify({ name: 'somewhere-dev-cache', private: true }, null, 2));
81
+ }
82
+ try {
83
+ await execFileAsync('npm', ['install', '--ignore-scripts', '--no-bin-links', '--no-audit', '--no-fund',
84
+ '--no-package-lock', '--prefix', dir, ...specs], { cwd: dir, maxBuffer: 32 * 1024 * 1024, env: { ...process.env, npm_config_ignore_scripts: 'true' } });
85
+ }
86
+ catch (err) {
87
+ const detail = err instanceof Error
88
+ ? (err.stderr ?? err.message).toString().slice(-600)
89
+ : String(err);
90
+ throw new Error(`Could not resolve ${specs.join(', ')}: ${detail}`);
91
+ }
92
+ }
93
+ /** True when `dir/node_modules/<name>` is a package esbuild would resolve. */
94
+ function installed(dir, name) {
95
+ return existsSync(join(dir, 'node_modules', name, 'package.json'));
96
+ }
97
+ /**
98
+ * The build toolchain, at the container's exact pins, in the CLI's cache.
99
+ *
100
+ * One directory per group because tailwind v3 and v4 are the same package NAME
101
+ * at incompatible majors — the container isolates them for that reason and so
102
+ * does this. Groups are prepared only when the project needs them: a project
103
+ * with no Tailwind never installs a Tailwind engine.
104
+ *
105
+ * Returns the group directories, already populated.
106
+ */
107
+ async function prepareToolchain(manifest, groups, onFirstInstall) {
108
+ const dirs = {};
109
+ for (const group of groups) {
110
+ const pins = manifest.toolchain[group];
111
+ if (!pins)
112
+ throw new Error(`the vendored compiler declares no "${group}" toolchain group`);
113
+ const dir = join(cacheHome(), 'dev-toolchain', `${group}-${digestOf(pins)}`);
114
+ dirs[group] = dir;
115
+ const missing = Object.entries(pins)
116
+ .filter(([name]) => !installed(dir, name))
117
+ .map(([name, range]) => `${name}@${range}`);
118
+ if (!missing.length)
119
+ continue;
120
+ onFirstInstall?.(`build toolchain (${missing.map((s) => s.split('@')[0] || s).join(', ')})`);
121
+ await installInto(dir, missing);
122
+ }
123
+ return dirs;
124
+ }
125
+ /**
126
+ * Install React at the version the compile image bakes, not the floor of the
127
+ * declared range (tsk_0312cf17).
128
+ *
129
+ * The image keeps React 19 in a tree of its own and prefers it over installing
130
+ * the app's range; locally that set does not exist, so the compiler took its
131
+ * other branch and floor-pinned instead — `react: ^19.2.0` became exactly
132
+ * 19.2.0 while the image served 19.2.7. The same tree, compiled by the same
133
+ * compiler, against two different Reacts.
134
+ *
135
+ * The fix is to rewrite the spec, NOT to add a second node_modules tree. That
136
+ * was tried and is actively worse: a package that physically lives inside the
137
+ * dependency cache resolves `react` to its own sibling before any search path
138
+ * is consulted, so a separate pinned tree gets bundled ALONGSIDE the cache's
139
+ * copy — two Reacts in one bundle, which renders a blank page. The image has no
140
+ * such problem because it ends up with one flat tree, and this keeps one too.
141
+ *
142
+ * Pinning the spec also stops npm resolving React on its own as a peer of
143
+ * something else (react-router-dom pulls one in), which is how a warm cache
144
+ * ended up serving a third version again.
145
+ */
146
+ export function applyImagePins(specs, pins) {
147
+ if (!Object.keys(pins).length)
148
+ return specs;
149
+ return specs.map((spec) => {
150
+ const at = spec.lastIndexOf('@');
151
+ const name = at > 0 ? spec.slice(0, at) : spec;
152
+ return pins[name] ? `${name}@${pins[name]}` : spec;
153
+ });
154
+ }
155
+ function digestOf(value) {
156
+ return createHash('sha256').update(JSON.stringify(value)).digest('hex').slice(0, 12);
157
+ }
158
+ /**
159
+ * Where the APP's own dependencies come from, in resolution order.
160
+ *
161
+ * 1. The project's own node_modules, when it exists. This is the whole reason
162
+ * a local loop can beat a cloud one: the tree is already on disk and it is
163
+ * the exact tree the developer installed.
164
+ * 2. A CLI-managed cache keyed by the project's dependency map, for the case
165
+ * where node_modules is absent (a fresh `somewhere init`, a clone with no
166
+ * install) or a declared pin is not satisfied by what is installed.
167
+ *
168
+ * Keying the cache on the dependency map rather than sharing one flat tree
169
+ * means two projects on incompatible majors of the same package never
170
+ * overwrite each other, and two projects with identical dependencies share the
171
+ * install for free.
172
+ */
173
+ function resolveAppDependencies(cwd, pkg, pins) {
174
+ const search = [];
175
+ const projectModules = join(cwd, 'node_modules');
176
+ if (existsSync(projectModules))
177
+ search.push(projectModules);
178
+ const deps = pkg.dependencies ?? {};
179
+ // The pins are part of the cache identity (tsk_0312cf17): when the image
180
+ // bumps its React and the CLI re-vendors, the old cache is simply not reused,
181
+ // so a warm cache can never keep serving the version we just moved off.
182
+ const cacheDir = join(cacheHome(), 'dev-deps', digestOf([Object.entries(deps).sort(), pins]));
183
+ // The core decides what is actually missing (its baked-satisfies rules run
184
+ // against this exact search path) and calls host.installPackages for the
185
+ // rest. All we do here is make the cache dir part of the search path.
186
+ search.push(join(cacheDir, 'node_modules'));
187
+ return search;
188
+ }
189
+ // ─── Entry detection — the same rule the deploy pipeline uses ───────────────
190
+ //
191
+ // The HTML's `<script type="module" src>` tags are the single source of truth
192
+ // for what the compiler is allowed to touch. Mirrors
193
+ // worker/src/utils/module-entry.ts; a divergence here would compile a
194
+ // different entry locally than on deploy, which is the one thing this loop
195
+ // must never do.
196
+ export function isCompilableEntry(path) {
197
+ return /\.(?:tsx?|jsx|mts|cts)$/i.test(path);
198
+ }
199
+ export function collectModuleEntryScripts(files) {
200
+ const entries = new Set();
201
+ for (const [path, content] of Object.entries(files)) {
202
+ if (typeof content !== 'string')
203
+ continue;
204
+ if (!path.toLowerCase().endsWith('.html'))
205
+ continue;
206
+ const tagRe = /<script\b[^>]*>/gi;
207
+ let m;
208
+ while ((m = tagRe.exec(content)) !== null) {
209
+ const tag = m[0];
210
+ if (!/\btype\s*=\s*["']module["']/i.test(tag))
211
+ continue;
212
+ const srcMatch = /\bsrc\s*=\s*["']([^"']+)["']/i.exec(tag);
213
+ if (!srcMatch)
214
+ continue;
215
+ let src = srcMatch[1];
216
+ if (src.startsWith('/'))
217
+ src = src.slice(1);
218
+ if (isCompilableEntry(src) && files[src] !== undefined)
219
+ entries.add(src);
220
+ }
221
+ }
222
+ return entries;
223
+ }
224
+ export function detectBundleEntry(files) {
225
+ const entries = collectModuleEntryScripts(files);
226
+ const indexHtml = files['index.html'];
227
+ if (typeof indexHtml === 'string') {
228
+ const tagRe = /<script\b[^>]*>/gi;
229
+ let m;
230
+ while ((m = tagRe.exec(indexHtml)) !== null) {
231
+ const tag = m[0];
232
+ if (!/\btype\s*=\s*["']module["']/i.test(tag))
233
+ continue;
234
+ const srcMatch = /\bsrc\s*=\s*["']([^"']+)["']/i.exec(tag);
235
+ if (!srcMatch)
236
+ continue;
237
+ let src = srcMatch[1];
238
+ if (src.startsWith('/'))
239
+ src = src.slice(1);
240
+ if (entries.has(src))
241
+ return src;
242
+ }
243
+ }
244
+ for (const e of entries)
245
+ return e;
246
+ return null;
247
+ }
248
+ /**
249
+ * Point index.html at the compiled bundle instead of the raw entry, and add a
250
+ * <link> for each CSS chunk esbuild split out. The deploy pipeline does exactly
251
+ * this rewrite before serving (jsx-compile.ts) — the browser must receive the
252
+ * same HTML locally or the page it renders is not the page deploy renders.
253
+ */
254
+ export function rewriteIndexHtml(html, entry, entryChunk, chunkNames) {
255
+ const escaped = entry.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
256
+ const reSourceEntry = new RegExp(`(<script\\b[^>]*\\bsrc\\s*=\\s*)(["'])/?${escaped}\\2`, 'i');
257
+ const reCompiledEntry = /(<script\b[^>]*\bsrc\s*=\s*)(["'])\/_compiled\/[^"']+\.js\2/i;
258
+ const newUrl = `/_compiled/${entryChunk}`;
259
+ let next = html.replace(reSourceEntry, `$1$2${newUrl}$2`);
260
+ if (next === html)
261
+ next = html.replace(reCompiledEntry, `$1$2${newUrl}$2`);
262
+ const cssChunks = chunkNames.filter((name) => name.endsWith('.css'));
263
+ const reCompiledCssLink = /<link\b[^>]*\brel\s*=\s*(["'])stylesheet\1[^>]*\bhref\s*=\s*(["'])\/_compiled\/[^"']+\.css\2[^>]*>/gi;
264
+ next = next.replace(reCompiledCssLink, '');
265
+ if (cssChunks.length) {
266
+ const linkTags = cssChunks.map((name) => `<link rel="stylesheet" href="/_compiled/${name}">`).join('\n');
267
+ const headClose = /<\/head\s*>/i;
268
+ const bodyOpen = /<body\b/i;
269
+ if (headClose.test(next))
270
+ next = next.replace(headClose, `${linkTags}\n</head>`);
271
+ else if (bodyOpen.test(next))
272
+ next = next.replace(bodyOpen, `${linkTags}\n<body`);
273
+ else
274
+ next = `${linkTags}\n${next}`;
275
+ }
276
+ return next;
277
+ }
278
+ export class LocalCompiler {
279
+ opts;
280
+ core = null;
281
+ searchPath = [];
282
+ depCacheDir = '';
283
+ constructor(opts) {
284
+ this.opts = opts;
285
+ }
286
+ /**
287
+ * Resolve everything the compiler needs before the first build, so every
288
+ * rebuild afterwards is pure compile time. Idempotent.
289
+ */
290
+ /**
291
+ * The node_modules dirs the compiler resolves the app's dependencies from,
292
+ * in order. The local FUNCTION runtime resolves against the same list, so a
293
+ * function and a component import the same copy of a package (tsk_3269026d).
294
+ * Empty until prepare() has run.
295
+ */
296
+ get moduleSearchPath() {
297
+ return this.searchPath;
298
+ }
299
+ async prepare(pkg, tailwindVersion) {
300
+ if (this.core)
301
+ return;
302
+ const root = packageRoot();
303
+ const manifest = readVendorManifest(root);
304
+ const requireVendored = createRequire(join(root, 'runtime', 'compiler', 'compile-core.cjs'));
305
+ const requireCli = createRequire(join(root, 'package.json'));
306
+ const groups = ['base', ...(tailwindVersion === 4 ? ['tw4'] : tailwindVersion === 3 ? ['tw3'] : [])];
307
+ const toolchainDirs = await prepareToolchain(manifest, groups, this.opts.onPrepare);
308
+ const react19Pins = manifest.toolchain.react19 ?? {};
309
+ this.searchPath = resolveAppDependencies(this.opts.cwd, pkg, react19Pins);
310
+ this.depCacheDir = resolve(this.searchPath[this.searchPath.length - 1], '..');
311
+ const requireToolchain = (group) => createRequire(join(toolchainDirs[group], 'package.json'));
312
+ const requireBase = requireToolchain('base');
313
+ const requireTw3 = toolchainDirs.tw3 ? requireToolchain('tw3') : null;
314
+ const requireTw4 = toolchainDirs.tw4 ? requireToolchain('tw4') : null;
315
+ const { createCompileCore } = requireVendored('./compile-core.cjs');
316
+ this.core = createCompileCore({
317
+ // esbuild-wasm at the container's exact version. Loaded through the CLI's
318
+ // own require so it comes from the CLI's bundled tree, never the project's.
319
+ esbuild: requireCli('esbuild-wasm'),
320
+ imageNodeModules: this.searchPath,
321
+ // No isolated React-19 set locally: it exists in the image to skip a cold
322
+ // install of react/react-dom, and here those either sit in the project's
323
+ // node_modules already or land in the dependency cache once and stay.
324
+ react19NodeModules: null,
325
+ tw4TailwindDir: toolchainDirs.tw4 ? join(toolchainDirs.tw4, 'node_modules', 'tailwindcss') : null,
326
+ requireImage: (spec) => {
327
+ // tailwindcss means v3 here, exactly as it does in the image; the v4
328
+ // engine is reached only through requireTw4.
329
+ if (spec === 'tailwindcss' && requireTw3)
330
+ return requireTw3(spec);
331
+ // semver rides along in the CLI's own dependencies already.
332
+ if (spec === 'semver')
333
+ return requireCli(spec);
334
+ return requireBase(spec);
335
+ },
336
+ requireTw4: requireTw4 ? (spec) => requireTw4(spec) : undefined,
337
+ // The container refuses to install without its per-build scoped proxy
338
+ // because it is egress-locked. This is the developer's own machine
339
+ // running their own npm; the proxy does not exist here and its absence
340
+ // is not a safety signal.
341
+ requiresPackageProxy: false,
342
+ installPackages: async ({ specs }) => {
343
+ const pinned = applyImagePins(specs, react19Pins);
344
+ this.opts.onPrepare?.(`${pinned.length} ${pinned.length === 1 ? 'dependency' : 'dependencies'} (${pinned.join(', ')})`);
345
+ await installInto(this.depCacheDir, pinned);
346
+ },
347
+ // The local loop is not a publication: no artifact upload capability, and
348
+ // an identity that says plainly where this build came from.
349
+ stamp: { source: `cli-vendored-${manifest.commit}`, toolchain: digestOf(manifest.files) },
350
+ });
351
+ }
352
+ /** Compile the project. Throws CompileFailure for an error in the developer's source. */
353
+ async compile(sources) {
354
+ const { files, binaryFiles } = sources;
355
+ const entry = detectBundleEntry(files);
356
+ if (!entry) {
357
+ throw new CompileFailure('No app entry found. index.html needs a <script type="module" src="/src/main.tsx"> pointing at your app entry — that tag is what the platform compiles, locally and on deploy.', []);
358
+ }
359
+ const transformEntries = [...collectModuleEntryScripts(files)].filter((path) => path !== entry);
360
+ if (!this.core)
361
+ throw new Error('LocalCompiler.prepare() must run before compile()');
362
+ let result;
363
+ try {
364
+ result = await this.core.compile({
365
+ project_id: 'somewhere-dev-local',
366
+ build_id: 'somewhere-dev-local',
367
+ entry,
368
+ files,
369
+ binary_files: binaryFiles,
370
+ function_entries: [],
371
+ transform_entries: transformEntries,
372
+ package_json: files['package.json'],
373
+ tsconfig: files['tsconfig.json'],
374
+ vite_env: this.opts.viteEnv ?? {},
375
+ });
376
+ }
377
+ catch (err) {
378
+ throw toCompileFailure(err);
379
+ }
380
+ if (!result.entry_chunk)
381
+ throw new CompileFailure('The compiler produced no entry chunk.', []);
382
+ const html = typeof files['index.html'] === 'string'
383
+ ? rewriteIndexHtml(files['index.html'], entry, result.entry_chunk, Object.keys(result.chunks))
384
+ : null;
385
+ return {
386
+ entryChunk: result.entry_chunk,
387
+ chunks: result.chunks,
388
+ html,
389
+ entry,
390
+ warnings: result.warnings ?? [],
391
+ sourceDigest: result.source_digest,
392
+ artifacts: result.artifact_manifest.artifacts,
393
+ };
394
+ }
395
+ }
396
+ /**
397
+ * Turn a compiler error into something with a file and a line.
398
+ *
399
+ * The compiler reports a syntax error as SOURCE_PARSE_ERROR with every bad
400
+ * file joined into one message (`src/App.tsx: Expected ";" ...`). esbuild's own
401
+ * errors carry a structured location. Both become a list of
402
+ * {file, line, column, text} so the terminal and the browser overlay can point
403
+ * at the exact line instead of printing a paragraph.
404
+ */
405
+ export function toCompileFailure(err) {
406
+ const locations = [];
407
+ // The compiler's own parse phase hands back {file, line, column, message}
408
+ // per bad file (source_errors). Use it verbatim — it is the most precise
409
+ // location available, and it is what a syntax error produces.
410
+ const sourceErrors = err?.source_errors;
411
+ if (Array.isArray(sourceErrors) && sourceErrors.length) {
412
+ for (const e of sourceErrors) {
413
+ locations.push({ file: e.file, line: e.line, column: e.column, text: e.message });
414
+ }
415
+ return new CompileFailure(sourceErrors[0].message, locations);
416
+ }
417
+ const esbuildErrors = err?.errors;
418
+ if (Array.isArray(esbuildErrors) && esbuildErrors.length) {
419
+ for (const e of esbuildErrors) {
420
+ locations.push({
421
+ file: e.location?.file ?? '',
422
+ line: e.location?.line,
423
+ column: e.location ? e.location.column + 1 : undefined,
424
+ text: e.text,
425
+ });
426
+ }
427
+ return new CompileFailure(esbuildErrors[0].text, locations);
428
+ }
429
+ const message = err instanceof Error ? err.message : String(err);
430
+ for (const part of message.split('; ')) {
431
+ // `src/App.tsx:12:4: Expected ";" but found "}"` and the shorter
432
+ // `src/App.tsx: Expected ...` the parse phase produces.
433
+ const withPos = /^([^\s:]+\.[a-z]+):(\d+):(\d+):\s*(.+)$/i.exec(part);
434
+ if (withPos) {
435
+ locations.push({ file: withPos[1], line: Number(withPos[2]), column: Number(withPos[3]), text: withPos[4] });
436
+ continue;
437
+ }
438
+ const fileOnly = /^([^\s:]+\.[a-z]+):\s*(.+)$/i.exec(part);
439
+ if (fileOnly)
440
+ locations.push({ file: fileOnly[1], text: fileOnly[2] });
441
+ }
442
+ return new CompileFailure(message, locations);
443
+ }
444
+ //# sourceMappingURL=compiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../src/local/compiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,S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