@kayjs/kay 1.110.0 → 1.112.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/dist/eslint.js +160 -27
- package/editors/zed/extension.toml +2 -2
- package/llms/build-and-start.md +1 -1
- package/llms/checks.md +1 -0
- package/llms/component-libraries.md +1 -1
- package/llms/deprecated-lints.md +1 -1
- package/llms/dev-tool.md +1 -1
- package/llms/effects.md +1 -0
- package/llms/head.md +1 -1
- package/llms/images.md +2 -0
- package/llms/islands-lazy-components.md +23 -0
- package/llms/islands.md +2 -14
- package/llms/lints.md +1 -1
- package/llms/navigation.md +2 -2
- package/llms/performance-lints.md +1 -0
- package/llms/prerendering.md +1 -1
- package/llms/project-new-and-add.md +2 -2
- package/llms/project.md +1 -1
- package/llms/templates-elements-slots-snippets.md +2 -2
- package/llms/upgrading-archive.md +107 -58
- package/llms/upgrading.md +20 -124
- package/llms/whats-new-archive.md +31 -31
- package/llms/whats-new.md +36 -32
- package/llms.txt +3 -2
- package/package.json +11 -11
- package/src/build/client.ts +10 -8
- package/src/build/island-images.ts +277 -0
- package/src/build/pipeline.ts +10 -4
- package/src/build/static.ts +99 -24
- package/src/check/schema-builders.ts +113 -8
- package/src/check/shadow-types.ts +3 -3
- package/src/compiler/codegen.ts +1 -1
- package/src/compiler/dom.ts +4 -3
- package/src/compiler/handed-data.ts +15 -0
- package/src/compiler/helper-imports.ts +2 -2
- package/src/compiler/html.ts +3 -7
- package/src/compiler/index.ts +3 -1
- package/src/compiler/items.ts +162 -0
- package/src/compiler/jsx.ts +6 -8
- package/src/compiler/kay-exports.ts +1 -0
- package/src/compiler/lints.ts +1 -1
- package/src/compiler/markup.ts +10 -3
- package/src/compiler/rewrite-types.ts +2 -0
- package/src/compiler/rewrite.ts +4 -2
- package/src/compiler/route-lints.ts +8 -0
- package/src/compiler/template-walk.ts +2 -1
- package/src/config-shape.ts +4 -1
- package/src/config.ts +2 -2
- package/src/features.ts +1 -1
- package/src/new.ts +16 -4
- package/src/project.ts +3 -3
- package/src/runtime/await.server.ts +4 -2
- package/src/runtime/dev-tab-env.ts +28 -3
- package/src/runtime/dom-loop.ts +2 -4
- package/src/runtime/dom.ts +1 -1
- package/src/runtime/html.ts +52 -6
- package/src/runtime/image.ts +22 -4
- package/src/runtime/index.ts +1 -1
- package/src/runtime/island.server.ts +3 -3
- package/src/runtime/navigate.ts +5 -0
- package/src/runtime/navigation.ts +4 -0
- package/src/runtime/page-swap.ts +4 -1
- package/src/runtime/reactive.ts +72 -0
- package/src/runtime/row-key.ts +4 -0
- package/src/runtime/swap-focus.ts +56 -9
- package/src/runtime/swap-kept.ts +28 -0
- package/src/server/client.ts +3 -0
- package/src/server/dev.ts +2 -0
- package/src/server/image.ts +1 -1
- package/src/server/kept-exports.ts +1 -0
- package/src/server/render-document.ts +3 -2
- package/src/server/render.ts +2 -2
- package/src/template-styles.ts +2 -2
- package/types/build/client.d.ts +6 -0
- package/types/build/client.d.ts.map +1 -1
- package/types/build/island-images.d.ts +45 -0
- package/types/build/island-images.d.ts.map +1 -0
- package/types/build/pipeline.d.ts.map +1 -1
- package/types/build/static.d.ts.map +1 -1
- package/types/check/schema-builders.d.ts.map +1 -1
- package/types/compiler/dom.d.ts.map +1 -1
- package/types/compiler/handed-data.d.ts +5 -0
- package/types/compiler/handed-data.d.ts.map +1 -0
- package/types/compiler/html.d.ts.map +1 -1
- package/types/compiler/index.d.ts.map +1 -1
- package/types/compiler/items.d.ts +13 -0
- package/types/compiler/items.d.ts.map +1 -1
- package/types/compiler/jsx.d.ts.map +1 -1
- package/types/compiler/kay-exports.d.ts.map +1 -1
- package/types/compiler/lints.d.ts +9 -1
- package/types/compiler/lints.d.ts.map +1 -1
- package/types/compiler/markup.d.ts +2 -0
- package/types/compiler/markup.d.ts.map +1 -1
- package/types/compiler/rewrite-types.d.ts +1 -0
- package/types/compiler/rewrite-types.d.ts.map +1 -1
- package/types/compiler/route-lints.d.ts +8 -0
- package/types/compiler/route-lints.d.ts.map +1 -1
- package/types/compiler/template-walk.d.ts.map +1 -1
- package/types/config-shape.d.ts.map +1 -1
- package/types/config.d.ts +3 -1
- package/types/config.d.ts.map +1 -1
- package/types/new.d.ts.map +1 -1
- package/types/project.d.ts +2 -2
- package/types/project.d.ts.map +1 -1
- package/types/runtime/await.server.d.ts.map +1 -1
- package/types/runtime/dev-tab-env.d.ts.map +1 -1
- package/types/runtime/dom-loop.d.ts +2 -1
- package/types/runtime/dom-loop.d.ts.map +1 -1
- package/types/runtime/dom.d.ts +1 -1
- package/types/runtime/dom.d.ts.map +1 -1
- package/types/runtime/html.d.ts +5 -2
- package/types/runtime/html.d.ts.map +1 -1
- package/types/runtime/image.d.ts.map +1 -1
- package/types/runtime/index.d.ts +1 -1
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/navigate.d.ts.map +1 -1
- package/types/runtime/navigation.d.ts +2 -0
- package/types/runtime/navigation.d.ts.map +1 -1
- package/types/runtime/reactive.d.ts +5 -0
- package/types/runtime/reactive.d.ts.map +1 -1
- package/types/runtime/row-key.d.ts +2 -0
- package/types/runtime/row-key.d.ts.map +1 -0
- package/types/runtime/swap-focus.d.ts +2 -0
- package/types/runtime/swap-focus.d.ts.map +1 -1
- package/types/runtime/swap-kept.d.ts.map +1 -1
- package/types/server/app-stages.d.ts +3 -1
- package/types/server/app-stages.d.ts.map +1 -1
- package/types/server/app.d.ts +3 -1
- package/types/server/app.d.ts.map +1 -1
- package/types/server/client.d.ts +2 -0
- package/types/server/client.d.ts.map +1 -1
- package/types/server/dev.d.ts +1 -0
- package/types/server/dev.d.ts.map +1 -1
- package/types/server/kept-exports.d.ts.map +1 -1
- package/types/server/render-document.d.ts.map +1 -1
- package/types/server/render.d.ts +2 -2
- package/types/server/render.d.ts.map +1 -1
package/dist/eslint.js
CHANGED
|
@@ -25,11 +25,11 @@ var __esm = (fn, res, err) => () => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// package.json
|
|
28
|
-
var version = "1.
|
|
28
|
+
var version = "1.112.0", peerDependencies;
|
|
29
29
|
var init_package = __esm(() => {
|
|
30
30
|
peerDependencies = {
|
|
31
31
|
"@happy-dom/global-registrator": "^20.14.6 || ^21.0.3",
|
|
32
|
-
"@kaynooo/pg-orm": "^7.0.0 || ^8.0.0",
|
|
32
|
+
"@kaynooo/pg-orm": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
33
33
|
"@types/bun": "^1.4.4",
|
|
34
34
|
"axe-core": "^4.14.0",
|
|
35
35
|
"happy-dom": "^20.14.6 || ^21.0.3",
|
|
@@ -100,7 +100,7 @@ function nameDestructuredRows(file) {
|
|
|
100
100
|
node.row = row;
|
|
101
101
|
node.children.unshift({ kind: "const", ...node.item, pattern: node.item, value: at, row });
|
|
102
102
|
});
|
|
103
|
-
return { ...file, template };
|
|
103
|
+
return { ...file, template, facts: undefined };
|
|
104
104
|
}
|
|
105
105
|
var PATTERN_ITEM;
|
|
106
106
|
var init_template_walk = __esm(() => {
|
|
@@ -3900,6 +3900,87 @@ function constDeclaration(b, node, src, memo) {
|
|
|
3900
3900
|
function parameterNames(pattern) {
|
|
3901
3901
|
return parsedBindingNames(pattern) ?? [];
|
|
3902
3902
|
}
|
|
3903
|
+
function skipString(text, from) {
|
|
3904
|
+
const quote = text[from];
|
|
3905
|
+
let index = from + 1;
|
|
3906
|
+
while (index < text.length && text[index] !== quote)
|
|
3907
|
+
index += text[index] === "\\" ? 2 : 1;
|
|
3908
|
+
return index;
|
|
3909
|
+
}
|
|
3910
|
+
function accessorParameters(params) {
|
|
3911
|
+
const names = [];
|
|
3912
|
+
let depth = 0;
|
|
3913
|
+
let from = 0;
|
|
3914
|
+
let defaulted = false;
|
|
3915
|
+
let position = 0;
|
|
3916
|
+
const close = (to) => {
|
|
3917
|
+
const name = defaulted ? undefined : PLAIN_PARAMETER.exec(params.slice(from, to).trim())?.[1];
|
|
3918
|
+
if (name !== undefined)
|
|
3919
|
+
names.push({ name, position });
|
|
3920
|
+
position++;
|
|
3921
|
+
from = to + 1;
|
|
3922
|
+
defaulted = false;
|
|
3923
|
+
};
|
|
3924
|
+
for (let index = 0;index < params.length; index++) {
|
|
3925
|
+
const char = params[index];
|
|
3926
|
+
if (char === "=" && params[index + 1] === ">") {
|
|
3927
|
+
index++;
|
|
3928
|
+
} else if (QUOTES.includes(char)) {
|
|
3929
|
+
index = skipString(params, index);
|
|
3930
|
+
} else if (OPENING.includes(char)) {
|
|
3931
|
+
depth++;
|
|
3932
|
+
} else if (CLOSING.includes(char)) {
|
|
3933
|
+
depth--;
|
|
3934
|
+
} else if (char === "," && depth === 0) {
|
|
3935
|
+
close(index);
|
|
3936
|
+
} else if (char === "=" && depth === 0) {
|
|
3937
|
+
defaulted = true;
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
close(params.length);
|
|
3941
|
+
return depth === 0 && names.length > 0 ? names : undefined;
|
|
3942
|
+
}
|
|
3943
|
+
function simpleArguments(src, args) {
|
|
3944
|
+
const text = src.slice(args.start, args.end);
|
|
3945
|
+
if (!CHAINS.test(text))
|
|
3946
|
+
return;
|
|
3947
|
+
const spans = [];
|
|
3948
|
+
let from = 0;
|
|
3949
|
+
for (const cut of [...[...text.matchAll(COMMA)].map((match) => match.index), text.length]) {
|
|
3950
|
+
const piece = text.slice(from, cut);
|
|
3951
|
+
const lead = piece.length - piece.trimStart().length;
|
|
3952
|
+
spans.push({ start: args.start + from + lead, end: args.start + from + piece.trimEnd().length });
|
|
3953
|
+
from = cut + 1;
|
|
3954
|
+
}
|
|
3955
|
+
return spans;
|
|
3956
|
+
}
|
|
3957
|
+
function addSlotCall(b, src, slot, helper) {
|
|
3958
|
+
const spans = slot.outlet?.args && simpleArguments(src, slot.outlet.args);
|
|
3959
|
+
if (!slot.outlet || !spans)
|
|
3960
|
+
return false;
|
|
3961
|
+
b.add(`${helper}(${PROPS}.`).addSource(slot.outlet.name);
|
|
3962
|
+
for (const span of spans)
|
|
3963
|
+
b.add(", () => ").addSource(span);
|
|
3964
|
+
b.add(")");
|
|
3965
|
+
return true;
|
|
3966
|
+
}
|
|
3967
|
+
function markBlock(sites, b, src, params, staticLoops) {
|
|
3968
|
+
if (!staticLoops && accessorParameters(src.slice(params.start, params.end)))
|
|
3969
|
+
sites.blocks.add(b.code.length);
|
|
3970
|
+
}
|
|
3971
|
+
function addBlockParameters(sites, b, src, params, staticLoops) {
|
|
3972
|
+
const bare = BARE_PARAMETER.test(src.slice(params.start, params.end));
|
|
3973
|
+
b.add(bare ? "" : "(");
|
|
3974
|
+
markBlock(sites, b, src, params, staticLoops);
|
|
3975
|
+
b.addSource(params).add(bare ? " => " : ") => ");
|
|
3976
|
+
}
|
|
3977
|
+
function addParameterReads(b, names, param, render) {
|
|
3978
|
+
if (names)
|
|
3979
|
+
b.add(`(${names.map(({ name, position }) => `${name} = ${param}(${name}${position === 0 ? "" : `, ${position}`}), `).join("")}`);
|
|
3980
|
+
render();
|
|
3981
|
+
if (names)
|
|
3982
|
+
b.add(")");
|
|
3983
|
+
}
|
|
3903
3984
|
function slotValue(b, slot) {
|
|
3904
3985
|
if (!slot.outlet) {
|
|
3905
3986
|
b.add(`${PROPS}.children`);
|
|
@@ -3930,6 +4011,25 @@ function addKeyParameters(b, node, src) {
|
|
|
3930
4011
|
b.add(", ").addSource(node.index);
|
|
3931
4012
|
b.add(")");
|
|
3932
4013
|
}
|
|
4014
|
+
function addLoopTail(b, node, src, accessorLoops, rowKey) {
|
|
4015
|
+
const keying = rowKeying(node, src);
|
|
4016
|
+
const keyed = !accessorLoops && keying.kind !== "positional";
|
|
4017
|
+
if (!node.fallback && (accessorLoops || keyed))
|
|
4018
|
+
b.add(", undefined");
|
|
4019
|
+
if (accessorLoops)
|
|
4020
|
+
b.add(keying.kind === "positional" ? ', "positional"' : ', "keyed"');
|
|
4021
|
+
else if (keyed)
|
|
4022
|
+
b.add(", undefined");
|
|
4023
|
+
if (!keyed)
|
|
4024
|
+
return;
|
|
4025
|
+
b.add(", ");
|
|
4026
|
+
if (keying.kind === "expression") {
|
|
4027
|
+
addKeyParameters(b, node, src);
|
|
4028
|
+
b.add(" => (").addSource(keying.key).add(")");
|
|
4029
|
+
} else {
|
|
4030
|
+
b.add(rowKey);
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
3933
4033
|
function readsName(expression, name) {
|
|
3934
4034
|
return new RegExp(`(?<![\\w$.])${name.replaceAll("$", "\\$")}(?![\\w$])`).test(expression);
|
|
3935
4035
|
}
|
|
@@ -3952,12 +4052,17 @@ function usedProps(element, text) {
|
|
|
3952
4052
|
const names = [...element.attributes.flatMap((attribute) => attribute.kind === "spread" ? [] : [attribute.name]), ...element.children.flatMap((child) => child.kind === "slot" ? [child.name] : [])];
|
|
3953
4053
|
return `, { ${names.map((name) => `${JSON.stringify(text(name).replace(BOUND, ""))}: 0`).join(", ")} }`;
|
|
3954
4054
|
}
|
|
3955
|
-
var pendingElements, BOUND;
|
|
4055
|
+
var pendingElements, PLAIN_PARAMETER, OPENING = "([{<", CLOSING = ")]}>", QUOTES = "\"'`", CHAIN, CHAINS, COMMA, BARE_PARAMETER, BOUND;
|
|
3956
4056
|
var init_items = __esm(() => {
|
|
3957
4057
|
init_ast();
|
|
3958
4058
|
init_names();
|
|
3959
4059
|
init_pattern_names();
|
|
3960
4060
|
pendingElements = new WeakMap;
|
|
4061
|
+
PLAIN_PARAMETER = /^([\p{ID_Start}$_][\p{ID_Continue}$]*)(?:\s*\?)?\s*(?::|$)/u;
|
|
4062
|
+
CHAIN = String.raw`[\p{ID_Start}$_][\p{ID_Continue}$]*(?:\.[\p{ID_Start}$_][\p{ID_Continue}$]*)*`;
|
|
4063
|
+
CHAINS = new RegExp(String.raw`^\s*${CHAIN}(?:\s*,\s*${CHAIN})*\s*$`, "u");
|
|
4064
|
+
COMMA = /,/g;
|
|
4065
|
+
BARE_PARAMETER = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u;
|
|
3961
4066
|
BOUND = /^bind:/;
|
|
3962
4067
|
});
|
|
3963
4068
|
|
|
@@ -3997,6 +4102,7 @@ var init_kay_exports = __esm(() => {
|
|
|
3997
4102
|
flush: "browser",
|
|
3998
4103
|
focusInvalid: "browser",
|
|
3999
4104
|
followLog: "browser",
|
|
4105
|
+
followed: "shared",
|
|
4000
4106
|
formErrors: "shared",
|
|
4001
4107
|
guard: "browser",
|
|
4002
4108
|
guardLeave: "browser",
|
|
@@ -7212,6 +7318,7 @@ class TemplateWriter {
|
|
|
7212
7318
|
classTable = undefined;
|
|
7213
7319
|
mergesAtRuntime = false;
|
|
7214
7320
|
lazySlots = false;
|
|
7321
|
+
accessorBlocks = true;
|
|
7215
7322
|
scoping = "formScope";
|
|
7216
7323
|
wiresLoose = true;
|
|
7217
7324
|
formOf(node) {
|
|
@@ -7340,10 +7447,13 @@ class TemplateWriter {
|
|
|
7340
7447
|
const { b } = this;
|
|
7341
7448
|
b.wrap(node, () => {
|
|
7342
7449
|
b.add("const ").addSource(node.name).add(" = (").addSource(node.params).add(") => ");
|
|
7343
|
-
this.childrenValue(node.children);
|
|
7450
|
+
this.readingParameters(node.params, () => this.childrenValue(node.children));
|
|
7344
7451
|
b.add("; ");
|
|
7345
7452
|
});
|
|
7346
7453
|
}
|
|
7454
|
+
readingParameters(params, render) {
|
|
7455
|
+
addParameterReads(this.b, this.accessorBlocks ? accessorParameters(this.source(params)) : undefined, helperName("param"), render);
|
|
7456
|
+
}
|
|
7347
7457
|
componentProps(element, getters, except) {
|
|
7348
7458
|
const { b } = this;
|
|
7349
7459
|
const spreads = element.attributes.some((attribute) => attribute.kind === "spread") || writesTogether(element, this.src, this.facts.parts);
|
|
@@ -7355,7 +7465,7 @@ class TemplateWriter {
|
|
|
7355
7465
|
props.separate();
|
|
7356
7466
|
if (slot.params) {
|
|
7357
7467
|
b.add(`${JSON.stringify(this.source(slot.name))}: (`).addSource(slot.params).add(") => ");
|
|
7358
|
-
this.childrenValue(slot.children);
|
|
7468
|
+
this.readingParameters(slot.params, () => this.childrenValue(slot.children));
|
|
7359
7469
|
} else {
|
|
7360
7470
|
b.add(`get ${JSON.stringify(this.source(slot.name))}() { return `);
|
|
7361
7471
|
this.childrenValue(slot.children, this.lazySlots, scope, spreads);
|
|
@@ -7917,8 +8027,8 @@ function awaitAlertTail(alert, target) {
|
|
|
7917
8027
|
var HTML_HELPERS, DOM_HELPERS, APART;
|
|
7918
8028
|
var init_helper_imports = __esm(() => {
|
|
7919
8029
|
init_markup();
|
|
7920
|
-
HTML_HELPERS = ["attempt", "attribute", "checkedMarkup", "child", "className", "component", "componentClass", "currentPage", "dynamic", "element", "errorParagraph", "fieldDescribed", "formConstraints", "formKey", "formOptions", "formType", "handParts", "head", "html", "imageAttributes", "innerMarkup", "leadingNewline", "linkHref", "localHref", "loop", "memo", "merge", "nonEmptyAttribute", "omit", "outsideLink", "partClass", "partHanded", "partProps", "raw", "rawData", "rawTyped", "refillOptions", "schemaFill", "selectOptions", "serverIsland", "show", "spreadAttributes", "spreadWith", "style", "untrack"];
|
|
7921
|
-
DOM_HELPERS = ["append", "attribute", "branches", "checkedMarkup", "choose", "close", "component", "componentClass", "effect", "errorParagraph", "fragment", "handParts", "holdSubmits", "insert", "listen", "listenSubmit", "listenSubmitWith", "listenWith", "markers", "memo", "merge", "omit", "outside", "part", "partClass", "partHanded", "partProps", "property", "ref", "setClass", "setStyle", "spreadAttributes", "spreadWith", "template", "text", "transition", "untrack"];
|
|
8030
|
+
HTML_HELPERS = ["attempt", "attribute", "checkedMarkup", "child", "className", "component", "componentClass", "currentPage", "dynamic", "element", "errorParagraph", "fieldDescribed", "formConstraints", "formKey", "formOptions", "formType", "handParts", "head", "html", "imageAttributes", "innerMarkup", "leadingNewline", "linkHref", "localHref", "loop", "memo", "merge", "nonEmptyAttribute", "omit", "outsideLink", "param", "partClass", "partHanded", "partProps", "raw", "rawData", "rawTyped", "refillOptions", "rowKey", "schemaFill", "selectOptions", "serverIsland", "show", "spreadAttributes", "spreadWith", "style", "untrack"];
|
|
8031
|
+
DOM_HELPERS = ["append", "attribute", "branches", "checkedMarkup", "choose", "close", "component", "componentClass", "effect", "errorParagraph", "fragment", "handParts", "holdSubmits", "insert", "listen", "listenSubmit", "listenSubmitWith", "listenWith", "markers", "memo", "merge", "omit", "outside", "param", "part", "partClass", "partHanded", "partProps", "property", "ref", "setClass", "setStyle", "slotCall", "spreadAttributes", "spreadWith", "template", "text", "transition", "untrack"];
|
|
7922
8032
|
APART = [["kay/dom-loop", ["loop", "rowKey"]], ["kay/dom-await", ["awaited"]], ["kay/dom-try", ["attempt"]], ["kay/dom-spread", ["dynamic", "spread"]], ["kay/dom-image", ["image"]], ["kay/pending", ["pendingCall"]]];
|
|
7923
8033
|
});
|
|
7924
8034
|
|
|
@@ -8036,14 +8146,15 @@ var init_dom = __esm(() => {
|
|
|
8036
8146
|
if (form) {
|
|
8037
8147
|
b.add(`${helperName(this.scoping)}((`).addSource(form).add("), () => ");
|
|
8038
8148
|
if (item.node.outlet) {
|
|
8039
|
-
|
|
8149
|
+
if (!addSlotCall(b, this.src, item.node, helperName("slotCall")))
|
|
8150
|
+
slotValue(b, item.node);
|
|
8040
8151
|
} else {
|
|
8041
8152
|
b.add("{ const KayC = ");
|
|
8042
8153
|
slotValue(b, item.node);
|
|
8043
8154
|
b.add('; return typeof KayC === "function" ? KayC() : KayC }');
|
|
8044
8155
|
}
|
|
8045
8156
|
b.add(")");
|
|
8046
|
-
} else {
|
|
8157
|
+
} else if (!addSlotCall(b, this.src, item.node, helperName("slotCall"))) {
|
|
8047
8158
|
slotValue(b, item.node);
|
|
8048
8159
|
}
|
|
8049
8160
|
if (item.node.children.length > 0) {
|
|
@@ -8723,6 +8834,7 @@ var init_html = __esm(() => {
|
|
|
8723
8834
|
constructor(b, src, facts, ownMarkup, options = {}) {
|
|
8724
8835
|
super(b, src, facts, ownMarkup);
|
|
8725
8836
|
this.options = options;
|
|
8837
|
+
this.accessorBlocks = options.accessorLoops === true;
|
|
8726
8838
|
this.mergesAtRuntime = options.classMerge === true;
|
|
8727
8839
|
}
|
|
8728
8840
|
markup(nodes, inElement = false) {
|
|
@@ -8914,11 +9026,8 @@ var init_html = __esm(() => {
|
|
|
8914
9026
|
if (node.fallback) {
|
|
8915
9027
|
b.add(", () => ");
|
|
8916
9028
|
this.markup(node.fallback);
|
|
8917
|
-
} else if (this.options.accessorLoops) {
|
|
8918
|
-
b.add(", undefined");
|
|
8919
9029
|
}
|
|
8920
|
-
|
|
8921
|
-
b.add(rowKeying(node, this.src).kind === "positional" ? ', "positional"' : ', "keyed"');
|
|
9030
|
+
addLoopTail(b, node, this.src, this.options.accessorLoops === true, helperName("rowKey"));
|
|
8922
9031
|
b.add(")");
|
|
8923
9032
|
});
|
|
8924
9033
|
}
|
|
@@ -9911,7 +10020,9 @@ class JsxTemplate {
|
|
|
9911
10020
|
b.wrap(node, () => {
|
|
9912
10021
|
b.add("const ");
|
|
9913
10022
|
this.sites.snippets.add(b.code.length);
|
|
9914
|
-
b.addSource(node.name).add(" = (")
|
|
10023
|
+
b.addSource(node.name).add(" = (");
|
|
10024
|
+
markBlock(this.sites, b, this.src, node.params, this.options.staticLoops);
|
|
10025
|
+
b.addSource(node.params).add("): KayJSX.Element => (");
|
|
9915
10026
|
this.emitRoot(node.children);
|
|
9916
10027
|
b.add(");");
|
|
9917
10028
|
});
|
|
@@ -10226,10 +10337,8 @@ class JsxTemplate {
|
|
|
10226
10337
|
this.emitFunctionPropCheck(element, slot.name);
|
|
10227
10338
|
}
|
|
10228
10339
|
b.add(" ").addSource(slot.name).add("={");
|
|
10229
|
-
if (slot.params
|
|
10230
|
-
b.
|
|
10231
|
-
else if (slot.params)
|
|
10232
|
-
b.add("(").addSource(slot.params).add(") => ");
|
|
10340
|
+
if (slot.params)
|
|
10341
|
+
addBlockParameters(this.sites, b, this.src, slot.params, this.options.staticLoops);
|
|
10233
10342
|
this.emitRoot(slot.children);
|
|
10234
10343
|
b.add("}");
|
|
10235
10344
|
}
|
|
@@ -10457,7 +10566,7 @@ class JsxTemplate {
|
|
|
10457
10566
|
return this.src.slice(span.start, span.end);
|
|
10458
10567
|
}
|
|
10459
10568
|
}
|
|
10460
|
-
var CALLED2, TYPED_SUBJECT, UNIT_VALUE, JSX_TEXT_ESCAPES, MARKUP_ATTRIBUTES, EVENT_HANDLER2
|
|
10569
|
+
var CALLED2, TYPED_SUBJECT, UNIT_VALUE, JSX_TEXT_ESCAPES, MARKUP_ATTRIBUTES, EVENT_HANDLER2;
|
|
10461
10570
|
var init_jsx = __esm(() => {
|
|
10462
10571
|
init_ast();
|
|
10463
10572
|
init_expression();
|
|
@@ -10475,7 +10584,6 @@ var init_jsx = __esm(() => {
|
|
|
10475
10584
|
JSX_TEXT_ESCAPES = /[{}<>]|[ \t]{2,}/g;
|
|
10476
10585
|
MARKUP_ATTRIBUTES = new Set(["innerHTML", "srcdoc"]);
|
|
10477
10586
|
EVENT_HANDLER2 = /^on[A-Z]/;
|
|
10478
|
-
PLAIN_PARAMETER = /^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/u;
|
|
10479
10587
|
});
|
|
10480
10588
|
|
|
10481
10589
|
// src/compiler/lazy-imports.ts
|
|
@@ -11217,7 +11325,7 @@ class ModuleShell {
|
|
|
11217
11325
|
server;
|
|
11218
11326
|
options;
|
|
11219
11327
|
b;
|
|
11220
|
-
sites = { rows: new Set, consts: new Map, loopItems: new Set, snippets: new Set, props: new Map };
|
|
11328
|
+
sites = { rows: new Set, blocks: new Set, consts: new Map, loopItems: new Set, snippets: new Set, props: new Map };
|
|
11221
11329
|
src;
|
|
11222
11330
|
mode;
|
|
11223
11331
|
kind;
|
|
@@ -13645,6 +13753,14 @@ var init_route_lints = __esm(() => {
|
|
|
13645
13753
|
...LOOP_LINTS,
|
|
13646
13754
|
...LINK_LINTS,
|
|
13647
13755
|
...SCHEMA_LINTS,
|
|
13756
|
+
"static-remote-image": {
|
|
13757
|
+
level: "warn",
|
|
13758
|
+
group: "performance",
|
|
13759
|
+
site: true,
|
|
13760
|
+
summary: "On a `kay build --static` export, an island image the build cannot write files for: an `image(source, { width, height })` whose source is neither an imported image nor a literal URL, a literal URL on a host `assets.images.remote` does not list, a width or height that is no number literal, or an `aspect`, `quality` or `sizes` that is no literal. The export has no image route, so the browser links the original image, or asks for a file that does not exist. Give `image()` the URL as a literal on a listed host, with its size and options as literals, and the build fetches and resizes it. A best-effort read of the island's source. Reported by `kay build --static`.",
|
|
13761
|
+
wrong: 'img({...image(post.cover, { width: 1200, height: 800 })} alt="")',
|
|
13762
|
+
right: `img({...image('https://cms.example.com/cover.jpg', { width: 1200, height: 800 })} alt="")`
|
|
13763
|
+
},
|
|
13648
13764
|
"text-size-colour": {
|
|
13649
13765
|
level: "warn",
|
|
13650
13766
|
group: "code",
|
|
@@ -14954,7 +15070,7 @@ button(onClick={() => open.set(true)}) Log`
|
|
|
14954
15070
|
site: true,
|
|
14955
15071
|
summary: "A root Dockerfile whose `FROM oven/bun:<version>` is older than the Bun kay needs (`engines.bun`), so the image fails to build once kay moves up, as `kay upgrade` does. `--fix` moves the tag to the oldest Bun kay runs on, dropping a digest pin that would keep the old image; a tag that is no full version, as `1` or `latest`, is left alone.",
|
|
14956
15072
|
wrong: "FROM oven/bun:1.0.0 AS build",
|
|
14957
|
-
right: "FROM oven/bun:1.4.
|
|
15073
|
+
right: "FROM oven/bun:1.4.5 AS build"
|
|
14958
15074
|
},
|
|
14959
15075
|
"untyped-socket": {
|
|
14960
15076
|
level: "warn",
|
|
@@ -16067,6 +16183,17 @@ var init_fence_checks = __esm(() => {
|
|
|
16067
16183
|
CAPTCHA_OFF = /\bcaptcha\s*:\s*false\b/;
|
|
16068
16184
|
});
|
|
16069
16185
|
|
|
16186
|
+
// src/compiler/handed-data.ts
|
|
16187
|
+
function handedServer(island, output, file, script, server, unread) {
|
|
16188
|
+
if (!island || output !== "html" || !server || script.unparsed !== undefined || server.unparsed !== undefined)
|
|
16189
|
+
return server;
|
|
16190
|
+
const words = new Set(templateWords(file));
|
|
16191
|
+
return { ...server, data: server.data.filter((data) => !unread.has(data.local.start) || words.has(data.name)) };
|
|
16192
|
+
}
|
|
16193
|
+
var init_handed_data = __esm(() => {
|
|
16194
|
+
init_template_reads();
|
|
16195
|
+
});
|
|
16196
|
+
|
|
16070
16197
|
// src/compiler/island-cause.ts
|
|
16071
16198
|
function describeCause(cause) {
|
|
16072
16199
|
return cause.interactive === undefined ? causeText(cause) : `${causeText(cause)}; a use that turns on none of ${staticUse(cause.interactive)} renders as markup with no script`;
|
|
@@ -17394,9 +17521,10 @@ class RewriteFinder {
|
|
|
17394
17521
|
}
|
|
17395
17522
|
}
|
|
17396
17523
|
rows(path) {
|
|
17524
|
+
const block = this.input.sites.blocks.has(path.node.params[0]?.start ?? -1);
|
|
17397
17525
|
for (const [index, param] of path.node.params.entries()) {
|
|
17398
|
-
if (param.type === "Identifier" && this.input.sites.rows.has(param.start))
|
|
17399
|
-
this.rowBinding(path.scope, param.name, index === 0 ? loopKey(path, param.name) : undefined);
|
|
17526
|
+
if (param.type === "Identifier" && (block || this.input.sites.rows.has(param.start)))
|
|
17527
|
+
this.rowBinding(path.scope, param.name, index === 0 && !block ? loopKey(path, param.name) : undefined);
|
|
17400
17528
|
}
|
|
17401
17529
|
}
|
|
17402
17530
|
rowBinding(scope, name, key) {
|
|
@@ -17960,7 +18088,7 @@ function compileKay(original, filename, options = {}) {
|
|
|
17960
18088
|
const fences = [file.script, file.server, file.module].map((span) => span ? source.slice(span.start, span.end) : "").join(`
|
|
17961
18089
|
`);
|
|
17962
18090
|
const name = freeName(componentName(filename), fences, found.findings.globalReads);
|
|
17963
|
-
const final = generate(file, script, server, { ...generateOptions, name, rewrites: found.plan.rewrites, writes: found.plan.writes, values: found.plan.values });
|
|
18091
|
+
const final = generate(file, script, handedServer(island !== undefined, options.output, file, script, server, found.findings.unread), { ...generateOptions, name, rewrites: found.plan.rewrites, writes: found.plan.writes, values: found.plan.values });
|
|
17964
18092
|
const unparsed = script.unparsed !== undefined || server?.unparsed !== undefined;
|
|
17965
18093
|
const diagnostics = [
|
|
17966
18094
|
...coded(file.diagnostics, "template-syntax"),
|
|
@@ -18049,6 +18177,7 @@ function takeBlock(file, filename, options, script, scope, which = "fallback") {
|
|
|
18049
18177
|
if (block?.kind !== "slot")
|
|
18050
18178
|
return;
|
|
18051
18179
|
file.template.splice(index, 1);
|
|
18180
|
+
file.facts = undefined;
|
|
18052
18181
|
let lineStart = block.start;
|
|
18053
18182
|
const written = file.source.slice(block.start, block.end).split(`
|
|
18054
18183
|
`).map((text) => {
|
|
@@ -18179,6 +18308,7 @@ var init_compiler = __esm(() => {
|
|
|
18179
18308
|
init_codegen();
|
|
18180
18309
|
init_fence_checks();
|
|
18181
18310
|
init_fence_redirects();
|
|
18311
|
+
init_handed_data();
|
|
18182
18312
|
init_host();
|
|
18183
18313
|
init_island_arguments();
|
|
18184
18314
|
init_island_cause();
|
|
@@ -18747,7 +18877,10 @@ var init_config_shape = __esm(() => {
|
|
|
18747
18877
|
seo: bag(SEO),
|
|
18748
18878
|
robots: either(bool, bag(ROBOTS)),
|
|
18749
18879
|
sitemap: either(bool, bag(SITEMAP)),
|
|
18750
|
-
head: list(obj)
|
|
18880
|
+
head: list(bag({ tag: str, props: obj }, (entry, path, out) => {
|
|
18881
|
+
if ("children" in entry)
|
|
18882
|
+
out.push(`\`${path}.children\` is ignored: a tag's text goes in \`props.children\``);
|
|
18883
|
+
})),
|
|
18751
18884
|
budget: bag(BUDGET),
|
|
18752
18885
|
entry: str,
|
|
18753
18886
|
security: either(bool, bag(SECURITY_KEYS)),
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
id = "kay"
|
|
2
2
|
name = "Kay"
|
|
3
3
|
description = "Highlighting and the kay language server for .kay components"
|
|
4
|
-
version = "1.
|
|
4
|
+
version = "1.112.0"
|
|
5
5
|
schema_version = 1
|
|
6
6
|
authors = [ "Kaynooo" ]
|
|
7
7
|
repository = "https://github.com/Kayno0o/kayjs"
|
|
8
8
|
|
|
9
9
|
[grammars.kay]
|
|
10
10
|
repository = "https://github.com/Kayno0o/kayjs"
|
|
11
|
-
rev = "v1.
|
|
11
|
+
rev = "v1.112.0"
|
|
12
12
|
path = "editors/tree-sitter-kay"
|
|
13
13
|
|
|
14
14
|
[language_servers.kay]
|
package/llms/build-and-start.md
CHANGED
|
@@ -58,7 +58,7 @@ kay build --static --outdir dist
|
|
|
58
58
|
- It carries the maps of its code and of the browser build too, compressed (about 1.5 MB for a small app), so a stack in its logs and an island's report to `onError` point at your `.kay` lines as under `kay start`.
|
|
59
59
|
- It reads nothing of the project from disk but a `.env` and `bunfig.toml` where it runs, as `bun` would, so a file a page reads at runtime by path, rather than importing it, is not in it; the root, routes and public directory it was built with win over the options given to `pages()`.
|
|
60
60
|
- `--compile` and `--entry` are relative to the current directory.
|
|
61
|
-
- A build removes the executable the last `--compile` wrote, and the folder the last `--static` wrote (only one holding its `.kay-static` marker), before it starts: Tailwind scans every file of the project, so a leftover output would give its stylesheets the classes it names, at the cost of reading it.
|
|
61
|
+
- A build removes the executable the last `--compile` wrote, and the folder the last `--static` wrote (only one holding its `.kay-static` marker) unless git ignores it, before it starts: Tailwind scans every file of the project git does not ignore, so a leftover output would give its stylesheets the classes it names, at the cost of reading it. An ignored folder such as `dist` stays in place, served whole, until the new export replaces it.
|
|
62
62
|
- The public directory cannot be named `client`.
|
|
63
63
|
- The executable carries `kay.config.ts` without its `plugins`, nor the imports and top-level declarations only they used, side effects included, so a build plugin such as Tailwind's, whose native addon loads from node_modules, never runs there;
|
|
64
64
|
- Plugins set other than as a property of the object the file exports by default, or beside a spread, stay in, with a warning.
|
package/llms/checks.md
CHANGED
|
@@ -120,6 +120,7 @@ kay lint --cache
|
|
|
120
120
|
|
|
121
121
|
- `typescript7`, which `kay check` and the type checks of `kay dev`, `kay build` and the editor server run on, and `axe-core`, which `kay a11y`, `page.a11y()` and the dev tool's a11y warnings run on, are optional peers of kay: the app lists both in `devDependencies`, as `kay new` writes them, so a production install carries neither.
|
|
122
122
|
- Without `typescript7` those commands stop at once with `bun add -d typescript7@npm:typescript@^7.0.2`, without `axe-core` the a11y ones with `bun add -d axe-core@^4.14.0`; `kay dev` says so once at start and goes on without type checks, and `kay build --no-check` needs neither. `kay doctor`'s `peers` fails for the first and warns for the second.
|
|
123
|
+
- An optional peer of a kay library is reported by `kay check` when the app's configuration needs it: `auth()` with no `store` function or `AuthStore`, a SQLite file included, needs `@kaynooo/pg-orm`, and the check fails with `bun add @kaynooo/pg-orm`.
|
|
123
124
|
- `kay upgrade` adds both to an app coming from a kay before 1.97, in the first `kay check` it runs (`bun add --dev`).
|
|
124
125
|
|
|
125
126
|
### Linting
|
|
@@ -54,7 +54,7 @@ A package can ship `.kay` components, which the app installing it compiles as it
|
|
|
54
54
|
- One project renders with one set of settings: `bun test`, the server and `kay build` all read them from `kay.config.ts`.
|
|
55
55
|
- kay's own libraries, `@kayjs/auth`, `@kayjs/ui`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai`, are released with kay at its version, each peering on kay's minor and on the libraries of that same version: install the ones matching the app's kay, and move them together.
|
|
56
56
|
- An app on a `^0.x` range of one of kay's libraries moves it to kay's version by hand, as a caret on 0.x never reaches it.
|
|
57
|
-
- A library linked rather than installed, `"@kayjs/ui": "link:../kayjs-ui"`, works the same, and so does one installed in a `node_modules` above the project, as a workspace hoists it, or kept under `node_modules/.bun/` by Bun's isolated linker, a workspace's default, whose stylesheets the app's Tailwind plugin processes all the same, a bare `@import` of the library's own dependencies included: the app's own `package.json` names it either way. A linked library's own `kay`, a dev dependency in its folder, loads as the app's, so its `api()` and its signals are the app's own; its other peers resolve from its folder, as any linked package's do.
|
|
57
|
+
- A library linked rather than installed, `"@kayjs/ui": "link:../kayjs-ui"`, works the same, and so does one installed in a `node_modules` above the project, as a workspace hoists it, or kept under `node_modules/.bun/` by Bun's isolated linker, a workspace's default, whose stylesheets the app's Tailwind plugin processes all the same, a bare `@import` of the library's own dependencies included: the app's own `package.json` names it either way. `kay check` resolves a library's own imports from where Bun linked its dependencies, so the app lists only the library. A linked library's own `kay`, a dev dependency in its folder, loads as the app's, so its `api()` and its signals are the app's own; its other peers resolve from its folder, as any linked package's do.
|
|
58
58
|
|
|
59
59
|
### Extensions
|
|
60
60
|
|
package/llms/deprecated-lints.md
CHANGED
|
@@ -13,5 +13,5 @@ The lints of the `deprecated` group, each the old form a minor replaced, reporte
|
|
|
13
13
|
| Lint | Default | Group | Reports |
|
|
14
14
|
| --- | --- | --- | --- |
|
|
15
15
|
| `deprecated-action-options` | warn | deprecated | The arguments of `action` before 1.107, `action(schema, handler, options)` and `action(handler, options)`: the options come first, with the input in them, as an API route's do, `action({ input: schema, ...options }, handler)` and `action(options, handler)`. `input` is a plain record of fields or any schema. The old forms work until 2.0. Found on the `action` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files; the fix moves the arguments and keeps their text. |
|
|
16
|
-
| `deprecated-schema-builders` | warn | deprecated | The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of a `defineEnv` is the record of fields alone, as an env reads only the names it declares; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed, and keeps what each did: an `s.Array` takes `max: Number.MAX_SAFE_INTEGER` (the lowercase list stops at 1,000 items) and an `s.Object` `extra: 'strip'`, a rewrite whose options are not an object literal being reported without a fix; an `s.Union` of `Object.keys(R).map(key => s.Literal(key))` is `s.enum(R)`, and any other `s.Union` of a mapped array is reported without a fix; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (an action's input, an API route's body, `defineEnv`, collection frontmatter), where `s.Object` let it by, so the fix writes `{ extra: 'strip' }`. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says. |
|
|
16
|
+
| `deprecated-schema-builders` | warn | deprecated | The PascalCase builders of `s` before 1.106, which kay's own lowercase builders replace, each taking the same field options (`optional`, `default`, `error`, `label`, `description`, `example`) and short names for the rest: `s.String` is `s.string` (`min`, `max`), `s.Integer` `s.int`, `s.Number` and `s.Numeric` `s.number`, `s.Boolean` and `s.BooleanString` `s.boolean`, `s.Array` `s.list`, `s.UnionEnum` and `s.UnionKeys` `s.enum`, and `s.Date`, `s.Literal`, `s.Union`, `s.Object`, `s.File`, `s.Files`, `s.Secret` and `s.Public` their lowercase names; `s.Optional(field)` is `optional: true` in the options of the field; an `s.Object({ ... })` that is the schema of a `defineEnv` is the record of fields alone, as an env reads only the names it declares; and a file size written `'2m'` is `'2mb'`. The old names work until 2.0. Found on the `s` a file imports from `kay`, in the TypeScript files and the fences of `.kay` files. The fix renames the builder and the options that changed, and keeps what each did: an `s.Array` takes `max: Number.MAX_SAFE_INTEGER` (the lowercase list stops at 1,000 items), an `s.String` with no `maxLength` takes it too (the lowercase string stops at 10,000 characters), except in an action's input and an API route's `body`, which cap a string at 10,000 already, and an `s.Object` `extra: 'strip'`, a rewrite whose options are not an object literal being reported without a fix; an `s.Union` of `Object.keys(R).map(key => s.Literal(key))` is `s.enum(R)`, and any other `s.Union` of a mapped array is reported without a fix; an `s.Optional` around anything but one of these builders, such as a helper of `kay/content`, is left as it is. A lowercase `s.object` refuses a key its shape lacks where kay reads the schema itself (an action's input, an API route's body, `defineEnv`, collection frontmatter), where `s.Object` let it by, so the fix writes `{ extra: 'strip' }`. A query, the headers and the cookies of a request carry keys no schema names, so their unknown keys are dropped whatever the schema says. |
|
|
17
17
|
| `deprecated-ui-props` | warn | deprecated | A kayjs-ui or kayjs-ai prop under its name before 1.98. `heading` on a Dialog, SidePanel or FormDialog is `title`, which takes a string or a `@title` block as a Card's does, and the string that named the dialog for screen readers is `label`. `variant` on a Stat, Chat or ChatLauncher is `layout`, `variant` naming only the frame of a control. The old names work until 2.0. The fix renames the prop or the block, and the `title` string beside a `heading` to `label`; it offers none where the new name is already written. |
|
package/llms/dev-tool.md
CHANGED
|
@@ -27,7 +27,7 @@ The Request tab shows the route matched, the layouts, the params, the locale, th
|
|
|
27
27
|
- Its Network tab lists what the page fetched, read off Resource Timing, by navigation, newest first: the load, then each page swap, the last 5 kept, each request with its kind (document, page for a swap or prefetch, action, server island, fetch, script, stylesheet, image, font), status, size or `from the cache`, time and start after the navigation, an error status counted on the tab for the page shown; the tool's own requests, the live reload's and `/_kay/dev/` are left out, a hover prefetch is listed under its page, and another site's answer shows no status or size without `Timing-Allow-Origin`;
|
|
28
28
|
- Its Head tab shows the page's head as it is now: the search result it makes, its title and description with their length and the description's limit of 160 characters, the canonical link, hreflang alternates, the robots tag, whether the sitemap lists the page, the og and twitter tags with a preview of the social card image, and each JSON-LD block parsed or with its parse error; what `kay check` would flag in a built page's head shows as a problem, and with `seo` set but no origin it says there is no canonical link or sitemap; it reads again after each page swap;
|
|
29
29
|
- Its Routes tab lists every page, endpoint and API route the server serves, each locale's copy of a page on its own line, filtered by path or file, a path no request fills in linking to itself, fetched again after each restart; a section of what kay serves itself lists the sitemap, robots.txt, feeds, manifest, favicons, service worker, health check and a library's dev pages such as kayjs-mail's `/_kay/mail`, only those the running server serves, so a path an app file took over shows as the app's, and with `seo` set but no origin it says why there is no sitemap or robots.txt; under it a "kay's plumbing" group lists kay's own endpoints the app serves, one line each with its purpose and a `docs` link (the build files, `/_kay/assets/*` and `/_kay/images/*` once the build has some, `/_kay/images`, `/_kay/card`, `/_kay/files/*`, `POST /_kay/action/<file>/<name>` and `GET /_kay/fields/<file>/<name>` once an action exists, `/_kay/live`, `/_kay/error`, `/_kay/csp` with `security.reports`, `/_kay/preview` and `/_kay/draft` with `preview`, `/_kay/env.js` with an `s.public` field, `/_kay/search.json` and `/_kay/search/*` with a search index, the `analytics()` and `vitals()` routes, `/_kay/THIRD-PARTY-LICENSES.txt`), the filter box matching their path and purpose, a GET path with nothing to fill in linking to itself under `base`;
|
|
30
|
-
- Its Env tab lists each public variable (`s.public`) sent to the browser, read from `/_kay/env.js` with its value, flags one whose value looks like a secret (a URL with a password, a well-known token prefix, a hexadecimal or random string), only noting a name ending in `_KEY`, and says when the app sends no public env; the server's own env is never shown;
|
|
30
|
+
- Its Env tab lists each public variable (`s.public`) sent to the browser, read from `/_kay/env.js` with its value, flags one whose value looks like a secret (a URL with a password, a well-known token prefix, a hexadecimal or random string), only noting a name ending in `_KEY`, and says when the app sends no public env, without asking for `/_kay/env.js` then, as the page's request block tells it (no 404 in the browser console); the server's own env is never shown;
|
|
31
31
|
- Its Images tab lists each image of the page with the variant it got (a ladder width, a crop, the share card, or not resized by kay), the format and bytes the server answers with (a HEAD request, only for a loaded image of kay's image route or built variants, with a timeout; any other image is not asked), the size served against the size drawn (flagged past 4 times the pixels shown, never for an SVG, whose address ends in `.svg` or whose fetch answered `image/svg+xml`, as Resource Timing keeps it), the largest contentful paint, and an image without `width` and `height` or lazy-loaded while in view; copies of one image drawn alike share a row with their count, and hovering or focusing a row outlines each, and the list follows the page as images change;
|
|
32
32
|
- Its Performance tab shows the page load's LCP (with its element), CLS and INP as the browser reports them while the page is used, each rated against its good limit (2.5 s, 0.1, 200 ms) and naming the page they were measured on once a swap moved away from it, and the page's footprint measured in the browser (the DOM elements without the tool's own, the requests of the load, the EcoIndex grade and score and the grams of CO2e per view, worked out by the server with the models `kay build` uses, [Build](build-and-start.md#build-and-start-commands)), then the HTML (the document the browser holds), CSS and JS gzipped and the images, fonts and other files as the browser says they came, measured again after a swap, with the entry, the islands' chunks and the other chunks apart (a page a swap fetched and an action are not counted, another site's file counts as a request of unknown weight); the sizes are dev sizes, not minified, larger than `kay build` makes them, and a "Last kay build" block gives the route's scripts and stylesheets from the report `.kay` keeps (its age, `~` for an estimate, nothing before a first build);
|
|
33
33
|
- Its Not found tab lists the paths a production run recorded visitors found nothing at (the database of the app's `store`, SQLite or Postgres, else `data/not-found.sqlite`: the log `kay not-found` reads), most hit first, with the hosts they came from and the suggested target, those a `redirects` entry answers left out; a field holds the target (the suggestion, or one typed) and Add redirect writes it into `kay.config.ts` as `kay not-found --redirect` does, then `kay dev` restarts; `kay dev` records nothing itself, so the tab leaves the list while the file, or the Postgres table `kay_missing`, is absent (it creates none).
|
package/llms/effects.md
CHANGED
|
@@ -71,6 +71,7 @@ p {seconds()}s on the page, last key {key()}
|
|
|
71
71
|
|
|
72
72
|
- `effect(fn)` runs once the render is done and again whenever what it read changes; `effect(fn, { signal })` stops it when the signal aborts, as `every`, `watch` and `listen` stop.
|
|
73
73
|
- `onMount(fn)` is the sugar for `effect(() => untrack(fn))`: it runs once, after the markup is in place, and never runs again. It takes `{ signal }` too. `onCleanup`, `untrack`, `batch`, `root` and `flush` come from `kay` as well.
|
|
74
|
+
- `followed(read, draw)` draws what a block shows for the item `read` returns once, however often the item is replaced by a copy under the same key: `draw` gets the item, and a block it calls reads its parameter as the current item where it is used, so `{followed(() => row, row => cell(row, column))}` under `for row of rows key={row.id}` keeps the cell's nodes and focus while `rows.indexOf(row)` and `row === selected` hold in it. A value that is not an object is drawn as a call is, again when it changes. More reads after `draw`, `followed(() => entry.row, (row, index) => item(row, index), () => entry.index)`, are other arguments the block reads in place. `slot name(item, index)` called with names or paths does it for the first argument already, reading every other argument in place too, so a reorder keeps the block's nodes, and in a `form` as anywhere else. A block that does not read a parameter through its name, one taken as a pattern, a default or a rest, is drawn again when that argument changes, as is a plain function handed the item.
|
|
74
75
|
- Which one: `effect` to keep something in step with the signals it reads, `watch(source, run)` to react when `source` changes (the callback reads what it likes, gets the value before, and `{ immediate: true }` runs it once at the start too), `onMount` for what happens once, `every` for a timer and `listen` for an event.
|
|
75
76
|
- A function an `effect` or `onMount` callback returns runs as its cleanup, as one passed to `onCleanup` does: `effect(() => { const t = setInterval(tick, 1000); return () => clearInterval(t) })`.
|
|
76
77
|
- `effect`, `watch`, `every`, `listen` and `onCleanup` run with no owner at a module's top level, after an `await`, or in a timer: nothing stops the first four, which live until the page goes, and `onCleanup` drops its function. In development each logs a `[kay]` warning naming it, once, and `kay check` reports a call in an inline handler (one more per event), a timer, a promise callback or after an `await` as the `unowned-effect` lint; `root(fn)` is the owner to give them.
|
package/llms/head.md
CHANGED
|
@@ -203,7 +203,7 @@ export default defineConfig({
|
|
|
203
203
|
```
|
|
204
204
|
|
|
205
205
|
- With `i18n`, `name`, `titleTemplate`, `description`, `image`, `imageAlt` and `locale` each take a string or a record of one string per locale, `description: { en: 'What the site is', fr: 'Ce qu\'est le site' }`, so no page sets a tag for its language's; a locale the record lacks reads the default locale's. The head lints check every text. Each surface reads the locale it is served for: the page's tags and share card name follow the page's locale, and the web manifest does too (see below), but the one OpenAPI document is titled with the default locale's `name`.
|
|
206
|
-
- `head` adds tags to every page's head, written as a `head` block compiles them, a tag's text as `children
|
|
206
|
+
- `head` adds tags to every page's head, written as a `head` block compiles them, a tag's text as `props.children`, never a `children` beside `props`, which `kay check` refuses: `head: [{ tag: 'script', props: { src: '/stats.js', defer: true } }, { tag: 'script', props: { children: 'window.dataLayer = []' } }, { tag: 'meta', props: { name: 'color-scheme', content: 'light dark' } }]`. An analytics script that needs the visitor's consent loads from an island once they agreed (see [Privacy](privacy.md)).
|
|
207
207
|
- A layout or the page setting a tag of the same identity replaces one of those.
|
|
208
208
|
- An inline script or style among them is let through by the content security policy, its hash added.
|
|
209
209
|
- `site` is an origin, nothing after the host.
|
package/llms/images.md
CHANGED
|
@@ -131,6 +131,8 @@ img(src={hero} sizes="(min-width: 60rem) 50vw, 100vw" alt="The workshop")
|
|
|
131
131
|
- The URL is signed with a key the build keeps beside the client build and never serves, so nobody can have the site draw a title of their own; whitespace runs read as one space and a title is cut at 200 characters before it is signed.
|
|
132
132
|
- Each distinct title is one more card file, so a page titled by what visitors type, such as a search, draws one card per query.
|
|
133
133
|
- `kay build` writes the cards its prerendered pages ask for as files, which a static export links, refusing one on an image from `assets.images.dirs`; one on an image from `assets.images.remote` is drawn from a download.
|
|
134
|
+
- On a static export an island that draws an imported image in the browser links the same files as the server HTML, under the base. The build writes the ladder of every imported image and reads the `img` and `image()` calls of the islands' components, so a crop, a quality or a width below the ladder drawn only by a `render: 'client'` island has its file too; a `sizes`, `aspect` or `quality` that is no literal is not read, and its variant needs the same call in a server-rendered place.
|
|
135
|
+
- On a static export an island's `image('https://cms.example/a.jpg', { width, height })` with a literal URL on a host `assets.images.remote` lists is downloaded at build time (`remote.timeout` applies; a failure fails the build naming the URL) and linked as files; any other remote image or upload keeps its own URL in the browser, and an island image the build cannot read (a source, a size, a crop, a quality or `sizes` that is no literal, or a URL on a host `images.remote` does not list) warns with `static-remote-image`, a best-effort read of the island's source.
|
|
134
136
|
- Variants are served by `/_kay/images?src=...&w=...`, which answers only those widths, `&crop=16x9` for a cut one and `?src=...&card` for the share card.
|
|
135
137
|
- `kay build` writes every variant of every imported image, and the cut ones, share cards and widths under 320 its prerendered pages ask for, served as files with a year of immutable caching; development makes them on request, kept in `.kay/cache/images`.
|
|
136
138
|
Images stored at runtime, images looked up by `assets.images.resolve` and `assets.images.guards`, and images on another host (`assets.images.remote`) are in [Images uploaded at runtime and from other hosts](images-runtime-and-remote.md#runtime-and-remote-images).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Islands: components that load when they first draw
|
|
2
|
+
|
|
3
|
+
The rest of [Islands](islands.md).
|
|
4
|
+
|
|
5
|
+
## Common tasks
|
|
6
|
+
|
|
7
|
+
- Keep a large component out of the page's first load: draw it in a branch (`if`, `else`, a `match` case, a closed `Dialog`), and it loads when it first draws, with no declaration.
|
|
8
|
+
- Keep a component eager: draw it once outside a branch, or read it as a `snippet` value.
|
|
9
|
+
|
|
10
|
+
## Reference
|
|
11
|
+
|
|
12
|
+
### Components that load when they first draw
|
|
13
|
+
|
|
14
|
+
- A component an island imports loads on its own, with no declaration, when every tag using it sits where the island may not draw it at first paint: inside an `if`, `else`, `match` case or `@failed`, or in the lines or `@block` of a component that draws them only in such a branch (a closed `Dialog` and a `FormDialog` draw their body only when open). A tag also drawn outside a branch, a `snippet` read as a value, a dynamic tag or a server island keeps the import eager. A `for` body or a `pending` block inherits the position of the loop or `await` around it.
|
|
15
|
+
- What the server drew is loaded before the island hydrates (the page preloads its chunks, and the island names them in `data-lazy`), so its markup is claimed as it stands. What it did not draw loads when it first draws: a visitor reaching for the island (pointer over it, focus or touch inside it) loads every such component ahead, so the click finds the code in, except with `Save-Data`, which loads one when it opens.
|
|
16
|
+
- Until the code arrives the branch draws nothing, then the component in its place. A chunk that fails to load is tried again after 1 s and 3 s, a deploy that dropped it reloads the page as other chunks do, and a failure for good goes to `reportError` and `console.error`, not to `@failed`, which a render error of the branch reaches as ever; the branch tries again the next time it opens. A server-drawn chunk that fails to load leaves its island to draw that branch afresh.
|
|
17
|
+
- Only a component of 2,000 bytes of source or more loads this way, a chunk that only repeats code the islands load anyway is folded back into them after the bundle, so is every lazy chunk of a build when together they hold under 6,000 minified bytes (the lazy runtime would cost more), and an island that renders in the browser only (`clientOnly`) keeps its imports eager. A module with lazy imports awaits what the server drew at its top level, so a page without one carries none of this.
|
|
18
|
+
- A name inside a string or a whole-line comment of the file is no use of the component: only a tag or other code naming it keeps its import eager (a Table's `'Select all'` once kept its Select in every island). kayjs-ui's `Form`, `FormDialog` and `SaveForm` load the code that sends and reports a form (`forms-send`, with the toast it reports through) with the first send or blur check, tried once more when the chunk fails, so a page with a closed form-dialog does not carry it.
|
|
19
|
+
- `kay/dom-lazy` is the compiler's output contract for it, not API. `kay build --analyze` lists the modules of every island, a lazy component's apart from the eager ones.
|
|
20
|
+
|
|
21
|
+
A refresh, or a visit keeping its layout, keeps an island and gives it the new props in place; seed from a prop with `linked(() => prop)` ([Navigation](navigation.md#islands-kept-across-pages)).
|
|
22
|
+
|
|
23
|
+
Shared and persisted state, transitions, error fallbacks, element size, context and unique ids are in [Islands: state to unique ids](islands-state-to-ids.md).
|
package/llms/islands.md
CHANGED
|
@@ -239,7 +239,7 @@ if !connected()
|
|
|
239
239
|
### Islands
|
|
240
240
|
|
|
241
241
|
- A component is interactive when any element in it has an `on*` handler, a `bind:` (on an element or a component) or a `ref`, or when its script uses a value from `kay`, such as `signal`; the rule is at the top.
|
|
242
|
-
- `ActionError`, `ActionRedirectError`, `ApiError`, `apiUrl`, `byteCount`, `composing`, `ctx`, `defer`, `defineUi`, `describeField`, `durationMs`, `escapeHtml`, `formErrors`, `isEmail`, `lengthMs`, `localPath`, `postedChecked`, `postedValue`, `postedValues`, `publicEnv`, `recipe`, `route`, `s`, `sanitizeHtml`, `trustHtml`, `uid`, `validate`, `withBase` and `withQuery` from `kay` compute the same on both sides and keep a component static; every other value of `kay` needs the browser (state, effects, lifecycle, browser readings, navigation: `navigate`, `refresh`, `call` and `logFrom` among them), and so does `relativeTime` of `kay/i18n`.
|
|
242
|
+
- `ActionError`, `ActionRedirectError`, `ApiError`, `apiUrl`, `byteCount`, `composing`, `ctx`, `defer`, `defineUi`, `describeField`, `durationMs`, `escapeHtml`, `followed`, `formErrors`, `isEmail`, `lengthMs`, `localPath`, `postedChecked`, `postedValue`, `postedValues`, `publicEnv`, `recipe`, `route`, `s`, `sanitizeHtml`, `trustHtml`, `uid`, `validate`, `withBase` and `withQuery` from `kay` compute the same on both sides and keep a component static; every other value of `kay` needs the browser (state, effects, lifecycle, browser readings, navigation: `navigate`, `refresh`, `call` and `logFrom` among them), and so does `relativeTime` of `kay/i18n`.
|
|
243
243
|
- A namespace or default import of `kay` or `kay/i18n` (`import * as i18n from 'kay/i18n'`) always makes an island, as the compiler cannot tell which names the component reads through it: import the names (`import { formatDate } from 'kay/i18n'`) to keep a component static that only formats.
|
|
244
244
|
- An interactive component renders on the server and hydrates in the browser as an island.
|
|
245
245
|
- Everything else ships no JavaScript, except the small script swapping pages in on a page posting a form to an action, and elsewhere one line keeping Back right after a reload (see [Navigation](navigation.md#navigation)).
|
|
@@ -255,6 +255,7 @@ if !connected()
|
|
|
255
255
|
- Props a static component passes to an island are serialized for the browser: plain objects and arrays, strings, numbers, booleans, `null` and `undefined`.
|
|
256
256
|
- Dates, Maps, Sets, bigints, URLs and RegExps arrive as themselves, and a value referenced twice arrives once.
|
|
257
257
|
- They go into the page as JSON in an attribute, quoted with whichever quote it holds fewer of; every page carries them, so pass what the island reads rather than a whole object it picks from.
|
|
258
|
+
- A page that is an island itself (a closure passed to an interactive component) sends only the `--- server` consts its script or template read, so a list only the fence reduces stays on the server; one the template reads goes whole, so slice it in the fence.
|
|
258
259
|
- A `Snippet` prop (children and `@name` blocks without parameters) crosses; a `Snippet<[...]>` is a function and does not (below). Children and `@name` blocks without parameters pass from any static parent, a page or a layout included: the server renders them with the parent, as static markup the island shows where its template puts `slot` or the prop, and their code never reaches the browser.
|
|
259
260
|
- An island among those children is one of its own, hydrating by itself, and keeps its state when the island hides the block and shows it again, or moves it, since the island shows the same nodes each time.
|
|
260
261
|
- A block the island did not show on the server, or a client-only island's, travels in its props as markup and is built once shown.
|
|
@@ -281,16 +282,3 @@ if !connected()
|
|
|
281
282
|
### The action caller
|
|
282
283
|
|
|
283
284
|
- The code that runs an action call (its queue, timeout and retries, the post and its answer) loads with the first call, so an island that only declares or passes an action does not carry it; the action's own state (`pending()`, `data()`, `status()`, `error()`) is there from the first paint, and a call counts as pending at once, before that code is in, its `onStart` hook running when it is. A call whose code never loads rejects without running its hooks. An island holding an action caller loads it at idle, so a call made as the page goes away finds it in; a chunk a deploy dropped reloads the page as other chunks do.
|
|
284
|
-
|
|
285
|
-
### Components that load when they first draw
|
|
286
|
-
|
|
287
|
-
- A component an island imports loads on its own, with no declaration, when every tag using it sits where the island may not draw it at first paint: inside an `if`, `else`, `match` case or `@failed`, or in the lines or `@block` of a component that draws them only in such a branch (a closed `Dialog` and a `FormDialog` draw their body only when open). A tag also drawn outside a branch, a `snippet` read as a value, a dynamic tag or a server island keeps the import eager. A `for` body or a `pending` block inherits the position of the loop or `await` around it.
|
|
288
|
-
- What the server drew is loaded before the island hydrates (the page preloads its chunks, and the island names them in `data-lazy`), so its markup is claimed as it stands. What it did not draw loads when it first draws: a visitor reaching for the island (pointer over it, focus or touch inside it) loads every such component ahead, so the click finds the code in, except with `Save-Data`, which loads one when it opens.
|
|
289
|
-
- Until the code arrives the branch draws nothing, then the component in its place. A chunk that fails to load is tried again after 1 s and 3 s, a deploy that dropped it reloads the page as other chunks do, and a failure for good goes to `reportError` and `console.error`, not to `@failed`, which a render error of the branch reaches as ever; the branch tries again the next time it opens. A server-drawn chunk that fails to load leaves its island to draw that branch afresh.
|
|
290
|
-
- Only a component of 2,000 bytes of source or more loads this way, a chunk that only repeats code the islands load anyway is folded back into them after the bundle, so is every lazy chunk of a build when together they hold under 6,000 minified bytes (the lazy runtime would cost more), and an island that renders in the browser only (`clientOnly`) keeps its imports eager. A module with lazy imports awaits what the server drew at its top level, so a page without one carries none of this.
|
|
291
|
-
- A name inside a string or a whole-line comment of the file is no use of the component: only a tag or other code naming it keeps its import eager (a Table's `'Select all'` once kept its Select in every island). kayjs-ui's `Form`, `FormDialog` and `SaveForm` load the code that sends and reports a form (`forms-send`, with the toast it reports through) with the first send or blur check, tried once more when the chunk fails, so a page with a closed form-dialog does not carry it.
|
|
292
|
-
- `kay/dom-lazy` is the compiler's output contract for it, not API. `kay build --analyze` lists the modules of every island, a lazy component's apart from the eager ones.
|
|
293
|
-
|
|
294
|
-
A refresh, or a visit keeping its layout, keeps an island and gives it the new props in place; seed from a prop with `linked(() => prop)` ([Navigation](navigation.md#islands-kept-across-pages)).
|
|
295
|
-
|
|
296
|
-
Shared and persisted state, transitions, error fallbacks, element size, context and unique ids are in [Islands: state to unique ids](islands-state-to-ids.md).
|
package/llms/lints.md
CHANGED
|
@@ -91,7 +91,7 @@ The table of lints is split by group, each page holding its rows (the `deprecate
|
|
|
91
91
|
|
|
92
92
|
### Performance lints
|
|
93
93
|
|
|
94
|
-
The `performance` group (`unsized-image`, `large-public-image`, `serial-awaits`) has its own page, which holds its rows: [Performance lints](performance-lints.md).
|
|
94
|
+
The `performance` group (`unsized-image`, `large-public-image`, `static-remote-image`, `serial-awaits`) has its own page, which holds its rows: [Performance lints](performance-lints.md).
|
|
95
95
|
|
|
96
96
|
### SEO lints
|
|
97
97
|
|
package/llms/navigation.md
CHANGED
|
@@ -82,7 +82,7 @@ A handler of your own on Enter in a text field starts with `if (composing(event)
|
|
|
82
82
|
### Islands kept across pages
|
|
83
83
|
|
|
84
84
|
- An island marked `persist` lives on from page to page, its state and its element kept, when the next page renders it too: `Player(persist)` in a layout keeps a song playing.
|
|
85
|
-
- An island without `persist` is kept too when the next page renders the same component in the same place, its state staying and its props given in place: on a refresh any island is paired so, by component and its `key` or `id` prop when it has a string or number one, else by order among the islands of that component, so
|
|
85
|
+
- An island without `persist` is kept too when the next page renders the same component in the same place, its state staying and its props given in place: on a refresh any island is paired so, by component and its `key` or `id` prop when it has a string or number one, else the key of the keyed `for` it is drawn in, else by order among the islands of that component, so a list of islands needs an `id` or a `persist` only when its loop is by position or the keys of two loops drawing the same component overlap, and an island drawn in a deferred `await` block of a row takes none (an island marked `persist` by its key first); on a visit, a query change, Back or a redirect only the islands a layout renders are, by layout, component and order, so a sidebar's folded group or a menu stays as it was while a page's own islands are ended. An island whose static slots changed, or with no match, is ended, and a list whose items move is kept by `persist={id}`, which also changes the island by changing it. A call or a `refresh()` has `refresh: false` to leave the page alone.
|
|
86
86
|
- A browser with `Element.moveBefore` (Chrome 133, Firefox 144) moves it in place, so an iframe in it stays loaded, a video keeps playing and the focus stays in it; elsewhere it is taken out and put back, and the swap gives the focus and the selection back; a popover open in it closes either way. The scroll of every element inside it, nested ones and horizontal scroll too, is kept either way.
|
|
87
87
|
- `persist` takes a static or a dynamic value, a string computed from props or state (`Graph(persist={`${repo}:${scope}`})`): another value is another island, ended and hydrated afresh, while the same value keeps it.
|
|
88
88
|
- A bare `persist` matches the same component on the next page; `persist="left"` names one use, for two uses of a component to be told apart.
|
|
@@ -96,7 +96,7 @@ A handler of your own on Enter in a text field starts with `if (composing(event)
|
|
|
96
96
|
### Forms posting in place
|
|
97
97
|
|
|
98
98
|
- A form posting to an action posts without a reload, then shows the page the post leads to, as the browser would: `form.failed()` and `data()` of an action read as after a full post.
|
|
99
|
-
- A post going back to the same page, or refused and rendering it again, keeps the scroll position and the focused field.
|
|
99
|
+
- A post going back to the same page, or refused and rendering it again, keeps the scroll position and the focused field: the swap turns off Chrome's scroll anchoring while it morphs, so a list whose rows move or drop around the one in view leaves the window where it was. A focused field the swap removed (the posting row's) gives the focus to the field of that name now at its place in the document, else the last, never the first of the page.
|
|
100
100
|
- A refused post moves focus to the form's first field marked `aria-invalid`, which a screen reader reads with the message describing it (see [Actions](actions.md)).
|
|
101
101
|
- With no field marked, the message describing the form itself is announced and the control that posted it, such as a submit button, is focused again.
|
|
102
102
|
- A refused post focusing its field reveals it as `focusInvalid` does.
|
|
@@ -15,3 +15,4 @@
|
|
|
15
15
|
| `unsized-image` | warn | performance | An `img` or `input(type="image")` with neither `width` and `height` nor a spread that may carry them, so the page shifts as it loads; an imported PNG, JPEG, WebP, GIF or AVIF as `src={name}` and a stored file's `files.url(key)` alone are sized by kay; an SVG, a path, a value from data, an image with its own `srcset` or one size still warns; static `aspect-*` with a width or height, `w-*` with `h-*`, `size-*` or a `style` `aspect-ratio` reserve the box, a variant or a bound class does not. No fix: write the image's size. |
|
|
16
16
|
| `serial-awaits` | warn | performance | Two or more consecutive top-level `const x = await ...` statements of a `--- server` fence where no awaited expression reads a name an earlier one of the run declares, so the page takes the sum of their times. A pattern, a type annotation, `let`, a `try`, a statement or comment between two awaits and an expression reading an earlier binding end the run and are left alone. The fix, `const [a, b] = await Promise.all([...])`, is offered in the editor but is not safe, so `kay check --fix` leaves it: it starts the awaits together, so a guard (`await requireUser()`, anything that redirects or throws) stays in its own statement before them. |
|
|
17
17
|
| `large-public-image` | warn | performance | A static `img` `src`, a CSS `url()` or `image-set()` string, an `og:image` or `twitter:image` `meta`, `seo.image`, or a Markdown image, reference image, HTML `img` or frontmatter `image:` (CSS comments and Markdown code left out; an address under `site` counts) that names a PNG, JPEG, GIF, WebP, AVIF or BMP in `public/` over 256 KiB, sent whole as public files are. No fix: import it from `src/` so kay serves it resized as WebP; an `img` with its own `srcset` or a `src` written as an expression is left alone. Reported by `kay check` and `kay build`, set with `lints` only. |
|
|
18
|
+
| `static-remote-image` | warn | performance | On `kay build --static`, an island image the build cannot write files for: an `image(source, { width, height })` whose source is neither an imported image nor a literal URL, a literal URL on a host `assets.images.remote` does not list, a width or height that is no number literal, or an `aspect`, `quality` or `sizes` that is no literal. The export has no image route, so the browser links the original or asks for a missing file. No fix: write the URL, size and options as literals, on a listed host. Reported by `kay build --static`. |
|