@solidjs/vite-plugin 3.0.0-next.32 → 3.0.0-next.34

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.
@@ -1,6 +1,6 @@
1
1
  import * as babel from '@babel/core';
2
2
  import remapping from '@ampproject/remapping';
3
- import solid from 'babel-preset-solid';
3
+ import solid from '@solidjs/babel-plugin';
4
4
  import { existsSync, readFileSync, mkdirSync, writeFileSync, rmSync } from 'fs';
5
5
  import { mergeAndConcat } from 'merge-anything';
6
6
  import { createRequire } from 'module';
@@ -477,6 +477,27 @@ function createDevAssetResolver(server, filter = defaultStyleFilter) {
477
477
  };
478
478
  }
479
479
 
480
+ /**
481
+ * Cross-instance-safe stand-in for vite's `isRunnableDevEnvironment`.
482
+ *
483
+ * Vite's helper is an `instanceof RunnableDevEnvironment` check against the
484
+ * class of whichever `vite` module the CALLER imported. When this plugin is
485
+ * consumed through a workspace/`link:` install, its own `vite` import can
486
+ * resolve to a different physical copy than the one running the dev server —
487
+ * and then the `instanceof` is false for every environment, silently standing
488
+ * the SSR/dev middlewares down. The `runner` accessor is the type's defining
489
+ * member (`RunnableDevEnvironment` is exactly "a DevEnvironment with a
490
+ * runner"), so presence-check it instead of trusting class identity.
491
+ */
492
+ function isRunnableEnvironment(environment) {
493
+ return !!environment && typeof environment === 'object' && 'runner' in environment;
494
+ }
495
+ function getEnvironmentConsumer(environment, options) {
496
+ const consumer = environment?.config?.consumer;
497
+ if (consumer === 'client' || consumer === 'server') return consumer;
498
+ return options?.ssr ? 'server' : 'client';
499
+ }
500
+
480
501
  const VIRTUAL_ID = '\0@solidjs/vite-plugin:boundary-modules';
481
502
 
482
503
  /**
@@ -511,7 +532,7 @@ function boundaryModules() {
511
532
  // scan all the same. Real dev/build module graphs resolve without
512
533
  // the flag and stay fully guarded.
513
534
  const scan = !!options?.scan;
514
- const server = this.environment.config.consumer === 'server';
535
+ const server = getEnvironmentConsumer(this.environment, options) === 'server';
515
536
  if (id === 'server-only') {
516
537
  if (!server && !scan) this.error(`[@solidjs/vite-plugin] Attempt to import 'server-only' in a client module: ${importer}. ` + `Code that uses this module must run only on the server — make sure it is only ` + `imported by server code (e.g. a server entry, a "use server" module, or code ` + `reached exclusively from them).`);
517
538
  } else if (id === 'client-only') {
@@ -528,31 +549,206 @@ function boundaryModules() {
528
549
  }
529
550
 
530
551
  /**
531
- * Cross-instance-safe stand-in for vite's `isRunnableDevEnvironment`.
552
+ * Agent diagnostics surface (`diagnostics: true`, dev serve only).
532
553
  *
533
- * Vite's helper is an `instanceof RunnableDevEnvironment` check against the
534
- * class of whichever `vite` module the CALLER imported. When this plugin is
535
- * consumed through a workspace/`link:` install, its own `vite` import can
536
- * resolve to a different physical copy than the one running the dev server —
537
- * and then the `instanceof` is false for every environment, silently standing
538
- * the SSR/dev middlewares down. The `runner` accessor is the type's defining
539
- * member (`RunnableDevEnvironment` is exactly "a DevEnvironment with a
540
- * runner"), so presence-check it instead of trusting class identity.
554
+ * Three pieces:
555
+ * - an injected client module (virtual, imported by index.html or the
556
+ * start-mode client entry) that installs the in-page bridge from the
557
+ * app's own `@solidjs/diagnostics` and answers requests over Vite's
558
+ * WebSocket custom events;
559
+ * - a collector that forwards requests to the page and correlates
560
+ * responses by id;
561
+ * - an HTTP endpoint (`/__solid/diagnostics`) fronting that round-trip so
562
+ * any out-of-process consumer (agent, MCP tool, curl) can drive capture
563
+ * sessions without holding a WebSocket.
564
+ *
565
+ * `@solidjs/diagnostics` is deliberately a type-only dependency of this
566
+ * plugin: the runtime bridge always comes from the app's own installed
567
+ * copy, so plugin releases and diagnostics releases stay uncoupled. The
568
+ * wire constants are re-declared here with types imported from the
569
+ * package, so drift fails the plugin's own compile.
541
570
  */
542
- function isRunnableEnvironment(environment) {
543
- return !!environment && typeof environment === 'object' && 'runner' in environment;
571
+ const DIAGNOSTICS_ENDPOINT = '/__solid/diagnostics';
572
+ const REQUEST_EVENT = 'solid:diagnostics:request';
573
+ const RESPONSE_EVENT = 'solid:diagnostics:response';
574
+ const DIAGNOSTICS_PACKAGE = '@solidjs/diagnostics';
575
+ const DIAGNOSTICS_CLIENT_ID = 'virtual:solid-diagnostics/client';
576
+ const METHODS = ['begin', 'end', 'active', 'whyDidRun', 'costs'];
577
+
578
+ /** How long the endpoint waits for a page to answer before failing the call. */
579
+ const RESPONSE_TIMEOUT_MS = 10_000;
580
+ function diagnosticsClientModuleCode() {
581
+ // Runtime imports resolve to the APP's diagnostics package (see the
582
+ // resolveId assist below) — the page speaks its own package's protocol.
583
+ return [`import { installDiagnosticsBridge } from '${DIAGNOSTICS_PACKAGE}/browser';`, `import {`, ` DIAGNOSTICS_REQUEST_EVENT,`, ` DIAGNOSTICS_RESPONSE_EVENT,`, `} from '${DIAGNOSTICS_PACKAGE}/protocol';`, ``, `const bridge = installDiagnosticsBridge();`, ``, `async function dispatch(request) {`, ` switch (request.method) {`, ` case 'begin': bridge.begin(request.params); return true;`, ` case 'end': return bridge.end();`, ` case 'active': return bridge.active();`, ` case 'whyDidRun': return bridge.whyDidRun(request.params.name);`, ` case 'costs': return bridge.costs();`, ` default: throw new Error('Unknown diagnostics method: ' + request.method);`, ` }`, `}`, ``, `if (import.meta.hot) {`, ` import.meta.hot.on(DIAGNOSTICS_REQUEST_EVENT, async (request) => {`, ` let response;`, ` try {`, ` response = { id: request.id, result: await dispatch(request) };`, ` } catch (error) {`, ` response = {`, ` id: request.id,`, ` error: error instanceof Error ? error.message : String(error),`, ` };`, ` }`, ` import.meta.hot.send(DIAGNOSTICS_RESPONSE_EVENT, response);`, ` });`, `}`].join('\n');
544
584
  }
545
- function getEnvironmentConsumer(environment, options) {
546
- const consumer = environment?.config?.consumer;
547
- if (consumer === 'client' || consumer === 'server') return consumer;
548
- return options?.ssr ? 'server' : 'client';
585
+ function sendJson(res, status, body) {
586
+ res.statusCode = status;
587
+ res.setHeader('Content-Type', 'application/json');
588
+ res.end(JSON.stringify(body));
589
+ }
590
+ function readJsonBody(req) {
591
+ return new Promise((resolve, reject) => {
592
+ const chunks = [];
593
+ req.on('data', chunk => chunks.push(chunk));
594
+ req.on('end', () => {
595
+ const text = Buffer.concat(chunks).toString('utf8');
596
+ if (!text) return resolve({});
597
+ try {
598
+ resolve(JSON.parse(text));
599
+ } catch {
600
+ reject(new Error('Request body is not valid JSON'));
601
+ }
602
+ });
603
+ req.on('error', reject);
604
+ });
605
+ }
606
+ function solidDiagnostics() {
607
+ let root = process.cwd();
608
+ let base = '/';
609
+ return {
610
+ name: 'solid:diagnostics',
611
+ // Dev-serve only: the channels this fronts exist in dev builds only.
612
+ apply(_config, env) {
613
+ return env.command === 'serve' && !env.isPreview;
614
+ },
615
+ configResolved(config) {
616
+ root = config.root;
617
+ base = config.base;
618
+ },
619
+ async resolveId(source, importer) {
620
+ if (source === DIAGNOSTICS_CLIENT_ID) {
621
+ return {
622
+ id: DIAGNOSTICS_CLIENT_ID,
623
+ moduleSideEffects: true
624
+ };
625
+ }
626
+ // The virtual module has no directory to resolve bare imports from;
627
+ // resolve the app's diagnostics package from the project root.
628
+ if (importer === DIAGNOSTICS_CLIENT_ID && source.startsWith(DIAGNOSTICS_PACKAGE)) {
629
+ const resolved = await this.resolve(source, path.resolve(root, 'index.html'), {
630
+ skipSelf: true
631
+ });
632
+ if (!resolved || resolved.id.startsWith('__vite-optional-peer-dep:')) {
633
+ this.error(`[@solidjs/vite-plugin] the diagnostics option requires ${DIAGNOSTICS_PACKAGE} ` + 'installed in the app (it provides the in-page bridge). Install it as a ' + 'development dependency or remove `diagnostics: true`.');
634
+ }
635
+ return resolved;
636
+ }
637
+ return null;
638
+ },
639
+ load(id) {
640
+ if (id === DIAGNOSTICS_CLIENT_ID) return diagnosticsClientModuleCode();
641
+ return null;
642
+ },
643
+ // Plain (index.html) apps get the client module injected here;
644
+ // start-mode apps import it from the generated client entry instead.
645
+ transformIndexHtml() {
646
+ return [{
647
+ tag: 'script',
648
+ attrs: {
649
+ type: 'module',
650
+ src: joinBase(base, '/@id/' + DIAGNOSTICS_CLIENT_ID)
651
+ },
652
+ injectTo: 'head'
653
+ }];
654
+ },
655
+ configureServer(server) {
656
+ const pending = new Map();
657
+ let nextId = 1;
658
+ server.ws.on(RESPONSE_EVENT, data => {
659
+ const entry = pending.get(data?.id);
660
+ if (!entry) return;
661
+ pending.delete(data.id);
662
+ clearTimeout(entry.timer);
663
+ entry.resolve(data);
664
+ });
665
+ server.middlewares.use(DIAGNOSTICS_ENDPOINT, async (req, res) => {
666
+ // The middleware mounts on the exact path; anything deeper is 404.
667
+ if (req.url && req.url !== '/' && req.url !== '') {
668
+ sendJson(res, 404, {
669
+ error: `Unknown diagnostics path ${req.url}`
670
+ });
671
+ return;
672
+ }
673
+ if (req.method === 'GET') {
674
+ sendJson(res, 200, {
675
+ ok: true,
676
+ methods: METHODS,
677
+ clients: server.ws.clients.size
678
+ });
679
+ return;
680
+ }
681
+ if (req.method !== 'POST') {
682
+ sendJson(res, 405, {
683
+ error: 'Use GET for status or POST { method, params }'
684
+ });
685
+ return;
686
+ }
687
+ let body;
688
+ try {
689
+ body = await readJsonBody(req);
690
+ } catch (error) {
691
+ sendJson(res, 400, {
692
+ error: error.message
693
+ });
694
+ return;
695
+ }
696
+ if (!body.method || !METHODS.includes(body.method)) {
697
+ sendJson(res, 400, {
698
+ error: `Unknown method ${JSON.stringify(body.method)}; expected one of: ${METHODS.join(', ')}`
699
+ });
700
+ return;
701
+ }
702
+ if (server.ws.clients.size === 0) {
703
+ sendJson(res, 503, {
704
+ error: 'No connected page. Open the app in a browser (dev server) so the ' + 'diagnostics bridge can answer.'
705
+ });
706
+ return;
707
+ }
708
+ const id = nextId++;
709
+ // Broadcast; with several open tabs the first responder wins. Good
710
+ // enough for the agent loop (one page under test); revisit with
711
+ // client targeting if multi-page capture ever matters.
712
+ const response = await new Promise(resolve => {
713
+ const timer = setTimeout(() => {
714
+ pending.delete(id);
715
+ resolve({
716
+ timeout: `No page answered within ${RESPONSE_TIMEOUT_MS}ms. The connected page ` + 'may predate `diagnostics: true` — reload it.'
717
+ });
718
+ }, RESPONSE_TIMEOUT_MS);
719
+ pending.set(id, {
720
+ resolve,
721
+ timer
722
+ });
723
+ server.ws.send(REQUEST_EVENT, {
724
+ id,
725
+ method: body.method,
726
+ params: body.params
727
+ });
728
+ });
729
+ if ('timeout' in response) {
730
+ sendJson(res, 504, {
731
+ error: response.timeout
732
+ });
733
+ } else if (response.error !== undefined) {
734
+ sendJson(res, 400, {
735
+ error: response.error
736
+ });
737
+ } else {
738
+ sendJson(res, 200, {
739
+ result: response.result
740
+ });
741
+ }
742
+ });
743
+ }
744
+ };
549
745
  }
550
746
 
551
747
  // The `"use server"` directive compiler. This wraps the native
552
- // `transformDirectives` pass from @dom-expressions/compiler (Rust/Oxc); the
748
+ // `transformDirectives` pass from @solidjs/compiler (Rust/Oxc); the
553
749
  // original Babel implementation (hoisted from solid-start) lived in this
554
750
  // directory through vite-plugin-solid@c052963e and remains the frozen
555
- // reference for the native pass's fixture suite in dom-expressions.
751
+ // reference for the native pass's fixture suite.
556
752
 
557
753
  let compilerPromise;
558
754
 
@@ -561,11 +757,11 @@ let compilerPromise;
561
757
  // compiler's opt-in loader in index.ts).
562
758
  async function loadCompiler() {
563
759
  try {
564
- return await (compilerPromise ??= import('@dom-expressions/compiler'));
760
+ return await (compilerPromise ??= import('@solidjs/compiler'));
565
761
  } catch (error) {
566
762
  compilerPromise = undefined;
567
763
  const reason = error instanceof Error ? `\n\nCause: ${error.message}` : '';
568
- throw new Error('@solidjs/vite-plugin: failed to load @dom-expressions/compiler (the "use server" ' + 'transform). Your platform should get a prebuilt native binary or the ' + '@dom-expressions/compiler-wasm32-wasi fallback — check that optional ' + 'dependencies were installed.' + reason);
764
+ throw new Error('@solidjs/vite-plugin: failed to load @solidjs/compiler (the "use server" ' + 'transform). Your platform should get a prebuilt native binary or the ' + '@solidjs/compiler-wasm32-wasi fallback — check that optional ' + 'dependencies were installed.' + reason);
569
765
  }
570
766
  }
571
767
 
@@ -1377,6 +1573,7 @@ function startServe(options, internal = {}) {
1377
1573
  const serverComponents = !!internal.serverComponents;
1378
1574
  const errorBoundary = options.errorBoundary !== false;
1379
1575
  const styleFilter = internal.styleFilter;
1576
+ const diagnostics = !!internal.diagnostics;
1380
1577
  let devtoolsEnabled = false;
1381
1578
  let devtoolsResolutions = {};
1382
1579
  let devtoolsIds = {};
@@ -1541,15 +1738,18 @@ function startServe(options, internal = {}) {
1541
1738
  const {
1542
1739
  app
1543
1740
  } = requireEntries();
1741
+ // Dev-only: the diagnostics bridge fronts dev-mode channels, so builds
1742
+ // never see this import (mirrors the plugin's own serve-only `apply`).
1743
+ const diagnosticsImport = diagnostics && !isBuild ? [`import ${JSON.stringify(DIAGNOSTICS_CLIENT_ID)};`] : [];
1544
1744
  if (clientMode) {
1545
1745
  // render(), not hydrate(): the shell's body is empty, the app mounts
1546
1746
  // fresh. Client code compiles non-hydratable in client mode, so the
1547
1747
  // app cannot claim server DOM anyway. The entry script is injected
1548
1748
  // without `async` (plain module = deferred), so document.body is
1549
1749
  // complete when this runs.
1550
- return [`import { render } from '@solidjs/web';`, ...errorBoundaryImport(), ...(toolbar ? [`import { DevToolbar } from ${JSON.stringify(DEVTOOLS_PACKAGE)};`] : []), `import App from ${JSON.stringify(app)};`, ``, `render(() => ${isBuild && errorBoundary ? '<DefaultErrorBoundary><App /></DefaultErrorBoundary>' : toolbar ? '<DevToolbar><App /></DevToolbar>' : '<App />'}, document.body);`].join('\n');
1750
+ return [...diagnosticsImport, `import { render } from '@solidjs/web';`, ...errorBoundaryImport(), ...(toolbar ? [`import { DevToolbar } from ${JSON.stringify(DEVTOOLS_PACKAGE)};`] : []), `import App from ${JSON.stringify(app)};`, ``, `render(() => ${isBuild && errorBoundary ? '<DefaultErrorBoundary><App /></DefaultErrorBoundary>' : toolbar ? '<DevToolbar><App /></DevToolbar>' : '<App />'}, document.body);`].join('\n');
1551
1751
  }
1552
- return [`import { hydrate } from '@solidjs/web';`, ...(toolbar ? [`import { DevToolbar } from ${JSON.stringify(DEVTOOLS_PACKAGE)};`] : []), ...(serverComponents ? [`import { installServerComponents } from '@solidjs/web/frames';`] : []), ...errorBoundaryImport(), `import Document from ${JSON.stringify(documentSpec())};`, `import App from ${JSON.stringify(app)};`, ``, ...(serverComponents ? [
1752
+ return [...diagnosticsImport, `import { hydrate } from '@solidjs/web';`, ...(toolbar ? [`import { DevToolbar } from ${JSON.stringify(DEVTOOLS_PACKAGE)};`] : []), ...(serverComponents ? [`import { installServerComponents } from '@solidjs/web/frames';`] : []), ...errorBoundaryImport(), `import Document from ${JSON.stringify(documentSpec())};`, `import App from ${JSON.stringify(app)};`, ``, ...(serverComponents ? [
1553
1753
  // Installs the t=0 document-adoption registry and the transport
1554
1754
  // policy (component responses morph their boundary instead of
1555
1755
  // decoding as data). Must run before hydrate().
@@ -1961,7 +2161,7 @@ function startServe(options, internal = {}) {
1961
2161
  return null;
1962
2162
  },
1963
2163
  async transform(code, id, opts) {
1964
- if (isBuild || !devtoolsEnabled) return null;
2164
+ if (isBuild || !devtoolsEnabled && !diagnostics) return null;
1965
2165
  const current = requireEntries();
1966
2166
  if (current.generated || getEnvironmentConsumer(this.environment, opts) !== 'client') {
1967
2167
  return null;
@@ -1971,12 +2171,17 @@ function startServe(options, internal = {}) {
1971
2171
  if (normalizePath(id.split('?')[0]) !== normalizePath(path.resolve(root, current.entryClient))) {
1972
2172
  return null;
1973
2173
  }
1974
- const toolbar = await resolveDevtools((source, importer) => this.resolve(source, importer, {
1975
- skipSelf: true
1976
- }), id, 'client');
1977
- if (!toolbar) return null;
2174
+ const injected = [];
2175
+ if (diagnostics) injected.push(`import ${JSON.stringify(DIAGNOSTICS_CLIENT_ID)};`);
2176
+ if (devtoolsEnabled) {
2177
+ const toolbar = await resolveDevtools((source, importer) => this.resolve(source, importer, {
2178
+ skipSelf: true
2179
+ }), id, 'client');
2180
+ if (toolbar) injected.push(`import ${JSON.stringify(DEVTOOLS_MOUNT_ID)};`);
2181
+ }
2182
+ if (injected.length === 0) return null;
1978
2183
  return {
1979
- code: `import ${JSON.stringify(DEVTOOLS_MOUNT_ID)};\n${code}`,
2184
+ code: `${injected.join('\n')}\n${code}`,
1980
2185
  map: null
1981
2186
  };
1982
2187
  },
@@ -2710,7 +2915,7 @@ const require$1 = createRequire(import.meta.url);
2710
2915
  * second string-literal argument of the form
2711
2916
  * `"__SOLID_LAZY_MODULE__:" + spec`, which `resolveLazyModuleUrls` swaps for
2712
2917
  * the project-relative resolved module path. The prefix and shape are FROZEN
2713
- * — the emitting side lives in @dom-expressions/compiler and must match.
2918
+ * — the emitting side lives in @solidjs/compiler and must match.
2714
2919
  */
2715
2920
  const LAZY_PLACEHOLDER_PREFIX = '__SOLID_LAZY_MODULE__:';
2716
2921
 
@@ -2828,18 +3033,17 @@ async function fetchAssets(key) {
2828
3033
  }
2829
3034
  export default (registry && registry[${JSON.stringify(root)}]) ||
2830
3035
  (bridgeUrl ? createBridgeResolver() : { resolve: jsOnly, resolveSync: jsOnly });`;
2831
- const SOLID_BUILT_INS = ['For', 'Show', 'Switch', 'Match', 'Loading', 'Reveal', 'Portal', 'Repeat', 'Dynamic', 'Errored'];
2832
3036
 
2833
3037
  /** Possible options for the extensions property */
2834
3038
 
2835
3039
  let nativeCompilerPromise;
2836
3040
  async function loadNativeCompiler() {
2837
3041
  try {
2838
- return await (nativeCompilerPromise ??= import('@dom-expressions/compiler'));
3042
+ return await (nativeCompilerPromise ??= import('@solidjs/compiler'));
2839
3043
  } catch (error) {
2840
3044
  nativeCompilerPromise = undefined;
2841
3045
  const reason = error instanceof Error ? `\n\nCause: ${error.message}` : '';
2842
- throw new Error('@solidjs/vite-plugin: failed to load @dom-expressions/compiler, which is required ' + 'in every mode (it drives the lazy, refresh, and server-function transforms; ' + 'compiler: "babel" only switches the JSX transform). Your platform should get ' + 'a prebuilt native binary or the @dom-expressions/compiler-wasm32-wasi fallback ' + '— check that optional dependencies were installed.' + reason);
3046
+ throw new Error('@solidjs/vite-plugin: failed to load @solidjs/compiler, which is required ' + 'in every mode (it drives the lazy, refresh, and server-function transforms; ' + 'compiler: "babel" only switches the JSX transform). Your platform should get ' + 'a prebuilt native binary or the @solidjs/compiler-wasm32-wasi fallback ' + '— check that optional dependencies were installed.' + reason);
2843
3047
  }
2844
3048
  }
2845
3049
 
@@ -2909,12 +3113,23 @@ function getSolidOptions(options, isSsr, dev, isTestMode = false) {
2909
3113
  hydratable: false
2910
3114
  };
2911
3115
  }
3116
+
3117
+ // Server components (serverFunctions.components) turn on the SSR-side
3118
+ // behavior-claims transform: ref/on* positions on intrinsic elements
3119
+ // compile to guarded `_bnd` claim holes instead of dropping. SSR-only
3120
+ // by construction (the dom generate ignores the flag), and apps without
3121
+ // the flag compile byte-for-byte as before.
3122
+ const serverComponents = typeof options.serverFunctions === 'object' && !!options.serverFunctions.components;
3123
+
3124
+ // Solid-specific defaults (moduleName "@solidjs/web", the control-flow
3125
+ // builtIns, contextToCustomElements, wrapConditionals) are baked into both
3126
+ // backends — @solidjs/compiler and @solidjs/babel-plugin — so only the
3127
+ // posture this plugin actually decides is passed.
2912
3128
  return {
2913
- moduleName: '@solidjs/web',
2914
- builtIns: SOLID_BUILT_INS,
2915
- contextToCustomElements: true,
2916
- wrapConditionals: true,
2917
3129
  ...solidOptions,
3130
+ ...(serverComponents && solidOptions.generate === 'ssr' ? {
3131
+ serverComponents: true
3132
+ } : {}),
2918
3133
  dev,
2919
3134
  ...(options.solid || {})
2920
3135
  };
@@ -3504,10 +3719,13 @@ function solidPlugin(options = {}) {
3504
3719
  }
3505
3720
 
3506
3721
  // Babel JSX backend: one babel.transformAsync hosting the user's
3507
- // options plus babel-preset-solid.
3722
+ // options plus @solidjs/babel-plugin. Appended to `plugins` (was the
3723
+ // sole preset pre-rename): user plugins still run before it, user
3724
+ // presets still run after — babel runs plugins before presets and
3725
+ // presets in reverse order, so the pass order is unchanged.
3508
3726
  const babelOptions = mergeAndConcat(babelUserOptions, {
3509
3727
  ...babelBaseOptions,
3510
- presets: [[solid, solidOptions]]
3728
+ plugins: [[solid, solidOptions]]
3511
3729
  });
3512
3730
  const result = await babel.transformAsync(code, babelOptions);
3513
3731
  if (!result) {
@@ -3549,10 +3767,17 @@ function solidPlugin(options = {}) {
3549
3767
  serverFunctions: !!options.serverFunctions,
3550
3768
  serverComponents,
3551
3769
  ssr: !!options.ssr,
3552
- styleFilter: filterDevStyles
3770
+ styleFilter: filterDevStyles,
3771
+ diagnostics: !!options.diagnostics
3553
3772
  }));
3554
3773
  }
3555
3774
 
3775
+ // Agent diagnostics endpoint + injected bridge (dev serve only — the
3776
+ // plugin no-ops itself for builds and preview via `apply`).
3777
+ if (options.diagnostics) {
3778
+ plugins.push(solidDiagnostics());
3779
+ }
3780
+
3556
3781
  // Builder-mode (environments API) client-before-server build ordering.
3557
3782
  // Server builds read the client manifest — `virtual:solid-manifest` bakes
3558
3783
  // dist/client/.vite/manifest.json in, and the persisted server-function