MCPcopy
hub / github.com/postcss/postcss / sync

Method sync

lib/lazy-result.js:402–437  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

400 }
401
402 sync() {
403 if (this.error) throw this.error
404 if (this.processed) return this.result
405 this.processed = true
406
407 if (this.processing) {
408 throw this.getAsyncError()
409 }
410
411 for (let plugin of this.plugins) {
412 let promise = this.runOnRoot(plugin)
413 if (isPromise(promise)) {
414 throw this.getAsyncError()
415 }
416 }
417
418 this.prepareVisitors()
419 if (this.hasListener) {
420 let root = this.result.root
421 while (!root[isClean]) {
422 root[isClean] = true
423 this.walkSync(root)
424 }
425 if (this.listeners.OnceExit) {
426 if (root.type === 'document') {
427 for (let subRoot of root.nodes) {
428 this.visitSync(this.listeners.OnceExit, subRoot)
429 }
430 } else {
431 this.visitSync(this.listeners.OnceExit, root)
432 }
433 }
434 }
435
436 return this.result
437 }
438
439 then(onFulfilled, onRejected) {
440 if (process.env.NODE_ENV !== 'production') {

Callers 7

messagesMethod · 0.95
rootMethod · 0.95
stringifyMethod · 0.95
warningsMethod · 0.95
processor.test.tsFile · 0.45
result.test.tsFile · 0.45

Calls 6

getAsyncErrorMethod · 0.95
runOnRootMethod · 0.95
prepareVisitorsMethod · 0.95
walkSyncMethod · 0.95
visitSyncMethod · 0.95
isPromiseFunction · 0.85

Tested by

no test coverage detected