chore: ♻️ Fix: Some Deps should be Peer not dev/main (#109)
Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com> Co-authored-by: Adam Matthiesen <amatthiesen@outlook.com>
This commit is contained in:
parent
62829e268a
commit
b685e6617d
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
"@matthiesenxyz/starlight-ghostcms": patch
|
||||
"@matthiesenxyz/astro-ghostcms": patch
|
||||
---
|
||||
|
||||
Update Deps
|
|
@ -1,60 +0,0 @@
|
|||
# @matthiesenxyz/astro-ghostcms-rendercontent
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2724119: Prep to deprecate this package. Moving to `astro-remote`
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- f921005: Bump dependencies:
|
||||
|
||||
- vite from to
|
||||
- @eliancodes/brutal-ui from to
|
||||
- typescript from to
|
||||
- ultrahtml from to
|
||||
- @fontsource-variable/inter from to
|
||||
- astro-seo from to
|
||||
- astro from to
|
||||
- sass from to
|
||||
- @astrojs/starlight from to
|
||||
- sharp from to
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 1f850db: Bump dependencies:
|
||||
|
||||
- astro from to
|
||||
- vite from to
|
||||
- astro-seo from to
|
||||
- sass from to
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 3a5aea9: Updated Tests and Linted packages
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 455ad3f: Bump astro from 4.0.0 to 4.3.7
|
||||
- 12be739: Depencency updates
|
||||
|
||||
## 0.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix License File
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Initialization of changeset cli
|
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 MatthiesenXYZ - Astro-GhostCMS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,35 +0,0 @@
|
|||
# Astro GhostCMS Content API HTML Processor
|
||||
|
||||
## NOTE: This package is no longer in use - Please switch to [`astro-remote`](https://github.com/natemoo-re/astro-remote)
|
||||
|
||||
Render remote GhostCMS HTML in Astro with full control over the output.
|
||||
|
||||
Powered by [`ultrahtml`](https://github.com/natemoo-re/ultrahtml).
|
||||
|
||||
## Rendering Remote Content
|
||||
|
||||
The most basic function of `astro-ghostcms-rendercontent` is to convert a string of HTML to Astro friendly HTML. Use the `GhostRender` component.
|
||||
|
||||
```astro
|
||||
---
|
||||
import { GhostRender } from "@matthiesenxyz/astro-ghostcms-rendercontent";
|
||||
---
|
||||
|
||||
<GhostRender content={post.html} />
|
||||
```
|
||||
|
||||
### Customization
|
||||
|
||||
`GhostRender` allows full control over the rendering of output. The `components` option allows you to replace a standard HTML element with a custom component.
|
||||
|
||||
```astro
|
||||
---
|
||||
import { GhostRender } from "@matthiesenxyz/astro-ghostcms-rendercontent";
|
||||
import Title from '../components/Title.astro';
|
||||
---
|
||||
|
||||
<!-- Render <h1> as custom <Title> component -->
|
||||
<GhostRender content={post.html} components={{ h1: Title }} />
|
||||
```
|
||||
|
||||
For examples on how to setup custom components check [examples](./examples/)
|
|
@ -1,12 +0,0 @@
|
|||
---
|
||||
import { Code } from "astro/components"
|
||||
import { parse } from "ultrahtml"
|
||||
import { querySelector } from "ultrahtml/selector"
|
||||
|
||||
const html = await Astro.slots.render("default")
|
||||
const ast = await parse(html)
|
||||
const codetag = querySelector(ast,'code')
|
||||
const { children } = codetag
|
||||
const code = children[0].value
|
||||
---
|
||||
<Code code={code} lang={"sh"} theme={"monokai"}/>
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
---
|
||||
<h1 class="righteous">
|
||||
<slot />
|
||||
</h1>
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
---
|
||||
<h2 class="righteous">
|
||||
<slot />
|
||||
</h2>
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
---
|
||||
<h3 class="righteous">
|
||||
<slot />
|
||||
</h3>
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
---
|
||||
<h4 class="righteous">
|
||||
<slot />
|
||||
</h4>
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
---
|
||||
<h5 class="righteous">
|
||||
<slot />
|
||||
</h5>
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
---
|
||||
<h6 class="righteous">
|
||||
<slot />
|
||||
</h6>
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
---
|
||||
<p class="my-5"><slot /></p>
|
||||
|
||||
<style is:inline>
|
||||
#ghost p a {
|
||||
color: rgb(0, 123, 247);
|
||||
}
|
||||
#ghost ul li a {
|
||||
color: rgb(0, 123, 247);
|
||||
}
|
||||
#ghost ul li {
|
||||
padding-top: 0.5rem;
|
||||
margin-left: 2rem;
|
||||
list-style: circle;
|
||||
}
|
||||
#ghost ul {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
</style>
|
|
@ -1,8 +0,0 @@
|
|||
export { default as H1 } from "./H1.astro";
|
||||
export { default as H2 } from "./H2.astro";
|
||||
export { default as H3 } from "./H3.astro";
|
||||
export { default as H4 } from "./H4.astro";
|
||||
export { default as H5 } from "./H5.astro";
|
||||
export { default as H6 } from "./H6.astro";
|
||||
export { default as CodeSlot } from "./CodeSlot.astro";
|
||||
export { default as Paragraph } from "./Paragraph.astro";
|
|
@ -1 +0,0 @@
|
|||
export { default as GhostRender } from "./lib/GhostRender.astro";
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
import { createComponentProxy, html } from './utils';
|
||||
|
||||
export interface Props {
|
||||
content?: string;
|
||||
components?: Record<string, any>;
|
||||
}
|
||||
|
||||
const input = Astro.props.content ?? await Astro.slots.render('default');
|
||||
if (!input) {
|
||||
throw new Error('Unable to render <GhostRender> without a content prop or children')
|
||||
}
|
||||
// @ts-ignore
|
||||
const components = createComponentProxy($$result, Astro.props.components);
|
||||
const content = await html(input, { components });
|
||||
---
|
||||
|
||||
<Fragment set:html={content} />
|
|
@ -1 +0,0 @@
|
|||
/// <reference types="astro/client" />
|
|
@ -1,59 +0,0 @@
|
|||
import { jsx as h } from "astro/jsx-runtime";
|
||||
import { renderJSX } from "astro/runtime/server/jsx";
|
||||
import * as entities from "entities";
|
||||
import { transform } from "ultrahtml";
|
||||
import { __unsafeHTML } from "ultrahtml";
|
||||
import swap from "ultrahtml/transformers/swap";
|
||||
|
||||
export function createComponentProxy(
|
||||
result,
|
||||
_components: Record<string, any> = {},
|
||||
) {
|
||||
const components = {};
|
||||
for (const [key, value] of Object.entries(_components)) {
|
||||
if (typeof value === "string") {
|
||||
components[key] = value;
|
||||
} else {
|
||||
components[key] = async (props, children) => {
|
||||
if (key === "CodeBlock" || key === "CodeSpan") {
|
||||
props.code = entities.decode(JSON.parse(`"${props.code}"`));
|
||||
}
|
||||
const output = await renderJSX(
|
||||
result,
|
||||
h(value, { ...props, "set:html": children.value }),
|
||||
);
|
||||
return __unsafeHTML(output);
|
||||
};
|
||||
}
|
||||
}
|
||||
return components;
|
||||
}
|
||||
|
||||
function getIndent(ln: string): string {
|
||||
if (ln.trim() === ln) return "";
|
||||
return ln.slice(0, ln.length - ln.trim().length);
|
||||
}
|
||||
|
||||
export function dedent(str: string): string {
|
||||
const lns = str.replace(/^[\r\n]+/, "").split("\n");
|
||||
let indent = getIndent(lns[0]);
|
||||
if (indent.length === 0 && lns.length > 1) {
|
||||
indent = getIndent(lns[1]);
|
||||
}
|
||||
return lns
|
||||
.map((ln) => (ln.startsWith(indent) ? ln.slice(indent.length) : ln))
|
||||
.map((ln, i, { length }) => (i === length - 1 ? ln.trim() : ln))
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
export interface HTMLOptions {
|
||||
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
||||
components?: {};
|
||||
}
|
||||
|
||||
export async function html(
|
||||
input: string,
|
||||
opts: HTMLOptions = {},
|
||||
): Promise<string> {
|
||||
return transform(dedent(input), [swap(opts.components)]);
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
{
|
||||
"name": "@matthiesenxyz/astro-ghostcms-rendercontent",
|
||||
"type": "module",
|
||||
"version": "0.0.9",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/MatthiesenXYZ/astro-ghostcms.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/MatthiesenXYZ/astro-ghostcms/issues",
|
||||
"email": "issues@astro-ghostcms.xyz"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"homepage": "https://astro-ghostcms.xyz",
|
||||
"files": [
|
||||
"examples",
|
||||
"lib",
|
||||
"index.ts",
|
||||
"CHANGELOG.md"
|
||||
],
|
||||
"types": "./index.ts",
|
||||
"exports": {
|
||||
".": "./index.ts",
|
||||
"./lib/*": "./lib/*",
|
||||
"./examples/*": "./examples/*",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"keywords": [
|
||||
"astro-ghostcms"
|
||||
],
|
||||
"author": {
|
||||
"email": "adam@matthiesen.xyz",
|
||||
"name": "Adam Matthiesen - MatthiesenXYZ",
|
||||
"url": "https://matthiesen.xyz"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"entities": "^4.5.0",
|
||||
"ultrahtml": "^1.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"astro": "4.4.13"
|
||||
}
|
||||
}
|
|
@ -79,6 +79,6 @@
|
|||
"picocolors": "^1.0.0",
|
||||
"satori": "^0.10.13",
|
||||
"satori-html": "^0.3.2",
|
||||
"vite": "^5.1.5"
|
||||
"vite": "^5.1.6"
|
||||
}
|
||||
}
|
|
@ -54,19 +54,18 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/starlight": "^0.21.1",
|
||||
"astro": "^4.4.13",
|
||||
"vitest": "^1.3.1",
|
||||
"vitest-fetch-mock": "^0.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/rss": "^4.0.5",
|
||||
"@matthiesenxyz/astro-gists": "^0.2.3",
|
||||
"@matthiesenxyz/astro-gists": "^0.2.7",
|
||||
"@ts-ghost/core-api": "^6.0.0",
|
||||
"@ts-ghost/content-api": "^4.0.12",
|
||||
"astro-integration-kit": "^0.5.1",
|
||||
"astro-remote": "^0.3.2",
|
||||
"ultrahtml": "^1.5.3",
|
||||
"vite": "^5.1.5",
|
||||
"vite": "^5.1.6",
|
||||
"vite-tsconfig-paths": "^4.3.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -11,10 +11,13 @@
|
|||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.25"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/starlight": "^0.21.1",
|
||||
"@matthiesenxyz/starlight-ghostcms": "workspace:*",
|
||||
"@matthiesenxyz/astro-gists": "^0.2.7",
|
||||
"astro": "^4.4.13",
|
||||
"sharp": "^0.33.2"
|
||||
}
|
||||
|
|
1366
pnpm-lock.yaml
1366
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue