1
0
mirror of https://github.com/kremalicious/astro-redirect-from.git synced 2024-11-22 01:47:01 +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>", "author": "Matthias Kretschmann <m@kretschmann.io>",
"homepage": "https://kremalicious.com/astro-redirect-from", "homepage": "https://kremalicious.com/astro-redirect-from",
"license": "MIT", "license": "MIT",
"main": "dist/index.js",
"type": "module", "type": "module",
"main": "dist/index.js",
"types": "./dist/index.d.ts",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"start": "tsc --watch", "start": "tsc --watch",
@ -18,9 +19,6 @@
"release": "release-it --non-interactive", "release": "release-it --non-interactive",
"prepublishOnly": "npm run build" "prepublishOnly": "npm run build"
}, },
"exports": {
".": "./dist/index.js"
},
"files": [ "files": [
"dist" "dist"
], ],

View File

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

View File

@ -1,9 +1,17 @@
import path from 'node:path' import path from 'node:path'
import type { AstroIntegration } from 'astro' import type { AstroIntegration } from 'astro'
import type { PluginOptions } from './types'
import { getMarkdownFiles, getSlugFromFilePath, writeJson } from './utils' import { getMarkdownFiles, getSlugFromFilePath, writeJson } from './utils'
import { getRedirects } from './getRedirects' 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({ export default function astroRedirectFrom({
contentDir = 'src/pages/', contentDir = 'src/pages/',
getSlug = getSlugFromFilePath 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 }