mirror of
https://github.com/kremalicious/astro-redirect-from.git
synced 2024-12-22 01:13:23 +01:00
refactor
This commit is contained in:
parent
93e72936e4
commit
3ca573ae10
@ -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"
|
||||
],
|
||||
|
@ -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(
|
||||
|
10
src/index.ts
10
src/index.ts
@ -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
|
||||
|
@ -1,8 +0,0 @@
|
||||
export type GetSlug = (filePath: string) => string
|
||||
|
||||
export type PluginOptions = {
|
||||
contentDir?: string
|
||||
getSlug?: GetSlug
|
||||
}
|
||||
|
||||
export type Redirects = { [old: string]: string }
|
Loading…
Reference in New Issue
Block a user