@refrakt-md/eleventy 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/data.d.ts +33 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +59 -0
- package/dist/data.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +9 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +20 -0
- package/dist/plugin.js.map +1 -0
- package/dist/types.d.ts +18 -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 +40 -0
- package/templates/base.njk +22 -0
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { EleventyTheme } from './types.js';
|
|
2
|
+
export interface EleventyPageData {
|
|
3
|
+
url: string;
|
|
4
|
+
title: string;
|
|
5
|
+
html: string;
|
|
6
|
+
seo: {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
metaTags: string;
|
|
10
|
+
jsonLd: string;
|
|
11
|
+
};
|
|
12
|
+
frontmatter: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a global data function for Eleventy.
|
|
16
|
+
*
|
|
17
|
+
* Call this in your `_data/refrakt.js` file:
|
|
18
|
+
*
|
|
19
|
+
* import { createDataFile } from '@refrakt-md/eleventy';
|
|
20
|
+
* import manifest from '@refrakt-md/lumina/manifest';
|
|
21
|
+
* import { layouts } from '@refrakt-md/lumina/layouts';
|
|
22
|
+
* export default createDataFile({ theme: { manifest, layouts } });
|
|
23
|
+
*
|
|
24
|
+
* Returns an async function that loads content, applies transforms,
|
|
25
|
+
* and produces an array of page objects with pre-rendered HTML.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createDataFile(config: {
|
|
28
|
+
theme: EleventyTheme;
|
|
29
|
+
contentDir?: string;
|
|
30
|
+
basePath?: string;
|
|
31
|
+
configPath?: string;
|
|
32
|
+
}): () => Promise<EleventyPageData[]>;
|
|
33
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;IACF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACtC,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAoDpC"}
|
package/dist/data.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { renderPage, extractSeoData, seoToHtml } from '@refrakt-md/transform';
|
|
3
|
+
/**
|
|
4
|
+
* Create a global data function for Eleventy.
|
|
5
|
+
*
|
|
6
|
+
* Call this in your `_data/refrakt.js` file:
|
|
7
|
+
*
|
|
8
|
+
* import { createDataFile } from '@refrakt-md/eleventy';
|
|
9
|
+
* import manifest from '@refrakt-md/lumina/manifest';
|
|
10
|
+
* import { layouts } from '@refrakt-md/lumina/layouts';
|
|
11
|
+
* export default createDataFile({ theme: { manifest, layouts } });
|
|
12
|
+
*
|
|
13
|
+
* Returns an async function that loads content, applies transforms,
|
|
14
|
+
* and produces an array of page objects with pre-rendered HTML.
|
|
15
|
+
*/
|
|
16
|
+
export function createDataFile(config) {
|
|
17
|
+
const { theme, contentDir = './content', basePath = '/', } = config;
|
|
18
|
+
return async function loadRefrakt() {
|
|
19
|
+
const { loadContent } = await import('@refrakt-md/content');
|
|
20
|
+
const absContentDir = resolve(contentDir);
|
|
21
|
+
const site = await loadContent(absContentDir, basePath);
|
|
22
|
+
return site.pages.map((page) => {
|
|
23
|
+
const pageData = {
|
|
24
|
+
renderable: page.renderable,
|
|
25
|
+
regions: page.regions ?? {},
|
|
26
|
+
title: page.title,
|
|
27
|
+
url: page.url,
|
|
28
|
+
pages: site.pages.map((p) => ({
|
|
29
|
+
url: p.url,
|
|
30
|
+
title: p.title,
|
|
31
|
+
draft: p.draft ?? false,
|
|
32
|
+
description: p.frontmatter?.description,
|
|
33
|
+
date: p.frontmatter?.date,
|
|
34
|
+
author: p.frontmatter?.author,
|
|
35
|
+
tags: p.frontmatter?.tags,
|
|
36
|
+
image: p.frontmatter?.image,
|
|
37
|
+
})),
|
|
38
|
+
frontmatter: page.frontmatter ?? {},
|
|
39
|
+
headings: page.headings,
|
|
40
|
+
};
|
|
41
|
+
const html = renderPage({ theme, page: pageData });
|
|
42
|
+
const seoData = extractSeoData({
|
|
43
|
+
title: page.title,
|
|
44
|
+
frontmatter: page.frontmatter ?? {},
|
|
45
|
+
seo: page.seo,
|
|
46
|
+
});
|
|
47
|
+
const seoHtml = seoToHtml(seoData);
|
|
48
|
+
const seo = { ...seoHtml, description: seoData.description };
|
|
49
|
+
return {
|
|
50
|
+
url: page.url,
|
|
51
|
+
title: page.title,
|
|
52
|
+
html,
|
|
53
|
+
seo,
|
|
54
|
+
frontmatter: page.frontmatter ?? {},
|
|
55
|
+
};
|
|
56
|
+
});
|
|
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AAsB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,oBAAoB;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RefraktEleventyOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Eleventy plugin for refrakt.
|
|
4
|
+
*
|
|
5
|
+
* Configures passthrough file copy for theme CSS and optionally
|
|
6
|
+
* behaviors JS from node_modules.
|
|
7
|
+
*/
|
|
8
|
+
export declare function refraktPlugin(eleventyConfig: any, options?: RefraktEleventyOptions): void;
|
|
9
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,GAAE,sBAA2B,GAAG,IAAI,CAc7F"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* Eleventy plugin for refrakt.
|
|
4
|
+
*
|
|
5
|
+
* Configures passthrough file copy for theme CSS and optionally
|
|
6
|
+
* behaviors JS from node_modules.
|
|
7
|
+
*/
|
|
8
|
+
export function refraktPlugin(eleventyConfig, options = {}) {
|
|
9
|
+
const { cssPrefix = '/css', } = options;
|
|
10
|
+
// Passthrough copy Lumina CSS from node_modules
|
|
11
|
+
// Users should configure the specific paths for their theme
|
|
12
|
+
if (options.cssFiles) {
|
|
13
|
+
for (const cssFile of options.cssFiles) {
|
|
14
|
+
if (existsSync(cssFile)) {
|
|
15
|
+
eleventyConfig.addPassthroughCopy({ [cssFile]: cssPrefix });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,cAAmB,EAAE,UAAkC,EAAE;IACtF,MAAM,EACL,SAAS,GAAG,MAAM,GAClB,GAAG,OAAO,CAAC;IAEZ,gDAAgD;IAChD,4DAA4D;IAC5D,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACxC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzB,cAAc,CAAC,kBAAkB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7D,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AdapterTheme } from '@refrakt-md/transform';
|
|
2
|
+
/**
|
|
3
|
+
* Theme definition for the Eleventy adapter.
|
|
4
|
+
*
|
|
5
|
+
* Alias for the shared `AdapterTheme` — all non-Svelte adapters
|
|
6
|
+
* use the same shape (manifest + layouts).
|
|
7
|
+
*/
|
|
8
|
+
export type EleventyTheme = AdapterTheme;
|
|
9
|
+
/** Options for the refrakt Eleventy plugin */
|
|
10
|
+
export interface RefraktEleventyOptions {
|
|
11
|
+
/** Path to refrakt.config.json (default: './refrakt.config.json') */
|
|
12
|
+
configPath?: string;
|
|
13
|
+
/** CSS files to passthrough copy (resolved from theme) */
|
|
14
|
+
cssFiles?: string[];
|
|
15
|
+
/** Path prefix for copied CSS (default: '/css') */
|
|
16
|
+
cssPrefix?: string;
|
|
17
|
+
}
|
|
18
|
+
//# 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,aAAa,GAAG,YAAY,CAAC;AAEzC,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACtC,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
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,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@refrakt-md/eleventy",
|
|
3
|
+
"description": "Eleventy plugin for refrakt.md — render Markdoc runes in 11ty v3 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/eleventy"
|
|
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
|
+
"templates"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@refrakt-md/content": "0.9.2",
|
|
34
|
+
"@refrakt-md/transform": "0.9.2",
|
|
35
|
+
"@refrakt-md/types": "0.9.2"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@11ty/eleventy": "^3.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
{% if page.seo.title %}<title>{{ page.seo.title }}</title>{% endif %}
|
|
7
|
+
{{ page.seo.metaTags | safe }}
|
|
8
|
+
{{ page.seo.jsonLd | safe }}
|
|
9
|
+
<link rel="stylesheet" href="/css/index.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
{{ page.html | safe }}
|
|
13
|
+
<script type="module">
|
|
14
|
+
import { registerElements, RfContext, initRuneBehaviors, initLayoutBehaviors } from '/js/behaviors.js';
|
|
15
|
+
|
|
16
|
+
RfContext.currentUrl = '{{ page.url }}';
|
|
17
|
+
registerElements();
|
|
18
|
+
initRuneBehaviors();
|
|
19
|
+
initLayoutBehaviors();
|
|
20
|
+
</script>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|