@refrakt-md/nuxt 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.
- package/dist/behaviors.d.ts +7 -0
- package/dist/behaviors.d.ts.map +1 -0
- package/dist/behaviors.js +10 -0
- package/dist/behaviors.js.map +1 -0
- package/dist/composables.d.ts +21 -0
- package/dist/composables.d.ts.map +1 -0
- package/dist/composables.js +34 -0
- package/dist/composables.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +4 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +38 -0
- package/dist/module.js.map +1 -0
- package/dist/render.d.ts +3 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +2 -0
- package/dist/render.js.map +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RendererNode } from '@refrakt-md/types';
|
|
2
|
+
/**
|
|
3
|
+
* Check whether a rendered tree contains interactive runes that need
|
|
4
|
+
* client-side behavior initialization.
|
|
5
|
+
*/
|
|
6
|
+
export declare function hasInteractiveRunes(node: RendererNode): boolean;
|
|
7
|
+
//# sourceMappingURL=behaviors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behaviors.d.ts","sourceRoot":"","sources":["../src/behaviors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAE/D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { hasMatchingRunes } from '@refrakt-md/transform';
|
|
2
|
+
import { getBehaviorNames } from '@refrakt-md/behaviors';
|
|
3
|
+
/**
|
|
4
|
+
* Check whether a rendered tree contains interactive runes that need
|
|
5
|
+
* client-side behavior initialization.
|
|
6
|
+
*/
|
|
7
|
+
export function hasInteractiveRunes(node) {
|
|
8
|
+
return hasMatchingRunes(node, getBehaviorNames());
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=behaviors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behaviors.js","sourceRoot":"","sources":["../src/behaviors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAkB;IACrD,OAAO,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SeoInput } from '@refrakt-md/transform';
|
|
2
|
+
export type RefraktMetaInput = SeoInput;
|
|
3
|
+
/**
|
|
4
|
+
* Build head meta configuration for use with Nuxt's useHead().
|
|
5
|
+
*
|
|
6
|
+
* Returns an object suitable for passing to useHead() containing
|
|
7
|
+
* title, meta tags (OG, description), and script tags (JSON-LD).
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildRefraktHead(input: RefraktMetaInput): {
|
|
10
|
+
title: string;
|
|
11
|
+
meta: Array<{
|
|
12
|
+
name?: string;
|
|
13
|
+
property?: string;
|
|
14
|
+
content: string;
|
|
15
|
+
}>;
|
|
16
|
+
script: Array<{
|
|
17
|
+
type: string;
|
|
18
|
+
children: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=composables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composables.d.ts","sourceRoot":"","sources":["../src/composables.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD,CAgCA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { extractSeoData } from '@refrakt-md/transform';
|
|
2
|
+
/**
|
|
3
|
+
* Build head meta configuration for use with Nuxt's useHead().
|
|
4
|
+
*
|
|
5
|
+
* Returns an object suitable for passing to useHead() containing
|
|
6
|
+
* title, meta tags (OG, description), and script tags (JSON-LD).
|
|
7
|
+
*/
|
|
8
|
+
export function buildRefraktHead(input) {
|
|
9
|
+
const data = extractSeoData(input);
|
|
10
|
+
const meta = [];
|
|
11
|
+
const script = [];
|
|
12
|
+
if (data.description) {
|
|
13
|
+
meta.push({ name: 'description', content: data.description });
|
|
14
|
+
meta.push({ property: 'og:description', content: data.description });
|
|
15
|
+
}
|
|
16
|
+
if (data.title) {
|
|
17
|
+
meta.push({ property: 'og:title', content: data.title });
|
|
18
|
+
}
|
|
19
|
+
if (data.ogImage) {
|
|
20
|
+
meta.push({ property: 'og:image', content: data.ogImage });
|
|
21
|
+
meta.push({ name: 'twitter:card', content: 'summary_large_image' });
|
|
22
|
+
}
|
|
23
|
+
if (data.ogUrl) {
|
|
24
|
+
meta.push({ property: 'og:url', content: data.ogUrl });
|
|
25
|
+
}
|
|
26
|
+
if (data.ogType) {
|
|
27
|
+
meta.push({ property: 'og:type', content: data.ogType });
|
|
28
|
+
}
|
|
29
|
+
for (const schema of data.jsonLd) {
|
|
30
|
+
script.push({ type: 'application/ld+json', children: JSON.stringify(schema) });
|
|
31
|
+
}
|
|
32
|
+
return { title: data.title, meta, script };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=composables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composables.js","sourceRoot":"","sources":["../src/composables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAuB;IAKvD,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,IAAI,GAAiE,EAAE,CAAC;IAC9E,MAAM,MAAM,GAA8C,EAAE,CAAC;IAE7D,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as refrakt } from './module.js';
|
|
2
|
+
export { renderPage } from './render.js';
|
|
3
|
+
export type { RenderPageInput } from './render.js';
|
|
4
|
+
export { buildRefraktHead } from './composables.js';
|
|
5
|
+
export type { RefraktMetaInput } from './composables.js';
|
|
6
|
+
export { hasInteractiveRunes } from './behaviors.js';
|
|
7
|
+
export type { NuxtTheme, RefraktNuxtOptions } from './types.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGrD,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Module
|
|
2
|
+
export { default as refrakt } from './module.js';
|
|
3
|
+
// Rendering
|
|
4
|
+
export { renderPage } from './render.js';
|
|
5
|
+
// SEO
|
|
6
|
+
export { buildRefraktHead } from './composables.js';
|
|
7
|
+
// Behaviors
|
|
8
|
+
export { hasInteractiveRunes } from './behaviors.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAEjD,YAAY;AACZ,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM;AACN,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,YAAY;AACZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;;AAErD,wBAmCG"}
|
package/dist/module.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineNuxtModule } from 'nuxt/kit';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { CORE_PACKAGES } from '@refrakt-md/transform';
|
|
4
|
+
import { loadRefraktConfig } from '@refrakt-md/transform/node';
|
|
5
|
+
export default defineNuxtModule({
|
|
6
|
+
meta: {
|
|
7
|
+
name: '@refrakt-md/nuxt',
|
|
8
|
+
configKey: 'refrakt',
|
|
9
|
+
},
|
|
10
|
+
defaults: {
|
|
11
|
+
configPath: './refrakt.config.json',
|
|
12
|
+
},
|
|
13
|
+
setup(options, nuxt) {
|
|
14
|
+
const refraktConfig = loadRefraktConfig(options.configPath);
|
|
15
|
+
// Add packages to transpile list
|
|
16
|
+
const transpile = [
|
|
17
|
+
...CORE_PACKAGES,
|
|
18
|
+
'@refrakt-md/nuxt',
|
|
19
|
+
refraktConfig.theme,
|
|
20
|
+
`${refraktConfig.theme}/nuxt`,
|
|
21
|
+
...(refraktConfig.packages ?? []),
|
|
22
|
+
];
|
|
23
|
+
nuxt.options.build.transpile.push(...transpile);
|
|
24
|
+
// Configure Vue to treat rf-* as custom elements
|
|
25
|
+
nuxt.options.vue.compilerOptions.isCustomElement = (tag) => tag.startsWith('rf-');
|
|
26
|
+
// Watch content directory for HMR
|
|
27
|
+
const contentDir = resolve(nuxt.options.rootDir, refraktConfig.contentDir);
|
|
28
|
+
nuxt.hook('builder:watch', async (_event, relativePath) => {
|
|
29
|
+
if (relativePath.endsWith('.md')) {
|
|
30
|
+
const absPath = resolve(nuxt.options.rootDir, relativePath);
|
|
31
|
+
if (absPath.startsWith(contentDir)) {
|
|
32
|
+
await nuxt.callHook('builder:generateApp');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,uBA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C,CAAC;gBAC5C,CAAC;YACF,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/render.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AdapterTheme } from '@refrakt-md/transform';
|
|
2
|
+
/**
|
|
3
|
+
* Theme definition for the Nuxt adapter.
|
|
4
|
+
*
|
|
5
|
+
* Alias for the shared `AdapterTheme` — all non-Svelte adapters
|
|
6
|
+
* use the same shape (manifest + layouts).
|
|
7
|
+
*/
|
|
8
|
+
export type NuxtTheme = AdapterTheme;
|
|
9
|
+
export interface RefraktNuxtOptions {
|
|
10
|
+
configPath?: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC;AAErC,MAAM,WAAW,kBAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@refrakt-md/nuxt",
|
|
3
|
+
"description": "Nuxt module for refrakt.md — render Markdoc runes in Nuxt projects",
|
|
4
|
+
"version": "0.9.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/refrakt-md/refrakt.git",
|
|
10
|
+
"directory": "packages/nuxt"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/refrakt-md/refrakt/issues",
|
|
13
|
+
"homepage": "https://github.com/refrakt-md/refrakt",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"main": "dist/index.js",
|
|
18
|
+
"types": "dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@refrakt-md/behaviors": "0.9.2",
|
|
33
|
+
"@refrakt-md/content": "0.9.2",
|
|
34
|
+
"@refrakt-md/transform": "0.9.2",
|
|
35
|
+
"@refrakt-md/types": "0.9.2"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"nuxt": "^3.0.0",
|
|
39
|
+
"vue": "^3.0.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"nuxt": "^3.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|