sygnal 6.6.0 → 7.0.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 +132 -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.map +1 -1
- 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 +87 -4
- package/dist/diagnostics.cjs.js.map +1 -1
- package/dist/diagnostics.esm.js +86 -5
- package/dist/diagnostics.esm.js.map +1 -1
- package/dist/guide/accessibility.md +2 -0
- 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/ui/tabs.md +5 -4
- package/dist/guide/ui/tooltip.md +24 -0
- package/dist/index.cjs.js +772 -318
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +198 -31
- package/dist/index.esm.js +772 -318
- 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 +17 -16
- 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/instance.ts +60 -16
- package/src/core/runtime.ts +5 -1
- 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 +8 -2
- package/src/extra/behaviors.ts +21 -0
- 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 +3 -0
- 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 +13 -0
- package/src/extra/fetchDriver.ts +112 -7
- package/src/extra/fetchEventSource.ts +113 -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 +10 -4
- package/src/extra/testing.ts +68 -11
- package/src/index.d.ts +197 -30
- package/src/index.ts +1 -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.cjs.js
CHANGED
|
@@ -867,17 +867,25 @@ function graphMiddleware(server, root, engine, ping = 25000) {
|
|
|
867
867
|
res.end(req.method === 'HEAD' ? undefined : body);
|
|
868
868
|
};
|
|
869
869
|
}
|
|
870
|
-
/**
|
|
871
|
-
|
|
870
|
+
/** The banner line when the project has no sygnal-check with the graph page (it used to print nothing). */
|
|
871
|
+
const GRAPH_MISSING_LINE = ' ➜ Sygnal graph: needs sygnal-check 0.10.0 or later in this project (npm i -D sygnal-check)';
|
|
872
|
+
/**
|
|
873
|
+
* Adds the page's URL under Vite's own when the dev server prints them, or, when the project's
|
|
874
|
+
* sygnal-check is missing or too old for the page (`available` false), a line saying what to install.
|
|
875
|
+
*/
|
|
876
|
+
function printGraphUrl(server, available = true) {
|
|
872
877
|
const print = server?.printUrls;
|
|
873
878
|
if (typeof print !== 'function')
|
|
874
879
|
return;
|
|
875
880
|
server.printUrls = function (...args) {
|
|
876
881
|
const out = print.apply(this, args);
|
|
877
882
|
try {
|
|
883
|
+
const logger = server.config?.logger || console;
|
|
878
884
|
const local = server.resolvedUrls?.local?.[0];
|
|
879
|
-
if (
|
|
880
|
-
|
|
885
|
+
if (!available)
|
|
886
|
+
logger.info(GRAPH_MISSING_LINE);
|
|
887
|
+
else if (local)
|
|
888
|
+
logger.info(` ➜ Sygnal graph: ${new URL(local).origin}${GRAPH_PATH}`);
|
|
881
889
|
}
|
|
882
890
|
catch (_) { }
|
|
883
891
|
return out;
|
|
@@ -1016,7 +1024,8 @@ function printGraphUrl(server) {
|
|
|
1016
1024
|
* skipped silently when missing; a sygnal-check without the page keeps the checker as in 5)
|
|
1017
1025
|
* builds it with createLiveProject on start and after each change: one build gives the page,
|
|
1018
1026
|
* the check overlay / console findings of 5, and the component stamps. Its URL is printed
|
|
1019
|
-
* under Vite's ("➜ Sygnal graph: http://localhost:5173/__sygnal/graph"
|
|
1027
|
+
* under Vite's ("➜ Sygnal graph: http://localhost:5173/__sygnal/graph"; without a sygnal-check
|
|
1028
|
+
* 0.10.0+ in the project, a line saying so instead). The modules of the
|
|
1020
1029
|
* scanned files get a tail setting a non-enumerable `__sygnalKey` (the static 'file#name'
|
|
1021
1030
|
* key, D521) on each top-level component function, which the runtime inspect() reports as
|
|
1022
1031
|
* `key`; with DevTools on, the dev entries also import 'virtual:sygnal/graph'
|
|
@@ -1084,7 +1093,7 @@ function sygnal(options = {}) {
|
|
|
1084
1093
|
// Files whose `import ... from 'sygnal'` resolves to the run() wrapper
|
|
1085
1094
|
const runtimeImporters = new Set();
|
|
1086
1095
|
// Statements run before the app starts: dev flag (+ strict flag)
|
|
1087
|
-
const flags = DEV_FLAG + (diagnostics.strict ? STRICT_FLAG : '');
|
|
1096
|
+
const flags = DEV_FLAG + (diagnostics.strict ? STRICT_FLAG : '') + (diagnostics.timingAudit ? AUDIT_FLAG : '');
|
|
1088
1097
|
const devImports = `import 'sygnal/diagnostics';import '${DEV_CLIENT}';`;
|
|
1089
1098
|
// D77: the DevTools bridge, dev only. First, so the diagnostics entry finds it.
|
|
1090
1099
|
// E-1: the MCP endpoint needs the bridge, so `mcp` turns it on
|
|
@@ -1282,8 +1291,7 @@ function sygnal(options = {}) {
|
|
|
1282
1291
|
// W-2 (D543): the page and its stream, behind the MCP endpoint's guard; its URL in the banner
|
|
1283
1292
|
if (graphOn && server?.middlewares) {
|
|
1284
1293
|
server.middlewares.use(graphMiddleware(server, root, engine));
|
|
1285
|
-
|
|
1286
|
-
printGraphUrl(server);
|
|
1294
|
+
printGraphUrl(server, graphAvailable(root));
|
|
1287
1295
|
}
|
|
1288
1296
|
},
|
|
1289
1297
|
transform(code, id, opts) {
|
|
@@ -1568,7 +1576,7 @@ function normalizeDiagnostics(value) {
|
|
|
1568
1576
|
if (!MODES.includes(mode)) {
|
|
1569
1577
|
throw new Error(`[vite-plugin-sygnal] diagnostics mode must be one of ${MODES.map(m => `'${m}'`).join(', ')}; got ${JSON.stringify(mode)}`);
|
|
1570
1578
|
}
|
|
1571
|
-
return { mode, strict: !!o.strict, ignore: Array.isArray(o.ignore) ? o.ignore.map(String) : [] };
|
|
1579
|
+
return { mode, strict: !!o.strict, timingAudit: !!o.timingAudit, ignore: Array.isArray(o.ignore) ? o.ignore.map(String) : [] };
|
|
1572
1580
|
}
|
|
1573
1581
|
/** Module id without a query or hash. */
|
|
1574
1582
|
function cleanId(id) {
|
|
@@ -1946,6 +1954,8 @@ function startChecker(server, root, mod, setup, opts, engine) {
|
|
|
1946
1954
|
}
|
|
1947
1955
|
const DEV_FLAG = 'if (globalThis.__SYGNAL_DEV__ === undefined) globalThis.__SYGNAL_DEV__ = true;';
|
|
1948
1956
|
const STRICT_FLAG = 'if (globalThis.__SYGNAL_STRICT__ === undefined) globalThis.__SYGNAL_STRICT__ = true;';
|
|
1957
|
+
// 7.0: the opt-in timing audit (SYG257, 'sygnal/diagnostics' checks/timingAudit.ts)
|
|
1958
|
+
const AUDIT_FLAG = 'if (globalThis.__SYGNAL_TIMING_AUDIT__ === undefined) globalThis.__SYGNAL_TIMING_AUDIT__ = true;';
|
|
1949
1959
|
// A top-level (column 0) run(Component, ...) statement: bare, or declaring a
|
|
1950
1960
|
// new binding. Assignments to existing variables, nested calls and indented
|
|
1951
1961
|
// calls (e.g. inside a function or test callback) do not match (B-007). It is
|