Skip to content

Commit

Permalink
fix: rename basePath to base
Browse files Browse the repository at this point in the history
  • Loading branch information
techfg committed Apr 21, 2024
1 parent c96e4ea commit e39891b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Rehype plugin for Astro to add support for transforming relative links in MD and

#### Defined in

[src/index.mjs:33](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.mjs#L33)
[src/index.mjs:34](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.mjs#L34)
12 changes: 7 additions & 5 deletions docs/interfaces/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@

### Properties

- [basePath](Options.md#basepath)
- [base](Options.md#base)
- [collectionPathMode](Options.md#collectionpathmode)
- [contentPath](Options.md#contentpath)
- [trailingSlash](Options.md#trailingslash)

## Properties

### basePath
### base

`Optional` **basePath**: `string`
`Optional` **base**: `string`

**`Name`**

basePath
base

**`Reference`**

Expand All @@ -35,6 +35,8 @@ https://docs.astro.build/en/reference/configuration-reference/#base

The base path to deploy to. Astro will use this path as the root for your pages and assets both in development and in production build.

**`Example`**

In the example below, `astro dev` will start your server at `/docs`.

```js
Expand All @@ -45,7 +47,7 @@ In the example below, `astro dev` will start your server at `/docs`.

#### Inherited from

z.input.basePath
z.input.base

#### Defined in

Expand Down
2 changes: 1 addition & 1 deletion src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function astroRehypeRelativeMarkdownLinks(opts = {}) {

// Debugging
debug("--------------------------------------");
debug("BasePath : %s", options.basePath);
debug("Base path : %s", options.base);
debug("ContentDir : %s", contentDir);
debug("CollectionPathMode : %s", collectionPathMode);
debug("TrailingSlashMode : %s", trailingSlashMode);
Expand Down
8 changes: 4 additions & 4 deletions src/options.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ export const OptionsSchema = z.object({
.union([z.literal("subdirectory"), z.literal("root")])
.default("subdirectory"),
/**
* @name basePath
* @name base
* @reference https://docs.astro.build/en/reference/configuration-reference/#base
* @description
* The base path to deploy to. Astro will use this path as the root for your pages and assets both in development and in production build.
*
* @example
* In the example below, `astro dev` will start your server at `/docs`.
*
*
* ```js
* {
* base: '/docs'
* }
* ```
*/
basePath: z.string().optional(),
base: z.string().optional(),
/**
* @name trailingSlash
* @default `ignore`
Expand Down
8 changes: 4 additions & 4 deletions src/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ export const splitPathFromQueryAndFragment = (url) => {
/** @type {import('./utils.d.ts').NormaliseAstroOutputPath} */
export const normaliseAstroOutputPath = (initialPath, options = {}) => {
const buildPath = () => {
if (!options.basePath) {
if (!options.base) {
return initialPath;
}

if (options.basePath.startsWith(URL_PATH_SEPARATOR)) {
return path.join(options.basePath, initialPath);
if (options.base.startsWith(URL_PATH_SEPARATOR)) {
return path.join(options.base, initialPath);
}

return URL_PATH_SEPARATOR + path.join(options.basePath, initialPath);
return URL_PATH_SEPARATOR + path.join(options.base, initialPath);
};

if (!initialPath) {
Expand Down

0 comments on commit e39891b

Please sign in to comment.