htmv 0.0.36 → 0.0.38

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.
@@ -73,10 +73,14 @@ export function parse(tokens) {
73
73
  }
74
74
  const nextToken = tokens[i]; //may be arguments token
75
75
  if (nextToken?.type === "arguments") {
76
- const args = nextToken.value.join(" ");
77
76
  nodes.push({
78
77
  type: "text",
79
- text: `<${tag} ${args}>`,
78
+ text: `<${tag}`,
79
+ });
80
+ parseArgs(nextToken.value);
81
+ nodes.push({
82
+ type: "text",
83
+ text: `>`,
80
84
  });
81
85
  i++;
82
86
  continue;
@@ -100,4 +104,30 @@ export function parse(tokens) {
100
104
  }
101
105
  return nodes;
102
106
  }
107
+ function parseArgs(args) {
108
+ let textBuffer = "";
109
+ for (let i = 0; i < args.length; i++) {
110
+ const letter = args[i];
111
+ if (letter === "{") {
112
+ clearBuffer();
113
+ continue;
114
+ }
115
+ if (letter === "}") {
116
+ tokens.push({
117
+ type: "interpolation",
118
+ value: textBuffer,
119
+ });
120
+ clearBuffer();
121
+ }
122
+ textBuffer += letter;
123
+ }
124
+ function clearBuffer() {
125
+ if (textBuffer.length > 0) {
126
+ tokens.push({
127
+ type: "text",
128
+ text: textBuffer,
129
+ });
130
+ }
131
+ }
132
+ }
103
133
  }
package/dist/views.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { parse } from "./next-parser/parser";
4
- import { render } from "./next-parser/renderer";
5
- import { tokenize } from "./next-parser/tokenizer";
3
+ import { parse } from "./compiler/parser";
4
+ import { render } from "./compiler/renderer";
5
+ import { tokenize } from "./compiler/tokenizer";
6
6
  let viewsPath = "";
7
7
  export function setViewsPath(path) {
8
8
  viewsPath = path;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "htmv",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.36",
5
+ "version": "0.0.38",
6
6
  "devDependencies": {
7
7
  "@biomejs/biome": "2.3.3",
8
8
  "@types/bun": "latest"
package/biome.json DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
3
- "vcs": {
4
- "enabled": true,
5
- "clientKind": "git",
6
- "useIgnoreFile": true
7
- },
8
- "files": {
9
- "includes": ["**", "!!**/dist"]
10
- },
11
- "formatter": {
12
- "enabled": true,
13
- "indentStyle": "tab"
14
- },
15
- "linter": {
16
- "enabled": true,
17
- "rules": {
18
- "recommended": true
19
- }
20
- },
21
- "javascript": {
22
- "formatter": {
23
- "quoteStyle": "double"
24
- }
25
- },
26
- "assist": {
27
- "enabled": true,
28
- "actions": {
29
- "source": {
30
- "organizeImports": "on"
31
- }
32
- }
33
- }
34
- }
File without changes
File without changes
File without changes
File without changes
File without changes