sygnal 6.6.0 → 7.1.0
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/CHANGELOG.md +258 -0
- package/README.md +2 -0
- package/dist/astro/index.cjs.js +32 -9
- package/dist/astro/index.cjs.js.map +1 -1
- package/dist/astro/index.mjs +32 -9
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/server.cjs.js +32 -43
- package/dist/astro/server.cjs.js.map +1 -1
- package/dist/astro/server.mjs +32 -43
- package/dist/astro/server.mjs.map +1 -1
- package/dist/devtools.cjs.js.map +1 -1
- package/dist/devtools.esm.js.map +1 -1
- package/dist/diagnostics.cjs.js +154 -6
- package/dist/diagnostics.cjs.js.map +1 -1
- package/dist/diagnostics.esm.js +153 -7
- package/dist/diagnostics.esm.js.map +1 -1
- package/dist/guide/accessibility.md +3 -1
- package/dist/guide/ai-chat.md +6 -6
- package/dist/guide/behaviors.md +1 -1
- package/dist/guide/element-commands.md +4 -2
- package/dist/guide/forms-reference.md +89 -3
- package/dist/guide/forms.md +8 -8
- package/dist/guide/http.md +77 -7
- package/dist/guide/migrating-to-7.md +314 -0
- package/dist/guide/recipes/ai-summarize.md +2 -1
- package/dist/guide/recipes/i18n.md +1 -1
- package/dist/guide/resources.md +2 -0
- package/dist/guide/timers.md +3 -3
- package/dist/guide/ui/tabs.md +5 -4
- package/dist/guide/ui/tooltip.md +24 -0
- package/dist/index.cjs.js +954 -388
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +300 -46
- package/dist/index.esm.js +953 -389
- package/dist/index.esm.js.map +1 -1
- package/dist/sygnal.min.js +1 -1
- package/dist/sygnal.min.js.map +1 -1
- package/dist/ui.cjs.js +96 -11
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.esm.js +96 -12
- package/dist/ui.esm.js.map +1 -1
- package/dist/vike/config/package.json +1 -1
- package/dist/vite/plugin.cjs.js +19 -9
- package/dist/vite/plugin.cjs.js.map +1 -1
- package/dist/vite/plugin.mjs +19 -9
- package/dist/vite/plugin.mjs.map +1 -1
- package/llms.txt +23 -22
- package/package.json +1 -1
- package/src/astro/index.d.ts +8 -0
- package/src/astro/index.ts +18 -0
- package/src/core/actions.ts +28 -21
- package/src/core/define.ts +2 -0
- package/src/core/hooks.ts +2 -2
- package/src/core/hosts/collection.ts +4 -3
- package/src/core/hosts/switchable.ts +26 -8
- package/src/core/instance.ts +66 -17
- package/src/core/runtime.ts +5 -1
- package/src/core/statics.ts +5 -5
- package/src/extra/ai/chat/behavior.ts +3 -3
- package/src/extra/ai/commandBar.ts +3 -3
- package/src/extra/ai/compose/behavior.ts +3 -3
- package/src/extra/ai/transports/shared.ts +10 -2
- package/src/extra/behaviors.ts +24 -3
- package/src/extra/diagnostics/checks/fetch.ts +21 -1
- package/src/extra/diagnostics/checks/forms.ts +4 -3
- package/src/extra/diagnostics/checks/index.ts +1 -0
- package/src/extra/diagnostics/checks/next.ts +49 -3
- package/src/extra/diagnostics/checks/props.ts +6 -1
- package/src/extra/diagnostics/checks/public.d.ts +12 -0
- package/src/extra/diagnostics/checks/timingAudit.ts +47 -0
- package/src/extra/diagnostics/codes.ts +24 -0
- package/src/extra/fetchDriver.ts +115 -7
- package/src/extra/fetchEventSource.ts +117 -0
- package/src/extra/form.ts +68 -26
- package/src/extra/formHelpers.ts +3 -1
- package/src/extra/lens.ts +3 -2
- package/src/extra/queryCache.ts +4 -3
- package/src/extra/socketDriver.ts +60 -9
- package/src/extra/ssr.ts +30 -41
- package/src/extra/testing.ts +100 -18
- package/src/extra/timers.ts +5 -2
- package/src/index.d.ts +299 -45
- package/src/index.ts +3 -0
- package/src/shared.ts +3 -0
- package/src/ui/dialog.ts +3 -2
- package/src/ui/tooltips.ts +92 -0
- package/src/ui.d.ts +35 -0
- package/src/ui.ts +1 -0
- package/src/vite/graph.ts +11 -3
- package/src/vite/plugin.d.ts +7 -0
- package/src/vite/plugin.ts +10 -5
package/dist/vite/plugin.mjs
CHANGED
|
@@ -864,17 +864,25 @@ function graphMiddleware(server, root, engine, ping = 25000) {
|
|
|
864
864
|
res.end(req.method === 'HEAD' ? undefined : body);
|
|
865
865
|
};
|
|
866
866
|
}
|
|
867
|
-
/**
|
|
868
|
-
|
|
867
|
+
/** The banner line when the project has no sygnal-check with the graph page (it used to print nothing). */
|
|
868
|
+
const GRAPH_MISSING_LINE = ' ➜ Sygnal graph: needs sygnal-check 0.10.0 or later in this project (npm i -D sygnal-check)';
|
|
869
|
+
/**
|
|
870
|
+
* Adds the page's URL under Vite's own when the dev server prints them, or, when the project's
|
|
871
|
+
* sygnal-check is missing or too old for the page (`available` false), a line saying what to install.
|
|
872
|
+
*/
|
|
873
|
+
function printGraphUrl(server, available = true) {
|
|
869
874
|
const print = server?.printUrls;
|
|
870
875
|
if (typeof print !== 'function')
|
|
871
876
|
return;
|
|
872
877
|
server.printUrls = function (...args) {
|
|
873
878
|
const out = print.apply(this, args);
|
|
874
879
|
try {
|
|
880
|
+
const logger = server.config?.logger || console;
|
|
875
881
|
const local = server.resolvedUrls?.local?.[0];
|
|
876
|
-
if (
|
|
877
|
-
|
|
882
|
+
if (!available)
|
|
883
|
+
logger.info(GRAPH_MISSING_LINE);
|
|
884
|
+
else if (local)
|
|
885
|
+
logger.info(` ➜ Sygnal graph: ${new URL(local).origin}${GRAPH_PATH}`);
|
|
878
886
|
}
|
|
879
887
|
catch (_) { }
|
|
880
888
|
return out;
|
|
@@ -1013,7 +1021,8 @@ function printGraphUrl(server) {
|
|
|
1013
1021
|
* skipped silently when missing; a sygnal-check without the page keeps the checker as in 5)
|
|
1014
1022
|
* builds it with createLiveProject on start and after each change: one build gives the page,
|
|
1015
1023
|
* the check overlay / console findings of 5, and the component stamps. Its URL is printed
|
|
1016
|
-
* under Vite's ("➜ Sygnal graph: http://localhost:5173/__sygnal/graph"
|
|
1024
|
+
* under Vite's ("➜ Sygnal graph: http://localhost:5173/__sygnal/graph"; without a sygnal-check
|
|
1025
|
+
* 0.10.0+ in the project, a line saying so instead). The modules of the
|
|
1017
1026
|
* scanned files get a tail setting a non-enumerable `__sygnalKey` (the static 'file#name'
|
|
1018
1027
|
* key, D521) on each top-level component function, which the runtime inspect() reports as
|
|
1019
1028
|
* `key`; with DevTools on, the dev entries also import 'virtual:sygnal/graph'
|
|
@@ -1081,7 +1090,7 @@ function sygnal(options = {}) {
|
|
|
1081
1090
|
// Files whose `import ... from 'sygnal'` resolves to the run() wrapper
|
|
1082
1091
|
const runtimeImporters = new Set();
|
|
1083
1092
|
// Statements run before the app starts: dev flag (+ strict flag)
|
|
1084
|
-
const flags = DEV_FLAG + (diagnostics.strict ? STRICT_FLAG : '');
|
|
1093
|
+
const flags = DEV_FLAG + (diagnostics.strict ? STRICT_FLAG : '') + (diagnostics.timingAudit ? AUDIT_FLAG : '');
|
|
1085
1094
|
const devImports = `import 'sygnal/diagnostics';import '${DEV_CLIENT}';`;
|
|
1086
1095
|
// D77: the DevTools bridge, dev only. First, so the diagnostics entry finds it.
|
|
1087
1096
|
// E-1: the MCP endpoint needs the bridge, so `mcp` turns it on
|
|
@@ -1279,8 +1288,7 @@ function sygnal(options = {}) {
|
|
|
1279
1288
|
// W-2 (D543): the page and its stream, behind the MCP endpoint's guard; its URL in the banner
|
|
1280
1289
|
if (graphOn && server?.middlewares) {
|
|
1281
1290
|
server.middlewares.use(graphMiddleware(server, root, engine));
|
|
1282
|
-
|
|
1283
|
-
printGraphUrl(server);
|
|
1291
|
+
printGraphUrl(server, graphAvailable(root));
|
|
1284
1292
|
}
|
|
1285
1293
|
},
|
|
1286
1294
|
transform(code, id, opts) {
|
|
@@ -1565,7 +1573,7 @@ function normalizeDiagnostics(value) {
|
|
|
1565
1573
|
if (!MODES.includes(mode)) {
|
|
1566
1574
|
throw new Error(`[vite-plugin-sygnal] diagnostics mode must be one of ${MODES.map(m => `'${m}'`).join(', ')}; got ${JSON.stringify(mode)}`);
|
|
1567
1575
|
}
|
|
1568
|
-
return { mode, strict: !!o.strict, ignore: Array.isArray(o.ignore) ? o.ignore.map(String) : [] };
|
|
1576
|
+
return { mode, strict: !!o.strict, timingAudit: !!o.timingAudit, ignore: Array.isArray(o.ignore) ? o.ignore.map(String) : [] };
|
|
1569
1577
|
}
|
|
1570
1578
|
/** Module id without a query or hash. */
|
|
1571
1579
|
function cleanId(id) {
|
|
@@ -1943,6 +1951,8 @@ function startChecker(server, root, mod, setup, opts, engine) {
|
|
|
1943
1951
|
}
|
|
1944
1952
|
const DEV_FLAG = 'if (globalThis.__SYGNAL_DEV__ === undefined) globalThis.__SYGNAL_DEV__ = true;';
|
|
1945
1953
|
const STRICT_FLAG = 'if (globalThis.__SYGNAL_STRICT__ === undefined) globalThis.__SYGNAL_STRICT__ = true;';
|
|
1954
|
+
// 7.0: the opt-in timing audit (SYG257, 'sygnal/diagnostics' checks/timingAudit.ts)
|
|
1955
|
+
const AUDIT_FLAG = 'if (globalThis.__SYGNAL_TIMING_AUDIT__ === undefined) globalThis.__SYGNAL_TIMING_AUDIT__ = true;';
|
|
1946
1956
|
// A top-level (column 0) run(Component, ...) statement: bare, or declaring a
|
|
1947
1957
|
// new binding. Assignments to existing variables, nested calls and indented
|
|
1948
1958
|
// calls (e.g. inside a function or test callback) do not match (B-007). It is
|