@blogmcp/sdk 0.1.1 → 0.1.2

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.
@@ -1,4 +1,2 @@
1
- var r = {};
2
- export {
3
- r as __exports
4
- };
1
+ import { __require as r } from "../node_modules/semver/index.js";
2
+ r();
@@ -1,2 +1,4 @@
1
- import { __require as r } from "../node_modules/semver/index.js";
2
- r();
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
@@ -1,4 +1,4 @@
1
- import { __exports as s } from "../../../../_virtual/index2.js";
1
+ import { __exports as s } from "../../../../_virtual/index3.js";
2
2
  import { __require as v } from "./constants.js";
3
3
  var m;
4
4
  function U() {
@@ -2,7 +2,7 @@ import { defineAsyncComponent as m, defineComponent as u, h as f } from "vue";
2
2
  import { componentMetadata as b } from "../../mdx-schema/dist/metadata/index.js";
3
3
  import { getComponentMetadata as T, getComponentNames as W } from "../../mdx-schema/dist/metadata/index.js";
4
4
  import { prepareProps as g } from "../../mdx-schema/dist/prepareProps.js";
5
- import "../../../_virtual/index3.js";
5
+ import "../../../_virtual/index2.js";
6
6
  const s = "__mdxPreparePropsAppliedFor", C = {
7
7
  Callout: {
8
8
  editor: { icon: "info", color: "#569cd6", borderColor: "#569cd6", bgColor: "rgba(86, 156, 214, 0.08)" },
@@ -1,22 +1,54 @@
1
- import i from "../../../node_modules/dompurify/dist/purify.es.js";
2
- let e;
3
- function o() {
4
- if (e)
5
- return e;
1
+ import f from "../../../node_modules/dompurify/dist/purify.es.js";
2
+ let i;
3
+ function u() {
4
+ if (i)
5
+ return i;
6
6
  if (typeof window < "u" && typeof window.document < "u")
7
- e = i;
7
+ i = f;
8
8
  else {
9
9
  const { JSDOM: t } = require("jsdom");
10
- e = i(new t("").window), f(e);
10
+ i = f(new t("").window);
11
11
  }
12
- return e;
12
+ return a(i), m(i), i;
13
13
  }
14
- function f(t) {
15
- t.addHook("afterSanitizeAttributes", (r) => {
16
- r.tagName === "A" && r.getAttribute("target") === "_blank" && r.setAttribute("rel", "noopener noreferrer");
14
+ function a(t) {
15
+ t.addHook("afterSanitizeAttributes", (e) => {
16
+ e.tagName === "A" && e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
17
17
  });
18
18
  }
19
- const n = {
19
+ const c = /* @__PURE__ */ new Set([
20
+ "width",
21
+ "height",
22
+ "min-width",
23
+ "min-height",
24
+ "max-width",
25
+ "max-height",
26
+ "aspect-ratio",
27
+ "object-fit"
28
+ ]);
29
+ function A(t) {
30
+ return t.length > 0 && t.length <= 40 && /^[a-z0-9.%/\s-]+$/i.test(t) && !/url|expression|\\/i.test(t);
31
+ }
32
+ function S(t) {
33
+ const e = [];
34
+ for (const r of t.split(";")) {
35
+ const n = r.indexOf(":");
36
+ if (n < 0)
37
+ continue;
38
+ const o = r.slice(0, n).trim().toLowerCase(), s = r.slice(n + 1).trim();
39
+ c.has(o) && A(s) && e.push(`${o}:${s}`);
40
+ }
41
+ return e.join(";");
42
+ }
43
+ function m(t) {
44
+ t.addHook("afterSanitizeAttributes", (e) => {
45
+ if (!e.hasAttribute("style"))
46
+ return;
47
+ const r = S(e.getAttribute("style") || "");
48
+ r ? e.setAttribute("style", r) : e.removeAttribute("style");
49
+ });
50
+ }
51
+ const l = {
20
52
  USE_PROFILES: { html: !0 },
21
53
  ADD_ATTR: ["target", "rel"],
22
54
  FORBID_TAGS: ["style", "form", "input", "iframe"],
@@ -24,18 +56,23 @@ const n = {
24
56
  SANITIZE_NAMED_PROPS: !0,
25
57
  ALLOW_DATA_ATTR: !1
26
58
  };
27
- function a(t, r = n) {
28
- return o().sanitize(t, r);
59
+ function p(t, e = l) {
60
+ return u().sanitize(t, e);
29
61
  }
30
62
  ({
31
63
  // Derive from STRICT_CONFIG so its security posture — and any FUTURE hardening (a new
32
64
  // FORBID_TAGS/FORBID_ATTR entry) — propagates to this higher-risk host boundary automatically.
33
65
  // ADD_ATTR is overridden outright (it restates STRICT_CONFIG's target/rel + adds the two
34
- // structural attrs the overlay anchors on) — the one place the two configs intentionally differ.
35
- ...n
66
+ // structural attrs the overlay anchors on). FORBID_ATTR is overridden to DROP `style` from
67
+ // the forbid list (keeping only `formaction`): DOMPurify then lets `style` through, and the
68
+ // shared `installStyleAllowlistHook` narrows it to the SIZING-only allowlist — so a customer
69
+ // renderer's intrinsic sizing (icon width/height) survives, while nothing that can overlay or
70
+ // reflow the contained host does, and customer JS still cannot run. STRICT_CONFIG (blog
71
+ // content) keeps `style` forbidden, so this exception is scoped to the embed host only.
72
+ ...l
36
73
  });
37
74
  export {
38
- n as STRICT_CONFIG,
39
- o as getPurifier,
40
- a as sanitizeHtml
75
+ l as STRICT_CONFIG,
76
+ u as getPurifier,
77
+ p as sanitizeHtml
41
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blogmcp/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Headless SDK for Knowledge Base blog — core client, Vue composables, Nuxt adapter",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -61,8 +61,8 @@
61
61
  }
62
62
  },
63
63
  "dependencies": {
64
- "@blogmcp/mdx-schema": "^0.1.1",
65
- "@blogmcp/sanitize": "^0.1.1",
64
+ "@blogmcp/mdx-schema": "^0.1.2",
65
+ "@blogmcp/sanitize": "^0.1.2",
66
66
  "marked": "^15.0.7"
67
67
  },
68
68
  "optionalDependencies": {