some more cleanup and fixes

This commit is contained in:
Adam Matthiesen 2024-03-05 23:12:40 -08:00
parent 70c366e0b8
commit c896e50468
4 changed files with 104 additions and 49 deletions

View File

@ -36,21 +36,15 @@
"types": "index.ts", "types": "index.ts",
"files": [ "files": [
"src", "src",
"CHANGELOG.md",
"index.ts", "index.ts",
"tsconfig.json", "LICENSE",
"types.d.ts" "package.json",
"README.md"
], ],
"exports": { "exports": {
".": "./index.ts", ".": "./index.ts",
"./overrides/MarkdownContent.astro": "./src/overrides/MarkdownContent.astro", "./overrides/*": "./src/overrides/*"
"./overrides/Sidebar.astro": "./src/overrides/Sidebar.astro",
"./overrides/SiteTitle.astro": "./src/overrides/SiteTitle.astro",
"./routes/index.astro": "./src/routes/index.astro",
"./routes/about.astro": "./src/routes/about.astro",
"./routes/authors.astro": "./src/routes/authors.astro",
"./routes/[slug].astro": "./src/routes/[slug].astro",
"./routes/rss.xml.ts": "./src/routes/rss.xml.ts",
"./schema": "./src/schemas/config.ts"
}, },
"scripts": { "scripts": {
"test": "vitest run", "test": "vitest run",
@ -69,7 +63,7 @@
"@ts-ghost/core-api": "^6.0.0", "@ts-ghost/core-api": "^6.0.0",
"@ts-ghost/content-api": "^4.0.12", "@ts-ghost/content-api": "^4.0.12",
"astro-integration-kit": "^0.5.1", "astro-integration-kit": "^0.5.1",
"vite": "^5.1.5", "vite": "^5.1.4",
"vite-tsconfig-paths": "^4.3.1" "vite-tsconfig-paths": "^4.3.1"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -4,7 +4,6 @@ import {
} from "astro-integration-kit"; } from "astro-integration-kit";
import { corePlugins } from "astro-integration-kit/plugins"; import { corePlugins } from "astro-integration-kit/plugins";
import { z } from "astro/zod"; import { z } from "astro/zod";
import { vitePluginStarlightGhostConfig } from "./vite";
import { type StarlightGhostConfig } from "../schemas/config"; import { type StarlightGhostConfig } from "../schemas/config";
export default defineIntegration({ export default defineIntegration({
@ -15,13 +14,15 @@ export default defineIntegration({
const { resolve } = createResolver(import.meta.url); const { resolve } = createResolver(import.meta.url);
return { return {
"astro:config:setup": ({ watchIntegration, updateConfig, injectRoute }) => { "astro:config:setup": ({
watchIntegration,
addVirtualImports,
injectRoute
}) => {
watchIntegration(resolve()); watchIntegration(resolve());
updateConfig({ addVirtualImports({
vite: { 'virtual:starlight-ghostcms/config': `export default ${JSON.stringify(options)}`,
plugins: [vitePluginStarlightGhostConfig(options)],
},
}); });
const makeRoute = (endpoint: string, entrypoint: string) => { const makeRoute = (endpoint: string, entrypoint: string) => {

View File

@ -1,24 +0,0 @@
import type { ViteUserConfig } from "astro";
import type { StarlightGhostConfig } from "../schemas/config.ts";
// Expose the starlight-blog plugin configuration.
export function vitePluginStarlightGhostConfig(
config: StarlightGhostConfig,
): VitePlugin {
const moduleId = 'virtual:starlight-ghostcms/config';
const resolvedModuleId = `\0${moduleId}`;
const moduleContent = `export default ${JSON.stringify(config)}`;
return {
name: "vite-plugin-starlight-ghostcms-config",
load(id) {
return id === resolvedModuleId ? moduleContent : undefined;
},
resolveId(id) {
return id === moduleId ? resolvedModuleId : undefined;
},
};
}
type VitePlugin = NonNullable<ViteUserConfig["plugins"]>[number];

View File

@ -184,7 +184,7 @@ importers:
devDependencies: devDependencies:
astro: astro:
specifier: 4.4.0 specifier: 4.4.0
version: 4.4.0(typescript@5.3.3) version: 4.4.0
packages/astro-ghostcms-theme-default: packages/astro-ghostcms-theme-default:
dependencies: dependencies:
@ -257,7 +257,7 @@ importers:
specifier: ^0.5.1 specifier: ^0.5.1
version: 0.5.1(astro@4.4.9) version: 0.5.1(astro@4.4.9)
vite: vite:
specifier: ^5.1.5 specifier: ^5.1.4
version: 5.1.5(@types/node@20.11.24) version: 5.1.5(@types/node@20.11.24)
vite-tsconfig-paths: vite-tsconfig-paths:
specifier: ^4.3.1 specifier: ^4.3.1
@ -322,7 +322,7 @@ importers:
version: link:../../packages/starlight-ghostcms version: link:../../packages/starlight-ghostcms
astro: astro:
specifier: ^4.4.0 specifier: ^4.4.0
version: 4.4.0(typescript@5.3.3) version: 4.4.0
sharp: sharp:
specifier: ^0.32.5 specifier: ^0.32.5
version: 0.32.6 version: 0.32.6
@ -441,7 +441,7 @@ packages:
'@astrojs/markdown-remark': 4.2.1 '@astrojs/markdown-remark': 4.2.1
'@mdx-js/mdx': 3.0.1 '@mdx-js/mdx': 3.0.1
acorn: 8.11.3 acorn: 8.11.3
astro: 4.4.0(typescript@5.3.3) astro: 4.4.0
es-module-lexer: 1.4.1 es-module-lexer: 1.4.1
estree-util-visit: 2.0.0 estree-util-visit: 2.0.0
github-slugger: 2.0.0 github-slugger: 2.0.0
@ -513,7 +513,7 @@ packages:
'@pagefind/default-ui': 1.0.4 '@pagefind/default-ui': 1.0.4
'@types/hast': 3.0.4 '@types/hast': 3.0.4
'@types/mdast': 4.0.3 '@types/mdast': 4.0.3
astro: 4.4.0(typescript@5.3.3) astro: 4.4.0
astro-expressive-code: 0.32.4(astro@4.4.0) astro-expressive-code: 0.32.4(astro@4.4.0)
bcp-47: 2.1.0 bcp-47: 2.1.0
hast-util-select: 6.0.2 hast-util-select: 6.0.2
@ -2698,7 +2698,7 @@ packages:
peerDependencies: peerDependencies:
astro: ^3.3.0 || ^4.0.0-beta astro: ^3.3.0 || ^4.0.0-beta
dependencies: dependencies:
astro: 4.4.0(typescript@5.3.3) astro: 4.4.0
hast-util-to-html: 8.0.4 hast-util-to-html: 8.0.4
remark-expressive-code: 0.32.4 remark-expressive-code: 0.32.4
dev: false dev: false
@ -2851,7 +2851,7 @@ packages:
- typescript - typescript
dev: false dev: false
/astro@4.4.0(typescript@5.3.3): /astro@4.4.0:
resolution: {integrity: sha512-JAsMrm1Z6W4Iqg9Q7LW/6lCXrqa4jndEOlR/yu7NGNP0BrPwSM8i4+yzya6hxgsNvyyVK8ywthaNhFmqd8Z+cg==} resolution: {integrity: sha512-JAsMrm1Z6W4Iqg9Q7LW/6lCXrqa4jndEOlR/yu7NGNP0BrPwSM8i4+yzya6hxgsNvyyVK8ywthaNhFmqd8Z+cg==}
engines: {node: '>=18.14.1', npm: '>=6.14.0'} engines: {node: '>=18.14.1', npm: '>=6.14.0'}
hasBin: true hasBin: true
@ -2934,6 +2934,90 @@ packages:
- terser - terser
- typescript - typescript
/astro@4.4.0(typescript@5.3.3):
resolution: {integrity: sha512-JAsMrm1Z6W4Iqg9Q7LW/6lCXrqa4jndEOlR/yu7NGNP0BrPwSM8i4+yzya6hxgsNvyyVK8ywthaNhFmqd8Z+cg==}
engines: {node: '>=18.14.1', npm: '>=6.14.0'}
hasBin: true
dependencies:
'@astrojs/compiler': 2.5.3
'@astrojs/internal-helpers': 0.2.1
'@astrojs/markdown-remark': 4.2.1
'@astrojs/telemetry': 3.0.4
'@babel/core': 7.23.9
'@babel/generator': 7.23.6
'@babel/parser': 7.23.9
'@babel/plugin-transform-react-jsx': 7.23.4(@babel/core@7.23.9)
'@babel/traverse': 7.23.9
'@babel/types': 7.23.9
'@medv/finder': 3.1.0
'@types/babel__core': 7.20.5
acorn: 8.11.3
aria-query: 5.3.0
axobject-query: 4.0.0
boxen: 7.1.1
chokidar: 3.6.0
ci-info: 4.0.0
clsx: 2.1.0
common-ancestor-path: 1.0.1
cookie: 0.6.0
cssesc: 3.0.0
debug: 4.3.4
deterministic-object-hash: 2.0.2
devalue: 4.3.2
diff: 5.2.0
dlv: 1.1.3
dset: 3.1.3
es-module-lexer: 1.4.1
esbuild: 0.19.12
estree-walker: 3.0.3
execa: 8.0.1
fast-glob: 3.3.2
flattie: 1.1.0
github-slugger: 2.0.0
gray-matter: 4.0.3
html-escaper: 3.0.3
http-cache-semantics: 4.1.1
js-yaml: 4.1.0
kleur: 4.1.5
magic-string: 0.30.7
mdast-util-to-hast: 13.0.2
mime: 3.0.0
ora: 7.0.1
p-limit: 5.0.0
p-queue: 8.0.1
path-to-regexp: 6.2.1
preferred-pm: 3.1.2
prompts: 2.4.2
rehype: 13.0.1
resolve: 1.22.8
semver: 7.6.0
server-destroy: 1.0.1
shikiji: 0.9.19
shikiji-core: 0.9.19
string-width: 7.1.0
strip-ansi: 7.1.0
tsconfck: 3.0.2(typescript@5.3.3)
unist-util-visit: 5.0.0
vfile: 6.0.1
vite: 5.1.5(@types/node@20.11.24)
vitefu: 0.2.5(vite@5.1.5)
which-pm: 2.1.1
yargs-parser: 21.1.1
zod: 3.22.4
optionalDependencies:
sharp: 0.32.6
transitivePeerDependencies:
- '@types/node'
- less
- lightningcss
- sass
- stylus
- sugarss
- supports-color
- terser
- typescript
dev: false
/astro@4.4.9(@types/node@20.11.24): /astro@4.4.9(@types/node@20.11.24):
resolution: {integrity: sha512-FTWhzKjao7rHHiF/CqPqPS18AFad+fmUcYUFhWWIsYETHcc9g0IIIiv6cHXUE7g6mEZf7ycAa+WdboeEHUhraQ==} resolution: {integrity: sha512-FTWhzKjao7rHHiF/CqPqPS18AFad+fmUcYUFhWWIsYETHcc9g0IIIiv6cHXUE7g6mEZf7ycAa+WdboeEHUhraQ==}
engines: {node: '>=18.14.1', npm: '>=6.14.0'} engines: {node: '>=18.14.1', npm: '>=6.14.0'}