minista 2.1.0 → 2.3.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 +3 -0
- package/client.d.ts +18 -0
- package/dist/build.d.ts +2 -0
- package/dist/build.js +2 -1
- package/dist/cli.js +29 -6
- package/dist/config.js +3 -0
- package/dist/esbuild.d.ts +3 -0
- package/dist/esbuild.js +37 -3
- package/dist/generate.js +4 -2
- package/dist/types.d.ts +23 -1
- package/dist/vite.d.ts +5 -2
- package/dist/vite.js +32 -5
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -105,6 +105,9 @@ export default defineConfig({
|
|
|
105
105
|
outDir: "assets/fonts", // string
|
|
106
106
|
outName: "[name]", // string
|
|
107
107
|
},
|
|
108
|
+
svgr: {
|
|
109
|
+
svgrOptions: {}, // https://react-svgr.com/docs/options/
|
|
110
|
+
},
|
|
108
111
|
icons: {
|
|
109
112
|
useSprite: true, // boolean
|
|
110
113
|
srcDir: "src/assets/icons", // string
|
package/client.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
declare module "*.mdx" {
|
|
2
|
+
import { MDXProps } from "mdx/types"
|
|
3
|
+
export default function MDXContent(props: MDXProps): JSX.Element
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module "*.md" {
|
|
7
|
+
export { default } from "*.mdx"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare module "*.svg" {
|
|
11
|
+
import * as React from "react"
|
|
12
|
+
|
|
13
|
+
const ReactComponent: React.FunctionComponent<
|
|
14
|
+
React.SVGProps<SVGSVGElement> & { title?: string }
|
|
15
|
+
>
|
|
16
|
+
export default ReactComponent
|
|
17
|
+
}
|
|
18
|
+
|
|
1
19
|
declare module "*?raw" {
|
|
2
20
|
const src: string
|
|
3
21
|
export default src
|
package/dist/build.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Options as MdxOptions } from "@mdx-js/esbuild";
|
|
2
|
+
import type { Config as SvgrOptions } from "@svgr/core";
|
|
2
3
|
import type { InlineConfig } from "vite";
|
|
3
4
|
import type { MinistaResolveConfig, RootStaticContent, RootJsxContent, GlobalStaticData, GetGlobalStaticData, PageJsxContent, StaticData, StaticDataItem, GetStaticData } from "./types.js";
|
|
4
5
|
export declare function buildTempPages(entryPoints: string[], buildOptions: {
|
|
5
6
|
outBase: string;
|
|
6
7
|
outDir: string;
|
|
7
8
|
mdxConfig: MdxOptions;
|
|
9
|
+
svgrOptions: SvgrOptions;
|
|
8
10
|
}): Promise<void>;
|
|
9
11
|
export declare function buildStaticPages(entryPoints: string[], tempRootFilePath: string, buildOptions: {
|
|
10
12
|
outBase: string;
|
package/dist/build.js
CHANGED
|
@@ -27,7 +27,7 @@ import { build as esBuild } from "esbuild";
|
|
|
27
27
|
import mdx from "@mdx-js/esbuild";
|
|
28
28
|
import { build as viteBuild, mergeConfig as mergeViteConfig } from "vite";
|
|
29
29
|
import { systemConfig } from "./system.js";
|
|
30
|
-
import { resolvePlugin, rawPlugin } from "./esbuild.js";
|
|
30
|
+
import { resolvePlugin, svgrPlugin, rawPlugin } from "./esbuild.js";
|
|
31
31
|
import { renderHtml } from "./render.js";
|
|
32
32
|
import { slashEnd } from "./utils.js";
|
|
33
33
|
const __filename = url.fileURLToPath(import.meta.url);
|
|
@@ -66,6 +66,7 @@ async function buildTempPages(entryPoints, buildOptions) {
|
|
|
66
66
|
resolvePlugin({
|
|
67
67
|
"react/jsx-runtime": "react/jsx-runtime.js"
|
|
68
68
|
}),
|
|
69
|
+
svgrPlugin(buildOptions.svgrOptions),
|
|
69
70
|
rawPlugin()
|
|
70
71
|
]
|
|
71
72
|
}).catch(() => process.exit(1));
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
1
17
|
import React from "react";
|
|
2
18
|
import fs from "fs-extra";
|
|
3
19
|
import { cac } from "cac";
|
|
@@ -20,19 +36,25 @@ import {
|
|
|
20
36
|
generateDownload,
|
|
21
37
|
generateBeautify
|
|
22
38
|
} from "./generate.js";
|
|
39
|
+
const cli = cac("minista");
|
|
40
|
+
function cleanOptions(options) {
|
|
41
|
+
const ret = __spreadValues({}, options);
|
|
42
|
+
delete ret["--"];
|
|
43
|
+
return ret;
|
|
44
|
+
}
|
|
23
45
|
function printVersion() {
|
|
24
46
|
const pkgURL = new URL("../package.json", import.meta.url);
|
|
25
47
|
const pkg = JSON.parse(fs.readFileSync(pkgURL, "utf8"));
|
|
26
48
|
const pkgVersion = pkg.version;
|
|
27
49
|
return pkgVersion;
|
|
28
50
|
}
|
|
29
|
-
|
|
30
|
-
cli.command("[root]").alias("dev").action(async () => {
|
|
51
|
+
cli.command("[root]", "start dev server").alias("dev").option("--host [host]", `[string] specify hostname`).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--https", `[boolean] use TLS + HTTP/2`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).action(async (root, options) => {
|
|
31
52
|
try {
|
|
53
|
+
const cliOptions = cleanOptions(options);
|
|
32
54
|
const userConfig = await getUserConfig();
|
|
33
55
|
const config = await getConfig(userConfig);
|
|
34
56
|
const mdxConfig = await getMdxConfig(config);
|
|
35
|
-
const viteConfig = await getViteConfig(config, mdxConfig);
|
|
57
|
+
const viteConfig = await getViteConfig(config, mdxConfig, cliOptions);
|
|
36
58
|
await Promise.all([
|
|
37
59
|
emptyResolveDir(systemConfig.temp.viteImporter.outDir),
|
|
38
60
|
emptyResolveDir(systemConfig.temp.icons.outDir)
|
|
@@ -44,7 +66,7 @@ cli.command("[root]").alias("dev").action(async () => {
|
|
|
44
66
|
process.exit(1);
|
|
45
67
|
}
|
|
46
68
|
});
|
|
47
|
-
cli.command("build [root]").action(async () => {
|
|
69
|
+
cli.command("build [root]", "build for production").action(async () => {
|
|
48
70
|
try {
|
|
49
71
|
const userConfig = await getUserConfig();
|
|
50
72
|
const config = await getConfig(userConfig);
|
|
@@ -76,12 +98,13 @@ cli.command("build [root]").action(async () => {
|
|
|
76
98
|
process.exit(1);
|
|
77
99
|
}
|
|
78
100
|
});
|
|
79
|
-
cli.command("preview [root]").action(async () => {
|
|
101
|
+
cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--https", `[boolean] use TLS + HTTP/2`).option("--open [path]", `[boolean | string] open browser on startup`).action(async (root, options) => {
|
|
80
102
|
try {
|
|
103
|
+
const cliOptions = cleanOptions(options);
|
|
81
104
|
const userConfig = await getUserConfig();
|
|
82
105
|
const config = await getConfig(userConfig);
|
|
83
106
|
const mdxConfig = await getMdxConfig(config);
|
|
84
|
-
const viteConfig = await getViteConfig(config, mdxConfig);
|
|
107
|
+
const viteConfig = await getViteConfig(config, mdxConfig, cliOptions);
|
|
85
108
|
await previewLocal(viteConfig);
|
|
86
109
|
} catch (err) {
|
|
87
110
|
console.log(err);
|
package/dist/config.js
CHANGED
package/dist/esbuild.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Plugin } from "esbuild";
|
|
2
|
+
import type { Config as SvgrOptions } from "@svgr/core";
|
|
2
3
|
/*! Fork: esbuild-plugin-resolve | https://github.com/markwylde/esbuild-plugin-resolve */
|
|
3
4
|
export declare function resolvePlugin(options: {
|
|
4
5
|
[key: string]: string;
|
|
5
6
|
}): Plugin;
|
|
7
|
+
/*! Fork: esbuild-plugin-svgr | https://github.com/kazijawad/esbuild-plugin-svgr */
|
|
8
|
+
export declare function svgrPlugin(options: SvgrOptions): Plugin;
|
|
6
9
|
/*! Fork: esbuild-plugin-resolve | https://github.com/hannoeru/esbuild-plugin-raw */
|
|
7
10
|
export declare function rawPlugin(): Plugin;
|
package/dist/esbuild.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
1
17
|
import React from "react";
|
|
18
|
+
import fs from "fs-extra";
|
|
2
19
|
import path from "path";
|
|
3
|
-
import { readFile } from "fs/promises";
|
|
4
20
|
/*! Fork: esbuild-plugin-resolve | https://github.com/markwylde/esbuild-plugin-resolve */
|
|
5
21
|
function resolvePlugin(options) {
|
|
6
22
|
return {
|
|
@@ -35,6 +51,23 @@ function resolvePluginIntercept(build, moduleName, moduleTarget) {
|
|
|
35
51
|
return { contents: importerCode, resolveDir: args.pluginData.resolveDir };
|
|
36
52
|
});
|
|
37
53
|
}
|
|
54
|
+
/*! Fork: esbuild-plugin-svgr | https://github.com/kazijawad/esbuild-plugin-svgr */
|
|
55
|
+
function svgrPlugin(options) {
|
|
56
|
+
return {
|
|
57
|
+
name: "esbuild-svgr",
|
|
58
|
+
setup(build) {
|
|
59
|
+
build.onLoad({ filter: /\.svg$/ }, async (args) => {
|
|
60
|
+
const { transform: transformSvgr } = await import("@svgr/core");
|
|
61
|
+
const svg = await fs.promises.readFile(args.path, "utf8");
|
|
62
|
+
const contents = await transformSvgr(svg, __spreadValues({}, options), { filePath: args.path });
|
|
63
|
+
return {
|
|
64
|
+
contents,
|
|
65
|
+
loader: options.typescript ? "tsx" : "jsx"
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
38
71
|
/*! Fork: esbuild-plugin-resolve | https://github.com/hannoeru/esbuild-plugin-raw */
|
|
39
72
|
function rawPlugin() {
|
|
40
73
|
return {
|
|
@@ -48,7 +81,7 @@ function rawPlugin() {
|
|
|
48
81
|
});
|
|
49
82
|
build.onLoad({ filter: /\?raw$/, namespace: "raw-loader" }, async (args) => {
|
|
50
83
|
return {
|
|
51
|
-
contents: await readFile(args.path.replace(/\?raw$/, "")),
|
|
84
|
+
contents: await fs.promises.readFile(args.path.replace(/\?raw$/, "")),
|
|
52
85
|
loader: "text"
|
|
53
86
|
};
|
|
54
87
|
});
|
|
@@ -57,5 +90,6 @@ function rawPlugin() {
|
|
|
57
90
|
}
|
|
58
91
|
export {
|
|
59
92
|
rawPlugin,
|
|
60
|
-
resolvePlugin
|
|
93
|
+
resolvePlugin,
|
|
94
|
+
svgrPlugin
|
|
61
95
|
};
|
package/dist/generate.js
CHANGED
|
@@ -35,7 +35,8 @@ async function generateTempRoot(config, mdxConfig) {
|
|
|
35
35
|
await buildTempPages([srcRootFilePaths[0]], {
|
|
36
36
|
outBase: config.rootSrcDir,
|
|
37
37
|
outDir: systemConfig.temp.root.outDir,
|
|
38
|
-
mdxConfig
|
|
38
|
+
mdxConfig,
|
|
39
|
+
svgrOptions: config.assets.svgr.svgrOptions
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -44,7 +45,8 @@ async function generateTempPages(config, mdxConfig) {
|
|
|
44
45
|
await buildTempPages(srcPageFilePaths, {
|
|
45
46
|
outBase: config.pagesSrcDir,
|
|
46
47
|
outDir: systemConfig.temp.pages.outDir,
|
|
47
|
-
mdxConfig
|
|
48
|
+
mdxConfig,
|
|
49
|
+
svgrOptions: config.assets.svgr.svgrOptions
|
|
48
50
|
});
|
|
49
51
|
}
|
|
50
52
|
async function generateAssets(config, viteConfig) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExoticComponent } from "react";
|
|
2
|
-
import type { UserConfig as ViteUserConfig } from "vite";
|
|
2
|
+
import type { UserConfig as ViteUserConfig, CorsOptions as ViteCorsOptions } from "vite";
|
|
3
|
+
import type { Config as SvgrOptions } from "@svgr/core";
|
|
3
4
|
import type { Options as HighlightOptions } from "rehype-highlight";
|
|
4
5
|
import type { Options as MdxOptions } from "@mdx-js/esbuild";
|
|
5
6
|
import type { HTMLBeautifyOptions, CSSBeautifyOptions, JSBeautifyOptions } from "js-beautify";
|
|
@@ -33,6 +34,9 @@ export declare type MinistaConfig = {
|
|
|
33
34
|
outDir: string;
|
|
34
35
|
outName: string;
|
|
35
36
|
};
|
|
37
|
+
svgr: {
|
|
38
|
+
svgrOptions: SvgrOptions;
|
|
39
|
+
};
|
|
36
40
|
icons: {
|
|
37
41
|
useSprite: boolean;
|
|
38
42
|
srcDir: string;
|
|
@@ -91,6 +95,9 @@ export declare type MinistaUserConfig = {
|
|
|
91
95
|
outDir?: string;
|
|
92
96
|
outName?: string;
|
|
93
97
|
};
|
|
98
|
+
svgr?: {
|
|
99
|
+
svgrOptions?: SvgrOptions;
|
|
100
|
+
};
|
|
94
101
|
icons?: {
|
|
95
102
|
useSprite?: boolean;
|
|
96
103
|
srcDir?: string;
|
|
@@ -170,6 +177,21 @@ export declare type MinistaSystemConfig = {
|
|
|
170
177
|
};
|
|
171
178
|
};
|
|
172
179
|
};
|
|
180
|
+
export declare type MinistaCliDevOptions = {
|
|
181
|
+
host?: string | boolean;
|
|
182
|
+
port?: number;
|
|
183
|
+
strictPort?: boolean;
|
|
184
|
+
https?: boolean;
|
|
185
|
+
open?: boolean | string;
|
|
186
|
+
cors?: boolean | ViteCorsOptions;
|
|
187
|
+
};
|
|
188
|
+
export declare type MinistaCliPreviewOptions = {
|
|
189
|
+
host?: string | boolean;
|
|
190
|
+
port?: number;
|
|
191
|
+
strictPort?: boolean;
|
|
192
|
+
https?: boolean;
|
|
193
|
+
open?: boolean | string;
|
|
194
|
+
};
|
|
173
195
|
export declare type MinistaLocation = {
|
|
174
196
|
pathname: string;
|
|
175
197
|
};
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { UserConfig as ViteConfig, Plugin } from "vite";
|
|
2
|
+
import type { Config as SvgrOptions } from "@svgr/core";
|
|
2
3
|
import type { Options as MdxOptions } from "@mdx-js/esbuild";
|
|
3
|
-
import type { MinistaResolveConfig, MinistaSvgstoreOptions } from "./types.js";
|
|
4
|
-
export declare function getViteConfig(config: MinistaResolveConfig, mdxConfig: MdxOptions): Promise<ViteConfig>;
|
|
4
|
+
import type { MinistaResolveConfig, MinistaSvgstoreOptions, MinistaCliDevOptions, MinistaCliPreviewOptions } from "./types.js";
|
|
5
|
+
export declare function getViteConfig(config: MinistaResolveConfig, mdxConfig: MdxOptions, cliOptions?: MinistaCliDevOptions | MinistaCliPreviewOptions): Promise<ViteConfig>;
|
|
5
6
|
export declare function resolveEntry(entry: string | string[] | {}): {};
|
|
6
7
|
export declare function vitePluginMinistaVirtualHtml(): Plugin;
|
|
8
|
+
/*! Fork: vite-plugin-svgr | https://github.com/pd4d10/vite-plugin-svgr */
|
|
9
|
+
export declare function vitePluginMinistaSvgr(svgrOptions: SvgrOptions): Plugin;
|
|
7
10
|
export declare function vitePluginMinistaSvgSpriteIcons(srcDir: string, options: MinistaSvgstoreOptions | undefined, output: string, tempOutput: string): Plugin;
|
package/dist/vite.js
CHANGED
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
defineConfig as defineViteConfig,
|
|
8
8
|
searchForWorkspaceRoot,
|
|
9
9
|
createLogger,
|
|
10
|
-
mergeConfig as mergeViteConfig
|
|
10
|
+
mergeConfig as mergeViteConfig,
|
|
11
|
+
transformWithEsbuild
|
|
11
12
|
} from "vite";
|
|
12
13
|
import react from "@vitejs/plugin-react";
|
|
13
14
|
import mdx from "@mdx-js/rollup";
|
|
@@ -17,11 +18,11 @@ import { getFilePaths } from "./path.js";
|
|
|
17
18
|
import { getFilename, getFilenameObject } from "./utils.js";
|
|
18
19
|
const __filename = url.fileURLToPath(import.meta.url);
|
|
19
20
|
const __dirname = path.dirname(__filename);
|
|
20
|
-
async function getViteConfig(config, mdxConfig) {
|
|
21
|
+
async function getViteConfig(config, mdxConfig, cliOptions) {
|
|
21
22
|
var _a, _b, _c, _d, _e;
|
|
22
23
|
const imgExt = ["jpg", "jpeg", "gif", "png", "webp", "svg"];
|
|
23
24
|
const fontExt = ["woff", "woff2", "eot", "ttf", "otf"];
|
|
24
|
-
const
|
|
25
|
+
const defaultViteConfig = defineViteConfig({
|
|
25
26
|
base: config.base || "/",
|
|
26
27
|
publicDir: config.public || "public",
|
|
27
28
|
build: {
|
|
@@ -89,7 +90,9 @@ async function getViteConfig(config, mdxConfig) {
|
|
|
89
90
|
},
|
|
90
91
|
customLogger: createLogger("info", { prefix: "[minista]" })
|
|
91
92
|
});
|
|
92
|
-
const mergedViteConfig = mergeViteConfig(
|
|
93
|
+
const mergedViteConfig = mergeViteConfig(defaultViteConfig, config.vite);
|
|
94
|
+
const svgrPlugin = vitePluginMinistaSvgr(config.assets.svgr.svgrOptions);
|
|
95
|
+
mergedViteConfig.plugins.push(svgrPlugin);
|
|
93
96
|
if (config.assets.icons.useSprite) {
|
|
94
97
|
const iconsPlugin = vitePluginMinistaSvgSpriteIcons(config.vitePluginSvgSpriteIconsSrcDir, config.assets.icons.svgstoreOptions, config.out + config.vitePluginSvgSpriteIconsOutput, config.vitePluginSvgSpriteIconsTempOutput);
|
|
95
98
|
const iconsResolveAlias = {
|
|
@@ -101,7 +104,7 @@ async function getViteConfig(config, mdxConfig) {
|
|
|
101
104
|
}
|
|
102
105
|
const mdxPlugin = mdx(mdxConfig);
|
|
103
106
|
mergedViteConfig.plugins.push(mdxPlugin);
|
|
104
|
-
return mergedViteConfig;
|
|
107
|
+
return cliOptions ? mergeViteConfig(mergedViteConfig, { server: cliOptions }) : mergedViteConfig;
|
|
105
108
|
}
|
|
106
109
|
function resolveEntry(entry) {
|
|
107
110
|
const result1 = typeof entry === "object" ? entry : typeof entry === "string" ? { [getFilename(entry)]: entry } : Array.isArray(entry) ? getFilenameObject(entry) : {};
|
|
@@ -166,6 +169,29 @@ function vitePluginMinistaVirtualHtml() {
|
|
|
166
169
|
}
|
|
167
170
|
};
|
|
168
171
|
}
|
|
172
|
+
/*! Fork: vite-plugin-svgr | https://github.com/pd4d10/vite-plugin-svgr */
|
|
173
|
+
function vitePluginMinistaSvgr(svgrOptions) {
|
|
174
|
+
return {
|
|
175
|
+
name: "vite-plugin-minista-svgr",
|
|
176
|
+
async transform(code, id) {
|
|
177
|
+
if (id.endsWith(".svg")) {
|
|
178
|
+
const { transform: transformSvgr } = await import("@svgr/core");
|
|
179
|
+
const svgCode = await fs.promises.readFile(id, "utf8");
|
|
180
|
+
const componentCode = await transformSvgr(svgCode, svgrOptions, {
|
|
181
|
+
componentName: "ReactComponent",
|
|
182
|
+
filePath: id
|
|
183
|
+
});
|
|
184
|
+
const res = await transformWithEsbuild(componentCode, id, {
|
|
185
|
+
loader: "jsx"
|
|
186
|
+
});
|
|
187
|
+
return {
|
|
188
|
+
code: res.code,
|
|
189
|
+
map: null
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
169
195
|
function vitePluginMinistaSvgSpriteIcons(srcDir, options = {}, output, tempOutput) {
|
|
170
196
|
async function getSvgSpriteFile(spriteOutput) {
|
|
171
197
|
const svgFiles = await getFilePaths(srcDir, "svg");
|
|
@@ -223,5 +249,6 @@ export {
|
|
|
223
249
|
getViteConfig,
|
|
224
250
|
resolveEntry,
|
|
225
251
|
vitePluginMinistaSvgSpriteIcons,
|
|
252
|
+
vitePluginMinistaSvgr,
|
|
226
253
|
vitePluginMinistaVirtualHtml
|
|
227
254
|
};
|
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.3.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minista": "./bin/minista.js"
|
|
7
7
|
},
|
|
@@ -51,8 +51,10 @@
|
|
|
51
51
|
"test:dev": "vitest watch",
|
|
52
52
|
"user": "cd ./user && npx minista",
|
|
53
53
|
"user:dev": "cd ./user && npx minista",
|
|
54
|
+
"user:dev-h": "cd ./user && npx minista --host",
|
|
54
55
|
"user:build": "cd ./user && npx minista build",
|
|
55
56
|
"user:preview": "cd ./user && npx minista preview",
|
|
57
|
+
"user:preview-h": "cd ./user && npx minista preview --host",
|
|
56
58
|
"user:v": "cd ./user && npx minista -v",
|
|
57
59
|
"user:h": "cd ./user && npx minista -h",
|
|
58
60
|
"prepublishOnly": "npm run clean:dist && npm run build:all",
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
"@mdx-js/esbuild": "^2.1.1",
|
|
73
75
|
"@mdx-js/react": "^2.1.1",
|
|
74
76
|
"@mdx-js/rollup": "^2.1.1",
|
|
77
|
+
"@svgr/core": "^6.2.1",
|
|
75
78
|
"@vitejs/plugin-react": "^1.3.0",
|
|
76
79
|
"cac": "^6.7.12",
|
|
77
80
|
"deepmerge-ts": "^4.0.2",
|