minista 3.1.0 → 3.1.2

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);
@@ -24,7 +24,7 @@ function getStories(config) {
24
24
  if (!storyId || !storyTitle) {
25
25
  return [];
26
26
  }
27
- const storyList = Object.keys(storyFile).filter((key) => key !== "default").map((key) => ({ storyKey: key, storyObj: storyFile[key] }));
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;
30
30
  const currentId = item.storyKey.toLowerCase();
@@ -54,7 +54,9 @@ function getStories(config) {
54
54
  component,
55
55
  args,
56
56
  parameters,
57
- decorators
57
+ decorators,
58
+ metadata: { ...{}, ...storyFile.metadata || {} },
59
+ frontmatter: { ...{}, ...storyFile.frontmatter || {} }
58
60
  };
59
61
  });
60
62
  });
@@ -91,7 +93,9 @@ function getStories(config) {
91
93
  component,
92
94
  args,
93
95
  parameters,
94
- decorators
96
+ decorators,
97
+ metadata: { ...{}, ...storyFile.metadata || {} },
98
+ frontmatter: { ...{}, ...storyFile.frontmatter || {} }
95
99
  }
96
100
  ];
97
101
  });
@@ -110,14 +114,16 @@ function getStories(config) {
110
114
  }, baseComponent) : baseComponent;
111
115
  const metadata = {
112
116
  title: item.title,
113
- draft: item.draft
117
+ draft: item.draft,
118
+ ...item.metadata,
119
+ ...item.frontmatter
114
120
  };
115
121
  return {
116
122
  path: item.path,
117
123
  component: decoratedComponent,
118
124
  getStaticData: void 0,
119
125
  metadata,
120
- frontmatter: metadata
126
+ frontmatter: item.frontmatter
121
127
  };
122
128
  });
123
129
  return { storyPages, storyItems: [] };
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.0",
4
+ "version": "3.1.2",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=14.15.0"