-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,012 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extend: 'vuepress-theme-parent' | ||
} |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
jest.mock('vuepress-theme-parent') | ||
jest.mock('vuepress-theme-child') | ||
|
||
import ThemeAPI from '../../lib/theme-api' | ||
import { resolve } from 'path' | ||
|
||
const theme = { | ||
path: resolve(process.cwd(), '__mocks__/vuepress-theme-child'), | ||
name: 'vuepress-theme-child', | ||
shortcut: 'child', | ||
entryFile: require('vuepress-theme-child') | ||
} | ||
|
||
const parent = { | ||
path: resolve(process.cwd(), '__mocks__/vuepress-theme-parent'), | ||
name: 'vuepress-theme-parent', | ||
shortcut: 'parent', | ||
entryFile: {} | ||
} | ||
|
||
describe('ThemeAPI', () => { | ||
test('extend', async () => { | ||
const themeAPI = new ThemeAPI(theme, parent) | ||
console.log(themeAPI.theme.entry) | ||
}) | ||
// loadTheme('vuepress-theme-child') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 2 additions & 11 deletions
13
packages/@vuepress/core/lib/internal-plugins/layoutComponents.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,13 @@ | ||
module.exports = (options, ctx) => { | ||
const { layoutComponentMap } = ctx | ||
const componentNames = Object.keys(layoutComponentMap) | ||
|
||
return { | ||
name: '@vuepress/internal-layout-components', | ||
|
||
async clientDynamicModules () { | ||
const componentNames = Object.keys(ctx.themeAPI.layoutComponentMap) | ||
const code = `export default {\n${componentNames | ||
.map(name => ` ${JSON.stringify(name)}: () => import(${JSON.stringify(layoutComponentMap[name].path)})`) | ||
.map(name => ` ${JSON.stringify(name)}: () => import(${JSON.stringify(ctx.themeAPI.layoutComponentMap[name].path)})`) | ||
.join(',\n')} \n}` | ||
return { name: 'layout-components.js', content: code, dirname: 'internal' } | ||
}, | ||
|
||
chainWebpack (config, isServer) { | ||
const setAlias = (alias, raw) => config.resolve.alias.set(alias, raw) | ||
componentNames.forEach(name => { | ||
setAlias(`@${name}`, layoutComponentMap[name].path) | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.