@verbaly/compiler 0.60.0 → 0.62.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/dist/index.js CHANGED
@@ -1958,7 +1958,7 @@ function renderHtml(html, options) {
1958
1958
  const key = attrs.get(attr);
1959
1959
  const attrMapRaw = attrs.get(attrsAttr);
1960
1960
  if (key === void 0 && attrMapRaw === void 0) continue;
1961
- const args = parseArgs(attrs.get(argsAttr));
1961
+ const args = parseArgs(attrs.get(argsAttr), argsAttr);
1962
1962
  if (key) {
1963
1963
  if (!v.has(key)) missing.add(key);
1964
1964
  else if (!VOID.has(tagName) && !attrChunk.trimEnd().endsWith("/")) {
@@ -1966,7 +1966,7 @@ function renderHtml(html, options) {
1966
1966
  const close = findClose(html, tagName, openEnd, inSkip);
1967
1967
  if (close) {
1968
1968
  const text = t(key, args);
1969
- const own = parseArgs(attrs.get(linksAttr));
1969
+ const own = parseArgs(attrs.get(linksAttr), linksAttr);
1970
1970
  const merged = own ? globalLinks ? {
1971
1971
  ...globalLinks,
1972
1972
  ...own
@@ -1987,7 +1987,7 @@ function renderHtml(html, options) {
1987
1987
  }
1988
1988
  }
1989
1989
  if (attrMapRaw !== void 0) {
1990
- const map = parseArgs(attrMapRaw);
1990
+ const map = parseArgs(attrMapRaw, attrsAttr);
1991
1991
  if (map) for (const [name, attrKey] of Object.entries(map)) {
1992
1992
  if (typeof attrKey !== "string") continue;
1993
1993
  if (!v.has(attrKey)) {
@@ -2252,12 +2252,12 @@ function parseAttrs(chunk) {
2252
2252
  while ((m = ATTR.exec(chunk)) !== null) attrs.set(m[1].toLowerCase(), m[2] ?? m[3] ?? m[4] ?? "");
2253
2253
  return attrs;
2254
2254
  }
2255
- function parseArgs(raw) {
2255
+ function parseArgs(raw, attribute) {
2256
2256
  if (!raw) return void 0;
2257
2257
  try {
2258
2258
  return JSON.parse(decodeEntities(raw));
2259
2259
  } catch {
2260
- console.warn(`[verbaly] invalid args JSON: ${raw}`);
2260
+ warnOnce(`invalid JSON in ${attribute}: ${raw}`, `${attribute}:${raw}`);
2261
2261
  return;
2262
2262
  }
2263
2263
  }