Начат фронтенд

This commit is contained in:
Georgiy Syralev
2025-09-16 14:47:30 +03:00
parent f37e85e2e0
commit 40de29041d
2100 changed files with 305701 additions and 11807 deletions

View File

@@ -1,62 +1,12 @@
'use strict'
let MapGenerator = require('./map-generator')
let parse = require('./parse')
const Result = require('./result')
let stringify = require('./stringify')
let warnOnce = require('./warn-once')
let parse = require('./parse')
const Result = require('./result')
class NoWorkResult {
get content() {
return this.result.css
}
get css() {
return this.result.css
}
get map() {
return this.result.map
}
get messages() {
return []
}
get opts() {
return this.result.opts
}
get processor() {
return this.result.processor
}
get root() {
if (this._root) {
return this._root
}
let root
let parser = parse
try {
root = parser(this._css, this._opts)
} catch (error) {
this.error = error
}
if (this.error) {
throw this.error
} else {
this._root = root
return root
}
}
get [Symbol.toStringTag]() {
return 'NoWorkResult'
}
constructor(processor, css, opts) {
css = css.toString()
this.stringified = false
@@ -87,28 +37,65 @@ class NoWorkResult {
if (generatedMap) {
this.result.map = generatedMap
}
} else {
map.clearAnnotation()
this.result.css = map.css
}
}
async() {
if (this.error) return Promise.reject(this.error)
return Promise.resolve(this.result)
get [Symbol.toStringTag]() {
return 'NoWorkResult'
}
catch(onRejected) {
return this.async().catch(onRejected)
get processor() {
return this.result.processor
}
finally(onFinally) {
return this.async().then(onFinally, onFinally)
get opts() {
return this.result.opts
}
sync() {
if (this.error) throw this.error
return this.result
get css() {
return this.result.css
}
get content() {
return this.result.css
}
get map() {
return this.result.map
}
get root() {
if (this._root) {
return this._root
}
let root
let parser = parse
try {
root = parser(this._css, this._opts)
} catch (error) {
this.error = error
}
if (this.error) {
throw this.error
} else {
this._root = root
return root
}
}
get messages() {
return []
}
warnings() {
return []
}
toString() {
return this._css
}
then(onFulfilled, onRejected) {
@@ -125,12 +112,22 @@ class NoWorkResult {
return this.async().then(onFulfilled, onRejected)
}
toString() {
return this._css
catch(onRejected) {
return this.async().catch(onRejected)
}
warnings() {
return []
finally(onFinally) {
return this.async().then(onFinally, onFinally)
}
async() {
if (this.error) return Promise.reject(this.error)
return Promise.resolve(this.result)
}
sync() {
if (this.error) throw this.error
return this.result
}
}