Urara-Blog/node_modules/.pnpm-store/v3/files/31/3f8056c59741aaa6b7e9de4d0f0a51222ba11c56f4eaae5af2b365a978c39b0d34c3a000d89a31ab0c6d8bf094b4c4e0c1d617ac36d3dbc46e45f9be37e2c3
2022-08-14 01:14:53 +08:00

33 lines
654 B
Text

'use strict'
let Container = require('./container')
let LazyResult, Processor
class Document extends Container {
constructor(defaults) {
// type needs to be passed to super, otherwise child roots won't be normalized correctly
super({ type: 'document', ...defaults })
if (!this.nodes) {
this.nodes = []
}
}
toResult(opts = {}) {
let lazy = new LazyResult(new Processor(), this, opts)
return lazy.stringify()
}
}
Document.registerLazyResult = dependant => {
LazyResult = dependant
}
Document.registerProcessor = dependant => {
Processor = dependant
}
module.exports = Document
Document.default = Document