Skip to content

Commit c8f14fc

Browse files
committed
update import type definition #41
1 parent cfbea69 commit c8f14fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+47
-44
lines changed

README.md

Lines changed: 1 addition & 1 deletion

dist/index-umd-web.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9525,6 +9525,7 @@
95259525
const path = resolve(url, currentFile).absolute;
95269526
t = new URL(path, self.origin);
95279527
}
9528+
// @ts-ignore
95289529
return fetch(t, t.origin != self.origin ? { mode: 'cors' } : {}).then(parseResponse);
95299530
}
95309531

dist/index.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
var process = require('node:process');
34
var promises = require('node:fs/promises');
45

56
exports.EnumToken = void 0;

dist/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -820,11 +820,11 @@ export declare interface MinifyFeature {
820820

821821
ordering: number;
822822

823-
register: (options: MinifyOptions | ParserOptions) => void;
824-
run: (ast: AstRule | AstAtRule, options: ParserOptions = {}, parent: AstRule | AstAtRule | AstRuleStyleSheet, context: {
825-
[key: string]: any
826-
}) => void;
827-
cleanup?: (ast: AstRuleStyleSheet, options: ParserOptions = {}, context: { [key: string]: any }) => void;
823+
register(options: MinifyOptions | ParserOptions): void;
824+
825+
// run(ast: AstRule | AstAtRule, options: ParserOptions = {}, parent: AstRule | AstAtRule | AstRuleStyleSheet, context: { [key: string]: any }): void;
826+
827+
// cleanup?(ast: AstRuleStyleSheet, options: ParserOptions = {}, context: { [key: string]: any }): void;
828828
}
829829

830830
export declare interface MinifyFeature {

dist/node/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import process from 'node:process';
12
export { EnumToken } from '../lib/ast/types.js';
23
export { minify } from '../lib/ast/minify.js';
34
export { walk, walkValues } from '../lib/ast/walk.js';

dist/web/load.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ async function load(url, currentFile) {
1818
const path = resolve(url, currentFile).absolute;
1919
t = new URL(path, self.origin);
2020
}
21+
// @ts-ignore
2122
return fetch(t, t.origin != self.origin ? { mode: 'cors' } : {}).then(parseResponse);
2223
}
2324

src/lib/ast/expand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {combinators, splitRule} from "./minify";
22
import {parseString} from "../parser";
33
import {walkValues} from "./walk";
44
import {renderToken} from "../renderer";
5-
import {AstAtRule, AstNode, AstRule, AstRuleStyleSheet, Token} from "../../@types/index.d.ts";
5+
import type {AstAtRule, AstNode, AstRule, AstRuleStyleSheet, Token} from "../../@types/index.d.ts";
66
import {EnumToken} from "./types";
77

88
export function expand(ast: AstNode): AstNode {

src/lib/ast/features/calc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AstAtRule,
33
AstDeclaration,
44
AstRule,

src/lib/ast/features/inlinecssvariables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AstAtRule, AstComment,
33
AstDeclaration,
44
AstRule, AstRuleList,

src/lib/ast/features/shorthand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {PropertyList} from "../../parser/declaration";
22
import {EnumToken} from "../types";
3-
import {AstAtRule, AstRule, AstRuleStyleSheet, MinifyOptions, PropertyListOptions} from "../../../@types/index.d.ts";
3+
import type {AstAtRule, AstRule, AstRuleStyleSheet, MinifyOptions, PropertyListOptions} from "../../../@types/index.d.ts";
44

55
export class ComputeShorthandFeature {
66

src/lib/ast/math/expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
BinaryExpressionNode,
33
BinaryExpressionToken,
44
FractionToken,

src/lib/ast/math/math.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {FractionToken} from "../../../@types/index.d.ts";
1+
import type {FractionToken} from "../../../@types/index.d.ts";
22
import {EnumToken} from "../types";
33
import {reduceNumber} from "../../renderer";
44

src/lib/ast/minify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {replaceCompound} from './expand';
55
import {doRender, renderToken} from "../renderer";
66
import * as allFeatures from "./features";
77
import {walkValues} from "./walk";
8-
import {
8+
import type {
99
AstAtRule,
1010
AstDeclaration,
1111
AstNode,

src/lib/ast/validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {EnumToken} from "./types";
2-
import {AstNode} from "../../@types/index.d.ts";
2+
import type {AstNode} from "../../@types/index.d.ts";
33

44
export function validateNode(node: AstNode, expected?: EnumToken): boolean {
55

src/lib/ast/walk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AstNode,
33
AstRuleList, BinaryExpressionToken,
44
FunctionToken,

src/lib/parser/declaration/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AstDeclaration,
33
AstNode,
44
PropertyListOptions,

src/lib/parser/declaration/map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AstDeclaration,
33
IdentToken, PropertiesConfig,
44
PropertyMapType,

src/lib/parser/declaration/set.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AstDeclaration,
33
DimensionToken,
44
LiteralToken,

src/lib/parser/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {renderToken} from "../renderer";
1818
import {COLORS_NAMES} from "../renderer/color";
1919
import {combinators, definedPropertySettings, EnumToken, expand, funcLike, minify, walk, walkValues} from "../ast";
2020
import {tokenize} from "./tokenize";
21-
import {
21+
import type {
2222
AstAtRule,
2323
AstComment,
2424
AstDeclaration,

src/lib/parser/tokenize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {isDigit, isNewLine, isNonPrintable, isWhiteSpace} from "./utils";
2-
import {Position, TokenizeResult} from "../../@types/index.d.ts";
2+
import type {Position, TokenizeResult} from "../../@types/index.d.ts";
33
import {EnumToken} from "../ast";
44

55
declare type InputStream = string;

src/lib/parser/utils/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import config from '../../../config.json' assert {type: 'json'};
2-
import {PropertiesConfig} from "../../../@types/index.d.ts";
2+
import type {PropertiesConfig} from "../../../@types/index.d.ts";
33

44
export const getConfig = () => <PropertiesConfig>config;

src/lib/parser/utils/declaration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AstDeclaration, ErrorDescription, FunctionToken, ParensToken, Position, Token} from "../../../@types/index.d.ts";
1+
import type {AstDeclaration, ErrorDescription, FunctionToken, ParensToken, Position, Token} from "../../../@types/index.d.ts";
22
import {EnumToken, walkValues} from "../../ast";
33
import {isWhiteSpace} from "./syntax";
44

src/lib/parser/utils/syntax.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import {colorsFunc} from "../../renderer";
55
import {COLORS_NAMES} from "../../renderer/color";
6-
import {
6+
import type {
77
AngleToken,
88
DimensionToken,
99
FunctionToken,

src/lib/parser/utils/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {EnumToken} from "../../ast";
2-
import {IdentToken, PropertyMapType, Token} from "../../../@types/index.d.ts";
2+
import type {IdentToken, PropertyMapType, Token} from "../../../@types/index.d.ts";
33

44
// https://www.w3.org/TR/css-values-4/#math-function
55
export const funcList: string[] = ['clamp', 'calc'];

src/lib/renderer/color/color.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AngleToken,
33
ColorKind,
44
ColorSpace,

src/lib/renderer/color/colormix.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ColorToken, IdentToken, PercentageToken, Token} from "../../../@types/index.d.ts";
1+
import type {ColorToken, IdentToken, PercentageToken, Token} from "../../../@types/index.d.ts";
22
import {isPolarColorspace, isRectangularOrthogonalColorspace} from "../../parser";
33
import {EnumToken} from "../../ast";
44
import {getNumber} from "./color";

src/lib/renderer/color/hex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ColorToken, IdentToken, NumberToken, PercentageToken} from "../../../@types/index.d.ts";
1+
import type {ColorToken, IdentToken, NumberToken, PercentageToken} from "../../../@types/index.d.ts";
22
import {EnumToken} from "../../ast";
33
import {getNumber, minmax} from "./color";
44
import {cmyk2rgb, hsl2rgb, hwb2rgb, lab2rgb, lch2rgb, oklab2rgb, oklch2rgb} from "./rgb";

src/lib/renderer/color/hsl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {hwb2hsv} from "./hsv";
2-
import {ColorToken, IdentToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
2+
import type {ColorToken, IdentToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
33
import {getNumber} from "./color";
44
import {hex2rgb, lab2rgb, lch2rgb, oklab2rgb, oklch2rgb} from "./rgb";
55
import {getComponents} from "./utils";

src/lib/renderer/color/hwb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {hsl2hsv} from "./hsv";
2-
import {AngleToken, ColorToken, IdentToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
2+
import type {AngleToken, ColorToken, IdentToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
33
import {getComponents} from "./utils";
44
import {getAngle, getNumber} from "./color";
55
import {EnumToken} from "../../ast";

src/lib/renderer/color/lab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {D50, e, getComponents, k} from "./utils";
22
import {srgb2xyz, xyzd502srgb} from "./xyz";
3-
import {ColorToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
3+
import type {ColorToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
44
import {hex2srgb, hsl2srgb, hwb2srgb, oklch2srgb, rgb2srgb} from "./srgb";
55
import {getLCHComponents} from "./lch";
66
import {getOKLABComponents, OKLab_to_XYZ} from "./oklab";

src/lib/renderer/color/lch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ColorToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
1+
import type {ColorToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
22
import {getComponents} from "./utils";
33
import {getAngle, getNumber} from "./color";
44
import {EnumToken} from "../../ast";

src/lib/renderer/color/oklab.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import {getComponents, multiplyMatrices} from "./utils";
22
import {srgb2lsrgbvalues, hex2srgb, hsl2srgb, hwb2srgb, lab2srgb, lch2srgb, rgb2srgb, lsrgb2srgbvalues} from "./srgb";
3-
import {ColorToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
3+
import type {ColorToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
44
import {getNumber} from "./color";
55
import {EnumToken} from "../../ast";
66
import {getOKLCHComponents} from "./oklch";
77
import {lch2labvalues} from "./lab";
8-
import {eq} from "../../parser/utils/eq";
98

109
export function hex2oklab(token: ColorToken) {
1110

src/lib/renderer/color/oklch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {ColorToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
2-
import {getComponents, powerlessColorComponent} from "./utils";
1+
import type {ColorToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
2+
import {getComponents} from "./utils";
33
import {getAngle, getNumber} from "./color";
44
import {EnumToken} from "../../ast";
55
import {lab2lchvalues} from "./lch";

src/lib/renderer/color/relativecolor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ColorToken, PercentageToken, Token} from "../../../@types/index.d.ts";
1+
import type {ColorToken, PercentageToken, Token} from "../../../@types/index.d.ts";
22
import {convert, getNumber} from "./color";
33
import {EnumToken, walkValues} from "../../ast";
44
import {reduceNumber} from "../render";

src/lib/renderer/color/rgb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ColorToken} from "../../../@types/index.d.ts";
1+
import type {ColorToken} from "../../../@types/index.d.ts";
22
import {minmax} from "./color";
33
import {COLORS_NAMES} from "./utils";
44
import {expandHexValue} from "./hex";

src/lib/renderer/color/srgb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// srgb-linear -> srgb
33
// 0 <= r, g, b <= 1
44
import {COLORS_NAMES, getComponents} from "./utils";
5-
import {ColorToken, DimensionToken, IdentToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
5+
import type {ColorToken, DimensionToken, IdentToken, NumberToken, PercentageToken, Token} from "../../../@types/index.d.ts";
66
import {color2srgbvalues, getAngle, getNumber} from "./color";
77
import {EnumToken} from "../../ast";
88
import {getLABComponents, Lab_to_sRGB, lch2labvalues} from "./lab";

src/lib/renderer/color/utils/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ColorToken, NumberToken, Token} from "../../../../@types/index.d.ts";
1+
import type {ColorToken, NumberToken, Token} from "../../../../@types/index.d.ts";
22
import {EnumToken} from "../../../ast";
33
import {COLORS_NAMES} from "./constants";
44
import {expandHexValue} from "../hex";

src/lib/renderer/color/utils/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ColorSpace, IdentToken} from "../../../../@types/index.d.ts";
1+
import type {ColorSpace, IdentToken} from "../../../../@types/index.d.ts";
22
import {EnumToken} from "../../../ast";
33

44
export const colorRange = {

src/lib/renderer/render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AngleToken,
33
AstAtRule,
44
AstComment,

src/lib/renderer/sourcemap/sourcemap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Location, SourceMapObject} from "../../../@types/index.d.ts";
1+
import type {Location, SourceMapObject} from "../../../@types/index.d.ts";
22
import {encode} from "./lib";
33

44
export class SourceMap {

src/node/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AstNode,
33
ParseResult,
44
ParserOptions,

src/web/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
AstNode,
33
ParseResult,
44
ParserOptions,

0 commit comments

Comments
 (0)