@blogmcp/sdk 0.9.1 → 0.9.3
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/nuxt/composables/useAsyncKb.js +17 -16
- package/dist/packages/mdx-render-vue/dist/packages/sanitize/dist/html-core.js +5 -0
- package/dist/packages/mdx-render-vue/dist/render/button/Button.vue2.js +1 -1
- package/package.json +3 -3
- package/src/nuxt/composables/useAsyncKb.ts +10 -11
- package/src/nuxt/nuxt-imports.d.ts +14 -0
- package/dist/packages/mdx-render-vue/dist/packages/sanitize/dist/html.js +0 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
15
|
-
const a = l(),
|
|
16
|
-
|
|
17
|
-
async () => (await a.fetch(
|
|
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
|
|
21
|
+
return i.value && (a.article.value = i.value), a;
|
|
21
22
|
}
|
|
22
|
-
async function
|
|
23
|
-
const t =
|
|
24
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
w as useAsyncArticle,
|
|
33
|
+
m as useAsyncArticleList,
|
|
34
|
+
p as useAsyncNavigation
|
|
34
35
|
};
|
|
@@ -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.
|
|
3
|
+
"version": "0.9.3",
|
|
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.
|
|
86
|
-
"@blogmcp/sanitize": "^0.9.
|
|
85
|
+
"@blogmcp/mdx-schema": "^0.9.3",
|
|
86
|
+
"@blogmcp/sanitize": "^0.9.3",
|
|
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
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
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
|
+
}
|