@fluixi/template-parser 0.1.0-alpha.3 → 1.0.0-alpha.100
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 +1 -1
- package/README.md +9 -7
- package/dist/a11y.cjs +100 -1
- package/dist/a11y.d.cts +21 -0
- package/dist/a11y.d.ts +2 -2
- package/dist/a11y.js +1 -1
- package/dist/a11y.mjs +79 -1
- package/dist/ast.cjs +46 -1
- package/dist/ast.d.cts +223 -0
- package/dist/ast.d.ts +9 -9
- package/dist/ast.d.ts.map +1 -1
- package/dist/ast.js +2 -2
- package/dist/ast.mjs +25 -1
- package/dist/directives.cjs +206 -1
- package/dist/directives.d.cts +49 -0
- package/dist/directives.d.ts +2 -2
- package/dist/directives.d.ts.map +1 -1
- package/dist/directives.js +2 -2
- package/dist/directives.mjs +185 -1
- package/dist/index.cjs +857 -1
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.mjs +835 -1
- package/dist/parser.cjs +832 -1
- package/dist/parser.d.cts +27 -0
- package/dist/parser.d.ts +2 -2
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +0 -0
- package/dist/parser.mjs +809 -1
- package/dist/reader.cjs +122 -1
- package/dist/reader.d.cts +60 -0
- package/dist/reader.d.ts +2 -2
- package/dist/reader.mjs +101 -1
- package/dist/tags.cjs +77 -1
- package/dist/tags.d.cts +15 -0
- package/dist/tags.d.ts +1 -1
- package/dist/tags.d.ts.map +1 -1
- package/dist/tags.js +1 -1
- package/dist/tags.mjs +56 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +6 -5
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fluixi/template-parser: the dependency-free foundation for every tool that
|
|
3
|
+
* needs to understand a Fluixi `` html`...` `` template: the compiler, the
|
|
4
|
+
* language server, the TypeScript plugin, and the Biome/formatter plugin.
|
|
5
|
+
*
|
|
6
|
+
* Pipeline: pieces → {@link Reader} (lexing/holes) → {@link parseTemplate}
|
|
7
|
+
* (structure + diagnostics) → Template AST. Downstream, each tool binds the
|
|
8
|
+
* opaque hole slots to its own representation and consumes the AST, the
|
|
9
|
+
* compiler lowers it to codegen IR, the LSP answers completion/hover/rename.
|
|
10
|
+
*
|
|
11
|
+
* The parser never resolves the JS inside `${…}`; it records each hole as an
|
|
12
|
+
* index + span. That is the single seam that keeps this package host-agnostic.
|
|
13
|
+
*/
|
|
14
|
+
export * from './ast.cjs';
|
|
15
|
+
export { Reader, type Piece, type HoleToken } from './reader.cjs';
|
|
16
|
+
export { CORE_DIRECTIVES, resolveAttribute, type DirectiveDescriptor, type RawAttribute, } from './directives.cjs';
|
|
17
|
+
export { parseTemplate, type ParserOptions } from './parser.cjs';
|
|
18
|
+
import type { Piece } from './reader.cjs';
|
|
19
|
+
import { type ParserOptions } from './parser.cjs';
|
|
20
|
+
import type { ParseResult, SourceSpan } from './ast.cjs';
|
|
21
|
+
/**
|
|
22
|
+
* Build a piece list from the static string segments of a tagged template
|
|
23
|
+
* (`quasi.strings`), inserting a hole between each pair. Offsets are synthetic
|
|
24
|
+
* (cumulative over the joined text), good enough for standalone parsing and
|
|
25
|
+
* tests. Hosts with real source positions (the compiler, the LSP) should build
|
|
26
|
+
* {@link Piece}s directly so spans map back to the original file.
|
|
27
|
+
*/
|
|
28
|
+
export declare function piecesFromStrings(statics: readonly string[]): Piece[];
|
|
29
|
+
/** Convenience: parse directly from static string segments. */
|
|
30
|
+
export declare function parse(statics: readonly string[], opts?: ParserOptions): ParseResult;
|
|
31
|
+
export type { SourceSpan };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fluixi/template-parser
|
|
2
|
+
* @fluixi/template-parser: the dependency-free foundation for every tool that
|
|
3
3
|
* needs to understand a Fluixi `` html`...` `` template: the compiler, the
|
|
4
4
|
* language server, the TypeScript plugin, and the Biome/formatter plugin.
|
|
5
5
|
*
|
|
6
6
|
* Pipeline: pieces → {@link Reader} (lexing/holes) → {@link parseTemplate}
|
|
7
7
|
* (structure + diagnostics) → Template AST. Downstream, each tool binds the
|
|
8
|
-
* opaque hole slots to its own representation and consumes the AST
|
|
8
|
+
* opaque hole slots to its own representation and consumes the AST, the
|
|
9
9
|
* compiler lowers it to codegen IR, the LSP answers completion/hover/rename.
|
|
10
10
|
*
|
|
11
11
|
* The parser never resolves the JS inside `${…}`; it records each hole as an
|
|
@@ -21,7 +21,7 @@ import type { ParseResult, SourceSpan } from './ast.js';
|
|
|
21
21
|
/**
|
|
22
22
|
* Build a piece list from the static string segments of a tagged template
|
|
23
23
|
* (`quasi.strings`), inserting a hole between each pair. Offsets are synthetic
|
|
24
|
-
* (cumulative over the joined text)
|
|
24
|
+
* (cumulative over the joined text), good enough for standalone parsing and
|
|
25
25
|
* tests. Hosts with real source positions (the compiler, the LSP) should build
|
|
26
26
|
* {@link Piece}s directly so spans map back to the original file.
|
|
27
27
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fluixi/template-parser
|
|
2
|
+
* @fluixi/template-parser: the dependency-free foundation for every tool that
|
|
3
3
|
* needs to understand a Fluixi `` html`...` `` template: the compiler, the
|
|
4
4
|
* language server, the TypeScript plugin, and the Biome/formatter plugin.
|
|
5
5
|
*
|
|
6
6
|
* Pipeline: pieces → {@link Reader} (lexing/holes) → {@link parseTemplate}
|
|
7
7
|
* (structure + diagnostics) → Template AST. Downstream, each tool binds the
|
|
8
|
-
* opaque hole slots to its own representation and consumes the AST
|
|
8
|
+
* opaque hole slots to its own representation and consumes the AST, the
|
|
9
9
|
* compiler lowers it to codegen IR, the LSP answers completion/hover/rename.
|
|
10
10
|
*
|
|
11
11
|
* The parser never resolves the JS inside `${…}`; it records each hole as an
|
|
@@ -19,7 +19,7 @@ import { parseTemplate } from './parser.js';
|
|
|
19
19
|
/**
|
|
20
20
|
* Build a piece list from the static string segments of a tagged template
|
|
21
21
|
* (`quasi.strings`), inserting a hole between each pair. Offsets are synthetic
|
|
22
|
-
* (cumulative over the joined text)
|
|
22
|
+
* (cumulative over the joined text), good enough for standalone parsing and
|
|
23
23
|
* tests. Hosts with real source positions (the compiler, the LSP) should build
|
|
24
24
|
* {@link Piece}s directly so spans map back to the original file.
|
|
25
25
|
*/
|