@lucidkiln/core 1.6.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/{environment-By1fPtOz.d.ts → environment-BQipJ3kg.d.ts} +7 -4
- package/dist/environment-BQipJ3kg.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/source-DxHQeBEo.js.map +1 -1
- package/package.json +2 -2
- package/dist/environment-By1fPtOz.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.7.1
|
|
4
|
+
|
|
5
|
+
- Supports Node 26 as well as Node 24. ([de608f3](https://github.com/buildlucid/kiln/commit/de608f35b8e5a022eb28e03e8083e8c64f4e3d15))
|
|
6
|
+
|
|
7
|
+
## 1.7.0
|
|
8
|
+
|
|
9
|
+
- Cache stores now receive the render's `state` in `get` and `set`, so a store can keep something per request, such as the connection it reads with. See [Cache stores](https://kilnlang.com/docs/tags/cache/#cache-stores). ([2fa3f0a](https://github.com/buildlucid/kiln/commit/2fa3f0a37d8f9b1e5dd51c1ece78e5938998f72e))
|
|
10
|
+
|
|
3
11
|
## 1.6.0
|
|
4
12
|
|
|
5
13
|
- New host components. A loader can return a component written in JavaScript with `hostComponent`, such as one made with React or Svelte. ([8d43019](https://github.com/buildlucid/kiln/commit/8d43019e8a0278449232b518d9e0a0f22547d83e))
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Kiln is a template language for building websites on the server. The syntax will
|
|
|
12
12
|
|
|
13
13
|
- **Async data.** Templates can call async functions to load what they need. Kiln only waits where a call returns a promise, and runs calls that don't depend on each other at the same time.
|
|
14
14
|
- **Server islands.** Build a page as static HTML and let the parts that need live data load on each visit, or stream them in from a server.
|
|
15
|
-
- **Runs anywhere.** No dependencies and no `eval`. Works on Node 24 and Cloudflare Workers.
|
|
15
|
+
- **Runs anywhere.** No dependencies and no `eval`. Works on Node 24, Node 26 and Cloudflare Workers.
|
|
16
16
|
- **Safe by default.** Templates only read what you give them, output is escaped, and limits stop runaway templates.
|
|
17
17
|
- **Layouts and components.** Blocks, includes, components with typed props and slots, and macros.
|
|
18
18
|
- **Clear errors.** Strict mode catches typos, and every error shows the template, line and column.
|
|
@@ -134,12 +134,14 @@ type AbortSignalLike = {
|
|
|
134
134
|
type TypeCheck = (value: unknown) => boolean;
|
|
135
135
|
/**
|
|
136
136
|
* Where the `cache` tag saves output, given as the `cache` option. See `memoryCache`. Each method takes one object, so
|
|
137
|
-
* more details can be added without breaking stores.
|
|
137
|
+
* more details can be added without breaking stores. `state` is the render's `state` option, for a store that keeps
|
|
138
|
+
* something per request, such as the connection it reads with.
|
|
138
139
|
*/
|
|
139
|
-
type KilnCache = {
|
|
140
|
+
type KilnCache<State = unknown> = {
|
|
140
141
|
/** Returns the value saved under `key`, or null when there is none. */
|
|
141
142
|
get(entry: {
|
|
142
143
|
key: string;
|
|
144
|
+
state: State;
|
|
143
145
|
}): string | null | undefined | Promise<string | null | undefined>;
|
|
144
146
|
/**
|
|
145
147
|
* Saves `value` under `key`. The value is Kiln's own string, holding the HTML and what the section added to outlets,
|
|
@@ -151,6 +153,7 @@ type KilnCache = {
|
|
|
151
153
|
value: string;
|
|
152
154
|
seconds: number | null;
|
|
153
155
|
tags: string[];
|
|
156
|
+
state: State;
|
|
154
157
|
}): void | Promise<void>;
|
|
155
158
|
};
|
|
156
159
|
type RenderInfo<State = unknown> = {
|
|
@@ -412,7 +415,7 @@ type KilnOptions<State = undefined, Schema extends KilnSchema = DefaultSchema> =
|
|
|
412
415
|
/** Enables `dump`. Default `false`. */
|
|
413
416
|
debug?: boolean;
|
|
414
417
|
/** Where the `cache` tag saves output, such as `memoryCache()`. Without it, the tag renders every time. */
|
|
415
|
-
cache?: KilnCache
|
|
418
|
+
cache?: KilnCache<State>;
|
|
416
419
|
/** App and build identity added to fragment cache keys. Default `""`. */
|
|
417
420
|
cacheNamespace?: string;
|
|
418
421
|
limits?: Partial<Limits>;
|
|
@@ -536,4 +539,4 @@ declare const memoryCache: ({ max }?: {
|
|
|
536
539
|
};
|
|
537
540
|
//#endregion
|
|
538
541
|
export { Diagnostic as $, HostRender as A, TemplateReference as B, memoryLoader as C, HtmlChecks as D, HtmlCheckLevel as E, AnalysedProp as F, IslandEntry as G, KilnCache as H, Analysis as I, JsonValue as J, IslandManifest as K, CallArgument as L, Markup as M, isSafe as N, PrecompiledTemplate as O, safe as P, streamIslands as Q, FunctionCall as R, memoryCache as S, HtmlCheck as T, RenderInfo as U, AbortSignalLike as V, DeferredIslands as W, deferIslands as X, StreamedIslands as Y, islandScript as Z, TemplateContext as _, KilnGlobals as a, builtins as b, KilnTemplates as c, Limits as d, KilnRenderError as et, LoadedTemplate as f, TemplateBlock as g, RenderOptions as h, KilnFunctions as i, hostComponent as j, HostComponent as k, KilnTests as l, RenderAware as m, KilnCallable as n, TemplateLocation as nt, KilnOptions as o, Loader as p, IslandMode as q, KilnFilters as r, KilnSchema as s, Kiln as t, KilnSyntaxError as tt, KilnTypes as u, TemplateName as v, withRender as w, createKiln as x, TypeChecks as y, TemplateExport as z };
|
|
539
|
-
//# sourceMappingURL=environment-
|
|
542
|
+
//# sourceMappingURL=environment-BQipJ3kg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-BQipJ3kg.d.ts","names":[],"sources":["../src/errors.ts","../src/runtime/islands.ts","../src/runtime/types.ts","../src/analyzer.ts","../src/runtime/markup.ts","../src/compiler/host.ts","../src/compiler/precompiled.ts","../src/html/options.ts","../src/environment.ts"],"mappings":";;KAEY;;EAEX;EACA;EACA;;EAEA;EACA,OAAO;EACP,KAAK;;KAGM;EACX;EACA;EACA;;;;;cAyBY,wBAAwB;EAC3B;WACA,aAAa;EAE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ropType, l as ShapeKey, m as Position, p as TypeName, r as EscapeStrategy } from "./ast-DzzSn9tS.js";
|
|
2
|
-
import { $ as Diagnostic, A as HostRender, B as TemplateReference, C as memoryLoader, D as HtmlChecks, E as HtmlCheckLevel, F as AnalysedProp, G as IslandEntry, H as KilnCache, I as Analysis, J as JsonValue, K as IslandManifest, L as CallArgument, M as Markup, N as isSafe, O as PrecompiledTemplate, P as safe, Q as streamIslands, R as FunctionCall, S as memoryCache, T as HtmlCheck, U as RenderInfo, V as AbortSignalLike, W as DeferredIslands, X as deferIslands, Y as StreamedIslands, Z as islandScript, _ as TemplateContext, a as KilnGlobals, b as builtins, c as KilnTemplates, d as Limits, et as KilnRenderError, f as LoadedTemplate, g as TemplateBlock, h as RenderOptions, i as KilnFunctions, j as hostComponent, k as HostComponent, l as KilnTests, m as RenderAware, n as KilnCallable, nt as TemplateLocation, o as KilnOptions, p as Loader, q as IslandMode, r as KilnFilters, s as KilnSchema, t as Kiln, tt as KilnSyntaxError, u as KilnTypes, v as TemplateName, w as withRender, x as createKiln, y as TypeChecks, z as TemplateExport } from "./environment-
|
|
2
|
+
import { $ as Diagnostic, A as HostRender, B as TemplateReference, C as memoryLoader, D as HtmlChecks, E as HtmlCheckLevel, F as AnalysedProp, G as IslandEntry, H as KilnCache, I as Analysis, J as JsonValue, K as IslandManifest, L as CallArgument, M as Markup, N as isSafe, O as PrecompiledTemplate, P as safe, Q as streamIslands, R as FunctionCall, S as memoryCache, T as HtmlCheck, U as RenderInfo, V as AbortSignalLike, W as DeferredIslands, X as deferIslands, Y as StreamedIslands, Z as islandScript, _ as TemplateContext, a as KilnGlobals, b as builtins, c as KilnTemplates, d as Limits, et as KilnRenderError, f as LoadedTemplate, g as TemplateBlock, h as RenderOptions, i as KilnFunctions, j as hostComponent, k as HostComponent, l as KilnTests, m as RenderAware, n as KilnCallable, nt as TemplateLocation, o as KilnOptions, p as Loader, q as IslandMode, r as KilnFilters, s as KilnSchema, t as Kiln, tt as KilnSyntaxError, u as KilnTypes, v as TemplateName, w as withRender, x as createKiln, y as TypeChecks, z as TemplateExport } from "./environment-BQipJ3kg.js";
|
|
3
3
|
//#region src/runtime/exposure.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Lists the members of a class that templates may read or call.
|
package/dist/index.js
CHANGED
|
@@ -3244,7 +3244,10 @@ var Compiler = class {
|
|
|
3244
3244
|
});
|
|
3245
3245
|
};
|
|
3246
3246
|
if (!store) return after(fresh(), NOTHING$1);
|
|
3247
|
-
const found = locating(run, span, () => store.get({
|
|
3247
|
+
const found = locating(run, span, () => store.get({
|
|
3248
|
+
key: name,
|
|
3249
|
+
state: state.userState
|
|
3250
|
+
}), "The cache store");
|
|
3248
3251
|
return after(found, (value) => {
|
|
3249
3252
|
const saved = typeof value === "string" ? unpackSaved(value) : null;
|
|
3250
3253
|
if (saved) {
|
|
@@ -3284,7 +3287,8 @@ var Compiler = class {
|
|
|
3284
3287
|
key: name,
|
|
3285
3288
|
value,
|
|
3286
3289
|
seconds: time,
|
|
3287
|
-
tags
|
|
3290
|
+
tags,
|
|
3291
|
+
state: state.userState
|
|
3288
3292
|
}), "The cache store");
|
|
3289
3293
|
});
|
|
3290
3294
|
});
|