minista 2.8.2 → 2.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.js +5 -5
- package/dist/config.js +5 -6
- package/dist/types.d.ts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +8 -2
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -762,7 +762,7 @@ async function buildSearchJson({
|
|
|
762
762
|
blockTextElements: { script: false, style: false, pre: false }
|
|
763
763
|
});
|
|
764
764
|
const regTrimPath = new RegExp(`^${entryBase}|index|.html`, "g");
|
|
765
|
-
const
|
|
765
|
+
const routePath = path.join(config.base, filePath.replace(regTrimPath, ""));
|
|
766
766
|
const regTrimTitle = new RegExp(trimTitle);
|
|
767
767
|
const pTitle = parsedHtml.querySelector("title");
|
|
768
768
|
const title = pTitle ? pTitle.rawText.replace(regTrimTitle, "") : "";
|
|
@@ -771,7 +771,7 @@ async function buildSearchJson({
|
|
|
771
771
|
if (!targetContent) {
|
|
772
772
|
tempWords.push(title);
|
|
773
773
|
tempPages.push({
|
|
774
|
-
path:
|
|
774
|
+
path: routePath,
|
|
775
775
|
toc: [],
|
|
776
776
|
title: titleArray,
|
|
777
777
|
content: []
|
|
@@ -815,7 +815,7 @@ async function buildSearchJson({
|
|
|
815
815
|
tempWords.push(title);
|
|
816
816
|
tempWords.push(body);
|
|
817
817
|
tempPages.push({
|
|
818
|
-
path:
|
|
818
|
+
path: routePath,
|
|
819
819
|
toc,
|
|
820
820
|
title: titleArray,
|
|
821
821
|
content: contentArray.flat()
|
|
@@ -837,7 +837,7 @@ async function buildSearchJson({
|
|
|
837
837
|
});
|
|
838
838
|
const pages = [];
|
|
839
839
|
await Promise.all(tempPages.map(async (page) => {
|
|
840
|
-
const
|
|
840
|
+
const routePath = page.path;
|
|
841
841
|
const toc = page.toc;
|
|
842
842
|
const title = page.title.map((word) => {
|
|
843
843
|
return sortedWords.indexOf(word);
|
|
@@ -845,7 +845,7 @@ async function buildSearchJson({
|
|
|
845
845
|
const content = page.content.map((word) => {
|
|
846
846
|
return sortedWords.indexOf(word);
|
|
847
847
|
});
|
|
848
|
-
pages.push({ path:
|
|
848
|
+
pages.push({ path: routePath, title, toc, content });
|
|
849
849
|
}));
|
|
850
850
|
const sortedPages = pages.sort((a, b) => {
|
|
851
851
|
const pathA = a.path.toUpperCase();
|
package/dist/config.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { deepmergeCustom } from "deepmerge-ts";
|
|
4
4
|
import { systemConfig } from "./system.js";
|
|
5
|
-
import { slashEnd, noSlashEnd, noSlashStart
|
|
5
|
+
import { slashEnd, noSlashEnd, noSlashStart } from "./utils.js";
|
|
6
6
|
const defaultConfig = {
|
|
7
7
|
base: "/",
|
|
8
8
|
public: "public",
|
|
@@ -164,7 +164,6 @@ async function resolveEntry(entry) {
|
|
|
164
164
|
return;
|
|
165
165
|
} else if (typeof input === "string") {
|
|
166
166
|
const pattern = {
|
|
167
|
-
name: getFilename(input),
|
|
168
167
|
input: noSlashStart(input),
|
|
169
168
|
insertPages: ["**/*"]
|
|
170
169
|
};
|
|
@@ -174,7 +173,6 @@ async function resolveEntry(entry) {
|
|
|
174
173
|
const strArray = input;
|
|
175
174
|
await Promise.all(strArray.map(async (item) => {
|
|
176
175
|
const pattern = {
|
|
177
|
-
name: getFilename(item),
|
|
178
176
|
input: noSlashStart(item),
|
|
179
177
|
insertPages: ["**/*"]
|
|
180
178
|
};
|
|
@@ -183,15 +181,16 @@ async function resolveEntry(entry) {
|
|
|
183
181
|
} else {
|
|
184
182
|
const objectArray = input;
|
|
185
183
|
await Promise.all(objectArray.map(async (item) => {
|
|
186
|
-
const name = item.name || getFilename(item.input);
|
|
187
184
|
const include = getInsertPagesInclude(item.insertPages);
|
|
188
185
|
const exclude = getInsertPagesExclude(item.insertPages);
|
|
189
186
|
const fixedExclude = exclude.map((item2) => "!" + item2);
|
|
190
|
-
|
|
191
|
-
name,
|
|
187
|
+
let pattern = {
|
|
192
188
|
input: noSlashStart(item.input),
|
|
193
189
|
insertPages: [...include, ...fixedExclude]
|
|
194
190
|
};
|
|
191
|
+
if (item.name) {
|
|
192
|
+
pattern.name = item.name;
|
|
193
|
+
}
|
|
195
194
|
return entries.push(pattern);
|
|
196
195
|
}));
|
|
197
196
|
}
|
package/dist/types.d.ts
CHANGED
package/dist/vite.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { MinistaResolveConfig, MinistaCliDevOptions, MinistaCliPreviewOptio
|
|
|
7
7
|
export declare function getViteConfig(config: MinistaResolveConfig, mdxConfig: MdxOptions, cliOptions?: MinistaCliDevOptions | MinistaCliPreviewOptions): Promise<ViteConfig>;
|
|
8
8
|
export declare function resolveEntry(entry: EntryObject[]): {
|
|
9
9
|
[key: string]: string;
|
|
10
|
-
} | string;
|
|
10
|
+
} | string[] | string;
|
|
11
11
|
export declare function resolveaAssetFileName(chunkInfo: PreRenderedAsset, config: MinistaResolveConfig): string;
|
|
12
12
|
export declare function vitePluginMinistaVirtualHtml({ entry, }: {
|
|
13
13
|
entry: EntryObject[];
|
package/dist/vite.js
CHANGED
|
@@ -112,8 +112,14 @@ function resolveEntry(entry) {
|
|
|
112
112
|
if (!entry.length) {
|
|
113
113
|
return "";
|
|
114
114
|
}
|
|
115
|
-
const
|
|
116
|
-
|
|
115
|
+
const hasName = entry.every((item) => item.name);
|
|
116
|
+
if (hasName) {
|
|
117
|
+
const entries = Object.fromEntries(entry.map((item) => [item.name, item.input]));
|
|
118
|
+
return entries;
|
|
119
|
+
} else {
|
|
120
|
+
const entries = entry.map((item) => item.input);
|
|
121
|
+
return entries;
|
|
122
|
+
}
|
|
117
123
|
}
|
|
118
124
|
function resolveaAssetFileName(chunkInfo, config) {
|
|
119
125
|
const imgExt = ["jpg", "jpeg", "gif", "png", "webp"];
|