do11y 0.0.0 → 0.1.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/dist/docs/cli.js +2 -3
- package/dist/docs/vite-config.d.ts +7 -4
- package/dist/docs/vite-config.js +14 -7
- package/package.json +1 -1
package/dist/docs/cli.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { createServer, build, preview, mergeConfig } from "vite";
|
|
2
|
-
import { getUserViteConfig,
|
|
2
|
+
import { getUserViteConfig, viteConfig } from "./vite-config.js";
|
|
3
3
|
const [_, __, command = "dev"] = process.argv;
|
|
4
4
|
if (command !== "dev" && command !== "build" && command !== "preview") {
|
|
5
5
|
throw new Error();
|
|
6
6
|
}
|
|
7
7
|
const userViteConfig = await getUserViteConfig(command);
|
|
8
|
-
const
|
|
9
|
-
const mergedViteConfig = mergeConfig({ plugins: [vuePlugin] }, viteConfig);
|
|
8
|
+
const mergedViteConfig = mergeConfig(userViteConfig, viteConfig);
|
|
10
9
|
if (command === "dev") {
|
|
11
10
|
const server = await createServer(mergedViteConfig);
|
|
12
11
|
await server.listen();
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { type Plugin
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type Plugin } from "vite";
|
|
2
|
+
export declare const getUserViteConfig: (command: "dev" | "build" | "preview") => Promise<{
|
|
3
|
+
plugins: Plugin<any>[];
|
|
4
|
+
resolve: (import("vite").ResolveOptions & {
|
|
5
|
+
alias?: import("vite").AliasOptions;
|
|
6
|
+
}) | undefined;
|
|
7
|
+
}>;
|
|
5
8
|
export declare const viteConfig: {
|
|
6
9
|
root: string;
|
|
7
10
|
plugins: Plugin<any>[];
|
package/dist/docs/vite-config.js
CHANGED
|
@@ -7,7 +7,11 @@ export const getUserViteConfig = async (command) => {
|
|
|
7
7
|
command: command === "dev" ? "serve" : "build",
|
|
8
8
|
mode: command === "dev" ? "dev" : "build",
|
|
9
9
|
});
|
|
10
|
-
|
|
10
|
+
const config = userConfigFile?.config ?? {};
|
|
11
|
+
return {
|
|
12
|
+
plugins: await getUserPlugins(config),
|
|
13
|
+
resolve: config.resolve,
|
|
14
|
+
};
|
|
11
15
|
};
|
|
12
16
|
const getPlugin = async (plugin) => {
|
|
13
17
|
if (!plugin) {
|
|
@@ -26,16 +30,19 @@ const getPlugin = async (plugin) => {
|
|
|
26
30
|
return (await getPlugin(await plugin)).flat();
|
|
27
31
|
}
|
|
28
32
|
};
|
|
29
|
-
|
|
33
|
+
const getUserPlugins = async (userViteConfig) => {
|
|
30
34
|
const userPlugins = userViteConfig.plugins?.map(async (p) => await getPlugin(p)) ?? [];
|
|
31
35
|
const resolvedUserPlugins = (await Promise.all(userPlugins)).flat();
|
|
32
36
|
const vuePluginApi = resolvedUserPlugins.find((p) => p.name === "vite:vue").api;
|
|
33
37
|
const VuePlugin = (await import("@vitejs/plugin-vue")).default;
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
return [
|
|
39
|
+
VuePlugin({
|
|
40
|
+
...vuePluginApi.options,
|
|
41
|
+
include: [/\.vue$/, /\.md$/],
|
|
42
|
+
exclude: [/\.vue\?meta$/],
|
|
43
|
+
}),
|
|
44
|
+
...resolvedUserPlugins.filter((i) => i.name !== "vite:vue"),
|
|
45
|
+
];
|
|
39
46
|
};
|
|
40
47
|
export const viteConfig = {
|
|
41
48
|
root: docs,
|