@vesk/vesk-cli 0.2.48 → 0.2.50-canary.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.
Files changed (2) hide show
  1. package/dist/cli.js +29 -4
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -3917,12 +3917,29 @@ function handleScroll(pathname, isReplace, scrollBehavior) {
3917
3917
  requestAnimationFrame(() => window.scrollTo({ top: 0, behavior }));
3918
3918
  }
3919
3919
  }
3920
+ function decodeHeadText(value) {
3921
+ if (value.indexOf("&") === -1) return value;
3922
+ return value.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]*);/g, (match, body) => {
3923
+ if (body.charCodeAt(0) === 35) {
3924
+ const hex = body.charCodeAt(1) === 120 || body.charCodeAt(1) === 88;
3925
+ const num = parseInt(hex ? body.slice(2) : body.slice(1), hex ? 16 : 10);
3926
+ if (!Number.isFinite(num) || num < 0 || num > 1114111) return match;
3927
+ try {
3928
+ return String.fromCodePoint(num);
3929
+ } catch {
3930
+ return match;
3931
+ }
3932
+ }
3933
+ const named = HEAD_ENTITIES[body.toLowerCase()];
3934
+ return named === void 0 ? match : named;
3935
+ });
3936
+ }
3920
3937
  function applyHeadAttrs(el, raw2) {
3921
3938
  for (const attrMatch of raw2.matchAll(/([a-zA-Z0-9\-:]+)\s*=\s*("([^"]*)"|'([^']*)')/g)) {
3922
3939
  const name = attrMatch[1];
3923
3940
  const value = attrMatch[3] ?? attrMatch[4] ?? "";
3924
3941
  if (name.toLowerCase() === "charset") continue;
3925
- el.setAttribute(name, value);
3942
+ el.setAttribute(name, decodeHeadText(value));
3926
3943
  }
3927
3944
  }
3928
3945
  function applyHead(headHtml) {
@@ -3936,7 +3953,7 @@ function applyHead(headHtml) {
3936
3953
  const titleMatch = headHtml.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
3937
3954
  if (titleMatch) {
3938
3955
  const t = document.createElement("title");
3939
- t.textContent = titleMatch[1];
3956
+ t.textContent = decodeHeadText(titleMatch[1]);
3940
3957
  t.setAttribute(HEAD_MARKER, "");
3941
3958
  head.appendChild(t);
3942
3959
  }
@@ -3965,7 +3982,7 @@ function applyHead(headHtml) {
3965
3982
  }
3966
3983
  for (const m of headHtml.matchAll(/<style\b([^>]*)>([\s\S]*?)<\/style>/gi)) {
3967
3984
  const style = document.createElement("style");
3968
- style.textContent = m[2];
3985
+ style.textContent = decodeHeadText(m[2]);
3969
3986
  style.setAttribute(HEAD_MARKER, "");
3970
3987
  head.appendChild(style);
3971
3988
  }
@@ -4245,7 +4262,7 @@ function useRouter() {
4245
4262
  }
4246
4263
  };
4247
4264
  }
4248
- var Redirect, NotFoundError, RouterCtx, _currentRouter, _outletId, __isHydrating, _state, _scrollPositions, _isPopStateNavigation, HEAD_MARKER;
4265
+ var Redirect, NotFoundError, RouterCtx, _currentRouter, _outletId, __isHydrating, _state, _scrollPositions, _isPopStateNavigation, HEAD_MARKER, HEAD_ENTITIES;
4249
4266
  var init_router_components = __esm({
4250
4267
  "../runtime/src/router-components.ts"() {
4251
4268
  "use strict";
@@ -4281,6 +4298,14 @@ var init_router_components = __esm({
4281
4298
  _scrollPositions = /* @__PURE__ */ new Map();
4282
4299
  _isPopStateNavigation = false;
4283
4300
  HEAD_MARKER = "data-vesk-head";
4301
+ HEAD_ENTITIES = {
4302
+ amp: "&",
4303
+ lt: "<",
4304
+ gt: ">",
4305
+ quot: '"',
4306
+ apos: "'",
4307
+ nbsp: "\xA0"
4308
+ };
4284
4309
  }
4285
4310
  });
4286
4311
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.48",
3
+ "version": "0.2.50-canary.1",
4
4
  "type": "module",
5
5
  "description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "main": "./dist/cli.js",
10
10
  "dependencies": {
11
- "@vesk/adapter": "^0.2.48",
12
- "@vesk/compiler": "^0.2.48",
13
- "@vesk/plugin-tailwind": "^0.2.48",
14
- "@vesk/runtime": "^0.2.48",
11
+ "@vesk/adapter": "^0.2.50-canary.1",
12
+ "@vesk/compiler": "^0.2.50-canary.1",
13
+ "@vesk/plugin-tailwind": "^0.2.50-canary.1",
14
+ "@vesk/runtime": "^0.2.50-canary.1",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",