Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Oct 14, 2023
1 parent f4d3648 commit 5a20e70
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
30 changes: 15 additions & 15 deletions Source/Export.ts → Source/Function/Integration.ts
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"
);
6 changes: 4 additions & 2 deletions Source/Interface/Option.ts
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;
}
9 changes: 6 additions & 3 deletions Source/Variable/Option.ts
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";

0 comments on commit 5a20e70

Please sign in to comment.