@forinda/kickjs-view 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +35 -2
- package/dist/assets-30rOQ1d0.d.ts +88 -0
- package/dist/assets-30rOQ1d0.d.ts.map +1 -0
- package/dist/ast-B7pxZgFT.d.ts +369 -0
- package/dist/ast-B7pxZgFT.d.ts.map +1 -0
- package/dist/cli.d.ts +28 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -0
- package/dist/edge.d.ts +6 -0
- package/dist/edge.js +11 -0
- package/dist/exports-WibN1iWb.js +14 -0
- package/dist/exports-WibN1iWb.js.map +1 -0
- package/dist/file-loader.d.ts +3 -0
- package/dist/file-loader.js +14 -0
- package/dist/file-loader.js.map +1 -0
- package/dist/format-BVAljUk8.js +18 -0
- package/dist/format-BVAljUk8.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/project-J0t2RzxZ.d.ts +29 -0
- package/dist/project-J0t2RzxZ.d.ts.map +1 -0
- package/dist/read-exports-CtiwXL4e.js +19 -0
- package/dist/read-exports-CtiwXL4e.js.map +1 -0
- package/dist/views-DA6Conh5.d.ts +163 -0
- package/dist/views-DA6Conh5.d.ts.map +1 -0
- package/package.json +89 -3
- package/virtual.d.ts +18 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Felix Orinda
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @forinda/kickjs-view
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`.kick` views for [KickJS](https://kickjs.app/): server-rendered HTML templates that work on Express, Fastify, h3 and the edge.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
@layout('layouts/main')
|
|
7
|
+
<h1>{{ user.name | titlecase }}</h1>
|
|
8
|
+
@for (post of posts) {
|
|
9
|
+
<post-card [post]="post" />
|
|
10
|
+
} @empty {
|
|
11
|
+
<p>No posts yet</p>
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- `{{ value | pipe }}`, escaped for where it lands; `@if`, `@for`, `@switch`, `@let`
|
|
16
|
+
- layouts (mapped by folder, with a base layout), components with inputs and slots
|
|
17
|
+
- pipes for dates, numbers and currency in a locale and time zone
|
|
18
|
+
- templates checked at build time, shipped as data — no `eval`, no file system on the edge
|
|
19
|
+
- `kick fmt:views` / `kick check:views`
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import kickViews from 'virtual:kick-views'
|
|
23
|
+
import { createViews, KickView } from '@forinda/kickjs-view'
|
|
24
|
+
|
|
25
|
+
const views = createViews({ ...kickViews, layout: 'layouts/main' })
|
|
26
|
+
bootstrap({ modules, adapters: [KickView({ views })] })
|
|
27
|
+
|
|
28
|
+
// in a controller
|
|
29
|
+
await ctx.render('users/show', { user })
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Experimental while 0.x. Guide: [kickjs.app/guide/views](https://kickjs.app/guide/views).
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
MIT
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
import { a as ViewsOptions, r as Views } from "./views-DA6Conh5.js";
|
|
3
|
+
import { _ as TemplateAst, s as CheckedTemplate, u as Expr, v as Diagnostic, y as Pos } from "./ast-B7pxZgFT.js";
|
|
4
|
+
import { t as Project } from "./project-J0t2RzxZ.js";
|
|
5
|
+
//#region src/parse/expression.d.ts
|
|
6
|
+
/** Property names a template never reads, even through `[...]` (checked at runtime). */
|
|
7
|
+
declare const FORBIDDEN_NAMES: ReadonlySet<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Parse one expression. `base` is where `src` starts in the template, so
|
|
10
|
+
* positions in diagnostics and spans point into the template file.
|
|
11
|
+
*/
|
|
12
|
+
declare function parseExpression(src: string, file: string, base: Pos): {
|
|
13
|
+
expr?: Expr;
|
|
14
|
+
diagnostics: Diagnostic[];
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/parse/template.d.ts
|
|
18
|
+
interface ParseResult {
|
|
19
|
+
ast: TemplateAst;
|
|
20
|
+
diagnostics: Diagnostic[];
|
|
21
|
+
}
|
|
22
|
+
/** Parse a `.kick` source. A leading BOM is dropped; positions refer to the rest. */
|
|
23
|
+
declare function parse(source: string, file: string): ParseResult;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/check/check.d.ts
|
|
26
|
+
interface CheckResult {
|
|
27
|
+
template?: CheckedTemplate;
|
|
28
|
+
diagnostics: Diagnostic[];
|
|
29
|
+
}
|
|
30
|
+
/** Check one template of `project` by name. */
|
|
31
|
+
declare function check(name: string, project: Project): CheckResult;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/urls.d.ts
|
|
34
|
+
/**
|
|
35
|
+
* Attributes whose value is a URL a browser may navigate to, load or run
|
|
36
|
+
* (spec §4). Their assembled value is scheme-checked when rendered.
|
|
37
|
+
*/
|
|
38
|
+
declare const URL_ATTRS: ReadonlySet<string>;
|
|
39
|
+
declare function isUrlAttr(tag: string, attr: string): boolean;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/pipes/read-exports.d.ts
|
|
42
|
+
declare function readPipeExports(source: string, file: string): {
|
|
43
|
+
names: string[];
|
|
44
|
+
diagnostics: Diagnostic[];
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/adapter.d.ts
|
|
48
|
+
type Next = (err?: unknown) => void;
|
|
49
|
+
/**
|
|
50
|
+
* The web fetch entry's middleware (`createWebApp({ middlewares: [viewsMiddleware(views)] })`),
|
|
51
|
+
* which takes `(ctx, next)` middleware rather than adapters.
|
|
52
|
+
*/
|
|
53
|
+
declare function viewsMiddleware(views: Views): (ctx: {
|
|
54
|
+
req: object;
|
|
55
|
+
}, next: () => unknown) => unknown;
|
|
56
|
+
interface KickViewOptions extends ViewsOptions {
|
|
57
|
+
/** A views instance to use — share it with error pages and emails. */
|
|
58
|
+
views?: Views;
|
|
59
|
+
}
|
|
60
|
+
declare function KickView(options?: KickViewOptions): {
|
|
61
|
+
name: string;
|
|
62
|
+
views: Views;
|
|
63
|
+
middleware: () => {
|
|
64
|
+
handler: (req: object, res: unknown, next: Next) => void;
|
|
65
|
+
phase: 'beforeGlobal';
|
|
66
|
+
}[];
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/assets.d.ts
|
|
70
|
+
interface ViteManifestChunk {
|
|
71
|
+
file: string;
|
|
72
|
+
css?: string[];
|
|
73
|
+
imports?: string[];
|
|
74
|
+
isEntry?: boolean;
|
|
75
|
+
}
|
|
76
|
+
type ViteManifest = Record<string, ViteManifestChunk>;
|
|
77
|
+
type AssetsMode = {
|
|
78
|
+
dev: true;
|
|
79
|
+
base: string;
|
|
80
|
+
} | {
|
|
81
|
+
dev: false;
|
|
82
|
+
manifest: ViteManifest;
|
|
83
|
+
base: string;
|
|
84
|
+
};
|
|
85
|
+
declare function assetTags(entry: string, mode: AssetsMode, nonce?: string): string;
|
|
86
|
+
//#endregion
|
|
87
|
+
export { KickView as a, readPipeExports as c, CheckResult as d, check as f, parseExpression as g, FORBIDDEN_NAMES as h, assetTags as i, URL_ATTRS as l, parse as m, ViteManifest as n, KickViewOptions as o, ParseResult as p, ViteManifestChunk as r, viewsMiddleware as s, AssetsMode as t, isUrlAttr as u };
|
|
88
|
+
//# sourceMappingURL=assets-30rOQ1d0.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets-30rOQ1d0.d.ts","names":[],"sources":["../src/parse/expression.ts","../src/parse/template.ts","../src/check/check.ts","../src/urls.ts","../src/pipes/read-exports.ts","../src/adapter.ts","../src/assets.ts"],"mappings":";;;;;;cAWa,iBAAiB;;;;;iBA+Yd,gBACd,aACA,cACA,MAAM;EACH,OAAO;EAAM,aAAa;;;;UCzYd;EACf,KAAK;EACL,aAAa;;;iBA01BC,MAAM,gBAAgB,eAAe;;;UC/0BpC;EACf,WAAW;EACX,aAAa;;;iBAmoBC,MAAM,cAAc,SAAS,UAAU;;;;;;;cCnqB1C,WAAW;iBAaR,UAAU,aAAa;;;iBC6DvB,gBACd,gBACA;EACG;EAAiB,aAAa;;;;KCvE9B,QAAQ;;;;;iBA2CG,gBACd,OAAO,SACL;EAAO;GAAe;UAQT,wBAAwB;;EAEvC,QAAQ;;iBAsBM,SAAS,UAAS;;;;IA9CM,UAAA,aAAM,cAAc,MAAQ;IAuD3B;;;;;UCzFxB;EACf;EACA;EACA;EACA;;KAGU,eAAe,eAAe;KAE9B;EACN;EAAW;;EACX;EAAY,UAAU;EAAc;;iBAE1B,UAAU,eAAe,MAAM,YAAY"}
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/diagnostics.d.ts
|
|
3
|
+
/** A point in a template: 0-based offset, 1-based line and column (UTF-16 units). */
|
|
4
|
+
interface Pos {
|
|
5
|
+
offset: number;
|
|
6
|
+
line: number;
|
|
7
|
+
column: number;
|
|
8
|
+
}
|
|
9
|
+
interface Span {
|
|
10
|
+
start: Pos;
|
|
11
|
+
end: Pos;
|
|
12
|
+
}
|
|
13
|
+
interface Diagnostic {
|
|
14
|
+
file: string;
|
|
15
|
+
span: Span;
|
|
16
|
+
message: string;
|
|
17
|
+
severity: 'error' | 'warning';
|
|
18
|
+
/** The templates being rendered, outermost first, when the error came from a render. */
|
|
19
|
+
stack?: string[];
|
|
20
|
+
}
|
|
21
|
+
/** The position of `offset` in `source`. */
|
|
22
|
+
declare const positionAt: (source: string, offset: number) => Pos;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/ast.d.ts
|
|
25
|
+
/** Bumped when the shape of a checked template changes; builds and runtimes must agree. */
|
|
26
|
+
declare const AST_FORMAT_VERSION = 1;
|
|
27
|
+
type Literal = string | number | boolean | null;
|
|
28
|
+
interface PathSegment {
|
|
29
|
+
/** `.name` / `?.name` */
|
|
30
|
+
name?: string;
|
|
31
|
+
/** `[expr]` / `?.[expr]` */
|
|
32
|
+
computed?: Expr;
|
|
33
|
+
optional: boolean;
|
|
34
|
+
}
|
|
35
|
+
type Expr = {
|
|
36
|
+
kind: 'literal';
|
|
37
|
+
value: Literal;
|
|
38
|
+
span: Span;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'path';
|
|
41
|
+
root: string;
|
|
42
|
+
segments: PathSegment[];
|
|
43
|
+
span: Span;
|
|
44
|
+
} | {
|
|
45
|
+
kind: 'unary';
|
|
46
|
+
op: '!' | '-';
|
|
47
|
+
arg: Expr;
|
|
48
|
+
span: Span;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'binary';
|
|
51
|
+
op: '+' | '-' | '<' | '>' | '<=' | '>=' | '==' | '!=' | '===' | '!==';
|
|
52
|
+
left: Expr;
|
|
53
|
+
right: Expr;
|
|
54
|
+
span: Span;
|
|
55
|
+
} | {
|
|
56
|
+
kind: 'logical';
|
|
57
|
+
op: '&&' | '||' | '??';
|
|
58
|
+
left: Expr;
|
|
59
|
+
right: Expr;
|
|
60
|
+
span: Span;
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'conditional';
|
|
63
|
+
test: Expr;
|
|
64
|
+
whenTrue: Expr;
|
|
65
|
+
whenFalse: Expr;
|
|
66
|
+
span: Span;
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'pipe';
|
|
69
|
+
input: Expr;
|
|
70
|
+
name: string;
|
|
71
|
+
args: Expr[];
|
|
72
|
+
span: Span;
|
|
73
|
+
};
|
|
74
|
+
/** Where an interpolation lands, which decides how its value is escaped (spec §4). */
|
|
75
|
+
type Ctx = 'text' | 'rcdata' | 'raw-text' | 'comment';
|
|
76
|
+
interface Attr {
|
|
77
|
+
/** As written: `href`, `userId` (from `[userId]`), `on` (from `[class.on]`). */
|
|
78
|
+
name: string;
|
|
79
|
+
/**
|
|
80
|
+
* `static` `a="x"`, `interp` `a="x{{ y }}"`, `bare` `a`, `bind` `[a]="expr"`,
|
|
81
|
+
* `class` `[class.a]="expr"`, `style` `[style.a(.unit)]="expr"`.
|
|
82
|
+
*/
|
|
83
|
+
kind: 'static' | 'interp' | 'bare' | 'bind' | 'class' | 'style';
|
|
84
|
+
/** `static` / `interp`: the value, literal text and expressions in order. */
|
|
85
|
+
parts?: Array<string | Expr>;
|
|
86
|
+
/** `bind` / `class` / `style`: the bound expression. */
|
|
87
|
+
expr?: Expr;
|
|
88
|
+
/** `[style.width.px]`: `px`. */
|
|
89
|
+
unit?: string;
|
|
90
|
+
quoted: boolean;
|
|
91
|
+
span: Span;
|
|
92
|
+
}
|
|
93
|
+
interface Element {
|
|
94
|
+
k: 'element';
|
|
95
|
+
/** As written. */
|
|
96
|
+
tag: string;
|
|
97
|
+
attrs: Attr[];
|
|
98
|
+
children: Node[];
|
|
99
|
+
/** Inside `<svg>` / `<math>`: names keep their case. */
|
|
100
|
+
foreign: boolean;
|
|
101
|
+
void: boolean;
|
|
102
|
+
selfClosing: boolean;
|
|
103
|
+
span: Span;
|
|
104
|
+
}
|
|
105
|
+
interface IfBranch {
|
|
106
|
+
/** Absent on `@else`. */
|
|
107
|
+
cond?: Expr;
|
|
108
|
+
/** `@if (x; as y)` */
|
|
109
|
+
alias?: string;
|
|
110
|
+
body: Node[];
|
|
111
|
+
}
|
|
112
|
+
type LoopVar = '$index' | '$first' | '$last' | '$even' | '$odd' | '$count';
|
|
113
|
+
type Node = {
|
|
114
|
+
k: 'text';
|
|
115
|
+
value: string;
|
|
116
|
+
span: Span;
|
|
117
|
+
} | {
|
|
118
|
+
k: 'interp';
|
|
119
|
+
expr: Expr;
|
|
120
|
+
ctx: Ctx;
|
|
121
|
+
span: Span;
|
|
122
|
+
} | Element | {
|
|
123
|
+
k: 'comment';
|
|
124
|
+
children: Node[];
|
|
125
|
+
span: Span;
|
|
126
|
+
} | {
|
|
127
|
+
k: 'if';
|
|
128
|
+
branches: IfBranch[];
|
|
129
|
+
span: Span;
|
|
130
|
+
} | {
|
|
131
|
+
k: 'for';
|
|
132
|
+
item: string | [string, string];
|
|
133
|
+
of: Expr;
|
|
134
|
+
lets: Record<string, LoopVar>;
|
|
135
|
+
body: Node[];
|
|
136
|
+
empty?: Node[];
|
|
137
|
+
span: Span;
|
|
138
|
+
} | {
|
|
139
|
+
k: 'switch';
|
|
140
|
+
on: Expr;
|
|
141
|
+
cases: Array<{
|
|
142
|
+
value: Expr;
|
|
143
|
+
body: Node[];
|
|
144
|
+
}>;
|
|
145
|
+
default?: Node[];
|
|
146
|
+
span: Span;
|
|
147
|
+
} | {
|
|
148
|
+
k: 'let';
|
|
149
|
+
name: string;
|
|
150
|
+
expr: Expr;
|
|
151
|
+
span: Span;
|
|
152
|
+
} | {
|
|
153
|
+
k: 'verbatim';
|
|
154
|
+
text: string;
|
|
155
|
+
span: Span;
|
|
156
|
+
} | {
|
|
157
|
+
k: 'slot-outlet';
|
|
158
|
+
name?: string;
|
|
159
|
+
fallback: Node[];
|
|
160
|
+
span: Span;
|
|
161
|
+
} | {
|
|
162
|
+
k: 'slot-fill';
|
|
163
|
+
name: string;
|
|
164
|
+
body: Node[];
|
|
165
|
+
span: Span;
|
|
166
|
+
} | {
|
|
167
|
+
k: 'assets';
|
|
168
|
+
entry: string;
|
|
169
|
+
span: Span;
|
|
170
|
+
};
|
|
171
|
+
interface InputDecl {
|
|
172
|
+
name: string;
|
|
173
|
+
default?: {
|
|
174
|
+
value: Literal;
|
|
175
|
+
span: Span;
|
|
176
|
+
};
|
|
177
|
+
span: Span;
|
|
178
|
+
}
|
|
179
|
+
interface TemplateAst {
|
|
180
|
+
file: string;
|
|
181
|
+
/** `undefined`: none declared (the default layout applies); `null`: `@layout(none)`. */
|
|
182
|
+
layout?: string | null;
|
|
183
|
+
layoutSpan?: Span;
|
|
184
|
+
inputs: InputDecl[];
|
|
185
|
+
body: Node[];
|
|
186
|
+
}
|
|
187
|
+
/** `[line, column]` of a node in its template, for render errors. */
|
|
188
|
+
type At = [number, number];
|
|
189
|
+
/** A path segment: `.n` or `[e]`; `o` marks `?.`. */
|
|
190
|
+
type CSeg = {
|
|
191
|
+
n: string;
|
|
192
|
+
o?: 1;
|
|
193
|
+
} | {
|
|
194
|
+
e: CExpr;
|
|
195
|
+
o?: 1;
|
|
196
|
+
};
|
|
197
|
+
type CExpr =
|
|
198
|
+
/** literal */
|
|
199
|
+
{
|
|
200
|
+
k: 'l';
|
|
201
|
+
v: Literal;
|
|
202
|
+
} |
|
|
203
|
+
/** undefined (a name a component doesn't have) */
|
|
204
|
+
{
|
|
205
|
+
k: 'x';
|
|
206
|
+
} |
|
|
207
|
+
/** page / shared data: `n` then the path */
|
|
208
|
+
{
|
|
209
|
+
k: 'd';
|
|
210
|
+
n: string;
|
|
211
|
+
p: CSeg[];
|
|
212
|
+
} |
|
|
213
|
+
/** a scope slot (@let, loop item, @if alias, component input) then the path */
|
|
214
|
+
{
|
|
215
|
+
k: 'v';
|
|
216
|
+
s: number;
|
|
217
|
+
p: CSeg[];
|
|
218
|
+
} |
|
|
219
|
+
/** a loop variable of the loop whose meta is in slot `s` */
|
|
220
|
+
{
|
|
221
|
+
k: 'm';
|
|
222
|
+
s: number;
|
|
223
|
+
w: LoopVar;
|
|
224
|
+
} | {
|
|
225
|
+
k: 'u';
|
|
226
|
+
o: '!' | '-';
|
|
227
|
+
a: CExpr;
|
|
228
|
+
} | {
|
|
229
|
+
k: 'b';
|
|
230
|
+
o: string;
|
|
231
|
+
l: CExpr;
|
|
232
|
+
r: CExpr;
|
|
233
|
+
} | {
|
|
234
|
+
k: 'c';
|
|
235
|
+
t: CExpr;
|
|
236
|
+
y: CExpr;
|
|
237
|
+
n: CExpr;
|
|
238
|
+
} | {
|
|
239
|
+
k: 'p';
|
|
240
|
+
n: string;
|
|
241
|
+
i: CExpr;
|
|
242
|
+
a: CExpr[];
|
|
243
|
+
};
|
|
244
|
+
/** One attribute of an element whose attributes need work at render time. */
|
|
245
|
+
type CAttr =
|
|
246
|
+
/** static; `v: true` is a bare attribute */
|
|
247
|
+
{
|
|
248
|
+
t: 's';
|
|
249
|
+
n: string;
|
|
250
|
+
v: string | true;
|
|
251
|
+
} |
|
|
252
|
+
/** `n="text {{ e }}"`; `u` marks a URL attribute (`srcset` checks each candidate) */
|
|
253
|
+
{
|
|
254
|
+
t: 'i';
|
|
255
|
+
n: string;
|
|
256
|
+
p: Array<string | CExpr>;
|
|
257
|
+
u?: 'url' | 'srcset';
|
|
258
|
+
} |
|
|
259
|
+
/** `[n]="e"` */
|
|
260
|
+
{
|
|
261
|
+
t: 'b';
|
|
262
|
+
n: string;
|
|
263
|
+
e: CExpr;
|
|
264
|
+
u?: 'url' | 'srcset';
|
|
265
|
+
} |
|
|
266
|
+
/** `[class.n]="e"` */
|
|
267
|
+
{
|
|
268
|
+
t: 'c';
|
|
269
|
+
n: string;
|
|
270
|
+
e: CExpr;
|
|
271
|
+
} |
|
|
272
|
+
/** `[style.n(.x)]="e"` */
|
|
273
|
+
{
|
|
274
|
+
t: 'y';
|
|
275
|
+
n: string;
|
|
276
|
+
e: CExpr;
|
|
277
|
+
x?: string;
|
|
278
|
+
};
|
|
279
|
+
type CNode =
|
|
280
|
+
/** static output */
|
|
281
|
+
{
|
|
282
|
+
k: 's';
|
|
283
|
+
t: string;
|
|
284
|
+
} |
|
|
285
|
+
/** `{{ e }}`: `text` escapes HTML (trusted HTML prints as is), `rcdata` (`<title>`, `<textarea>`) escapes everything, `json` is the one value of a JSON script */
|
|
286
|
+
{
|
|
287
|
+
k: 'i';
|
|
288
|
+
c: 'text' | 'rcdata' | 'json';
|
|
289
|
+
e: CExpr;
|
|
290
|
+
at: At;
|
|
291
|
+
} |
|
|
292
|
+
/** the attributes of an element (between `<tag` and `>`); `f` takes a component caller's fallthrough attributes */
|
|
293
|
+
{
|
|
294
|
+
k: 'A';
|
|
295
|
+
tag: string;
|
|
296
|
+
a: CAttr[];
|
|
297
|
+
f?: 1;
|
|
298
|
+
at: At;
|
|
299
|
+
} | {
|
|
300
|
+
k: 'if';
|
|
301
|
+
br: Array<{
|
|
302
|
+
c?: CExpr;
|
|
303
|
+
a?: number;
|
|
304
|
+
b: CNode[];
|
|
305
|
+
}>;
|
|
306
|
+
} | {
|
|
307
|
+
k: 'for';
|
|
308
|
+
e: CExpr;
|
|
309
|
+
it: number | [number, number];
|
|
310
|
+
m: number;
|
|
311
|
+
b: CNode[];
|
|
312
|
+
em?: CNode[];
|
|
313
|
+
at: At;
|
|
314
|
+
} | {
|
|
315
|
+
k: 'sw';
|
|
316
|
+
e: CExpr;
|
|
317
|
+
cs: Array<{
|
|
318
|
+
e: CExpr;
|
|
319
|
+
b: CNode[];
|
|
320
|
+
}>;
|
|
321
|
+
d?: CNode[];
|
|
322
|
+
} | {
|
|
323
|
+
k: 'let';
|
|
324
|
+
s: number;
|
|
325
|
+
e: CExpr;
|
|
326
|
+
} |
|
|
327
|
+
/** a component: inputs into its slots, fallthrough attributes, slot fills (`''` is the default) */
|
|
328
|
+
{
|
|
329
|
+
k: 'cmp';
|
|
330
|
+
n: string;
|
|
331
|
+
in: Array<{
|
|
332
|
+
s: number;
|
|
333
|
+
e: CExpr;
|
|
334
|
+
}>;
|
|
335
|
+
fa: CAttr[];
|
|
336
|
+
f: Record<string, CNode[]>;
|
|
337
|
+
at: At;
|
|
338
|
+
} |
|
|
339
|
+
/** `<slot name="n">fallback</slot>` */
|
|
340
|
+
{
|
|
341
|
+
k: 'o';
|
|
342
|
+
n: string;
|
|
343
|
+
fb: CNode[];
|
|
344
|
+
} | {
|
|
345
|
+
k: 'as';
|
|
346
|
+
en: string;
|
|
347
|
+
};
|
|
348
|
+
interface CheckedTemplate {
|
|
349
|
+
v: typeof AST_FORMAT_VERSION;
|
|
350
|
+
name: string;
|
|
351
|
+
file: string;
|
|
352
|
+
/** declared layout; `null` is `@layout(none)`; absent means the default layout applies to a page */
|
|
353
|
+
layout?: string | null;
|
|
354
|
+
/** scope slots the template needs */
|
|
355
|
+
slots: number;
|
|
356
|
+
/** a component's inputs: name, slot, default, required */
|
|
357
|
+
inputs: Array<{
|
|
358
|
+
n: string;
|
|
359
|
+
s: number;
|
|
360
|
+
d?: Literal;
|
|
361
|
+
r: boolean;
|
|
362
|
+
}>;
|
|
363
|
+
/** `@slot('name') { }` fills a page passes to its layout */
|
|
364
|
+
fills: Record<string, CNode[]>;
|
|
365
|
+
body: CNode[];
|
|
366
|
+
}
|
|
367
|
+
//#endregion
|
|
368
|
+
export { TemplateAst as _, CNode as a, Span as b, Ctx as c, IfBranch as d, InputDecl as f, PathSegment as g, Node as h, CExpr as i, Element as l, LoopVar as m, Attr as n, CSeg as o, Literal as p, CAttr as r, CheckedTemplate as s, AST_FORMAT_VERSION as t, Expr as u, Diagnostic as v, positionAt as x, Pos as y };
|
|
369
|
+
//# sourceMappingURL=ast-B7pxZgFT.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-B7pxZgFT.d.ts","names":[],"sources":["../src/diagnostics.ts","../src/ast.ts"],"mappings":";;;UACiB;EACf;EACA;EACA;;UAGe;EACf,OAAO;EACP,KAAK;;UAGU;EACf;EACA,MAAM;EACN;EACA;;EAEA;;;cA6BW,aAAU,gBAAkB,mBAAmB;;;;cC5C/C;KAED;UAEK;;EAEf;;EAEA,WAAW;EACX;;KAGU;EACN;EAAiB,OAAO;EAAS,MAAM;;EACvC;EAAc;EAAc,UAAU;EAAe,MAAM;;EAC3D;EAAe;EAAe,KAAK;EAAM,MAAM;;EAE/C;EACA;EACA,MAAM;EACN,OAAO;EACP,MAAM;;EAEN;EAAiB;EAAwB,MAAM;EAAM,OAAO;EAAM,MAAM;;EACxE;EAAqB,MAAM;EAAM,UAAU;EAAM,WAAW;EAAM,MAAM;;EACxE;EAAc,OAAO;EAAM;EAAc,MAAM;EAAQ,MAAM;;;KAGvD;UAEK;;EAEf;;;;;EAKA;;EAEA,QAAQ,eAAe;;EAEvB,OAAO;;EAEP;EACA;EACA,MAAM;;UAGS;EACf;;EAEA;EACA,OAAO;EACP,UAAU;;EAEV;EACA;EACA;EACA,MAAM;;UAGS;;EAEf,OAAO;;EAEP;EACA,MAAM;;KAGI;KAEA;EACN;EAAW;EAAe,MAAM;;EAChC;EAAa,MAAM;EAAM,KAAK;EAAK,MAAM;IAC3C;EACE;EAAc,UAAU;EAAQ,MAAM;;EACtC;EAAS,UAAU;EAAY,MAAM;;EAErC;EACA;EACA,IAAI;EACJ,MAAM,eAAe;EACrB,MAAM;EACN,QA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AW,GAAG;;EAC1B,IAAI;EACJ,GAAG,eAAe;EAClB,IAAI;;;;EAGJ;EAAQ;EAAW,IAAI;;EACvB;EAAS;;UAEE;EACf,UAAU;EACV;EACA;;EAEA;;EAEA;;EAEA,QAAQ;IAAQ;IAAW;IAAW,IAAI;IAAS;;;EAEnD,OAAO,eAAe;EACtB,MAAM"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { t as Project } from "./project-J0t2RzxZ.js";
|
|
3
|
+
import { KickCliPlugin } from "@forinda/kickjs-cli-kit";
|
|
4
|
+
//#region src/cli.d.ts
|
|
5
|
+
export interface ViewsCliOptions {
|
|
6
|
+
/** Project root. */
|
|
7
|
+
root: string;
|
|
8
|
+
/** Views folder, relative to the root. Default `src/views`. */
|
|
9
|
+
dir?: string;
|
|
10
|
+
/** Only these files (relative to the root). Default: every `.kick` file in the views folder. */
|
|
11
|
+
paths?: string[];
|
|
12
|
+
log: (message: string) => void;
|
|
13
|
+
}
|
|
14
|
+
/** Format templates in place, or with `check` report the ones that would change. Returns the exit code. */
|
|
15
|
+
export declare function fmtViews(opts: ViewsCliOptions & {
|
|
16
|
+
check?: boolean;
|
|
17
|
+
indent?: number;
|
|
18
|
+
}): Promise<number>;
|
|
19
|
+
/** Parse and check every template; print each problem with its position. Returns the exit code. */
|
|
20
|
+
export declare function checkViews(opts: ViewsCliOptions & {
|
|
21
|
+
pipesFile?: string;
|
|
22
|
+
componentsDir?: string;
|
|
23
|
+
layouts?: Project['layouts'];
|
|
24
|
+
baseLayout?: string;
|
|
25
|
+
}): Promise<number>;
|
|
26
|
+
export declare const viewCliPlugin: KickCliPlugin;
|
|
27
|
+
//#endregion
|
|
28
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli.ts"],"mappings":";;;;iBAqBiB;;EAEf;;EAEA;;EAEA;EACA,MAAM;;;wBA4Bc,SACpB,MAAM;EAAoB;EAAiB;IAC1C;;wBA0BmB,WACpB,MAAM;EACJ;EACA;EACA,UAAU;EACV;IAED;qBAuCU,eAAe"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @forinda/kickjs-view v0.1.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Felix Orinda
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import{d as parse,m as check,n as BUILTIN_PIPES,t as readPipeExports}from"./read-exports-CtiwXL4e.js";import{t as format}from"./format-BVAljUk8.js";import{readFile,readdir,writeFile}from"node:fs/promises";import{join,relative,resolve,sep}from"node:path";import{existsSync}from"node:fs";const line=(d,prefix)=>`${prefix}${d.file}:${d.span.start.line}:${d.span.start.column} — ${d.message}`;async function templates(viewsDir,root,paths){return paths?.length?paths.map(p=>relative(viewsDir,resolve(root,p))).filter(p=>p.endsWith(`.kick`)&&!p.startsWith(`..`)).map(p=>p.slice(0,-5).split(sep).join(`/`)):existsSync(viewsDir)?(await readdir(viewsDir,{recursive:!0,withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.kick`)).map(e=>relative(viewsDir,join(direntDir(e),e.name)).slice(0,-5).split(sep).join(`/`)).toSorted():[]}async function fmtViews(opts){let dir=opts.dir??`src/views`,viewsDir=resolve(opts.root,dir),failed=!1,changed=0;for(let name of await templates(viewsDir,opts.root,opts.paths)){let file=join(viewsDir,`${name}.kick`),source=await readFile(file,`utf8`),r=format(source,`${name}.kick`,{indent:opts.indent});for(let d of r.diagnostics)opts.log(line(d,`${dir}/`));r.output===void 0?failed=!0:r.output!==source&&(changed++,opts.check?opts.log(`would reformat ${dir}/${name}.kick`):(await writeFile(file,r.output),opts.log(`formatted ${dir}/${name}.kick`)))}return failed||opts.check&&changed?1:0}async function checkViews(opts){let dir=opts.dir??`src/views`,viewsDir=resolve(opts.root,dir),pipesFile=resolve(opts.root,opts.pipesFile??join(dir,`pipes.ts`)),all=await templates(viewsDir,opts.root),pipes=new Set(BUILTIN_PIPES),errors=0,report=(d,prefix)=>{d.severity===`error`&&errors++,opts.log(line(d,prefix))};if(existsSync(pipesFile)){let read=readPipeExports(await readFile(pipesFile,`utf8`),relative(opts.root,pipesFile));for(let n of read.names)pipes.add(n);for(let d of read.diagnostics)report(d,``)}let project={templates:/* @__PURE__ */ new Map,pipes,componentsDir:opts.componentsDir??`components`,layouts:opts.layouts,baseLayout:opts.baseLayout},syntax=/* @__PURE__ */ new Set;for(let name of all){let r=parse(await readFile(join(viewsDir,`${name}.kick`),`utf8`),`${name}.kick`);project.templates.set(name,r.ast);for(let d of r.diagnostics)report(d,`${dir}/`);r.diagnostics.some(d=>d.severity===`error`)&&syntax.add(name)}let wanted=opts.paths?.length?await templates(viewsDir,opts.root,opts.paths):all;for(let name of wanted)if(!syntax.has(name))for(let d of check(name,project).diagnostics)report(d,`${dir}/`);return errors||opts.log(`${wanted.length} template(s) checked, no errors`),+!!errors}const viewCliPlugin={name:`kick/view`,register(program,ctx){program.command(`fmt:views [paths...]`).description(`Format .kick templates (spacing and indentation; raw regions untouched)`).option(`--check`,`list files that would change and exit 1, writing nothing`).option(`--dir <dir>`,`views folder`,`src/views`).action(async(paths,o)=>{process.exitCode=await fmtViews({root:ctx.projectRoot,dir:o.dir,paths,check:o.check,log:ctx.log})}),program.command(`check:views [paths...]`).description(`Check .kick templates for errors: syntax, unknown pipes, inputs, slots, layouts, unsafe interpolation`).option(`--dir <dir>`,`views folder`,`src/views`).option(`--pipes <file>`,`pipes file (default <dir>/pipes.ts)`).action(async(paths,o)=>{process.exitCode=await checkViews({root:ctx.projectRoot,dir:o.dir,paths,pipesFile:o.pipes,log:ctx.log})})}};function direntDir(e){return e.parentPath??e.path??``}export{checkViews,fmtViews,viewCliPlugin};
|
|
12
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["/**\n * `kick fmt:views` and `kick check:views`, as a kick CLI plugin:\n *\n * ```ts\n * // kick.config.ts\n * import { viewCliPlugin } from '@forinda/kickjs-view/cli'\n * export default defineConfig({ plugins: [viewCliPlugin] })\n * ```\n */\nimport { existsSync } from 'node:fs'\nimport { readdir, readFile, writeFile } from 'node:fs/promises'\nimport { join, relative, resolve, sep } from 'node:path'\nimport type { KickCliPlugin } from '@forinda/kickjs-cli-kit'\nimport type { Diagnostic } from './diagnostics'\nimport { check } from './check/check'\nimport type { Project } from './check/project'\nimport { format } from './format'\nimport { parse } from './parse/template'\nimport { BUILTIN_PIPES } from './pipes/builtins'\nimport { readPipeExports } from './pipes/read-exports'\n\nexport interface ViewsCliOptions {\n /** Project root. */\n root: string\n /** Views folder, relative to the root. Default `src/views`. */\n dir?: string\n /** Only these files (relative to the root). Default: every `.kick` file in the views folder. */\n paths?: string[]\n log: (message: string) => void\n}\n\nconst line = (d: Diagnostic, prefix: string) =>\n `${prefix}${d.file}:${d.span.start.line}:${d.span.start.column} — ${d.message}`\n\n/** Template names (`users/show`) under the views folder, or those `paths` name. */\nasync function templates(viewsDir: string, root: string, paths?: string[]): Promise<string[]> {\n if (paths?.length) {\n return paths\n .map((p) => relative(viewsDir, resolve(root, p)))\n .filter((p) => p.endsWith('.kick') && !p.startsWith('..'))\n .map((p) => p.slice(0, -'.kick'.length).split(sep).join('/'))\n }\n if (!existsSync(viewsDir)) return []\n const entries = await readdir(viewsDir, { recursive: true, withFileTypes: true })\n return entries\n .filter((e) => e.isFile() && e.name.endsWith('.kick'))\n .map((e) =>\n relative(viewsDir, join(direntDir(e), e.name))\n .slice(0, -'.kick'.length)\n .split(sep)\n .join('/'),\n )\n .toSorted()\n}\n\n/** Format templates in place, or with `check` report the ones that would change. Returns the exit code. */\nexport async function fmtViews(\n opts: ViewsCliOptions & { check?: boolean; indent?: number },\n): Promise<number> {\n const dir = opts.dir ?? 'src/views'\n const viewsDir = resolve(opts.root, dir)\n let failed = false\n let changed = 0\n for (const name of await templates(viewsDir, opts.root, opts.paths)) {\n const file = join(viewsDir, `${name}.kick`)\n const source = await readFile(file, 'utf8')\n const r = format(source, `${name}.kick`, { indent: opts.indent })\n for (const d of r.diagnostics) opts.log(line(d, `${dir}/`))\n if (r.output === undefined) {\n failed = true\n continue\n }\n if (r.output === source) continue\n changed++\n if (opts.check) opts.log(`would reformat ${dir}/${name}.kick`)\n else {\n await writeFile(file, r.output)\n opts.log(`formatted ${dir}/${name}.kick`)\n }\n }\n return failed || (opts.check && changed) ? 1 : 0\n}\n\n/** Parse and check every template; print each problem with its position. Returns the exit code. */\nexport async function checkViews(\n opts: ViewsCliOptions & {\n pipesFile?: string\n componentsDir?: string\n layouts?: Project['layouts']\n baseLayout?: string\n },\n): Promise<number> {\n const dir = opts.dir ?? 'src/views'\n const viewsDir = resolve(opts.root, dir)\n const pipesFile = resolve(opts.root, opts.pipesFile ?? join(dir, 'pipes.ts'))\n const all = await templates(viewsDir, opts.root)\n const pipes = new Set(BUILTIN_PIPES)\n let errors = 0\n const report = (d: Diagnostic, prefix: string) => {\n if (d.severity === 'error') errors++\n opts.log(line(d, prefix))\n }\n if (existsSync(pipesFile)) {\n const read = readPipeExports(await readFile(pipesFile, 'utf8'), relative(opts.root, pipesFile))\n for (const n of read.names) pipes.add(n)\n for (const d of read.diagnostics) report(d, '')\n }\n const project: Project = {\n templates: new Map(),\n pipes,\n componentsDir: opts.componentsDir ?? 'components',\n layouts: opts.layouts,\n baseLayout: opts.baseLayout,\n }\n const syntax = new Set<string>()\n for (const name of all) {\n const r = parse(await readFile(join(viewsDir, `${name}.kick`), 'utf8'), `${name}.kick`)\n project.templates.set(name, r.ast)\n for (const d of r.diagnostics) report(d, `${dir}/`)\n if (r.diagnostics.some((d) => d.severity === 'error')) syntax.add(name)\n }\n const wanted = opts.paths?.length ? await templates(viewsDir, opts.root, opts.paths) : all\n for (const name of wanted) {\n if (syntax.has(name)) continue\n for (const d of check(name, project).diagnostics) report(d, `${dir}/`)\n }\n if (!errors) opts.log(`${wanted.length} template(s) checked, no errors`)\n return errors ? 1 : 0\n}\n\nexport const viewCliPlugin: KickCliPlugin = {\n name: 'kick/view',\n register(program, ctx) {\n program\n .command('fmt:views [paths...]')\n .description('Format .kick templates (spacing and indentation; raw regions untouched)')\n .option('--check', 'list files that would change and exit 1, writing nothing')\n .option('--dir <dir>', 'views folder', 'src/views')\n .action(async (paths: string[], o: { check?: boolean; dir: string }) => {\n process.exitCode = await fmtViews({\n root: ctx.projectRoot,\n dir: o.dir,\n paths,\n check: o.check,\n log: ctx.log,\n })\n })\n program\n .command('check:views [paths...]')\n .description(\n 'Check .kick templates for errors: syntax, unknown pipes, inputs, slots, layouts, unsafe interpolation',\n )\n .option('--dir <dir>', 'views folder', 'src/views')\n .option('--pipes <file>', 'pipes file (default <dir>/pipes.ts)')\n .action(async (paths: string[], o: { dir: string; pipes?: string }) => {\n process.exitCode = await checkViews({\n root: ctx.projectRoot,\n dir: o.dir,\n paths,\n pipesFile: o.pipes,\n log: ctx.log,\n })\n })\n },\n}\n\n/** A dirent's folder: `parentPath` from Node 20.12, `path` before it. */\nfunction direntDir(e: { parentPath?: string; path?: string }): string {\n return e.parentPath ?? e.path ?? ''\n}\n"],"mappings":";;;;;;;;;;8RA+BA,MAAM,MAAQ,EAAe,SAC3B,GAAG,SAAS,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,KAAK,GAAG,EAAE,KAAK,MAAM,OAAO,KAAK,EAAE,UAGxE,eAAe,UAAU,SAAkB,KAAc,MAAqC,CAS5F,OARI,OAAO,OACF,MACJ,IAAK,GAAM,SAAS,SAAU,QAAQ,KAAM,CAAC,CAAC,CAAC,CAAC,CAChD,OAAQ,GAAM,EAAE,SAAS,OAAO,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K,IAAI,GAAG,OAAO,OAAO,gCAAgC,EAChE,SACT,CAEA,MAAa,cAA+B,CAC1C,KAAM,YACN,SAAS,QAAS,IAAK,CACrB,QACG,QAAQ,sBAAsB,CAAC,CAC/B,YAAY,yEAAyE,CAAC,CACtF,OAAO,UAAW,0DAA0D,CAAC,CAC7E,OAAO,cAAe,eAAgB,WAAW,CAAC,CAClD,OAAO,MAAO,MAAiB,IAAwC,CACtE,QAAQ,SAAW,MAAM,SAAS,CAChC,KAAM,IAAI,YACV,IAAK,EAAE,IACP,MACA,MAAO,EAAE,MACT,IAAK,IAAI,GACX,CAAC,CACH,CAAC,EACH,QACG,QAAQ,wBAAwB,CAAC,CACjC,YACC,uGACF,CAAC,CACA,OAAO,cAAe,eAAgB,WAAW,CAAC,CAClD,OAAO,iBAAkB,qCAAqC,CAAC,CAC/D,OAAO,MAAO,MAAiB,IAAuC,CACrE,QAAQ,SAAW,MAAM,WAAW,CAClC,KAAM,IAAI,YACV,IAAK,EAAE,IACP,MACA,UAAW,EAAE,MACb,IAAK,IAAI,GACX,CAAC,CACH,CAAC,CACL,CACF,EAGA,SAAS,UAAU,EAAmD,CACpE,OAAO,EAAE,YAAc,EAAE,MAAQ,EACnC"}
|
package/dist/edge.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
import { C as SafeHtml, D as safeStyleValue, E as read, O as sanitizeSrcset, S as render, T as escapeJsonForScript, _ as builtinPipes, a as ViewsOptions, b as RenderEnv, c as useFileLoader, d as EnvPipe, f as pipesFor, g as PipeEnv, h as BUILTIN_PIPES, i as ViewsBundle, k as sanitizeUrl, m as withEnv, n as RenderOptions, o as bundleLoader, p as safeHtml, r as Views, s as createViews, t as Loader, v as MAX_DEPTH, w as escapeHtml, x as RenderError, y as Pipe } from "./views-DA6Conh5.js";
|
|
3
|
+
import { _ as TemplateAst, a as CNode, b as Span, c as Ctx, d as IfBranch, f as InputDecl, g as PathSegment, h as Node, i as CExpr, l as Element, m as LoopVar, n as Attr, o as CSeg, p as Literal, r as CAttr, s as CheckedTemplate, t as AST_FORMAT_VERSION, u as Expr, v as Diagnostic, x as positionAt, y as Pos } from "./ast-B7pxZgFT.js";
|
|
4
|
+
import { i as templateName, n as componentTag, r as layoutResolver, t as Project } from "./project-J0t2RzxZ.js";
|
|
5
|
+
import { a as KickView, c as readPipeExports, d as CheckResult, f as check, g as parseExpression, h as FORBIDDEN_NAMES, i as assetTags, l as URL_ATTRS, m as parse, n as ViteManifest, o as KickViewOptions, p as ParseResult, r as ViteManifestChunk, s as viewsMiddleware, t as AssetsMode, u as isUrlAttr } from "./assets-30rOQ1d0.js";
|
|
6
|
+
export { AST_FORMAT_VERSION, type AssetsMode, type Attr, BUILTIN_PIPES, type CAttr, type CExpr, type CNode, type CSeg, type CheckResult, type CheckedTemplate, type Ctx, type Diagnostic, type Element, type EnvPipe, type Expr, FORBIDDEN_NAMES, type IfBranch, type InputDecl, KickView, type KickViewOptions, type Literal, type Loader, type LoopVar, MAX_DEPTH, type Node, type ParseResult, type PathSegment, type Pipe, type PipeEnv, type Pos, type Project, type RenderEnv, RenderError, type RenderOptions, SafeHtml, type Span, type TemplateAst, URL_ATTRS, type Views, type ViewsBundle, type ViewsOptions, type ViteManifest, type ViteManifestChunk, assetTags, builtinPipes, bundleLoader, check, componentTag, createViews, escapeHtml, escapeJsonForScript, isUrlAttr, layoutResolver, parse, parseExpression, pipesFor, positionAt, read, readPipeExports, render, safeHtml, safeStyleValue, sanitizeSrcset, sanitizeUrl, templateName, useFileLoader, viewsMiddleware, withEnv };
|
package/dist/edge.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @forinda/kickjs-view v0.1.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Felix Orinda
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import{S as positionAt,_ as templateName,a as escapeHtml,c as safeStyleValue,d as parse,f as FORBIDDEN_NAMES,g as layoutResolver,h as componentTag,i as SafeHtml,l as sanitizeSrcset,m as check,n as BUILTIN_PIPES,o as escapeJsonForScript,p as parseExpression,r as builtinPipes,s as read,t as readPipeExports,u as sanitizeUrl,v as URL_ATTRS,w as AST_FORMAT_VERSION,y as isUrlAttr}from"./read-exports-CtiwXL4e.js";import{a as createViews,c as RenderError,d as safeHtml,f as withEnv,i as bundleLoader,l as render,n as KickView,o as useFileLoader,r as viewsMiddleware,s as MAX_DEPTH,t as assetTags,u as pipesFor}from"./exports-WibN1iWb.js";export{AST_FORMAT_VERSION,BUILTIN_PIPES,FORBIDDEN_NAMES,KickView,MAX_DEPTH,RenderError,SafeHtml,URL_ATTRS,assetTags,builtinPipes,bundleLoader,check,componentTag,createViews,escapeHtml,escapeJsonForScript,isUrlAttr,layoutResolver,parse,parseExpression,pipesFor,positionAt,read,readPipeExports,render,safeHtml,safeStyleValue,sanitizeSrcset,sanitizeUrl,templateName,useFileLoader,viewsMiddleware,withEnv};
|