minista 2.5.0 → 2.6.0
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/README.md +19 -16
- package/dist/build.d.ts +3 -1
- package/dist/build.js +11 -6
- package/dist/config.d.ts +3 -1
- package/dist/config.js +52 -16
- package/dist/css.js +1 -1
- package/dist/esbuild.d.ts +4 -0
- package/dist/esbuild.js +8 -0
- package/dist/generate.js +3 -0
- package/dist/path.js +7 -7
- package/dist/types.d.ts +32 -24
- package/dist/vite.d.ts +3 -2
- package/dist/vite.js +6 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -139,6 +139,24 @@ export default defineConfig({
|
|
|
139
139
|
},
|
|
140
140
|
},
|
|
141
141
|
vite: {}, // https://ja.vitejs.dev/config/
|
|
142
|
+
resolve: {
|
|
143
|
+
alias: [], // { [key: string]: string } | { find: string, replacement: string }[]
|
|
144
|
+
},
|
|
145
|
+
css: {
|
|
146
|
+
modules: {
|
|
147
|
+
cache: true,
|
|
148
|
+
scopeBehaviour: "local",
|
|
149
|
+
globalModulePaths: [],
|
|
150
|
+
generateScopedName: undefined,
|
|
151
|
+
hashPrefix: "",
|
|
152
|
+
localsConvention: "camelCaseOnly",
|
|
153
|
+
}, // https://ja.vitejs.dev/config/#css-modules
|
|
154
|
+
preprocessorOptions: {
|
|
155
|
+
scss: {},
|
|
156
|
+
less: {},
|
|
157
|
+
stylus: {},
|
|
158
|
+
}, // https://ja.vitejs.dev/config/#css-preprocessoroptions
|
|
159
|
+
},
|
|
142
160
|
markdown: {
|
|
143
161
|
syntaxHighlighter: "highlight", // "highlight" | "none"
|
|
144
162
|
highlightOptions: {}, // https://github.com/rehypejs/rehype-highlight#options
|
|
@@ -155,26 +173,11 @@ export default defineConfig({
|
|
|
155
173
|
max_preserve_newlines: 0,
|
|
156
174
|
indent_inner_html: true,
|
|
157
175
|
extra_liners: [],
|
|
158
|
-
inline: ["span", "
|
|
176
|
+
inline: ["span", "strong", "b", "small", "del", "s", "code", "br", "wbr"],
|
|
159
177
|
}, // https://github.com/beautify-web/js-beautify#css--html
|
|
160
178
|
cssOptions: {}, // https://github.com/beautify-web/js-beautify#css--html
|
|
161
179
|
jsOptions: {}, // https://github.com/beautify-web/js-beautify#options
|
|
162
180
|
},
|
|
163
|
-
css: {
|
|
164
|
-
modules: {
|
|
165
|
-
generateScopedName: undefined,
|
|
166
|
-
globalModulePaths: [],
|
|
167
|
-
hashPrefix: "",
|
|
168
|
-
localsConvention: "camelCaseOnly",
|
|
169
|
-
scopeBehaviour: "local",
|
|
170
|
-
cache: true,
|
|
171
|
-
}, // https://ja.vitejs.dev/config/#css-modules
|
|
172
|
-
preprocessorOptions: {
|
|
173
|
-
scss: {},
|
|
174
|
-
less: {},
|
|
175
|
-
stylus: {},
|
|
176
|
-
}, // https://ja.vitejs.dev/config/#css-preprocessoroptions
|
|
177
|
-
},
|
|
178
181
|
})
|
|
179
182
|
```
|
|
180
183
|
|
package/dist/build.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Options as MdxOptions } from "@mdx-js/esbuild";
|
|
2
2
|
import type { Config as SvgrOptions } from "@svgr/core";
|
|
3
3
|
import type { InlineConfig } from "vite";
|
|
4
|
-
import type { MinistaResolveConfig, RootStaticContent, RootJsxContent, GlobalStaticData, GetGlobalStaticData, PageJsxContent, StaticData, StaticDataItem, GetStaticData, PartialModules, CssOptions } from "./types.js";
|
|
4
|
+
import type { MinistaResolveConfig, MinistaResolveAlias, RootStaticContent, RootJsxContent, GlobalStaticData, GetGlobalStaticData, PageJsxContent, StaticData, StaticDataItem, GetStaticData, PartialModules, CssOptions } from "./types.js";
|
|
5
5
|
export declare function buildTempPages(entryPoints: string[], buildOptions: {
|
|
6
6
|
outBase: string;
|
|
7
7
|
outDir: string;
|
|
8
|
+
alias: MinistaResolveAlias;
|
|
8
9
|
mdxConfig: MdxOptions;
|
|
9
10
|
svgrOptions: SvgrOptions;
|
|
10
11
|
cssOptions: CssOptions;
|
|
@@ -43,6 +44,7 @@ export declare function buildPartialStringIndex(partialModules: PartialModules,
|
|
|
43
44
|
}): Promise<void>;
|
|
44
45
|
export declare function buildPartialStringBundle(entryPoint: string, buildOptions: {
|
|
45
46
|
outFile: string;
|
|
47
|
+
alias: MinistaResolveAlias;
|
|
46
48
|
mdxConfig: MdxOptions;
|
|
47
49
|
svgrOptions: SvgrOptions;
|
|
48
50
|
cssOptions: CssOptions;
|
package/dist/build.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
import { systemConfig } from "./system.js";
|
|
34
34
|
import { getFilePath } from "./path.js";
|
|
35
35
|
import {
|
|
36
|
+
getEsbuildAlias,
|
|
36
37
|
resolvePlugin,
|
|
37
38
|
svgrPlugin,
|
|
38
39
|
rawPlugin,
|
|
@@ -71,11 +72,18 @@ const esbuildLoaders = {
|
|
|
71
72
|
".woff": "file",
|
|
72
73
|
".woff2": "file"
|
|
73
74
|
};
|
|
75
|
+
const esbuildAlias = [
|
|
76
|
+
{
|
|
77
|
+
find: "react/jsx-runtime",
|
|
78
|
+
replacement: "react/jsx-runtime.js"
|
|
79
|
+
}
|
|
80
|
+
];
|
|
74
81
|
const userPkgHasPreact = [
|
|
75
82
|
...Object.keys(userPkg.dependencies || {}),
|
|
76
83
|
...Object.keys(userPkg.devDependencies || {})
|
|
77
84
|
].includes("preact");
|
|
78
85
|
async function buildTempPages(entryPoints, buildOptions) {
|
|
86
|
+
const alias = getEsbuildAlias([esbuildAlias, buildOptions.alias]);
|
|
79
87
|
await esBuild({
|
|
80
88
|
entryPoints,
|
|
81
89
|
outbase: buildOptions.outBase,
|
|
@@ -91,11 +99,9 @@ async function buildTempPages(entryPoints, buildOptions) {
|
|
|
91
99
|
external: esbuildExternals,
|
|
92
100
|
loader: esbuildLoaders,
|
|
93
101
|
plugins: [
|
|
102
|
+
resolvePlugin(alias),
|
|
94
103
|
CssModulePlugin(buildOptions.cssOptions),
|
|
95
104
|
mdx(buildOptions.mdxConfig),
|
|
96
|
-
resolvePlugin({
|
|
97
|
-
"react/jsx-runtime": "react/jsx-runtime.js"
|
|
98
|
-
}),
|
|
99
105
|
svgrPlugin(buildOptions.svgrOptions),
|
|
100
106
|
rawPlugin(),
|
|
101
107
|
partialHydrationPlugin()
|
|
@@ -420,6 +426,7 @@ export { ${tmpExportsStr} }`;
|
|
|
420
426
|
});
|
|
421
427
|
}
|
|
422
428
|
async function buildPartialStringBundle(entryPoint, buildOptions) {
|
|
429
|
+
const alias = getEsbuildAlias([esbuildAlias, buildOptions.alias]);
|
|
423
430
|
await esBuild({
|
|
424
431
|
entryPoints: [entryPoint],
|
|
425
432
|
outfile: buildOptions.outFile,
|
|
@@ -432,11 +439,9 @@ async function buildPartialStringBundle(entryPoint, buildOptions) {
|
|
|
432
439
|
external: esbuildExternals,
|
|
433
440
|
loader: esbuildLoaders,
|
|
434
441
|
plugins: [
|
|
442
|
+
resolvePlugin(alias),
|
|
435
443
|
CssModulePlugin(buildOptions.cssOptions),
|
|
436
444
|
mdx(buildOptions.mdxConfig),
|
|
437
|
-
resolvePlugin({
|
|
438
|
-
"react/jsx-runtime": "react/jsx-runtime.js"
|
|
439
|
-
}),
|
|
440
445
|
svgrPlugin(buildOptions.svgrOptions),
|
|
441
446
|
rawPlugin()
|
|
442
447
|
]
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AliasOptions as ViteAliasOptions } from "vite";
|
|
2
|
+
import type { MinistaConfig, MinistaUserConfig, MinistaResolveConfig, MinistaResolveAliasInput, MinistaResolveAlias } from "./types.js";
|
|
2
3
|
export declare const defaultConfig: MinistaConfig;
|
|
3
4
|
export declare function mergeConfig(userConfig: MinistaUserConfig): Promise<MinistaConfig>;
|
|
5
|
+
export declare function mergeAlias(configAlias: MinistaResolveAliasInput, viteConfigAlias: ViteAliasOptions): Promise<MinistaResolveAlias>;
|
|
4
6
|
export declare function resolveConfig(config: MinistaConfig): Promise<MinistaResolveConfig>;
|
|
5
7
|
export declare function getConfig(userConfig: MinistaUserConfig): Promise<MinistaResolveConfig>;
|
package/dist/config.js
CHANGED
|
@@ -83,6 +83,24 @@ const defaultConfig = {
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
vite: {},
|
|
86
|
+
resolve: {
|
|
87
|
+
alias: []
|
|
88
|
+
},
|
|
89
|
+
css: {
|
|
90
|
+
modules: {
|
|
91
|
+
cache: true,
|
|
92
|
+
scopeBehaviour: "local",
|
|
93
|
+
globalModulePaths: [],
|
|
94
|
+
generateScopedName: void 0,
|
|
95
|
+
hashPrefix: "",
|
|
96
|
+
localsConvention: "camelCaseOnly"
|
|
97
|
+
},
|
|
98
|
+
preprocessorOptions: {
|
|
99
|
+
scss: {},
|
|
100
|
+
less: {},
|
|
101
|
+
stylus: {}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
86
104
|
markdown: {
|
|
87
105
|
syntaxHighlighter: "highlight",
|
|
88
106
|
highlightOptions: {},
|
|
@@ -99,25 +117,10 @@ const defaultConfig = {
|
|
|
99
117
|
max_preserve_newlines: 0,
|
|
100
118
|
indent_inner_html: true,
|
|
101
119
|
extra_liners: [],
|
|
102
|
-
inline: ["span", "
|
|
120
|
+
inline: ["span", "strong", "b", "small", "del", "s", "code", "br", "wbr"]
|
|
103
121
|
},
|
|
104
122
|
cssOptions: {},
|
|
105
123
|
jsOptions: {}
|
|
106
|
-
},
|
|
107
|
-
css: {
|
|
108
|
-
modules: {
|
|
109
|
-
generateScopedName: void 0,
|
|
110
|
-
globalModulePaths: [],
|
|
111
|
-
hashPrefix: "",
|
|
112
|
-
localsConvention: "camelCaseOnly",
|
|
113
|
-
scopeBehaviour: "local",
|
|
114
|
-
cache: true
|
|
115
|
-
},
|
|
116
|
-
preprocessorOptions: {
|
|
117
|
-
scss: {},
|
|
118
|
-
less: {},
|
|
119
|
-
stylus: {}
|
|
120
|
-
}
|
|
121
124
|
}
|
|
122
125
|
};
|
|
123
126
|
async function mergeConfig(userConfig) {
|
|
@@ -127,8 +130,40 @@ async function mergeConfig(userConfig) {
|
|
|
127
130
|
const mergedConfig = customDeepmerge(defaultConfig, userConfig);
|
|
128
131
|
return mergedConfig;
|
|
129
132
|
}
|
|
133
|
+
async function mergeAlias(configAlias, viteConfigAlias) {
|
|
134
|
+
const alias = [];
|
|
135
|
+
async function getAlias(input) {
|
|
136
|
+
if (!input) {
|
|
137
|
+
return;
|
|
138
|
+
} else if (Array.isArray(input) && input.length > 0) {
|
|
139
|
+
await Promise.all(input.map(async (item) => {
|
|
140
|
+
const pattern = {
|
|
141
|
+
find: item.find,
|
|
142
|
+
replacement: item.replacement
|
|
143
|
+
};
|
|
144
|
+
return alias.push(pattern);
|
|
145
|
+
}));
|
|
146
|
+
} else if (typeof input === "object") {
|
|
147
|
+
await Promise.all(Object.entries(input).map((item) => {
|
|
148
|
+
const pattern = {
|
|
149
|
+
find: item[0],
|
|
150
|
+
replacement: item[1]
|
|
151
|
+
};
|
|
152
|
+
return alias.push(pattern);
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
await getAlias(configAlias);
|
|
157
|
+
await getAlias(viteConfigAlias);
|
|
158
|
+
return alias;
|
|
159
|
+
}
|
|
130
160
|
async function resolveConfig(config) {
|
|
161
|
+
var _a;
|
|
162
|
+
const configAlias = config.resolve.alias;
|
|
163
|
+
const viteConfigAlias = ((_a = config.vite.resolve) == null ? void 0 : _a.alias) || {};
|
|
164
|
+
const alias = await mergeAlias(configAlias, viteConfigAlias);
|
|
131
165
|
const resolvedConfig = __spreadProps(__spreadValues({}, config), {
|
|
166
|
+
alias,
|
|
132
167
|
rootSrcDir: noSlashEnd(config.root.srcDir),
|
|
133
168
|
pagesSrcDir: noSlashEnd(config.pages.srcDir),
|
|
134
169
|
publicOutDir: noSlashEnd(config.out),
|
|
@@ -153,6 +188,7 @@ async function getConfig(userConfig) {
|
|
|
153
188
|
export {
|
|
154
189
|
defaultConfig,
|
|
155
190
|
getConfig,
|
|
191
|
+
mergeAlias,
|
|
156
192
|
mergeConfig,
|
|
157
193
|
resolveConfig
|
|
158
194
|
};
|
package/dist/css.js
CHANGED
|
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import React from "react";
|
|
21
|
-
import path from "path";
|
|
22
21
|
import fs from "fs-extra";
|
|
22
|
+
import path from "path";
|
|
23
23
|
import postcss from "postcss";
|
|
24
24
|
import postcssModules from "postcss-modules";
|
|
25
25
|
var PreprocessLang = /* @__PURE__ */ ((PreprocessLang2) => {
|
package/dist/esbuild.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Plugin } from "esbuild";
|
|
2
2
|
import type { Config as SvgrOptions } from "@svgr/core";
|
|
3
|
+
import type { MinistaResolveAlias } from "./types.js";
|
|
4
|
+
export declare function getEsbuildAlias(aliasArray: MinistaResolveAlias[]): {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
3
7
|
/*! Fork: esbuild-plugin-resolve | https://github.com/markwylde/esbuild-plugin-resolve */
|
|
4
8
|
export declare function resolvePlugin(options: {
|
|
5
9
|
[key: string]: string;
|
package/dist/esbuild.js
CHANGED
|
@@ -19,6 +19,13 @@ import fs from "fs-extra";
|
|
|
19
19
|
import path from "path";
|
|
20
20
|
import { v4 as uuidv4 } from "uuid";
|
|
21
21
|
import { systemConfig } from "./system.js";
|
|
22
|
+
function getEsbuildAlias(aliasArray) {
|
|
23
|
+
const alias = [...aliasArray].flat();
|
|
24
|
+
const result = Object.assign({}, ...alias.map((item) => ({
|
|
25
|
+
[item.find]: item.replacement
|
|
26
|
+
})));
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
22
29
|
/*! Fork: esbuild-plugin-resolve | https://github.com/markwylde/esbuild-plugin-resolve */
|
|
23
30
|
function resolvePlugin(options) {
|
|
24
31
|
function resolvePluginIntercept(build, moduleName, moduleTarget) {
|
|
@@ -120,6 +127,7 @@ function partialHydrationPlugin() {
|
|
|
120
127
|
};
|
|
121
128
|
}
|
|
122
129
|
export {
|
|
130
|
+
getEsbuildAlias,
|
|
123
131
|
partialHydrationPlugin,
|
|
124
132
|
rawPlugin,
|
|
125
133
|
resolvePlugin,
|
package/dist/generate.js
CHANGED
|
@@ -46,6 +46,7 @@ async function generateTempRoot(config, mdxConfig) {
|
|
|
46
46
|
await buildTempPages([srcRootFilePaths[0]], {
|
|
47
47
|
outBase: config.rootSrcDir,
|
|
48
48
|
outDir: systemConfig.temp.root.outDir,
|
|
49
|
+
alias: config.alias,
|
|
49
50
|
mdxConfig,
|
|
50
51
|
svgrOptions: config.assets.svgr.svgrOptions,
|
|
51
52
|
cssOptions: config.css
|
|
@@ -57,6 +58,7 @@ async function generateTempPages(config, mdxConfig) {
|
|
|
57
58
|
await buildTempPages(srcPageFilePaths, {
|
|
58
59
|
outBase: config.pagesSrcDir,
|
|
59
60
|
outDir: systemConfig.temp.pages.outDir,
|
|
61
|
+
alias: config.alias,
|
|
60
62
|
mdxConfig,
|
|
61
63
|
svgrOptions: config.assets.svgr.svgrOptions,
|
|
62
64
|
cssOptions: config.css
|
|
@@ -92,6 +94,7 @@ async function generatePartialHydration(config, mdxConfig, viteConfig) {
|
|
|
92
94
|
await buildPartialStringBundle(stringIndex, {
|
|
93
95
|
outFile: stringBundle,
|
|
94
96
|
mdxConfig,
|
|
97
|
+
alias: config.alias,
|
|
95
98
|
svgrOptions: config.assets.svgr.svgrOptions,
|
|
96
99
|
cssOptions: config.css
|
|
97
100
|
});
|
package/dist/path.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
+
import fg from "fast-glob";
|
|
3
4
|
import path from "path";
|
|
4
|
-
import glob from "tiny-glob";
|
|
5
5
|
function getFilePath(targetDir, fileName, extension) {
|
|
6
6
|
const filePath = `${targetDir}/${fileName}.${extension}`;
|
|
7
7
|
const file = fs.existsSync(path.resolve(filePath)) ? path.resolve(filePath) : "";
|
|
8
8
|
return file;
|
|
9
9
|
}
|
|
10
10
|
async function getFilePaths(targetDir, extensions) {
|
|
11
|
-
const strExtension = typeof extensions === "string" ? extensions : extensions.join();
|
|
12
|
-
const globPattern = `${targetDir}
|
|
13
|
-
const files = await
|
|
11
|
+
const strExtension = typeof extensions === "string" ? extensions : extensions.join("|");
|
|
12
|
+
const globPattern = `${targetDir}/**/*.+(${strExtension})`;
|
|
13
|
+
const files = await fg(globPattern, { extglob: true });
|
|
14
14
|
return files;
|
|
15
15
|
}
|
|
16
16
|
async function getSameFilePaths(targetDir, fileName, extensions) {
|
|
17
|
-
const strExtension = typeof extensions === "string" ? extensions : extensions.join();
|
|
18
|
-
const globPattern = `${targetDir}/${fileName}
|
|
19
|
-
const files = await
|
|
17
|
+
const strExtension = typeof extensions === "string" ? extensions : extensions.join("|");
|
|
18
|
+
const globPattern = `${targetDir}/${fileName}.+(${strExtension})`;
|
|
19
|
+
const files = await fg(globPattern, { extglob: true });
|
|
20
20
|
return files;
|
|
21
21
|
}
|
|
22
22
|
export {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ExoticComponent } from "react";
|
|
2
2
|
import type { UserConfig as ViteUserConfig, CorsOptions as ViteCorsOptions } from "vite";
|
|
3
3
|
import type { Config as SvgrOptions } from "@svgr/core";
|
|
4
|
+
import type { SvgstoreAddOptions } from "@qrac/svgstore";
|
|
4
5
|
import type { Options as HighlightOptions } from "rehype-highlight";
|
|
5
6
|
import type { Options as MdxOptions } from "@mdx-js/esbuild";
|
|
6
7
|
import type { HTMLBeautifyOptions, CSSBeautifyOptions, JSBeautifyOptions } from "js-beautify";
|
|
@@ -58,7 +59,7 @@ export declare type MinistaConfig = {
|
|
|
58
59
|
srcDir: string;
|
|
59
60
|
outDir: string;
|
|
60
61
|
outName: string;
|
|
61
|
-
svgstoreOptions:
|
|
62
|
+
svgstoreOptions: SvgstoreAddOptions;
|
|
62
63
|
};
|
|
63
64
|
download: {
|
|
64
65
|
useRemote: boolean;
|
|
@@ -68,6 +69,10 @@ export declare type MinistaConfig = {
|
|
|
68
69
|
};
|
|
69
70
|
};
|
|
70
71
|
vite: ViteUserConfig;
|
|
72
|
+
resolve: {
|
|
73
|
+
alias: MinistaResolveAliasInput;
|
|
74
|
+
};
|
|
75
|
+
css: CssOptions;
|
|
71
76
|
markdown: {
|
|
72
77
|
syntaxHighlighter: "highlight" | "none";
|
|
73
78
|
highlightOptions: HighlightOptions;
|
|
@@ -80,7 +85,6 @@ export declare type MinistaConfig = {
|
|
|
80
85
|
cssOptions: CSSBeautifyOptions;
|
|
81
86
|
jsOptions: JSBeautifyOptions;
|
|
82
87
|
};
|
|
83
|
-
css: CssOptions;
|
|
84
88
|
};
|
|
85
89
|
export declare type MinistaUserConfig = {
|
|
86
90
|
base?: string;
|
|
@@ -134,7 +138,7 @@ export declare type MinistaUserConfig = {
|
|
|
134
138
|
srcDir?: string;
|
|
135
139
|
outDir?: string;
|
|
136
140
|
outName?: string;
|
|
137
|
-
svgstoreOptions?:
|
|
141
|
+
svgstoreOptions?: SvgstoreAddOptions;
|
|
138
142
|
};
|
|
139
143
|
download?: {
|
|
140
144
|
useRemote?: boolean;
|
|
@@ -144,6 +148,10 @@ export declare type MinistaUserConfig = {
|
|
|
144
148
|
};
|
|
145
149
|
};
|
|
146
150
|
vite?: ViteUserConfig;
|
|
151
|
+
resolve?: {
|
|
152
|
+
alias?: MinistaResolveAliasInput;
|
|
153
|
+
};
|
|
154
|
+
css?: CssUserOptions;
|
|
147
155
|
markdown?: {
|
|
148
156
|
syntaxHighlighter?: "highlight" | "none";
|
|
149
157
|
highlightOptions?: HighlightOptions;
|
|
@@ -156,21 +164,21 @@ export declare type MinistaUserConfig = {
|
|
|
156
164
|
cssOptions?: CSSBeautifyOptions;
|
|
157
165
|
jsOptions?: JSBeautifyOptions;
|
|
158
166
|
};
|
|
159
|
-
css?: CssUserOptions;
|
|
160
167
|
};
|
|
161
|
-
export declare type
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
export declare type MinistaResolveConfig = MinistaConfig & MinistaResolveAliasConfig & MinistaResolvePathConfig;
|
|
169
|
+
export declare type MinistaResolveAliasInput = {
|
|
170
|
+
[key: string]: string;
|
|
171
|
+
} | {
|
|
172
|
+
find: string;
|
|
173
|
+
replacement: string;
|
|
174
|
+
}[];
|
|
175
|
+
export declare type MinistaResolveAlias = {
|
|
176
|
+
find: string;
|
|
177
|
+
replacement: string;
|
|
178
|
+
}[];
|
|
179
|
+
export declare type MinistaResolveAliasConfig = {
|
|
180
|
+
alias: MinistaResolveAlias;
|
|
172
181
|
};
|
|
173
|
-
export declare type MinistaResolveConfig = MinistaConfig & MinistaResolvePathConfig;
|
|
174
182
|
export declare type MinistaResolvePathConfig = {
|
|
175
183
|
rootSrcDir: string;
|
|
176
184
|
pagesSrcDir: string;
|
|
@@ -275,14 +283,6 @@ export declare type PartialModules = {
|
|
|
275
283
|
export declare type PartialString = {
|
|
276
284
|
[key: string]: string;
|
|
277
285
|
};
|
|
278
|
-
export declare type CSSModulesOptions = {
|
|
279
|
-
cache: boolean;
|
|
280
|
-
scopeBehaviour: "global" | "local";
|
|
281
|
-
globalModulePaths: RegExp[];
|
|
282
|
-
generateScopedName: undefined | string | ((name: string, filename: string, css: string) => string);
|
|
283
|
-
hashPrefix: string;
|
|
284
|
-
localsConvention: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly";
|
|
285
|
-
};
|
|
286
286
|
export declare type CssOptions = {
|
|
287
287
|
modules: CSSModulesOptions | false;
|
|
288
288
|
preprocessorOptions: {
|
|
@@ -299,3 +299,11 @@ export declare type CssUserOptions = {
|
|
|
299
299
|
stylus?: Stylus.RenderOptions;
|
|
300
300
|
};
|
|
301
301
|
};
|
|
302
|
+
export declare type CSSModulesOptions = {
|
|
303
|
+
cache: boolean;
|
|
304
|
+
scopeBehaviour: "global" | "local";
|
|
305
|
+
globalModulePaths: RegExp[];
|
|
306
|
+
generateScopedName: undefined | string | ((name: string, filename: string, css: string) => string);
|
|
307
|
+
hashPrefix: string;
|
|
308
|
+
localsConvention: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly";
|
|
309
|
+
};
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { UserConfig as ViteConfig, Plugin } from "vite";
|
|
2
2
|
import type { Config as SvgrOptions } from "@svgr/core";
|
|
3
3
|
import type { Options as MdxOptions } from "@mdx-js/esbuild";
|
|
4
|
-
import type {
|
|
4
|
+
import type { SvgstoreAddOptions } from "@qrac/svgstore";
|
|
5
|
+
import type { MinistaResolveConfig, MinistaCliDevOptions, MinistaCliPreviewOptions } from "./types.js";
|
|
5
6
|
export declare function getViteConfig(config: MinistaResolveConfig, mdxConfig: MdxOptions, cliOptions?: MinistaCliDevOptions | MinistaCliPreviewOptions): Promise<ViteConfig>;
|
|
6
7
|
export declare function resolveEntry(entry: string | string[] | {}): {};
|
|
7
8
|
export declare function vitePluginMinistaVirtualHtml(): Plugin;
|
|
8
9
|
/*! Fork: vite-plugin-svgr | https://github.com/pd4d10/vite-plugin-svgr */
|
|
9
10
|
export declare function vitePluginMinistaSvgr(svgrOptions: SvgrOptions): Plugin;
|
|
10
|
-
export declare function vitePluginMinistaSvgSpriteIcons(srcDir: string, options:
|
|
11
|
+
export declare function vitePluginMinistaSvgSpriteIcons(srcDir: string, options: SvgstoreAddOptions | undefined, output: string, tempOutput: string): Plugin;
|
package/dist/vite.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "vite";
|
|
13
13
|
import react from "@vitejs/plugin-react";
|
|
14
14
|
import mdx from "@mdx-js/rollup";
|
|
15
|
-
import svgstore from "svgstore";
|
|
15
|
+
import svgstore from "@qrac/svgstore";
|
|
16
16
|
import { systemConfig } from "./system.js";
|
|
17
17
|
import { getFilePaths } from "./path.js";
|
|
18
18
|
import { getFilename, getFilenameObject } from "./utils.js";
|
|
@@ -92,6 +92,11 @@ async function getViteConfig(config, mdxConfig, cliOptions) {
|
|
|
92
92
|
css: config.css
|
|
93
93
|
});
|
|
94
94
|
const mergedViteConfig = mergeViteConfig(defaultViteConfig, config.vite);
|
|
95
|
+
if (config.alias.length > 0) {
|
|
96
|
+
await Promise.all(config.alias.map(async (item) => {
|
|
97
|
+
return mergedViteConfig.resolve.alias.push(item);
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
95
100
|
const svgrPlugin = vitePluginMinistaSvgr(config.assets.svgr.svgrOptions);
|
|
96
101
|
mergedViteConfig.plugins.push(svgrPlugin);
|
|
97
102
|
if (config.assets.icons.useSprite) {
|
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.
|
|
4
|
+
"version": "2.6.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minista": "./bin/minista.js"
|
|
7
7
|
},
|
|
@@ -87,18 +87,20 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@mdx-js/esbuild": "^2.1.1",
|
|
89
89
|
"@mdx-js/rollup": "^2.1.1",
|
|
90
|
+
"@qrac/svgstore": "^3.0.3",
|
|
90
91
|
"@svgr/core": "^6.2.1",
|
|
91
92
|
"@vitejs/plugin-react": "^1.3.2",
|
|
92
93
|
"cac": "^6.7.12",
|
|
93
94
|
"deepmerge-ts": "^4.0.3",
|
|
94
|
-
"esbuild": "^0.14.
|
|
95
|
+
"esbuild": "^0.14.42",
|
|
96
|
+
"fast-glob": "^3.2.11",
|
|
95
97
|
"fs-extra": "^10.1.0",
|
|
96
98
|
"js-beautify": "^1.14.3",
|
|
97
99
|
"mime-types": "^2.1.35",
|
|
98
|
-
"node-fetch": "^3.2.
|
|
100
|
+
"node-fetch": "^3.2.5",
|
|
99
101
|
"node-html-parser": "^5.3.3",
|
|
100
102
|
"picocolors": "^1.0.0",
|
|
101
|
-
"postcss": "^8.4.
|
|
103
|
+
"postcss": "^8.4.14",
|
|
102
104
|
"postcss-modules": "^4.3.1",
|
|
103
105
|
"react-helmet": "^6.1.0",
|
|
104
106
|
"react-router-dom": "^6.3.0",
|
|
@@ -107,8 +109,6 @@
|
|
|
107
109
|
"remark-gfm": "^3.0.1",
|
|
108
110
|
"remark-mdx-frontmatter": "^1.1.1",
|
|
109
111
|
"srcset": "^5.0.0",
|
|
110
|
-
"svgstore": "^3.0.1",
|
|
111
|
-
"tiny-glob": "^0.2.9",
|
|
112
112
|
"uuid": "^8.3.2",
|
|
113
113
|
"vite": "^2.9.9"
|
|
114
114
|
},
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"@types/js-beautify": "^1.13.3",
|
|
118
118
|
"@types/less": "^3.0.3",
|
|
119
119
|
"@types/mime-types": "^2.1.1",
|
|
120
|
-
"@types/node": "^17.0.
|
|
120
|
+
"@types/node": "^17.0.39",
|
|
121
121
|
"@types/react": "^17.0.45",
|
|
122
122
|
"@types/react-dom": "^17.0.16",
|
|
123
123
|
"@types/react-helmet": "^6.1.5",
|
|
@@ -126,10 +126,10 @@
|
|
|
126
126
|
"less": "^4.1.2",
|
|
127
127
|
"react": "^17.0.2",
|
|
128
128
|
"react-dom": "^17.0.2",
|
|
129
|
-
"sass": "^1.
|
|
130
|
-
"stylus": "^0.
|
|
131
|
-
"tsup": "^
|
|
132
|
-
"typescript": "^4.
|
|
133
|
-
"vitest": "^0.
|
|
129
|
+
"sass": "^1.52.2",
|
|
130
|
+
"stylus": "^0.58.1",
|
|
131
|
+
"tsup": "^6.0.1",
|
|
132
|
+
"typescript": "^4.7.3",
|
|
133
|
+
"vitest": "^0.13.1"
|
|
134
134
|
}
|
|
135
135
|
}
|