minista 3.1.1 → 3.1.3

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/cli/build.js CHANGED
@@ -42,9 +42,15 @@ async function build(inlineConfig = {}) {
42
42
  const { assets, search, delivery } = config.main;
43
43
  const { partial } = assets;
44
44
  const resolvedOut = path.join(resolvedRoot, config.main.out);
45
- const bundleCssName = path.join(assets.outDir, assets.bundle.outName + ".css");
45
+ const bundleCssName = path.join(
46
+ assets.outDir,
47
+ assets.outName.replace(/\[name\]/, assets.bundle.outName) + ".css"
48
+ );
46
49
  const bugBundleCssName = path.join(assets.outDir, "bundle.css");
47
- const hydrateJsName = path.join(assets.outDir, assets.partial.outName + ".js");
50
+ const hydrateJsName = path.join(
51
+ assets.outDir,
52
+ assets.outName.replace(/\[name\]/, assets.partial.outName) + ".js"
53
+ );
48
54
  let ssgResult;
49
55
  let assetsResult;
50
56
  let hydrateResult;
@@ -83,7 +89,7 @@ async function build(inlineConfig = {}) {
83
89
  );
84
90
  ssgResult = await viteBuild(ssgConfig);
85
91
  ssgItems = ssgResult.output.filter((item) => {
86
- return item.fileName.match(/__minista_plugin_ssg\.js$/);
92
+ return item.fileName.match(/__minista_plugin_ssg.*\.js$/);
87
93
  });
88
94
  if (ssgItems.length > 0) {
89
95
  const ssgPath = path.join(tempDir, "ssg.mjs");
@@ -191,10 +197,10 @@ async function build(inlineConfig = {}) {
191
197
  hydrateResult = { output: [] };
192
198
  }
193
199
  assetItems = assetsResult.output.filter((item) => {
194
- return !item.fileName.match(/__minista_plugin_bundle\.js$/);
200
+ return !item.fileName.match(/__minista_plugin_bundle.*\.js$/);
195
201
  });
196
202
  hydrateItems = hydrateResult.output.filter((item) => {
197
- return item.fileName.match(/__minista_plugin_hydrate\.js$/);
203
+ return item.fileName.match(/__minista_plugin_hydrate.*\.js$/);
198
204
  });
199
205
  hasBundleCss = assetsResult.output.some((item) => {
200
206
  return item.fileName === bundleCssName || item.fileName === bugBundleCssName;
@@ -210,8 +216,8 @@ async function build(inlineConfig = {}) {
210
216
  cssNameBugFix = { ...cssNameBugFix, ...{ [bugBundleCssName]: bundleCssName } };
211
217
  createAssets = [...assetItems, ...hydrateItems].map((item) => {
212
218
  const isCss = item.fileName.match(/.*\.css$/);
213
- const isBundleCss = item.fileName.match(/__minista_plugin_bundle\.css$/);
214
- const isHydrateJs = item.fileName.match(/__minista_plugin_hydrate\.js$/);
219
+ const isBundleCss = item.fileName.match(/__minista_plugin_bundle.*\.css$/);
220
+ const isHydrateJs = item.fileName.match(/__minista_plugin_hydrate.*\.js$/);
215
221
  let fileName = item.fileName;
216
222
  isBundleCss && (fileName = bundleCssName);
217
223
  isHydrateJs && (fileName = hydrateJsName);
@@ -18,12 +18,12 @@ function getStories(config) {
18
18
  const jsStories = Object.keys(JS_STORIES).map((storyFileKey) => {
19
19
  const storyFile = JS_STORIES[storyFileKey];
20
20
  const storyMeta = storyFile.default;
21
- const storyBase = "/" + config.main.storyapp.outDir;
22
- const storyId = (storyMeta.id || storyMeta.title || "").split("/").map((id) => id.trim().toLowerCase()).join("/");
23
- const storyTitle = (storyMeta.title || "").split("/").map((title) => title.trim()).join(" / ");
24
- if (!storyId || !storyTitle) {
21
+ if (!storyMeta?.id || !storyMeta?.title) {
25
22
  return [];
26
23
  }
24
+ const storyBase = "/" + config.main.storyapp.outDir;
25
+ const storyId = (storyMeta.id || storyMeta.title).split("/").map((id) => id.trim().toLowerCase()).join("/");
26
+ const storyTitle = storyMeta.title.split("/").map((title) => title.trim()).join(" / ");
27
27
  const storyList = Object.keys(storyFile).filter((key) => !["default", "metadata", "frontmatter"].includes(key)).map((key) => ({ storyKey: key, storyObj: storyFile[key] }));
28
28
  return storyList.map((item) => {
29
29
  const currentObj = item.storyObj;
@@ -1,5 +1,4 @@
1
1
  import path from "node:path";
2
- import { parse as parseUrl } from "node:url";
3
2
  import fetch from "node-fetch";
4
3
  import fs from "fs-extra";
5
4
  import fg from "fast-glob";
@@ -8,7 +7,7 @@ import { generateRemoteCache, generateRemotes } from "../generate/remote.js";
8
7
  import { getElements } from "../utility/element.js";
9
8
  import { getUniquePaths } from "../utility/path.js";
10
9
  function getRemoteExt(url) {
11
- const pathname = parseUrl(url).pathname || "";
10
+ const pathname = new URL(url).pathname || "";
12
11
  const parsedName = path.parse(pathname);
13
12
  return parsedName.ext.replace(/^\./, "") || "";
14
13
  }
@@ -1,5 +1,4 @@
1
1
  import path from "node:path";
2
- import { parse as parseUrl } from "node:url";
3
2
  import fs from "fs-extra";
4
3
  function getHtmlPath(pathname) {
5
4
  let fileName = pathname.endsWith("/") ? path.join(pathname, "index.html") : pathname + ".html";
@@ -22,9 +21,14 @@ function getUniquePaths(paths, excludes) {
22
21
  }
23
22
  }
24
23
  function isLocalPath(root, url) {
25
- const isAbsolute = parseUrl(url).protocol;
26
- if (!url || isAbsolute) {
24
+ if (!url)
27
25
  return false;
26
+ try {
27
+ const { protocol } = new URL(url);
28
+ if (protocol) {
29
+ return false;
30
+ }
31
+ } catch (_) {
28
32
  }
29
33
  const filePath = path.join(root, url);
30
34
  return fs.existsSync(filePath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minista",
3
3
  "description": "Static site generator with 100% static export from React and Vite",
4
- "version": "3.1.1",
4
+ "version": "3.1.3",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=14.15.0"
@@ -77,17 +77,17 @@
77
77
  "@qrac/svgstore": "^3.0.3",
78
78
  "@svgr/core": "^8.0.0",
79
79
  "@svgr/plugin-jsx": "^8.0.1",
80
- "@vitejs/plugin-react": "^4.0.0",
80
+ "@vitejs/plugin-react": "^4.0.3",
81
81
  "archiver": "^5.3.1",
82
82
  "cac": "^6.7.14",
83
- "dayjs": "^1.11.7",
83
+ "dayjs": "^1.11.9",
84
84
  "deepmerge-ts": "^5.1.0",
85
- "esbuild": "^0.17.19",
86
- "fast-glob": "^3.2.12",
85
+ "esbuild": "^0.18.15",
86
+ "fast-glob": "^3.3.0",
87
87
  "fs-extra": "^11.1.1",
88
88
  "iconv-lite": "^0.6.3",
89
89
  "image-size": "^1.0.2",
90
- "js-beautify": "^1.14.7",
90
+ "js-beautify": "^1.14.9",
91
91
  "mime-types": "^2.1.35",
92
92
  "mojigiri": "^0.3.0",
93
93
  "node-fetch": "^3.3.1",
@@ -95,7 +95,7 @@
95
95
  "picocolors": "^1.0.0",
96
96
  "picomatch": "^2.3.1",
97
97
  "react-helmet-async": "^1.3.0",
98
- "react-router-dom": "^6.11.2",
98
+ "react-router-dom": "^6.14.2",
99
99
  "rehype-highlight": "^6.0.0",
100
100
  "rehype-raw": "^6.1.1",
101
101
  "rehype-react": "^7.2.0",
@@ -104,8 +104,8 @@
104
104
  "remark-mdx-frontmatter": "^3.0.0",
105
105
  "remark-parse": "^10.0.2",
106
106
  "remark-rehype": "^10.1.0",
107
- "sharp": "^0.32.1",
107
+ "sharp": "^0.32.4",
108
108
  "unified": "^10.1.2",
109
- "vite": "^4.3.9"
109
+ "vite": "^4.4.6"
110
110
  }
111
111
  }