-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4d3648
commit 5a20e70
Showing
3 changed files
with
25 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import type Option from "./Interface/Option.js"; | ||
|
||
import type { AstroIntegration } from "astro"; | ||
|
||
import { deepmerge } from "deepmerge-ts"; | ||
|
||
export const { default: Default } = await import("./Variable/Option.js"); | ||
|
||
/** | ||
* @module Integration | ||
* | ||
*/ | ||
export default (_Option: Option = {}): AstroIntegration => { | ||
for (const Option in _Option) { | ||
if ( | ||
Object.prototype.hasOwnProperty.call(_Option, Option) && | ||
_Option[Option] === true | ||
) { | ||
_Option[Option] = Default[Option]; | ||
_Option[Option] = Default[Option as keyof typeof Default]; | ||
} | ||
} | ||
|
||
const _options = deepmerge(Default, _Option); | ||
|
||
_options.URL = _options.URL?.endsWith("/") | ||
? _options.URL | ||
: `${_options.URL}/`; | ||
|
||
return { | ||
name: "astro-short-urls", | ||
hooks: { | ||
"astro:build:done": async () => {}, | ||
}, | ||
}; | ||
}; | ||
|
||
export const { default: Default } = await import("../Variable/Option.js"); | ||
|
||
import type Option from "../Interface/Option.js"; | ||
|
||
import type { AstroIntegration } from "astro"; | ||
|
||
export const { default: Merge } = await import( | ||
"typescript-esbuild/Target/Function/Merge.js" | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
/** | ||
* @module Option | ||
* | ||
*/ | ||
export default interface Type { | ||
// biome-ignore lint/suspicious/noExplicitAny: | ||
[key: string]: any; | ||
|
||
URL?: string; | ||
|
||
Logger?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import type Type from "../Interface/Option.js"; | ||
|
||
/** | ||
* @module Option | ||
* | ||
*/ | ||
export default { | ||
URL: "/", | ||
Logger: 2, | ||
} satisfies Type; | ||
|
||
import type Type from "../Interface/Option.js"; |