@vuepress/bundlerutils 2.0.0-rc.31 → 2.0.0-rc.32

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/index.d.ts CHANGED
@@ -4,43 +4,34 @@ import { VuepressSSRContext } from "@vuepress/shared";
4
4
  import { Router } from "vue-router";
5
5
  import { SSRContext } from "vue/server-renderer";
6
6
  import { MarkdownLink } from "@vuepress/markdown";
7
- //#region src/build/types.d.ts
8
7
  /**
9
8
  * Map from page route path to its chunk output file names.
10
9
  * Used by prefetch/preload strategy.
11
10
  */
12
11
  type PageChunkFilesMap = Map<string, string[]>;
13
- //#endregion
14
- //#region src/build/createPageChunkFilesMap.d.ts
15
12
  /**
16
13
  * Create a map from page route paths to their chunk output file names.
17
14
  */
18
- declare const createPageChunkFilesMap: ({ pages, resolvePageChunkFiles }: {
15
+ export declare const createPageChunkFilesMap: ({ pages, resolvePageChunkFiles }: {
19
16
  pages: Page[];
20
17
  resolvePageChunkFiles: (page: Page) => string[];
21
18
  }) => PageChunkFilesMap;
22
- //#endregion
23
- //#region src/build/createVueServerApp.d.ts
24
19
  /**
25
20
  * Create vue app and router for server side rendering
26
21
  */
27
- declare const createVueServerApp: (serverAppPath: string) => Promise<{
22
+ export declare const createVueServerApp: (serverAppPath: string) => Promise<{
28
23
  vueApp: App$1;
29
24
  vueRouter: Router;
30
25
  }>;
31
- //#endregion
32
- //#region src/build/getSsrTemplate.d.ts
33
26
  /**
34
27
  * Util to read the ssr template file
35
28
  */
36
- declare const getSsrTemplate: (app: App) => Promise<string>;
37
- //#endregion
38
- //#region src/build/renderPageToString.d.ts
39
- type PageSSRContext = SSRContext & VuepressSSRContext;
29
+ export declare const getSsrTemplate: (app: App) => Promise<string>;
30
+ export type PageSSRContext = SSRContext & VuepressSSRContext;
40
31
  /**
41
32
  * Render a vuepress page to string
42
33
  */
43
- declare const renderPageToString: <T extends PageSSRContext = PageSSRContext>({ page, vueApp, vueRouter, ssrContextInit }: {
34
+ export declare const renderPageToString: <T extends PageSSRContext = PageSSRContext>({ page, vueApp, vueRouter, ssrContextInit }: {
44
35
  page: Page;
45
36
  vueApp: App$1;
46
37
  vueRouter: Router;
@@ -49,28 +40,23 @@ declare const renderPageToString: <T extends PageSSRContext = PageSSRContext>({
49
40
  ssrContext: T;
50
41
  ssrString: string;
51
42
  }>;
52
- //#endregion
53
- //#region src/build/resolveLinkRoutePath.d.ts
54
43
  /**
55
44
  * Normalize a MarkdownLink to a route path
56
45
  * that can be matched against Page.path.
57
46
  *
58
47
  * Returns null if the link is unresolvable.
59
48
  */
60
- declare const resolveLinkRoutePath: ({ base, current, link }: {
49
+ export declare const resolveLinkRoutePath: ({ base, current, link }: {
61
50
  base: string;
62
51
  current: string;
63
52
  link: MarkdownLink;
64
53
  }) => string | null;
65
- //#endregion
66
- //#region src/build/resolveLinkedPageChunkFiles.d.ts
67
54
  /**
68
55
  * Resolve the chunk output file names of pages linked from the current page.
69
56
  */
70
- declare const resolveLinkedPageChunkFiles: ({ base, page, pageChunkFilesMap }: {
57
+ export declare const resolveLinkedPageChunkFiles: ({ base, page, pageChunkFilesMap }: {
71
58
  base: string;
72
59
  page: Page;
73
60
  pageChunkFilesMap: PageChunkFilesMap;
74
61
  }) => Set<string>;
75
- //#endregion
76
- export { type PageChunkFilesMap, PageSSRContext, createPageChunkFilesMap, createVueServerApp, getSsrTemplate, renderPageToString, resolveLinkRoutePath, resolveLinkedPageChunkFiles };
62
+ export type { PageChunkFilesMap };
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { resolvePageRedirects } from "@vuepress/core";
2
2
  import { fs, importFile, importFileDefault } from "@vuepress/utils";
3
3
  import { ssrContextKey } from "vue";
4
4
  import { inferRoutePath, normalizeRoutePath } from "@vuepress/shared";
5
- //#region src/build/createPageChunkFilesMap.ts
5
+ // src/build/createPageChunkFilesMap.ts
6
6
  /**
7
7
  * Create a map from page route paths to their chunk output file names.
8
8
  */
@@ -16,8 +16,7 @@ const createPageChunkFilesMap = ({ pages, resolvePageChunkFiles }) => {
16
16
  }
17
17
  return pageChunkFilesMap;
18
18
  };
19
- //#endregion
20
- //#region src/build/createVueServerApp.ts
19
+ // src/build/createVueServerApp.ts
21
20
  /**
22
21
  * Create vue app and router for server side rendering
23
22
  */
@@ -29,14 +28,12 @@ const createVueServerApp = async (serverAppPath) => {
29
28
  vueRouter: router
30
29
  };
31
30
  };
32
- //#endregion
33
- //#region src/build/getSsrTemplate.ts
31
+ // src/build/getSsrTemplate.ts
34
32
  /**
35
33
  * Util to read the ssr template file
36
34
  */
37
35
  const getSsrTemplate = async (app) => fs.readFile(app.options.templateBuild, { encoding: "utf8" });
38
- //#endregion
39
- //#region src/build/renderPageToString.ts
36
+ // src/build/renderPageToString.ts
40
37
  /**
41
38
  * Render a vuepress page to string
42
39
  */
@@ -55,8 +52,7 @@ const renderPageToString = async ({ page, vueApp, vueRouter, ssrContextInit }) =
55
52
  ssrString: await renderToString(vueApp, ssrContext)
56
53
  };
57
54
  };
58
- //#endregion
59
- //#region src/build/resolveLinkRoutePath.ts
55
+ // src/build/resolveLinkRoutePath.ts
60
56
  /**
61
57
  * Normalize a MarkdownLink to a route path
62
58
  * that can be matched against Page.path.
@@ -65,10 +61,10 @@ const renderPageToString = async ({ page, vueApp, vueRouter, ssrContextInit }) =
65
61
  */
66
62
  const resolveLinkRoutePath = ({ base, current, link }) => {
67
63
  if (!link.absolute) return link.relative ? normalizeRoutePath(link.relative, current) : null;
68
- return inferRoutePath(link.absolute.startsWith(base) ? `/${link.absolute.slice(base.length)}` : link.absolute);
64
+ const pathWithoutBase = link.absolute.startsWith(base) ? `/${link.absolute.slice(base.length)}` : link.absolute;
65
+ return inferRoutePath(pathWithoutBase);
69
66
  };
70
- //#endregion
71
- //#region src/build/resolveLinkedPageChunkFiles.ts
67
+ // src/build/resolveLinkedPageChunkFiles.ts
72
68
  /**
73
69
  * Resolve the chunk output file names of pages linked from the current page.
74
70
  */
@@ -87,5 +83,4 @@ const resolveLinkedPageChunkFiles = ({ base, page, pageChunkFilesMap }) => {
87
83
  }
88
84
  return linkedPageChunkFiles;
89
85
  };
90
- //#endregion
91
86
  export { createPageChunkFilesMap, createVueServerApp, getSsrTemplate, renderPageToString, resolveLinkRoutePath, resolveLinkedPageChunkFiles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/bundlerutils",
3
- "version": "2.0.0-rc.31",
3
+ "version": "2.0.0-rc.32",
4
4
  "description": "Utils package of VuePress bundler",
5
5
  "keywords": [
6
6
  "bundler",
@@ -32,13 +32,13 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "vue": "^3.5.40",
36
- "vue-router": "^5.2.0",
37
- "@vuepress/client": "2.0.0-rc.31",
38
- "@vuepress/shared": "2.0.0-rc.31",
39
- "@vuepress/core": "2.0.0-rc.31",
40
- "@vuepress/markdown": "2.0.0-rc.31",
41
- "@vuepress/utils": "2.0.0-rc.31"
35
+ "@vuepress/client": "2.0.0-rc.32",
36
+ "@vuepress/core": "2.0.0-rc.32",
37
+ "@vuepress/markdown": "2.0.0-rc.32",
38
+ "@vuepress/shared": "2.0.0-rc.32",
39
+ "@vuepress/utils": "2.0.0-rc.32",
40
+ "vue": "^3.5.45",
41
+ "vue-router": "^5.4.0"
42
42
  },
43
43
  "tsdown": {
44
44
  "dts": true,