@vuepress/core
Advanced tools
Comparing version 2.0.0-beta.50 to 2.0.0-beta.51
@@ -303,6 +303,2 @@ import { MarkdownLink, MarkdownSfcBlocks, MarkdownOptions, Markdown, MarkdownHeader } from '@vuepress/markdown'; | ||
/** | ||
* Specify the layouts directory or components map | ||
*/ | ||
layouts?: string | Record<string, string>; | ||
/** | ||
* Allow using plugins in theme | ||
@@ -325,6 +321,2 @@ */ | ||
/** | ||
* Layout components | ||
*/ | ||
layouts: Record<string, string>; | ||
/** | ||
* Plugins, including theme itself and plugins used by theme | ||
@@ -510,8 +502,2 @@ */ | ||
/** | ||
* Layout components. | ||
* | ||
* Only available after initialization | ||
*/ | ||
layouts: Record<string, string>; | ||
/** | ||
* Markdown-it instance. | ||
@@ -558,7 +544,2 @@ * | ||
/** | ||
* Generate layout components temp file | ||
*/ | ||
declare const prepareLayoutComponents: (app: App) => Promise<void>; | ||
/** | ||
* Generate page component temp file of a single page | ||
@@ -661,3 +642,3 @@ */ | ||
*/ | ||
declare const resolveAppVersion: () => Promise<string>; | ||
declare const resolveAppVersion: () => string; | ||
@@ -679,7 +660,2 @@ /** | ||
/** | ||
* Resolve layouts from `layouts` option | ||
*/ | ||
declare const resolveThemeLayouts: (layouts?: ThemeObject['layouts']) => Record<string, string>; | ||
declare const createPage: (app: App, options: PageOptions) => Promise<Page>; | ||
@@ -856,2 +832,2 @@ | ||
export { AliasDefineHook, App, AppConfig, AppConfigBuild, AppConfigCommon, AppConfigDev, AppDir, AppDirFunction, AppEnv, AppOptions, AppWriteTemp, BuildApp, Bundler, ClientConfigFileHook, DevApp, ExtendsHook, Hook, HookItem, HookQueue, Hooks, HooksExposed, HooksName, HooksNormalized, HooksResult, LifeCycleHook, Page, PageOptions, Plugin, PluginApi, PluginConfig, PluginFunction, PluginObject, Theme, ThemeFunction, ThemeInfo, ThemeObject, appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, prepareClientConfigs, prepareLayoutComponents, preparePageComponent, preparePageData, preparePagesComponents, preparePagesData, preparePagesRoutes, prepareSiteData, renderPageContent, resolveAppDir, resolveAppEnv, resolveAppOptions, resolveAppPages, resolveAppSiteData, resolveAppVersion, resolveAppWriteTemp, resolvePageComponentInfo, resolvePageDataInfo, resolvePageDate, resolvePageFileContent, resolvePageFilePath, resolvePageHtmlInfo, resolvePageKey, resolvePageLang, resolvePagePath, resolvePagePermalink, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo, resolveThemeLayouts }; | ||
export { AliasDefineHook, App, AppConfig, AppConfigBuild, AppConfigCommon, AppConfigDev, AppDir, AppDirFunction, AppEnv, AppOptions, AppWriteTemp, BuildApp, Bundler, ClientConfigFileHook, DevApp, ExtendsHook, Hook, HookItem, HookQueue, Hooks, HooksExposed, HooksName, HooksNormalized, HooksResult, LifeCycleHook, Page, PageOptions, Plugin, PluginApi, PluginConfig, PluginFunction, PluginObject, Theme, ThemeFunction, ThemeInfo, ThemeObject, appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, prepareClientConfigs, preparePageComponent, preparePageData, preparePagesComponents, preparePagesData, preparePagesRoutes, prepareSiteData, renderPageContent, resolveAppDir, resolveAppEnv, resolveAppOptions, resolveAppPages, resolveAppSiteData, resolveAppVersion, resolveAppWriteTemp, resolvePageComponentInfo, resolvePageDataInfo, resolvePageDate, resolvePageFileContent, resolvePageFilePath, resolvePageHtmlInfo, resolvePageKey, resolvePageLang, resolvePagePath, resolvePagePermalink, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo }; |
@@ -15,15 +15,2 @@ // src/app/prepare/prepareClientConfigs.ts | ||
// src/app/prepare/prepareLayoutComponents.ts | ||
var prepareLayoutComponents = async (app) => { | ||
const content = `import { defineAsyncComponent } from 'vue' | ||
export const layoutComponents = {${Object.entries(app.layouts).map( | ||
([name, path10]) => ` | ||
${JSON.stringify(name)}: defineAsyncComponent(() => import(${app.env.isDebug ? `/* webpackChunkName: "layout-${name}" */` : ""}${JSON.stringify(path10)})),` | ||
).join("")} | ||
} | ||
`; | ||
await app.writeTemp("internal/layoutComponents.js", content); | ||
}; | ||
// src/app/prepare/preparePageComponent.ts | ||
@@ -75,4 +62,4 @@ var preparePageComponent = async (app, page) => { | ||
export const pagesComponents = {${app.pages.map( | ||
({ key, path: path10, componentFilePath, componentFileChunkName }) => ` | ||
// path: ${path10} | ||
({ key, path: path9, componentFilePath, componentFileChunkName }) => ` | ||
// path: ${path9} | ||
${JSON.stringify(key)}: defineAsyncComponent(() => import(${componentFileChunkName ? `/* webpackChunkName: "${componentFileChunkName}" */` : ""}${JSON.stringify(componentFilePath)})),` | ||
@@ -88,4 +75,4 @@ ).join("")} | ||
const content = `export const pagesData = {${app.pages.map( | ||
({ key, path: path10, dataFilePath, dataFileChunkName }) => ` | ||
// path: ${path10} | ||
({ key, path: path9, dataFilePath, dataFileChunkName }) => ` | ||
// path: ${path9} | ||
${JSON.stringify(key)}: () => import(${dataFileChunkName ? `/* webpackChunkName: "${dataFileChunkName}" */` : ""}${JSON.stringify(dataFilePath)}).then(({ data }) => data),` | ||
@@ -102,3 +89,3 @@ ).join("")} | ||
key, | ||
path: path10, | ||
path: path9, | ||
pathInferred, | ||
@@ -109,7 +96,7 @@ filePathRelative, | ||
const redirectsSet = /* @__PURE__ */ new Set(); | ||
redirectsSet.add(decodeURI(path10)); | ||
if (path10.endsWith("/")) { | ||
redirectsSet.add(path10 + "index.html"); | ||
redirectsSet.add(decodeURI(path9)); | ||
if (path9.endsWith("/")) { | ||
redirectsSet.add(path9 + "index.html"); | ||
} else { | ||
redirectsSet.add(path10.replace(/.html$/, "")); | ||
redirectsSet.add(path9.replace(/.html$/, "")); | ||
} | ||
@@ -125,4 +112,4 @@ if (pathInferred !== null) { | ||
} | ||
redirectsSet.delete(path10); | ||
return [key, path10, routeMeta, [...redirectsSet]]; | ||
redirectsSet.delete(path9); | ||
return [key, path9, routeMeta, [...redirectsSet]]; | ||
}; | ||
@@ -389,3 +376,3 @@ var preparePagesRoutes = async (app) => { | ||
import { hash } from "@vuepress/utils"; | ||
var resolvePageKey = ({ path: path10 }) => `v-${hash(path10)}`; | ||
var resolvePageKey = ({ path: path9 }) => `v-${hash(path9)}`; | ||
@@ -519,7 +506,7 @@ // src/page/resolvePageLang.ts | ||
}); | ||
const path10 = resolvePagePath({ permalink, pathInferred, options }); | ||
const key = resolvePageKey({ path: path10 }); | ||
const path9 = resolvePagePath({ permalink, pathInferred, options }); | ||
const key = resolvePageKey({ path: path9 }); | ||
const { htmlFilePath, htmlFilePathRelative } = resolvePageHtmlInfo({ | ||
app, | ||
path: path10 | ||
path: path9 | ||
}); | ||
@@ -539,3 +526,3 @@ const { | ||
key, | ||
path: path10, | ||
path: path9, | ||
title, | ||
@@ -548,3 +535,3 @@ lang, | ||
key, | ||
path: path10, | ||
path: path9, | ||
title, | ||
@@ -597,3 +584,3 @@ lang, | ||
frontmatter: { | ||
layout: "404" | ||
layout: "NotFound" | ||
} | ||
@@ -632,3 +619,2 @@ }) | ||
await preparePagesRoutes(app); | ||
await prepareLayoutComponents(app); | ||
await prepareSiteData(app); | ||
@@ -907,4 +893,4 @@ await prepareClientConfigs(app); | ||
var require4 = createRequire3(import.meta.url); | ||
var resolveAppVersion = async () => { | ||
const pkgJson = await fs3.readJSON( | ||
var resolveAppVersion = () => { | ||
const pkgJson = fs3.readJsonSync( | ||
require4.resolve("@vuepress/core/package.json") | ||
@@ -931,19 +917,2 @@ ); | ||
// src/app/resolveThemeLayouts.ts | ||
import { isPlainObject } from "@vuepress/shared"; | ||
import { chalk as chalk3, fs as fs5, logger as logger5, path as path9 } from "@vuepress/utils"; | ||
var resolveThemeLayouts = (layouts = {}) => { | ||
if (isPlainObject(layouts)) { | ||
return layouts; | ||
} | ||
if (!fs5.pathExistsSync(layouts)) { | ||
throw logger5.createError( | ||
`layouts directory does not exist: ${chalk3.magenta(layouts)}` | ||
); | ||
} | ||
return Object.fromEntries( | ||
fs5.readdirSync(layouts).filter((file) => /\.(vue|ts|js)$/.test(file)).map((file) => [path9.trimExt(file), path9.resolve(layouts, file)]) | ||
); | ||
}; | ||
// src/app/resolveThemeInfo.ts | ||
@@ -953,3 +922,2 @@ var resolveThemeInfo = (app, theme) => { | ||
const themeInfo = { | ||
layouts: resolveThemeLayouts(themeObject.layouts), | ||
plugins: [...themeObject.plugins ?? [], themeObject], | ||
@@ -964,3 +932,2 @@ templateBuild: themeObject.templateBuild, | ||
return { | ||
layouts: { ...parentThemeInfo.layouts, ...themeInfo.layouts }, | ||
plugins: [...parentThemeInfo.plugins, ...themeInfo.plugins], | ||
@@ -975,3 +942,2 @@ templateBuild: themeObject.templateBuild ?? parentThemeInfo.templateBuild, | ||
const themeInfo = resolveThemeInfo(app, app.options.theme); | ||
app.layouts = themeInfo.layouts; | ||
app.options.templateDev = config.templateDev ?? themeInfo.templateDev ?? app.options.templateDev; | ||
@@ -1037,3 +1003,2 @@ app.options.templateBuild = config.templateBuild ?? themeInfo.templateBuild ?? app.options.templateBuild; | ||
prepareClientConfigs, | ||
prepareLayoutComponents, | ||
preparePageComponent, | ||
@@ -1066,4 +1031,3 @@ preparePageData, | ||
resolvePluginObject, | ||
resolveThemeInfo, | ||
resolveThemeLayouts | ||
resolveThemeInfo | ||
}; |
{ | ||
"name": "@vuepress/core", | ||
"version": "2.0.0-beta.50", | ||
"version": "2.0.0-beta.51", | ||
"description": "Core package of VuePress", | ||
@@ -30,6 +30,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@vuepress/client": "2.0.0-beta.50", | ||
"@vuepress/markdown": "2.0.0-beta.50", | ||
"@vuepress/shared": "2.0.0-beta.50", | ||
"@vuepress/utils": "2.0.0-beta.50", | ||
"@vuepress/client": "2.0.0-beta.51", | ||
"@vuepress/markdown": "2.0.0-beta.51", | ||
"@vuepress/shared": "2.0.0-beta.51", | ||
"@vuepress/utils": "2.0.0-beta.51", | ||
"vue": "^3.2.37" | ||
@@ -36,0 +36,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
50807
1741
+ Added@mdit-vue/plugin-component@0.10.0(transitive)
+ Added@mdit-vue/plugin-frontmatter@0.10.0(transitive)
+ Added@mdit-vue/plugin-headers@0.10.0(transitive)
+ Added@mdit-vue/plugin-sfc@0.10.0(transitive)
+ Added@mdit-vue/plugin-title@0.10.0(transitive)
+ Added@mdit-vue/plugin-toc@0.10.0(transitive)
+ Added@mdit-vue/shared@0.10.0(transitive)
+ Added@mdit-vue/types@0.10.0(transitive)
+ Added@vuepress/client@2.0.0-beta.51(transitive)
+ Added@vuepress/markdown@2.0.0-beta.51(transitive)
+ Added@vuepress/shared@2.0.0-beta.51(transitive)
+ Added@vuepress/utils@2.0.0-beta.51(transitive)
- Removed@mdit-vue/plugin-component@0.9.4(transitive)
- Removed@mdit-vue/plugin-frontmatter@0.9.2(transitive)
- Removed@mdit-vue/plugin-headers@0.9.3(transitive)
- Removed@mdit-vue/plugin-sfc@0.9.2(transitive)
- Removed@mdit-vue/plugin-title@0.9.3(transitive)
- Removed@mdit-vue/plugin-toc@0.9.2(transitive)
- Removed@mdit-vue/shared@0.9.2(transitive)
- Removed@mdit-vue/types@0.9.2(transitive)
- Removed@vuepress/client@2.0.0-beta.50(transitive)
- Removed@vuepress/markdown@2.0.0-beta.50(transitive)
- Removed@vuepress/shared@2.0.0-beta.50(transitive)
- Removed@vuepress/utils@2.0.0-beta.50(transitive)