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

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,14 +1,8 @@
import Document from './document.js'
import Result, { Message, ResultOptions } from './result.js'
import { SourceMap } from './postcss.js'
import Processor from './processor.js'
import Result, { Message, ResultOptions } from './result.js'
import Root from './root.js'
import Warning from './warning.js'
declare namespace LazyResult {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { LazyResult_ as default }
}
import Root from './root.js'
/**
* A Promise proxy for the result of PostCSS transformations.
@@ -19,9 +13,22 @@ declare namespace LazyResult {
* const lazy = postcss([autoprefixer]).process(css)
* ```
*/
declare class LazyResult_<RootNode = Document | Root>
implements PromiseLike<Result<RootNode>>
{
export default class LazyResult implements PromiseLike<Result> {
/**
* Processes input CSS through synchronous and asynchronous plugins
* and calls `onFulfilled` with a Result instance. If a plugin throws
* an error, the `onRejected` callback will be executed.
*
* It implements standard Promise API.
*
* ```js
* postcss([autoprefixer]).process(css, { from: cssPath }).then(result => {
* console.log(result.css)
* })
* ```
*/
then: Promise<Result>['then']
/**
* Processes input CSS through synchronous and asynchronous plugins
* and calls onRejected for each error thrown in any plugin.
@@ -36,7 +43,7 @@ declare class LazyResult_<RootNode = Document | Root>
* })
* ```
*/
catch: Promise<Result<RootNode>>['catch']
catch: Promise<Result>['catch']
/**
* Processes input CSS through synchronous and asynchronous plugins
@@ -50,34 +57,31 @@ declare class LazyResult_<RootNode = Document | Root>
* })
* ```
*/
finally: Promise<Result<RootNode>>['finally']
finally: Promise<Result>['finally']
/**
* Processes input CSS through synchronous and asynchronous plugins
* and calls `onFulfilled` with a Result instance. If a plugin throws
* an error, the `onRejected` callback will be executed.
*
* It implements standard Promise API.
*
* ```js
* postcss([autoprefixer]).process(css, { from: cssPath }).then(result => {
* console.log(result.css)
* })
* ```
* @param processor Processor used for this transformation.
* @param css CSS to parse and transform.
* @param opts Options from the `Processor#process` or `Root#toResult`.
*/
then: Promise<Result<RootNode>>['then']
constructor(processor: Processor, css: string, opts: ResultOptions)
/**
* An alias for the `css` property. Use it with syntaxes
* that generate non-CSS output.
*
* This property will only work with synchronous plugins.
* If the processor contains any asynchronous plugins
* it will throw an error.
*
* PostCSS runners should always use `LazyResult#then`.
* Returns the default string description of an object.
* Required to implement the Promise interface.
*/
get content(): string
get [Symbol.toStringTag](): string
/**
* Returns a `Processor` instance, which will be used
* for CSS transformations.
*/
get processor(): Processor
/**
* Options from the `Processor#process` call.
*/
get opts(): ResultOptions
/**
* Processes input CSS through synchronous plugins, converts `Root`
@@ -91,6 +95,18 @@ declare class LazyResult_<RootNode = Document | Root>
*/
get css(): string
/**
* An alias for the `css` property. Use it with syntaxes
* that generate non-CSS output.
*
* This property will only work with synchronous plugins.
* If the processor contains any asynchronous plugins
* it will throw an error.
*
* PostCSS runners should always use `LazyResult#then`.
*/
get content(): string
/**
* Processes input CSS through synchronous plugins
* and returns `Result#map`.
@@ -103,6 +119,17 @@ declare class LazyResult_<RootNode = Document | Root>
*/
get map(): SourceMap
/**
* Processes input CSS through synchronous plugins
* and returns `Result#root`.
*
* This property will only work with synchronous plugins. If the processor
* contains any asynchronous plugins it will throw an error.
*
* PostCSS runners should always use `LazyResult#then`.
*/
get root(): Root
/**
* Processes input CSS through synchronous plugins
* and returns `Result#messages`.
@@ -114,54 +141,13 @@ declare class LazyResult_<RootNode = Document | Root>
*/
get messages(): Message[]
/**
* Options from the `Processor#process` call.
*/
get opts(): ResultOptions
/**
* Returns a `Processor` instance, which will be used
* for CSS transformations.
*/
get processor(): Processor
/**
* Processes input CSS through synchronous plugins
* and returns `Result#root`.
* and calls `Result#warnings`.
*
* This property will only work with synchronous plugins. If the processor
* contains any asynchronous plugins it will throw an error.
*
* PostCSS runners should always use `LazyResult#then`.
* @return Warnings from plugins.
*/
get root(): RootNode
/**
* Returns the default string description of an object.
* Required to implement the Promise interface.
*/
get [Symbol.toStringTag](): string
/**
* @param processor Processor used for this transformation.
* @param css CSS to parse and transform.
* @param opts Options from the `Processor#process` or `Root#toResult`.
*/
constructor(processor: Processor, css: string, opts: ResultOptions)
/**
* Run plugin in async way and return `Result`.
*
* @return Result with output content.
*/
async(): Promise<Result<RootNode>>
/**
* Run plugin in sync way and return `Result`.
*
* @return Result with output content.
*/
sync(): Result<RootNode>
warnings(): Warning[]
/**
* Alias for the `LazyResult#css` property.
@@ -175,16 +161,16 @@ declare class LazyResult_<RootNode = Document | Root>
toString(): string
/**
* Processes input CSS through synchronous plugins
* and calls `Result#warnings`.
* Run plugin in sync way and return `Result`.
*
* @return Warnings from plugins.
* @return Result with output content.
*/
warnings(): Warning[]
sync(): Result
/**
* Run plugin in async way and return `Result`.
*
* @return Result with output content.
*/
async(): Promise<Result>
}
declare class LazyResult<
RootNode = Document | Root
> extends LazyResult_<RootNode> {}
export = LazyResult