minista 2.8.4 → 2.8.6

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
@@ -316,7 +316,8 @@ async function buildTempAssets(viteConfig, buildOptions) {
316
316
  } else if (item.fileName.match(/(__minista_bundle_assets\.js|\.svg$)/)) {
317
317
  return;
318
318
  } else {
319
- const customFileName = buildOptions.outDir + item.fileName.replace(buildOptions.assetDir, "");
319
+ let customFileName = buildOptions.outDir + item.fileName.replace(buildOptions.assetDir, "");
320
+ customFileName = customFileName.replace(/-ministaDuplicateName\d*/, "");
320
321
  const customCode = (item == null ? void 0 : item.source) ? item == null ? void 0 : item.source : (item == null ? void 0 : item.code) ? item == null ? void 0 : item.code : "";
321
322
  return customCode && fs.outputFile(customFileName, customCode);
322
323
  }
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 } from "./utils.js";
5
+ import { slashEnd, noSlashEnd, noSlashStart, getFilename } from "./utils.js";
6
6
  const defaultConfig = {
7
7
  base: "/",
8
8
  public: "public",
@@ -164,6 +164,7 @@ async function resolveEntry(entry) {
164
164
  return;
165
165
  } else if (typeof input === "string") {
166
166
  const pattern = {
167
+ name: getFilename(input),
167
168
  input: noSlashStart(input),
168
169
  insertPages: ["**/*"]
169
170
  };
@@ -173,6 +174,7 @@ async function resolveEntry(entry) {
173
174
  const strArray = input;
174
175
  await Promise.all(strArray.map(async (item) => {
175
176
  const pattern = {
177
+ name: getFilename(item),
176
178
  input: noSlashStart(item),
177
179
  insertPages: ["**/*"]
178
180
  };
@@ -181,16 +183,15 @@ async function resolveEntry(entry) {
181
183
  } else {
182
184
  const objectArray = input;
183
185
  await Promise.all(objectArray.map(async (item) => {
186
+ const name = item.name || getFilename(item.input);
184
187
  const include = getInsertPagesInclude(item.insertPages);
185
188
  const exclude = getInsertPagesExclude(item.insertPages);
186
189
  const fixedExclude = exclude.map((item2) => "!" + item2);
187
- let pattern = {
190
+ const pattern = {
191
+ name,
188
192
  input: noSlashStart(item.input),
189
193
  insertPages: [...include, ...fixedExclude]
190
194
  };
191
- if (item.name) {
192
- pattern.name = item.name;
193
- }
194
195
  return entries.push(pattern);
195
196
  }));
196
197
  }
@@ -206,7 +207,17 @@ async function resolveEntry(entry) {
206
207
  }
207
208
  }
208
209
  await getEntries(entry);
209
- return entries;
210
+ const entryNames = entries.map((item) => item.name);
211
+ const duplicateNames = entryNames.filter((value, index, self) => self.indexOf(value) === index && self.lastIndexOf(value) !== index);
212
+ const uniqueNameEntries = entries.map((item, index) => {
213
+ const name = duplicateNames.includes(item.name) ? `${item.name}-ministaDuplicateName${index}` : item.name;
214
+ return {
215
+ name,
216
+ input: item.input,
217
+ insertPages: item.insertPages
218
+ };
219
+ });
220
+ return uniqueNameEntries;
210
221
  }
211
222
  async function mergeAlias(configAlias, viteConfigAlias) {
212
223
  const alias = [];
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[] | string;
10
+ } | 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,14 +112,8 @@ function resolveEntry(entry) {
112
112
  if (!entry.length) {
113
113
  return "";
114
114
  }
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
- }
115
+ const entries = Object.fromEntries(entry.map((item) => [item.name, item.input]));
116
+ return entries;
123
117
  }
124
118
  function resolveaAssetFileName(chunkInfo, config) {
125
119
  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.4",
4
+ "version": "2.8.6",
5
5
  "bin": {
6
6
  "minista": "./bin/minista.js"
7
7
  },