Revert changes to document and root

This commit is contained in:
bogdan0083
2021-11-05 11:03:55 +07:00
parent 827140d3a4
commit fa1d219e8d
2 changed files with 6 additions and 41 deletions
+3 -21
View File
@@ -2,7 +2,7 @@
let Container = require('./container')
let LazyResult, NoWork, Processor
let LazyResult, Processor
class Document extends Container {
constructor(defaults) {
@@ -15,23 +15,9 @@ class Document extends Container {
}
toResult(opts = {}) {
let result
let lazy = new LazyResult(new Processor(), this, opts)
if (
typeof opts.plugins === 'undefined' &&
typeof opts.parser === 'undefined' &&
typeof opts.stringifier === 'undefined' &&
typeof opts.syntax === 'undefined' &&
// @TODO what to do with this warning option? do we need it here and in processor.js?
// Seems like we will not have a warning after NoWork is properly implemented.
!opts.hideNothingWarning
) {
result = new NoWork(new Processor(), this, opts)
} else {
result = new LazyResult(new Processor(), this, opts)
}
return result.stringify()
return lazy.stringify()
}
}
@@ -39,10 +25,6 @@ Document.registerLazyResult = dependant => {
LazyResult = dependant
}
Document.registerNoWork = dependant => {
NoWork = dependant
}
Document.registerProcessor = dependant => {
Processor = dependant
}
+3 -20
View File
@@ -2,7 +2,7 @@
let Container = require('./container')
let LazyResult, NoWork, Processor
let LazyResult, Processor
class Root extends Container {
constructor(defaults) {
@@ -42,21 +42,8 @@ class Root extends Container {
}
toResult(opts = {}) {
let result
if (
typeof opts.plugins === 'undefined' &&
typeof opts.parser === 'undefined' &&
typeof opts.stringifier === 'undefined' &&
typeof opts.syntax === 'undefined' &&
!opts.hideNothingWarning
) {
result = new NoWork(new Processor(), this, opts)
} else {
result = new LazyResult(new Processor(), this, opts)
}
return result.stringify()
let lazy = new LazyResult(new Processor(), this, opts)
return lazy.stringify()
}
}
@@ -64,10 +51,6 @@ Root.registerLazyResult = dependant => {
LazyResult = dependant
}
Root.registerNoWork = dependant => {
NoWork = dependant
}
Root.registerProcessor = dependant => {
Processor = dependant
}