1
0
mirror of https://github.com/kremalicious/astro-redirect-from.git synced 2024-11-21 17:37:02 +01:00
This commit is contained in:
Matthias Kretschmann 2023-09-23 14:34:14 +01:00
parent 93e72936e4
commit 3ca573ae10
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 12 additions and 14 deletions

View File

@ -5,8 +5,9 @@
"author": "Matthias Kretschmann <m@kretschmann.io>",
"homepage": "https://kremalicious.com/astro-redirect-from",
"license": "MIT",
"main": "dist/index.js",
"type": "module",
"main": "dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc",
"start": "tsc --watch",
@ -18,9 +19,6 @@
"release": "release-it --non-interactive",
"prepublishOnly": "npm run build"
},
"exports": {
".": "./dist/index.js"
},
"files": [
"dist"
],

View File

@ -1,5 +1,5 @@
import path from 'node:path'
import type { Redirects } from './types'
import type { Redirects } from '.'
import { getMarkdownFrontmatter } from './utils'
export async function getRedirects(

View File

@ -1,9 +1,17 @@
import path from 'node:path'
import type { AstroIntegration } from 'astro'
import type { PluginOptions } from './types'
import { getMarkdownFiles, getSlugFromFilePath, writeJson } from './utils'
import { getRedirects } from './getRedirects'
export type GetSlug = (filePath: string) => string
export type PluginOptions = {
contentDir?: string
getSlug?: GetSlug
}
export type Redirects = { [old: string]: string }
export default function astroRedirectFrom({
contentDir = 'src/pages/',
getSlug = getSlugFromFilePath

View File

@ -1,8 +0,0 @@
export type GetSlug = (filePath: string) => string
export type PluginOptions = {
contentDir?: string
getSlug?: GetSlug
}
export type Redirects = { [old: string]: string }