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 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 path2 = filePath.replace(regTrimPath, "");
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: path2,
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: path2,
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 path2 = page.path;
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: path2, title, toc, content });
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, getFilename } from "./utils.js";
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
- const pattern = {
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
@@ -207,7 +207,7 @@ export declare type MinistaResolveEntryConfig = {
207
207
  entry: EntryObject[];
208
208
  };
209
209
  export declare type EntryObject = {
210
- name: string;
210
+ name?: string;
211
211
  input: string;
212
212
  insertPages: string[];
213
213
  };
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 entries = Object.fromEntries(entry.map((item) => [item.name, item.input]));
116
- return entries;
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"];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minista",
3
3
  "description": "Next.js Like Development with 100% Static Generate",
4
- "version": "2.8.2",
4
+ "version": "2.8.4",
5
5
  "bin": {
6
6
  "minista": "./bin/minista.js"
7
7
  },