@blogmcp/sdk 0.9.1 → 0.9.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,8 +1,9 @@
1
- import { useArticleList as i, useArticle as l } from "../../vue/composables/useArticles.js";
2
- import { useNavigation as r } from "../../vue/composables/useNavigation.js";
3
- async function f(n, c, e) {
4
- const t = i(c), { data: a } = await useAsyncData(
5
- n,
1
+ import { useAsyncData as n } from "#imports";
2
+ import { useArticleList as s, useArticle as l } from "../../vue/composables/useArticles.js";
3
+ import { useNavigation as v } from "../../vue/composables/useNavigation.js";
4
+ async function m(o, c, e) {
5
+ const t = s(c), { data: a } = await n(
6
+ o,
6
7
  async () => (await t.fetch(c), {
7
8
  articles: t.articles.value,
8
9
  totalCount: t.totalCount.value
@@ -11,24 +12,24 @@ async function f(n, c, e) {
11
12
  );
12
13
  return a.value && (t.articles.value = a.value.articles, t.totalCount.value = a.value.totalCount), t;
13
14
  }
14
- async function A(n, c, e, t) {
15
- const a = l(), s = () => typeof c == "string" ? c : c.value, o = () => typeof e == "string" ? e : e.value, { data: u } = await useAsyncData(
16
- n,
17
- async () => (await a.fetch(s(), o()), a.article.value),
15
+ async function w(o, c, e, t) {
16
+ const a = l(), u = () => typeof c == "string" ? c : c.value, r = () => typeof e == "string" ? e : e.value, { data: i } = await n(
17
+ o,
18
+ async () => (await a.fetch(u(), r()), a.article.value),
18
19
  t ? { watch: t } : void 0
19
20
  );
20
- return u.value && (a.article.value = u.value), a;
21
+ return i.value && (a.article.value = i.value), a;
21
22
  }
22
- async function w(n, c, e) {
23
- const t = r(), { data: a } = await useAsyncData(
24
- n,
23
+ async function p(o, c, e) {
24
+ const t = v(), { data: a } = await n(
25
+ o,
25
26
  async () => (await t.fetch(c), t.tree.value),
26
27
  e ? { watch: e } : void 0
27
28
  );
28
29
  return a.value && (t.tree.value = a.value), t;
29
30
  }
30
31
  export {
31
- A as useAsyncArticle,
32
- f as useAsyncArticleList,
33
- w as useAsyncNavigation
32
+ w as useAsyncArticle,
33
+ m as useAsyncArticleList,
34
+ p as useAsyncNavigation
34
35
  };
@@ -0,0 +1,5 @@
1
+ import "../../../node_modules/dompurify/dist/purify.es.js";
2
+ Number(
3
+ // Guarded: this core is also evaluated in browsers, where `process` need not exist.
4
+ (typeof process < "u" ? process.env?.SANITIZE_RECYCLE_AFTER_CALLS : void 0) ?? 500
5
+ );
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as m, computed as s, createElementBlock as l, openBlock as r, normalizeClass as i, toDisplayString as c } from "vue";
2
2
  import { buttonStyles as e } from "@blogmcp/mdx-schema/styles";
3
- import "../../packages/sanitize/dist/html.js";
3
+ import "../../packages/sanitize/dist/html-core.js";
4
4
  import { d as u } from "../../_virtual/index.js";
5
5
  const d = ["href"], z = /* @__PURE__ */ m({
6
6
  __name: "Button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blogmcp/sdk",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Headless SDK for Knowledge Base blog — core client, Vue composables, Nuxt adapter",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -82,8 +82,8 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@blogmcp/mdx-schema": "^0.9.1",
86
- "@blogmcp/sanitize": "^0.9.1",
85
+ "@blogmcp/mdx-schema": "^0.9.2",
86
+ "@blogmcp/sanitize": "^0.9.2",
87
87
  "marked": "^15.0.7"
88
88
  },
89
89
  "optionalDependencies": {
@@ -8,22 +8,21 @@
8
8
  * const { articles, totalCount } = await useAsyncArticleList('home', { status: 'published' })
9
9
  */
10
10
 
11
- // Note: These imports work in Nuxt apps where #imports is available.
12
- // The composable functions reference useAsyncData from Nuxt's auto-imports.
13
- // TypeScript types are declared inline to avoid hard dependency on nuxt types.
14
-
11
+ // `useAsyncData` comes from Nuxt through its `#imports` alias — an EXPLICIT import, the way a Nuxt
12
+ // module's runtime code takes it. Until 0.9.1 it was a bare identifier left to Nuxt's auto-import
13
+ // transform, which does not run over node_modules: the published package answered 500
14
+ // "useAsyncData is not defined" unless the consumer added
15
+ // `imports.transform.include: [/@blogmcp\/sdk\/dist\/nuxt\//]` (the headless kit did). With the
16
+ // alias the only requirement is `build.transpile: ['@blogmcp/sdk']`, so Vite resolves `#imports`
17
+ // inside this package instead of Node loading it raw. The alias is typed by ./nuxt-imports.d.ts for
18
+ // this package's own build; in a Nuxt app the app's own `#imports` types apply.
19
+
20
+ import { useAsyncData } from '#imports'
15
21
  import type { Ref } from 'vue'
16
22
  import { useArticleList, useArticle } from '../../vue/composables/useArticles'
17
23
  import type { ArticleListParams } from '../../vue/composables/useArticles'
18
24
  import { useNavigation } from '../../vue/composables/useNavigation'
19
25
 
20
- // Nuxt's useAsyncData type (declared to avoid importing from #imports at compile time)
21
- declare function useAsyncData<T>(
22
- key: string,
23
- handler: () => Promise<T>,
24
- opts?: { watch?: unknown[] }
25
- ): Promise<{ data: Ref<T | null>; pending: Ref<boolean>; error: Ref<Error | null> }>
26
-
27
26
  /**
28
27
  * SSR-hydrated article list.
29
28
  *
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The `#imports` alias for THIS package's own build and typecheck (vite-tsc has no Nuxt app around
3
+ * it). Only what the Nuxt adapters use, with Nuxt's shape. A consuming Nuxt app never sees this
4
+ * file: the emitted dist/nuxt/**.d.ts does not reference `#imports` (the import is implementation-
5
+ * only), and the app's own `.nuxt/imports.d.ts` types the alias there.
6
+ */
7
+ declare module '#imports' {
8
+ import type { Ref } from 'vue'
9
+ export function useAsyncData<T>(
10
+ key: string,
11
+ handler: () => Promise<T>,
12
+ opts?: { watch?: unknown[] },
13
+ ): Promise<{ data: Ref<T | null>; pending: Ref<boolean>; error: Ref<Error | null> }>
14
+ }
@@ -1,2 +0,0 @@
1
- import "../../../node_modules/dompurify/dist/purify.es.js";
2
- Number(process.env.SANITIZE_RECYCLE_AFTER_CALLS ?? 500);