mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
fix(ssr): add debug
This commit is contained in:
parent
8cb4189b96
commit
6b9e0922cf
@ -6,6 +6,7 @@ import { isAbsolutePath } from '../../src/core/router/util'
|
|||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
import { resolve, basename } from 'path'
|
import { resolve, basename } from 'path'
|
||||||
import resolvePathname from 'resolve-pathname'
|
import resolvePathname from 'resolve-pathname'
|
||||||
|
import debug from 'debug'
|
||||||
|
|
||||||
function cwd (...args) {
|
function cwd (...args) {
|
||||||
return resolve(process.cwd(), ...args)
|
return resolve(process.cwd(), ...args)
|
||||||
@ -112,10 +113,12 @@ export default class Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _loadFile (filePath) {
|
async _loadFile (filePath) {
|
||||||
|
debug('docsify')(`load > ${filePath}`)
|
||||||
let content
|
let content
|
||||||
try {
|
try {
|
||||||
if (isAbsolutePath(filePath)) {
|
if (isAbsolutePath(filePath)) {
|
||||||
const res = await fetch(filePath)
|
const res = await fetch(filePath)
|
||||||
|
if (!res.ok) throw Error()
|
||||||
content = await res.text()
|
content = await res.text()
|
||||||
this.lock = 0
|
this.lock = 0
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
"test": "echo 'hello'"
|
"test": "echo 'hello'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"debug": "^2.6.8",
|
||||||
"node-fetch": "^1.7.0",
|
"node-fetch": "^1.7.0",
|
||||||
"resolve-pathname": "^2.1.0"
|
"resolve-pathname": "^2.1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user