htmv 0.0.28 → 0.0.30

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/views.js CHANGED
@@ -10,10 +10,10 @@ export async function view(view, props) {
10
10
  const filePath = path.join(viewsPath, `${view}.html`);
11
11
  const code = await fs.readFile(filePath, "utf-8");
12
12
  const replacedCode = code
13
- .replace(/{(.+)}/g, (_, propName) => {
13
+ .replace(/{(\w+)}/g, (_, propName) => {
14
14
  return props[propName];
15
15
  })
16
- .replace(/<Isset\s+(\w+)>([\s\S]*?)<\/Isset>/g, (_, propNameWithPrefix, innerContent) => {
16
+ .replace(/<Isset\s+(!?\w+)>([\s\S]*?)<\/Isset>/g, (_, propNameWithPrefix, innerContent) => {
17
17
  const isNegated = propNameWithPrefix.startsWith("!");
18
18
  const propName = isNegated
19
19
  ? propNameWithPrefix.slice(1)
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.28",
5
+ "version": "0.0.30",
6
6
  "devDependencies": {
7
7
  "@biomejs/biome": "2.3.3",
8
8
  "@types/bun": "latest"
package/src/views.ts CHANGED
@@ -15,11 +15,11 @@ export async function view(view: string, props: Record<string, unknown>) {
15
15
  const filePath = path.join(viewsPath, `${view}.html`);
16
16
  const code = await fs.readFile(filePath, "utf-8");
17
17
  const replacedCode = code
18
- .replace(/{(.+)}/g, (_, propName) => {
18
+ .replace(/{(\w+)}/g, (_, propName) => {
19
19
  return props[propName] as string;
20
20
  })
21
21
  .replace(
22
- /<Isset\s+(\w+)>([\s\S]*?)<\/Isset>/g,
22
+ /<Isset\s+(!?\w+)>([\s\S]*?)<\/Isset>/g,
23
23
  (_, propNameWithPrefix: string, innerContent: string) => {
24
24
  const isNegated = propNameWithPrefix.startsWith("!");
25
25
  const propName = isNegated