-
Notifications
You must be signed in to change notification settings - Fork 923
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into meteorlxy-markdown-to-vue
- Loading branch information
Showing
17 changed files
with
229 additions
and
79 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# @vuepress/utils-bundler | ||
|
||
[![npm](https://badgen.net/npm/v/@vuepress/utils-bundler/next)](https://www.npmjs.com/package/@vuepress/utils-bundler) | ||
[![license](https://badgen.net/github/license/vuepress/core)](https://github.com/vuepress/core/blob/main/LICENSE) | ||
|
||
## Documentation | ||
|
||
https://vuepress.vuejs.org | ||
|
||
## License | ||
|
||
[MIT](https://github.com/vuepress/core/blob/main/LICENSE) |
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,59 @@ | ||
{ | ||
"name": "@vuepress/utils-bundler", | ||
"version": "2.0.0-rc.15", | ||
"description": "Utils package of VuePress bundler", | ||
"keywords": [ | ||
"bundler", | ||
"vuepress", | ||
"utils" | ||
], | ||
"homepage": "https://github.com/vuepress", | ||
"bugs": { | ||
"url": "https://github.com/vuepress/core/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vuepress/core.git" | ||
}, | ||
"license": "MIT", | ||
"author": "meteorlxy", | ||
"type": "module", | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "tsup", | ||
"clean": "rimraf dist" | ||
}, | ||
"dependencies": { | ||
"@vuepress/client": "workspace:*", | ||
"@vuepress/core": "workspace:*", | ||
"@vuepress/shared": "workspace:*", | ||
"@vuepress/utils": "workspace:*", | ||
"vue": "^3.5.3", | ||
"vue-router": "^4.4.3" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"tsup": { | ||
"clean": true, | ||
"dts": "./src/index.ts", | ||
"entry": [ | ||
"./src/index.ts" | ||
], | ||
"format": [ | ||
"esm" | ||
], | ||
"outDir": "./dist", | ||
"sourcemap": false, | ||
"target": "es2022", | ||
"tsconfig": "../../tsconfig.dts.json" | ||
} | ||
} |
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,29 @@ | ||
import type { CreateVueAppFunction } from '@vuepress/client' | ||
import { importFile, importFileDefault } from '@vuepress/utils' | ||
import type { App } from 'vue' | ||
import type { Router } from 'vue-router' | ||
|
||
/** | ||
* Create vue app and router for server side rendering | ||
*/ | ||
export const createVueServerApp = async ( | ||
serverAppPath: string, | ||
): Promise<{ | ||
vueApp: App | ||
vueRouter: Router | ||
}> => { | ||
// use different import function for cjs and esm | ||
const importer = serverAppPath.endsWith('.cjs') | ||
? importFileDefault | ||
: importFile | ||
|
||
// import the server app entry file | ||
const { createVueApp } = await importer<{ | ||
createVueApp: CreateVueAppFunction | ||
}>(serverAppPath) | ||
|
||
// create vue app | ||
const { app, router } = await createVueApp() | ||
|
||
return { vueApp: app, vueRouter: router } | ||
} |
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,8 @@ | ||
import type { App } from '@vuepress/core' | ||
import { fs } from '@vuepress/utils' | ||
|
||
/** | ||
* Util to read the ssr template file | ||
*/ | ||
export const getSsrTemplate = async (app: App): Promise<string> => | ||
fs.readFile(app.options.templateBuild, { encoding: 'utf8' }) |
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 @@ | ||
export * from './createVueServerApp' | ||
export * from './getSsrTemplate' | ||
export * from './renderPageToString' |
Oops, something went wrong.