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 CHANGED
@@ -1,12 +1,11 @@
1
1
  import { createServer, build, preview, mergeConfig } from "vite";
2
- import { getUserViteConfig, getUserVuePlugin, viteConfig } from "./vite-config.js";
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 vuePlugin = await getUserVuePlugin(userViteConfig);
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, type UserConfig } from "vite";
2
- import type { Api } from "@vitejs/plugin-vue";
3
- export declare const getUserViteConfig: (command: "dev" | "build" | "preview") => Promise<UserConfig>;
4
- export declare const getUserVuePlugin: (userViteConfig: UserConfig) => Promise<Plugin<Api>>;
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>[];
@@ -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
- return userConfigFile?.config ?? {};
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
- export const getUserVuePlugin = async (userViteConfig) => {
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 VuePlugin({
35
- ...vuePluginApi.options,
36
- include: [/\.vue$/, /\.md$/],
37
- exclude: [/\.vue\?meta$/],
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "do11y",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "description": "A bare-bones tool to document Vue components.",
5
5
  "license": "MIT",
6
6
  "repository": "github:sq11y/do11y",