@azerothjs/compiler 0.4.0-beta.3 → 0.5.0-beta.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/dist/codegen.d.ts +40 -0
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +200 -1
- package/dist/codegen.js.map +1 -1
- package/dist/compile.d.ts +18 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +71 -7
- package/dist/compile.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lint.d.ts +36 -0
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +145 -0
- package/dist/lint.js.map +1 -0
- package/dist/vite.d.ts +15 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +43 -3
- package/dist/vite.js.map +1 -1
- package/package.json +7 -2
package/dist/codegen.d.ts
CHANGED
|
@@ -10,6 +10,15 @@ import type { MarkupElement, MarkupFragment } from './types.ts';
|
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
12
|
export type ExpressionCompiler = (code: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Escapes a literal string for emission inside single quotes.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* quoteString('a\'b'); // "'a\\'b'" (the inner quote is escaped)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function quoteString(value: string): string;
|
|
13
22
|
/**
|
|
14
23
|
* Generates code for a markup element or fragment.
|
|
15
24
|
*
|
|
@@ -27,6 +36,37 @@ export type ExpressionCompiler = (code: string) => string;
|
|
|
27
36
|
* ```
|
|
28
37
|
*/
|
|
29
38
|
export declare function generate(node: MarkupElement | MarkupFragment, compileExpression: ExpressionCompiler): string;
|
|
39
|
+
/** What a dom-target region emission used, so compile() imports only that. */
|
|
40
|
+
export interface DomRegion {
|
|
41
|
+
/** The expression replacing the markup region. */
|
|
42
|
+
code: string;
|
|
43
|
+
/** True when the emission calls bindHole(). */
|
|
44
|
+
usesBindHole: boolean;
|
|
45
|
+
/** True when the emission calls bindChild(). */
|
|
46
|
+
usesBindChild: boolean;
|
|
47
|
+
/** True when the emission calls bindProps(). */
|
|
48
|
+
usesBindProps: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Emits a markup region as a cloned template plus dynamic bindings, or
|
|
52
|
+
* returns null when the region isn't template-eligible (the caller falls
|
|
53
|
+
* back to the h() emission).
|
|
54
|
+
*
|
|
55
|
+
* @param node - The region's root AST node
|
|
56
|
+
* @param compileExpression - Recompiles nested-markup-bearing JS
|
|
57
|
+
* @param allocateTemplate - Interns an HTML string, returning the hoisted
|
|
58
|
+
* template const's name (deduplicated per module)
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* // <li class="row">{name()}</li> becomes (hoisted)
|
|
63
|
+
* // const _tmpl$1 = tmpl('<li class="row"><!--$--></li>');
|
|
64
|
+
* // and (in place)
|
|
65
|
+
* // (() => { const _r = _tmpl$1(); const _e$1 = _r.firstChild;
|
|
66
|
+
* // bindHole(_e$1, () => (name())); return _r; })()
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function generateDomRegion(node: MarkupElement | MarkupFragment, compileExpression: ExpressionCompiler, allocateTemplate: (html: string) => string): DomRegion | null;
|
|
30
70
|
/**
|
|
31
71
|
* Visits the markup element tree (not expression holes) and calls `visit`
|
|
32
72
|
* with the tag of every component (capitalised/dotted) element. Used by
|
package/dist/codegen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../src/codegen.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACR,aAAa,EACb,cAAc,EAGjB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../src/codegen.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACR,aAAa,EACb,cAAc,EAGjB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AA+G1D;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjD;AAiID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,GAAG,MAAM,CA4B5G;AAwDD,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IAEtB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IAEb,+CAA+C;IAC/C,YAAY,EAAE,OAAO,CAAC;IAEtB,gDAAgD;IAChD,aAAa,EAAE,OAAO,CAAC;IAEvB,gDAAgD;IAChD,aAAa,EAAE,OAAO,CAAC;CAC1B;AAgCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,aAAa,GAAG,cAAc,EACpC,iBAAiB,EAAE,kBAAkB,EACrC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC3C,SAAS,GAAG,IAAI,CAoJlB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAa1G"}
|
package/dist/codegen.js
CHANGED
|
@@ -112,7 +112,7 @@ function isEventName(name) {
|
|
|
112
112
|
* quoteString('a\'b'); // "'a\\'b'" (the inner quote is escaped)
|
|
113
113
|
* ```
|
|
114
114
|
*/
|
|
115
|
-
function quoteString(value) {
|
|
115
|
+
export function quoteString(value) {
|
|
116
116
|
return `'${value.replace(/\\/g, '\\\\').replace(/'/g, '\\\'').replace(/\n/g, '\\n')}'`;
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -259,6 +259,205 @@ export function generate(node, compileExpression) {
|
|
|
259
259
|
const args = [`'${node.tag}'`, props, ...children];
|
|
260
260
|
return `h(${args.join(', ')})`;
|
|
261
261
|
}
|
|
262
|
+
// Template-cloning emission (the `dom` compile target).
|
|
263
|
+
//
|
|
264
|
+
// For a region whose entire subtree is host elements (no components, no
|
|
265
|
+
// fragments), the static structure is emitted ONCE as an HTML string and
|
|
266
|
+
// instantiated per use with cloneNode - the per-element createElement +
|
|
267
|
+
// applyProps work h() does becomes a single native clone. Dynamic parts
|
|
268
|
+
// (expression holes, event handlers, reactive/spread/DOM-property
|
|
269
|
+
// attributes) are bound into the clone by walking firstChild/nextSibling
|
|
270
|
+
// paths computed here at compile time. Holes leave a `<!--$-->` comment in
|
|
271
|
+
// the template (comments never merge with neighboring text the way a text
|
|
272
|
+
// placeholder would); bindHole() swaps the marker for the live node.
|
|
273
|
+
//
|
|
274
|
+
// Each region is emitted as BOTH forms behind a render-mode guard:
|
|
275
|
+
//
|
|
276
|
+
// isStringMode() || isHydrating() ? h(...) : (clone + bind)
|
|
277
|
+
//
|
|
278
|
+
// SSR and hydration ride the universal h() machinery - the server output
|
|
279
|
+
// and adoption walk stay byte-identical to the default target - while
|
|
280
|
+
// every fresh client creation (post-hydration rows, branch swaps, CSR)
|
|
281
|
+
// takes the clone path. The walk paths computed below never run against
|
|
282
|
+
// server DOM, whose hole anchors would shift them. Costs one mode check
|
|
283
|
+
// per instantiation and the duplicated region code in the bundle.
|
|
284
|
+
//
|
|
285
|
+
// Regions that contain components or fragments fall back to the universal
|
|
286
|
+
// h() emission alone - composition crosses function boundaries the
|
|
287
|
+
// template can't see across.
|
|
288
|
+
/**
|
|
289
|
+
* Static attributes h() sets as DOM PROPERTIES, not attributes. In a
|
|
290
|
+
* template they must go through bindProps to keep h()'s semantics (an
|
|
291
|
+
* attribute only sets the initial state; the property is the live state).
|
|
292
|
+
*
|
|
293
|
+
* @internal
|
|
294
|
+
*/
|
|
295
|
+
const DOM_PROPERTY_ATTRS = new Set(['value', 'checked', 'selected', 'innerHTML', 'textContent']);
|
|
296
|
+
/** Elements with no end tag (and no children). @internal */
|
|
297
|
+
const VOID_ELEMENTS = new Set([
|
|
298
|
+
'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',
|
|
299
|
+
'link', 'meta', 'param', 'source', 'track', 'wbr'
|
|
300
|
+
]);
|
|
301
|
+
/** Escapes text-node content for embedding in the template HTML. @internal */
|
|
302
|
+
function escapeTemplateText(text) {
|
|
303
|
+
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
304
|
+
}
|
|
305
|
+
/** Escapes an attribute value for embedding in the template HTML. @internal */
|
|
306
|
+
function escapeTemplateAttr(value) {
|
|
307
|
+
return value.replace(/&/g, '&').replace(/"/g, '"');
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* True when every element in the subtree is a host element - the shape the
|
|
311
|
+
* template path can serialize. Components and fragments bail to h().
|
|
312
|
+
*
|
|
313
|
+
* @internal
|
|
314
|
+
*/
|
|
315
|
+
function isHostOnly(el) {
|
|
316
|
+
if (el.isComponent) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
if (VOID_ELEMENTS.has(el.tag) && el.children.length > 0) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
for (const child of el.children) {
|
|
323
|
+
if (child.kind === 'fragment') {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
if (child.kind === 'element' && !isHostOnly(child)) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Emits a markup region as a cloned template plus dynamic bindings, or
|
|
334
|
+
* returns null when the region isn't template-eligible (the caller falls
|
|
335
|
+
* back to the h() emission).
|
|
336
|
+
*
|
|
337
|
+
* @param node - The region's root AST node
|
|
338
|
+
* @param compileExpression - Recompiles nested-markup-bearing JS
|
|
339
|
+
* @param allocateTemplate - Interns an HTML string, returning the hoisted
|
|
340
|
+
* template const's name (deduplicated per module)
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```ts
|
|
344
|
+
* // <li class="row">{name()}</li> becomes (hoisted)
|
|
345
|
+
* // const _tmpl$1 = tmpl('<li class="row"><!--$--></li>');
|
|
346
|
+
* // and (in place)
|
|
347
|
+
* // (() => { const _r = _tmpl$1(); const _e$1 = _r.firstChild;
|
|
348
|
+
* // bindHole(_e$1, () => (name())); return _r; })()
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
export function generateDomRegion(node, compileExpression, allocateTemplate) {
|
|
352
|
+
if (node.kind !== 'element' || !isHostOnly(node)) {
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
const ops = [];
|
|
356
|
+
function buildElement(el, path) {
|
|
357
|
+
let html = `<${el.tag}`;
|
|
358
|
+
const dynamicEntries = [];
|
|
359
|
+
for (const attr of el.attributes) {
|
|
360
|
+
if (attr.spread || attr.value.kind === 'expression' || DOM_PROPERTY_ATTRS.has(attr.name ?? '')) {
|
|
361
|
+
dynamicEntries.push(generateAttribute(attr, compileExpression));
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
html += attr.value.kind === 'none'
|
|
365
|
+
? ` ${attr.name}`
|
|
366
|
+
: ` ${attr.name}="${escapeTemplateAttr(attr.value.value)}"`;
|
|
367
|
+
}
|
|
368
|
+
html += '>';
|
|
369
|
+
if (dynamicEntries.length > 0) {
|
|
370
|
+
ops.push({ path, kind: 'props', code: `{ ${dynamicEntries.join(', ')} }` });
|
|
371
|
+
}
|
|
372
|
+
if (VOID_ELEMENTS.has(el.tag)) {
|
|
373
|
+
return html;
|
|
374
|
+
}
|
|
375
|
+
// Sole-child hole (`<span>{x()}</span>`): no marker - the binding
|
|
376
|
+
// appends straight into the empty parent. Saves a cloned comment
|
|
377
|
+
// node and a replaceChild per instance; with one-binding leaf
|
|
378
|
+
// elements (the dominant row shape) that is most of the work.
|
|
379
|
+
if (el.children.length === 1 && el.children[0].kind === 'expression') {
|
|
380
|
+
ops.push({
|
|
381
|
+
path,
|
|
382
|
+
kind: 'child',
|
|
383
|
+
code: wrapDynamic(compileExpression(el.children[0].code), false)
|
|
384
|
+
});
|
|
385
|
+
return `${html}</${el.tag}>`;
|
|
386
|
+
}
|
|
387
|
+
let index = 0;
|
|
388
|
+
for (const child of el.children) {
|
|
389
|
+
if (child.kind === 'text') {
|
|
390
|
+
html += escapeTemplateText(child.value);
|
|
391
|
+
}
|
|
392
|
+
else if (child.kind === 'expression') {
|
|
393
|
+
html += '<!--$-->';
|
|
394
|
+
ops.push({
|
|
395
|
+
path: [...path, index],
|
|
396
|
+
kind: 'hole',
|
|
397
|
+
code: wrapDynamic(compileExpression(child.code), false)
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
html += buildElement(child, [...path, index]);
|
|
402
|
+
}
|
|
403
|
+
index++;
|
|
404
|
+
}
|
|
405
|
+
return `${html}</${el.tag}>`;
|
|
406
|
+
}
|
|
407
|
+
const html = buildElement(node, []);
|
|
408
|
+
const templateName = allocateTemplate(html);
|
|
409
|
+
// The universal form for SSR/hydration - same output the default
|
|
410
|
+
// target produces, selected by the runtime mode guard.
|
|
411
|
+
const universal = generate(node, compileExpression);
|
|
412
|
+
if (ops.length === 0) {
|
|
413
|
+
return {
|
|
414
|
+
code: `(isStringMode() || isHydrating() ? ${universal} : ${templateName}())`,
|
|
415
|
+
usesBindHole: false,
|
|
416
|
+
usesBindChild: false,
|
|
417
|
+
usesBindProps: false
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
// Walk variables: one const per distinct node a binding targets, shared
|
|
421
|
+
// ancestor prefixes cached so each path segment is computed once.
|
|
422
|
+
const decls = [];
|
|
423
|
+
const varByPath = new Map([['', '_r']]);
|
|
424
|
+
let varId = 0;
|
|
425
|
+
function varFor(path) {
|
|
426
|
+
const key = path.join('.');
|
|
427
|
+
const existing = varByPath.get(key);
|
|
428
|
+
if (existing !== undefined) {
|
|
429
|
+
return existing;
|
|
430
|
+
}
|
|
431
|
+
const parent = varFor(path.slice(0, -1));
|
|
432
|
+
const name = `_e$${++varId}`;
|
|
433
|
+
decls.push(`const ${name} = ${parent}.firstChild${'.nextSibling'.repeat(path[path.length - 1])};`);
|
|
434
|
+
varByPath.set(key, name);
|
|
435
|
+
return name;
|
|
436
|
+
}
|
|
437
|
+
let usesBindHole = false;
|
|
438
|
+
let usesBindChild = false;
|
|
439
|
+
let usesBindProps = false;
|
|
440
|
+
const stmts = ops.map((op) => {
|
|
441
|
+
const target = varFor(op.path);
|
|
442
|
+
if (op.kind === 'hole') {
|
|
443
|
+
usesBindHole = true;
|
|
444
|
+
return `bindHole(${target}, ${op.code});`;
|
|
445
|
+
}
|
|
446
|
+
if (op.kind === 'child') {
|
|
447
|
+
usesBindChild = true;
|
|
448
|
+
return `bindChild(${target}, ${op.code});`;
|
|
449
|
+
}
|
|
450
|
+
usesBindProps = true;
|
|
451
|
+
return `bindProps(${target}, ${op.code});`;
|
|
452
|
+
});
|
|
453
|
+
const body = [`const _r = ${templateName}();`, ...decls, ...stmts, 'return _r;'].join(' ');
|
|
454
|
+
return {
|
|
455
|
+
code: `(isStringMode() || isHydrating() ? ${universal} : (() => { ${body} })())`,
|
|
456
|
+
usesBindHole,
|
|
457
|
+
usesBindChild,
|
|
458
|
+
usesBindProps
|
|
459
|
+
};
|
|
460
|
+
}
|
|
262
461
|
/**
|
|
263
462
|
* Visits the markup element tree (not expression holes) and calls `visit`
|
|
264
463
|
* with the tag of every component (capitalised/dotted) element. Used by
|
package/dist/codegen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,WAAW,EAC/C,CAAC;QACG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EACjC,CAAC;QACG,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EACzD,CAAC;YACG,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;AACL,CAAC"}
|
package/dist/compile.d.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { type SourceMapV3 } from './sourcemap.ts';
|
|
2
|
+
/** Options for compile(). */
|
|
3
|
+
export interface CompileOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Output shape for markup regions.
|
|
6
|
+
*
|
|
7
|
+
* - `'universal'` (default): h() calls - works in DOM, SSR string mode,
|
|
8
|
+
* and hydration. What the language tooling models.
|
|
9
|
+
* - `'dom'`: template cloning - host-element regions are hoisted as one
|
|
10
|
+
* HTML template and instantiated with cloneNode, with only the
|
|
11
|
+
* dynamic parts bound per instance. Each region also carries the
|
|
12
|
+
* universal h() branch behind a render-mode guard, so SSR and
|
|
13
|
+
* hydrate() work from the same artifact; the cost is the duplicated
|
|
14
|
+
* region code. Regions containing components/fragments fall back to
|
|
15
|
+
* h() alone.
|
|
16
|
+
*/
|
|
17
|
+
target?: 'universal' | 'dom';
|
|
18
|
+
}
|
|
2
19
|
/** Result of compiling a `.azeroth` source string. */
|
|
3
20
|
export interface CompileResult {
|
|
4
21
|
/** The compiled JS/TS source. */
|
|
@@ -43,5 +60,5 @@ export interface CompileResult {
|
|
|
43
60
|
* // }
|
|
44
61
|
* ```
|
|
45
62
|
*/
|
|
46
|
-
export declare function compile(source: string, filename?: string): CompileResult;
|
|
63
|
+
export declare function compile(source: string, filename?: string, options?: CompileOptions): CompileResult;
|
|
47
64
|
//# sourceMappingURL=compile.d.ts.map
|
package/dist/compile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAiBA,OAAO,EAIH,KAAK,WAAW,EAEnB,MAAM,gBAAgB,CAAC;AAexB,sDAAsD;AACtD,MAAM,WAAW,aAAa;IAE1B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb;8DAC0D;IAC1D,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAmB,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAiBA,OAAO,EAIH,KAAK,WAAW,EAEnB,MAAM,gBAAgB,CAAC;AAexB,6BAA6B;AAC7B,MAAM,WAAW,cAAc;IAE3B;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;CAChC;AAED,sDAAsD;AACtD,MAAM,WAAW,aAAa;IAE1B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb;8DAC0D;IAC1D,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAmB,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa,CAoKhH"}
|
package/dist/compile.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// prepend the import.
|
|
14
14
|
import { findMarkupStart } from "./scanner.js";
|
|
15
15
|
import { parseMarkup } from "./parser.js";
|
|
16
|
-
import { generate, walkComponentTags } from "./codegen.js";
|
|
16
|
+
import { generate, generateDomRegion, quoteString, walkComponentTags } from "./codegen.js";
|
|
17
17
|
import { buildLineStarts, locationFor, encodeMappings } from "./sourcemap.js";
|
|
18
18
|
/** Default module the auto-injected imports point at. */
|
|
19
19
|
const RUNTIME_MODULE = '@azerothjs/core';
|
|
@@ -74,10 +74,28 @@ function alreadyImports(source, name) {
|
|
|
74
74
|
* // }
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
|
-
export function compile(source, filename = 'module.azeroth') {
|
|
77
|
+
export function compile(source, filename = 'module.azeroth', options = {}) {
|
|
78
|
+
const target = options.target ?? 'universal';
|
|
78
79
|
// Built-in components referenced anywhere in the file's markup
|
|
79
80
|
// (including nested inside `{ ... }` holes, thanks to the recursion).
|
|
80
81
|
const usedBuiltins = new Set();
|
|
82
|
+
// Hoisted template HTML (dom target), interned so identical static
|
|
83
|
+
// regions share one template const.
|
|
84
|
+
const templates = new Map();
|
|
85
|
+
let usedH = false;
|
|
86
|
+
let usedBindHole = false;
|
|
87
|
+
let usedBindChild = false;
|
|
88
|
+
let usedBindProps = false;
|
|
89
|
+
let usedModeGuard = false;
|
|
90
|
+
const allocateTemplate = (html) => {
|
|
91
|
+
const existing = templates.get(html);
|
|
92
|
+
if (existing !== undefined) {
|
|
93
|
+
return existing;
|
|
94
|
+
}
|
|
95
|
+
const name = `_tmpl$${templates.size + 1}`;
|
|
96
|
+
templates.set(html, name);
|
|
97
|
+
return name;
|
|
98
|
+
};
|
|
81
99
|
const collect = (node) => walkComponentTags(node, (tag) => {
|
|
82
100
|
if (BUILTIN_COMPONENTS.has(tag)) {
|
|
83
101
|
usedBuiltins.add(tag);
|
|
@@ -100,6 +118,7 @@ export function compile(source, filename = 'module.azeroth') {
|
|
|
100
118
|
const { node, end } = parseMarkup(input, start);
|
|
101
119
|
collect(node);
|
|
102
120
|
result += generate(node, transformHole);
|
|
121
|
+
usedH = true;
|
|
103
122
|
j = end;
|
|
104
123
|
}
|
|
105
124
|
return result;
|
|
@@ -123,19 +142,64 @@ export function compile(source, filename = 'module.azeroth') {
|
|
|
123
142
|
}
|
|
124
143
|
const { node, end } = parseMarkup(source, start);
|
|
125
144
|
collect(node);
|
|
126
|
-
|
|
145
|
+
// dom target: template-clone emission where the region allows it;
|
|
146
|
+
// anything with components/fragments falls back to h().
|
|
147
|
+
let emitted = null;
|
|
148
|
+
if (target === 'dom') {
|
|
149
|
+
const region = generateDomRegion(node, transformHole, allocateTemplate);
|
|
150
|
+
if (region !== null) {
|
|
151
|
+
emitted = region.code;
|
|
152
|
+
usedBindHole = usedBindHole || region.usesBindHole;
|
|
153
|
+
usedBindChild = usedBindChild || region.usesBindChild;
|
|
154
|
+
usedBindProps = usedBindProps || region.usesBindProps;
|
|
155
|
+
// The region carries a universal h() branch behind the
|
|
156
|
+
// render-mode guard, so both sets of names are live.
|
|
157
|
+
usedModeGuard = true;
|
|
158
|
+
usedH = true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (emitted === null) {
|
|
162
|
+
emitted = generate(node, transformHole);
|
|
163
|
+
usedH = true;
|
|
164
|
+
}
|
|
165
|
+
push(emitted, start, false);
|
|
127
166
|
i = end;
|
|
128
167
|
}
|
|
129
168
|
const hasMarkup = pieces.some(p => !p.verbatim);
|
|
130
169
|
if (!hasMarkup) {
|
|
131
170
|
return { code: out, map: null };
|
|
132
171
|
}
|
|
133
|
-
// Auto-inject
|
|
134
|
-
// skipping names the source already imports.
|
|
135
|
-
|
|
136
|
-
|
|
172
|
+
// Auto-inject the runtime names the emission used plus any built-in
|
|
173
|
+
// components, skipping names the source already imports. The universal
|
|
174
|
+
// target keeps its historical "always import h" behavior; the dom
|
|
175
|
+
// target imports only what it emitted.
|
|
176
|
+
const runtimeNames = [];
|
|
177
|
+
if (target === 'universal' || usedH) {
|
|
178
|
+
runtimeNames.push('h');
|
|
179
|
+
}
|
|
180
|
+
if (templates.size > 0) {
|
|
181
|
+
runtimeNames.push('tmpl');
|
|
182
|
+
}
|
|
183
|
+
if (usedBindHole) {
|
|
184
|
+
runtimeNames.push('bindHole');
|
|
185
|
+
}
|
|
186
|
+
if (usedBindChild) {
|
|
187
|
+
runtimeNames.push('bindChild');
|
|
188
|
+
}
|
|
189
|
+
if (usedBindProps) {
|
|
190
|
+
runtimeNames.push('bindProps');
|
|
191
|
+
}
|
|
192
|
+
if (usedModeGuard) {
|
|
193
|
+
runtimeNames.push('isStringMode', 'isHydrating');
|
|
194
|
+
}
|
|
195
|
+
const names = [...runtimeNames, ...usedBuiltins].filter(name => !alreadyImports(source, name));
|
|
196
|
+
const importLine = names.length > 0
|
|
137
197
|
? `import { ${names.join(', ')} } from '${RUNTIME_MODULE}';\n`
|
|
138
198
|
: '';
|
|
199
|
+
const hoisted = templates.size > 0
|
|
200
|
+
? [...templates].map(([html, name]) => `const ${name} = tmpl(${quoteString(html)});`).join('\n') + '\n'
|
|
201
|
+
: '';
|
|
202
|
+
const prefix = importLine + hoisted;
|
|
139
203
|
const code = prefix + out;
|
|
140
204
|
return { code, map: buildSourceMap(code, prefix.length, pieces, source, filename) };
|
|
141
205
|
}
|
package/dist/compile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,yEAAyE;AACzE,yCAAyC;AACzC,gEAAgE;AAChE,8EAA8E;AAC9E,0EAA0E;AAC1E,kBAAkB;AAClB,yEAAyE;AACzE,0DAA0D;AAC1D,EAAE;AACF,4EAA4E;AAC5E,sBAAsB;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAA2B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,yEAAyE;AACzE,yCAAyC;AAC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,GAAG,KAAK,CAAC,QAAQ;YAC/B,CAAC,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;YAClD,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;QACxB,MAAM,GAAG,GAAG,WAAW,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO;QACH,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC,QAAQ,CAAC;QACnB,cAAc,EAAE,CAAC,MAAM,CAAC;QACxB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,cAAc,CAAC,KAAK,CAAC;KAClC,CAAC;AACN,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { compile, type CompileResult } from './compile.ts';
|
|
1
|
+
export { compile, type CompileResult, type CompileOptions } from './compile.ts';
|
|
2
|
+
export { lintMarkup, lintSource, type LintWarning } from './lint.ts';
|
|
2
3
|
export { CompileError, parseMarkup } from './parser.ts';
|
|
3
4
|
export { findMarkupStart, isWhitespace, isIdentStart, isIdentPart, skipBalanced, skipString, skipTemplate, skipLineComment, skipBlockComment, skipRegex } from './scanner.ts';
|
|
4
|
-
export { generate, walkComponentTags, type ExpressionCompiler } from './codegen.ts';
|
|
5
|
+
export { generate, generateDomRegion, walkComponentTags, type ExpressionCompiler, type DomRegion } from './codegen.ts';
|
|
5
6
|
export { azeroth, type AzerothPluginOptions } from './vite.ts';
|
|
6
7
|
export { vlqEncode, buildLineStarts, locationFor, encodeMappings, type SourceMapV3, type RawSegment } from './sourcemap.ts';
|
|
7
8
|
export type { Span, MarkupElement, MarkupFragment, MarkupText, MarkupExpression, MarkupChild, MarkupAttribute, MarkupAttributeValue, MarkupRegion } from './types.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACH,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,SAAS,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EACH,SAAS,EACT,eAAe,EACf,WAAW,EACX,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EAClB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,IAAI,EACJ,aAAa,EACb,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,YAAY,EACf,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
// codegen - AST -> h()/component-call source, with reactive wrapping
|
|
14
14
|
// compile - orchestrates scan -> parse -> codegen -> splice
|
|
15
15
|
export { compile } from "./compile.js";
|
|
16
|
+
export { lintMarkup, lintSource } from "./lint.js";
|
|
16
17
|
export { CompileError, parseMarkup } from "./parser.js";
|
|
17
18
|
export { findMarkupStart, isWhitespace, isIdentStart, isIdentPart, skipBalanced, skipString, skipTemplate, skipLineComment, skipBlockComment, skipRegex } from "./scanner.js";
|
|
18
|
-
export { generate, walkComponentTags } from "./codegen.js";
|
|
19
|
+
export { generate, generateDomRegion, walkComponentTags } from "./codegen.js";
|
|
19
20
|
export { azeroth } from "./vite.js";
|
|
20
21
|
export { vlqEncode, buildLineStarts, locationFor, encodeMappings } from "./sourcemap.js";
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,EAAE;AACF,6EAA6E;AAC7E,qEAAqE;AACrE,+DAA+D;AAC/D,iFAAiF;AACjF,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,yEAAyE;AACzE,wBAAwB;AACxB,oCAAoC;AACpC,wEAAwE;AACxE,+DAA+D;AAE/D,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,EAAE;AACF,6EAA6E;AAC7E,qEAAqE;AACrE,+DAA+D;AAC/D,iFAAiF;AACjF,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,yEAAyE;AACzE,wBAAwB;AACxB,oCAAoC;AACpC,wEAAwE;AACxE,+DAA+D;AAE/D,OAAO,EAAE,OAAO,EAA2C,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAoB,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACH,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,SAAS,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAA2C,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,OAAO,EAA6B,MAAM,WAAW,CAAC;AAC/D,OAAO,EACH,SAAS,EACT,eAAe,EACf,WAAW,EACX,cAAc,EAGjB,MAAM,gBAAgB,CAAC"}
|
package/dist/lint.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { MarkupElement, MarkupFragment } from './types.ts';
|
|
2
|
+
/** One lint finding. Warning severity - lint never fails a build. */
|
|
3
|
+
export interface LintWarning {
|
|
4
|
+
/** Stable rule id, e.g. 'azeroth/handler-call'. */
|
|
5
|
+
code: string;
|
|
6
|
+
/** Human-readable message with the suggested fix. */
|
|
7
|
+
message: string;
|
|
8
|
+
/** Source span of the offending attribute/element. */
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Lints one parsed markup region. Pure and allocation-light - the language
|
|
14
|
+
* service calls this per region on every diagnostics pass.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const { node } = parseMarkup('<button onClick={save()}>go</button>', 0);
|
|
19
|
+
* lintMarkup(node)[0].code; // 'azeroth/handler-call'
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function lintMarkup(node: MarkupElement | MarkupFragment): LintWarning[];
|
|
23
|
+
/**
|
|
24
|
+
* Lints every parseable top-level markup region in a module. Unparseable
|
|
25
|
+
* regions are skipped - the parse error itself is reported elsewhere
|
|
26
|
+
* (CompileError diagnostics), and half-typed markup should not also spray
|
|
27
|
+
* lint noise.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* lintSource('const x = <button onclick={f}>go</button>;')[0].code;
|
|
32
|
+
* // 'azeroth/event-case'
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function lintSource(source: string): LintWarning[];
|
|
36
|
+
//# sourceMappingURL=lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAI7E,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAExB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IAEb,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAEhB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACf;AA4BD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,GAAG,WAAW,EAAE,CAK9E;AAuED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAuBxD"}
|
package/dist/lint.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Markup lint: the reactivity and correctness mistakes the TYPE system
|
|
2
|
+
// cannot see. Typed component props already catch the classic foot-guns
|
|
3
|
+
// (`when={visible}` where visible isn't a getter is a plain type error), so
|
|
4
|
+
// these rules target syntax-level slips with near-zero false-positive
|
|
5
|
+
// rates:
|
|
6
|
+
//
|
|
7
|
+
// azeroth/handler-call onClick={save()} - calls save() at setup and
|
|
8
|
+
// passes its RESULT as the handler. Only fires on
|
|
9
|
+
// ZERO-argument calls of a plain reference;
|
|
10
|
+
// onClick={makeHandler(id)} is a legitimate
|
|
11
|
+
// factory idiom and stays silent.
|
|
12
|
+
// azeroth/duplicate-attr the same attribute written twice on one element
|
|
13
|
+
// (the later one silently wins).
|
|
14
|
+
// azeroth/event-case onclick= for a known DOM event - the framework
|
|
15
|
+
// convention is camelCase (onClick), and the
|
|
16
|
+
// editor tooling only models the camelCase form.
|
|
17
|
+
//
|
|
18
|
+
// Rules walk the parsed element tree of each top-level markup region.
|
|
19
|
+
// Warnings carry source spans, so the language service can squiggle them
|
|
20
|
+
// and the Vite plugin can print file:line:col.
|
|
21
|
+
import { findMarkupStart } from "./scanner.js";
|
|
22
|
+
import { parseMarkup } from "./parser.js";
|
|
23
|
+
/** A zero-argument call of a bare reference: `save()`, `actions.reset()`. */
|
|
24
|
+
const ZERO_ARG_CALL = /^[A-Za-z_$][\w$]*(\s*\.\s*[A-Za-z_$][\w$]*)*\s*\(\s*\)$/;
|
|
25
|
+
/** `on` + uppercase: the framework's event-handler convention. */
|
|
26
|
+
const CAMEL_EVENT = /^on[A-Z]/;
|
|
27
|
+
/**
|
|
28
|
+
* DOM events users actually write handlers for. The lowercase-event rule
|
|
29
|
+
* only fires for these, so an unconventional attribute that merely starts
|
|
30
|
+
* with "on" (onward-link, ...) is never flagged.
|
|
31
|
+
*/
|
|
32
|
+
const KNOWN_EVENTS = new Set([
|
|
33
|
+
'click', 'dblclick', 'contextmenu',
|
|
34
|
+
'input', 'change', 'submit', 'reset', 'invalid',
|
|
35
|
+
'keydown', 'keyup', 'keypress',
|
|
36
|
+
'focus', 'blur', 'focusin', 'focusout',
|
|
37
|
+
'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave',
|
|
38
|
+
'pointerdown', 'pointerup', 'pointermove', 'pointerenter', 'pointerleave', 'pointercancel',
|
|
39
|
+
'touchstart', 'touchend', 'touchmove', 'touchcancel',
|
|
40
|
+
'wheel', 'scroll',
|
|
41
|
+
'drag', 'dragstart', 'dragend', 'dragenter', 'dragleave', 'dragover', 'drop',
|
|
42
|
+
'load', 'error', 'abort',
|
|
43
|
+
'animationstart', 'animationend', 'animationiteration', 'transitionend',
|
|
44
|
+
'play', 'pause', 'ended', 'canplay', 'timeupdate', 'volumechange'
|
|
45
|
+
]);
|
|
46
|
+
/**
|
|
47
|
+
* Lints one parsed markup region. Pure and allocation-light - the language
|
|
48
|
+
* service calls this per region on every diagnostics pass.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const { node } = parseMarkup('<button onClick={save()}>go</button>', 0);
|
|
53
|
+
* lintMarkup(node)[0].code; // 'azeroth/handler-call'
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export function lintMarkup(node) {
|
|
57
|
+
const warnings = [];
|
|
58
|
+
visit(node, warnings);
|
|
59
|
+
return warnings;
|
|
60
|
+
}
|
|
61
|
+
/** @internal */
|
|
62
|
+
function visit(node, warnings) {
|
|
63
|
+
if (node.kind === 'element') {
|
|
64
|
+
lintElement(node, warnings);
|
|
65
|
+
}
|
|
66
|
+
if (node.kind === 'element' || node.kind === 'fragment') {
|
|
67
|
+
for (const child of node.children) {
|
|
68
|
+
visit(child, warnings);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** @internal */
|
|
73
|
+
function lintElement(el, warnings) {
|
|
74
|
+
const seen = new Set();
|
|
75
|
+
for (const attr of el.attributes) {
|
|
76
|
+
if (attr.spread || attr.name === null) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const name = attr.name;
|
|
80
|
+
if (seen.has(name)) {
|
|
81
|
+
warnings.push({
|
|
82
|
+
code: 'azeroth/duplicate-attr',
|
|
83
|
+
message: `Duplicate attribute "${name}" - the later one silently wins.`,
|
|
84
|
+
start: attr.start,
|
|
85
|
+
end: attr.end
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
seen.add(name);
|
|
89
|
+
// onClick={save()} - the call runs at setup; its RESULT becomes the
|
|
90
|
+
// handler. Zero-argument calls of a bare reference are flagged;
|
|
91
|
+
// calls WITH arguments are the handler-factory idiom and stay quiet.
|
|
92
|
+
if (CAMEL_EVENT.test(name) && attr.value.kind === 'expression' && ZERO_ARG_CALL.test(attr.value.code.trim())) {
|
|
93
|
+
const callee = attr.value.code.trim().replace(/\s*\(\s*\)$/, '');
|
|
94
|
+
warnings.push({
|
|
95
|
+
code: 'azeroth/handler-call',
|
|
96
|
+
message: `${name}={${attr.value.code.trim()}} calls ${callee}() during setup and passes its result as the handler. Use ${name}={${callee}} or ${name}={() => ${callee}()}.`,
|
|
97
|
+
start: attr.start,
|
|
98
|
+
end: attr.end
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// onclick= on a host element: works at runtime, but the convention
|
|
102
|
+
// (and all editor tooling) is camelCase.
|
|
103
|
+
if (!el.isComponent && name.startsWith('on') && KNOWN_EVENTS.has(name.slice(2))) {
|
|
104
|
+
const camel = `on${name[2].toUpperCase()}${name.slice(3)}`;
|
|
105
|
+
warnings.push({
|
|
106
|
+
code: 'azeroth/event-case',
|
|
107
|
+
message: `"${name}" - AzerothJS event handlers are camelCase: use ${camel}.`,
|
|
108
|
+
start: attr.start,
|
|
109
|
+
end: attr.end
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Lints every parseable top-level markup region in a module. Unparseable
|
|
116
|
+
* regions are skipped - the parse error itself is reported elsewhere
|
|
117
|
+
* (CompileError diagnostics), and half-typed markup should not also spray
|
|
118
|
+
* lint noise.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* lintSource('const x = <button onclick={f}>go</button>;')[0].code;
|
|
123
|
+
* // 'azeroth/event-case'
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export function lintSource(source) {
|
|
127
|
+
const warnings = [];
|
|
128
|
+
let i = 0;
|
|
129
|
+
for (;;) {
|
|
130
|
+
const start = findMarkupStart(source, i);
|
|
131
|
+
if (start === -1) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const { node, end } = parseMarkup(source, start);
|
|
136
|
+
warnings.push(...lintMarkup(node));
|
|
137
|
+
i = end;
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return warnings;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=lint.js.map
|
package/dist/lint.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wEAAwE;AACxE,4EAA4E;AAC5E,sEAAsE;AACtE,SAAS;AACT,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAC5D,4EAA4E;AAC5E,2DAA2D;AAC3D,2EAA2E;AAC3E,uEAAuE;AACvE,2EAA2E;AAC3E,EAAE;AACF,sEAAsE;AACtE,yEAAyE;AACzE,+CAA+C;AAG/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgB1C,6EAA6E;AAC7E,MAAM,aAAa,GAAG,yDAAyD,CAAC;AAEhF,kEAAkE;AAClE,MAAM,WAAW,GAAG,UAAU,CAAC;AAE/B;;;;GAIG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IACzB,OAAO,EAAE,UAAU,EAAE,aAAa;IAClC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS;IAC/C,SAAS,EAAE,OAAO,EAAE,UAAU;IAC9B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU;IACtC,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY;IACxF,aAAa,EAAE,WAAW,EAAE,aAA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AM,KAAK,GAAG,KAAM,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAG,GAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,CAAC;YAC/D,QAAQ,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,oBAAoB;gBAC1B,OAAO,EAAE,IAAK,IAAK,mDAAoD,KAAM,GAAG;gBAChF,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,GAAG,EAAE,IAAI,CAAC,GAAG;aAChB,CAAC,CAAC;QACP,CAAC;IACL,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IAErC,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,SACA,CAAC;QACG,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACzC,IAAI,KAAK,KAAK,CAAC,CAAC,EAChB,CAAC;YACG,MAAM;QACV,CAAC;QACD,IACA,CAAC;YACG,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YACnC,CAAC,GAAG,GAAG,CAAC;QACZ,CAAC;QACD,MACA,CAAC;YACG,MAAM;QACV,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
package/dist/vite.d.ts
CHANGED
|
@@ -3,6 +3,21 @@ import type { Plugin } from 'vite';
|
|
|
3
3
|
export interface AzerothPluginOptions {
|
|
4
4
|
/** File extension to handle. Default: `'.azeroth'`. */
|
|
5
5
|
extension?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Compile target for CLIENT transforms. `'dom'` emits template-cloning
|
|
8
|
+
* output behind a render-mode guard: SSR and hydrate() ride the
|
|
9
|
+
* universal h() branch, fresh client creation takes the clone path.
|
|
10
|
+
* Costs the duplicated region code in the bundle. Default:
|
|
11
|
+
* `'universal'`. SSR transforms always compile universal regardless
|
|
12
|
+
* (the server bundle has no use for templates).
|
|
13
|
+
*/
|
|
14
|
+
target?: 'universal' | 'dom';
|
|
15
|
+
/**
|
|
16
|
+
* Inject the dev error overlay (`@azerothjs/devtools-overlay`) into
|
|
17
|
+
* index.html during `vite serve`. Never injected into builds. Default:
|
|
18
|
+
* true.
|
|
19
|
+
*/
|
|
20
|
+
overlay?: boolean;
|
|
6
21
|
}
|
|
7
22
|
/**
|
|
8
23
|
* The AzerothJS Vite plugin. Add it to your Vite config so imports
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAKnC,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IAEjC,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;IAE7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CA+ElE"}
|
package/dist/vite.js
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
// resets, which is the honest model for a framework with no component-instance
|
|
15
15
|
// tree.
|
|
16
16
|
import { compile } from "./compile.js";
|
|
17
|
+
import { lintSource } from "./lint.js";
|
|
18
|
+
import { buildLineStarts, locationFor } from "./sourcemap.js";
|
|
17
19
|
/**
|
|
18
20
|
* The AzerothJS Vite plugin. Add it to your Vite config so imports
|
|
19
21
|
* of `.azeroth` files compile to runnable modules.
|
|
@@ -41,17 +43,55 @@ import { compile } from "./compile.js";
|
|
|
41
43
|
*/
|
|
42
44
|
export function azeroth(options = {}) {
|
|
43
45
|
const extension = options.extension ?? '.azeroth';
|
|
46
|
+
const clientTarget = options.target ?? 'universal';
|
|
47
|
+
const overlay = options.overlay ?? true;
|
|
48
|
+
let serving = false;
|
|
44
49
|
return {
|
|
45
50
|
name: 'azerothjs',
|
|
46
51
|
enforce: 'pre',
|
|
47
|
-
|
|
52
|
+
configResolved(config) {
|
|
53
|
+
serving = config.command === 'serve';
|
|
54
|
+
},
|
|
55
|
+
// Dev server only: load the error overlay before the app, so
|
|
56
|
+
// uncaught reactive errors surface in the page instead of dying in
|
|
57
|
+
// the console. Builds are never touched.
|
|
58
|
+
//
|
|
59
|
+
// @azerothjs/devtools-overlay is an OPTIONAL peer dependency, so the
|
|
60
|
+
// injection is a dynamic import with a catch: a project that hasn't
|
|
61
|
+
// installed it just doesn't get the overlay, instead of a static
|
|
62
|
+
// import breaking the dev server's module graph.
|
|
63
|
+
transformIndexHtml() {
|
|
64
|
+
if (!serving || !overlay) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return [{
|
|
68
|
+
tag: 'script',
|
|
69
|
+
attrs: { type: 'module' },
|
|
70
|
+
children: "import('@azerothjs/devtools-overlay').then(m => m.installOverlay()).catch(() => {});",
|
|
71
|
+
injectTo: 'head'
|
|
72
|
+
}];
|
|
73
|
+
},
|
|
74
|
+
async transform(code, id, transformOptions) {
|
|
48
75
|
// Strip any `?query` suffix Vite appends to module ids.
|
|
49
76
|
const filename = id.split('?')[0];
|
|
50
77
|
if (!filename.endsWith(extension)) {
|
|
51
78
|
return null;
|
|
52
79
|
}
|
|
53
|
-
//
|
|
54
|
-
|
|
80
|
+
// Lint before compiling: the rules catch mistakes the type
|
|
81
|
+
// system can't (onClick={save()}, duplicate attributes), and a
|
|
82
|
+
// build is where they reliably reach every contributor.
|
|
83
|
+
const lineStarts = buildLineStarts(code);
|
|
84
|
+
for (const finding of lintSource(code)) {
|
|
85
|
+
const loc = locationFor(finding.start, lineStarts);
|
|
86
|
+
// Optional call: vite always binds the plugin context, but
|
|
87
|
+
// unit tests invoke transform bare.
|
|
88
|
+
this?.warn(`${finding.code}: ${finding.message}`, { line: loc.line + 1, column: loc.column });
|
|
89
|
+
}
|
|
90
|
+
// 1) markup -> runtime calls (plus a source map back to
|
|
91
|
+
// .azeroth). SSR must stay universal: template cloning has no
|
|
92
|
+
// string mode.
|
|
93
|
+
const target = transformOptions?.ssr ? 'universal' : clientTarget;
|
|
94
|
+
const compiled = compile(code, filename, { target });
|
|
55
95
|
// 2) TS -> JS (the compiled module may still contain types). Vite
|
|
56
96
|
// transforms via oxc; passing our map as `inMap` chains it, so
|
|
57
97
|
// the final map points all the way back to the original
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,cAAc;AACd,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,4CAA4C;AAC5C,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,+EAA+E;AAC/E,yEAAyE;AACzE,+EAA+E;AAC/E,QAAQ;AAGR,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,cAAc;AACd,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,4CAA4C;AAC5C,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,+EAA+E;AAC/E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
|
|
3
|
+
"version": "0.5.0-beta.1",
|
|
4
4
|
"description": "AzerothJS compiler — .azeroth single-file-component compiler (markup to h() calls) and Vite plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,11 +22,16 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"peerDependencies":
|
|
24
24
|
{
|
|
25
|
-
"vite": ">=5"
|
|
25
|
+
"vite": ">=5",
|
|
26
|
+
"@azerothjs/devtools-overlay": "0.5.0-beta.1"
|
|
26
27
|
},
|
|
27
28
|
"peerDependenciesMeta":
|
|
28
29
|
{
|
|
29
30
|
"vite":
|
|
31
|
+
{
|
|
32
|
+
"optional": true
|
|
33
|
+
},
|
|
34
|
+
"@azerothjs/devtools-overlay":
|
|
30
35
|
{
|
|
31
36
|
"optional": true
|
|
32
37
|
}
|