@csstools/css-tokenizer
Advanced tools
Comparing version
# Changes to CSS Tokenizer | ||
### 2.1.1 (April 10, 2023) | ||
### 2.2.0 | ||
_July 24, 2023_ | ||
- Add support for `unicode-range-token` | ||
- Add `signCharacter` to `DimensionToken`, `NumberToken` and `PercentageToken` | ||
- Correctly tokenize negative zero `-0` | ||
### 2.1.1 | ||
_April 10, 2023_ | ||
- Document `tokenize` helper function | ||
### 2.1.0 (February 21, 2023) | ||
### 2.1.0 | ||
_February 21, 2023_ | ||
- Add `tokenize` helper function | ||
### 2.0.2 (February 13, 2023) | ||
### 2.0.2 | ||
_February 13, 2023_ | ||
- Relax `isToken` to match artificial tokens that correctly follow the interface. | ||
### 2.0.1 (January 28, 2023) | ||
### 2.0.1 | ||
_January 28, 2023_ | ||
- Improve `types` declaration in `package.json` | ||
### 2.0.0 (January 19, 2023) | ||
### 2.0.0 | ||
_January 19, 2023_ | ||
- Simplify `Reader` interface (breaking) | ||
@@ -26,4 +44,6 @@ - Change the `ParseError` interface, this is now a subclass of `Error` (breaking) | ||
### 1.0.0 (November 14, 2022) | ||
### 1.0.0 | ||
_November 14, 2022_ | ||
- Initial version |
@@ -79,1 +79,19 @@ /** ' */ | ||
export declare const SPACE = 32; | ||
/** u */ | ||
export declare const LATIN_SMALL_LETTER_U = 117; | ||
/** U */ | ||
export declare const LATIN_CAPITAL_LETTER_U = 85; | ||
/** r */ | ||
export declare const LATIN_SMALL_LETTER_R = 114; | ||
/** R */ | ||
export declare const LATIN_CAPITAL_LETTER_R = 82; | ||
/** l */ | ||
export declare const LATIN_SMALL_LETTER_L = 108; | ||
/** L */ | ||
export declare const LATIN_CAPITAL_LETTER_L = 76; | ||
/** ? */ | ||
export declare const QUESTION_MARK = 63; | ||
/** 0 */ | ||
export declare const DIGIT_ZERO = 48; | ||
/** F */ | ||
export declare const LATIN_CAPITAL_LETTER_F = 70; |
@@ -9,2 +9,3 @@ export declare function isDigitCodePoint(search: number): boolean; | ||
export declare function isIdentCodePoint(search: number): boolean; | ||
export declare function isNonASCII_IdentCodePoint(search: number): boolean; | ||
export declare function isNonPrintableCodePoint(search: number): boolean; | ||
@@ -11,0 +12,0 @@ export declare function isNewLine(search: number): boolean; |
@@ -6,2 +6,3 @@ export type CodePointReader = { | ||
codePointSource: Array<number>; | ||
representationIndices: Array<number>; | ||
source: string; | ||
@@ -11,2 +12,3 @@ advanceCodePoint(n?: number): void; | ||
unreadCodePoint(n?: number): void; | ||
resetRepresentation(): void; | ||
}; |
@@ -53,3 +53,5 @@ export declare enum TokenType { | ||
/** https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/#tokendef-close-curly */ | ||
CloseCurly = "}-token" | ||
CloseCurly = "}-token", | ||
/** https://drafts.csswg.org/css-syntax/#typedef-unicode-range-token */ | ||
UnicodeRange = "unicode-range-token" | ||
} | ||
@@ -79,2 +81,3 @@ export declare enum NumberType { | ||
value: number; | ||
signCharacter?: '+' | '-'; | ||
unit: string; | ||
@@ -96,2 +99,3 @@ type: NumberType; | ||
value: number; | ||
signCharacter?: '+' | '-'; | ||
type: NumberType; | ||
@@ -101,2 +105,3 @@ }>; | ||
value: number; | ||
signCharacter?: '+' | '-'; | ||
}>; | ||
@@ -117,3 +122,7 @@ export type TokenSemicolon = Token<TokenType.Semicolon, undefined>; | ||
export type TokenCloseCurly = Token<TokenType.CloseCurly, undefined>; | ||
export type CSSToken = TokenAtKeyword | TokenBadString | TokenBadURL | TokenCDC | TokenCDO | TokenColon | TokenComma | TokenComment | TokenDelim | TokenDimension | TokenEOF | TokenFunction | TokenHash | TokenIdent | TokenNumber | TokenPercentage | TokenSemicolon | TokenString | TokenURL | TokenWhitespace | TokenOpenParen | TokenCloseParen | TokenOpenSquare | TokenCloseSquare | TokenOpenCurly | TokenCloseCurly; | ||
export type TokenUnicodeRange = Token<TokenType.UnicodeRange, { | ||
startOfRange: number; | ||
endOfRange: number; | ||
}>; | ||
export type CSSToken = TokenAtKeyword | TokenBadString | TokenBadURL | TokenCDC | TokenCDO | TokenColon | TokenComma | TokenComment | TokenDelim | TokenDimension | TokenEOF | TokenFunction | TokenHash | TokenIdent | TokenNumber | TokenPercentage | TokenSemicolon | TokenString | TokenURL | TokenWhitespace | TokenOpenParen | TokenCloseParen | TokenOpenSquare | TokenCloseSquare | TokenOpenCurly | TokenCloseCurly | TokenUnicodeRange; | ||
export type Token<T extends TokenType, U> = [ | ||
@@ -120,0 +129,0 @@ /** The type of token */ |
@@ -6,2 +6,3 @@ import { CodePointReader } from './interfaces/code-point-reader'; | ||
codePointSource: Array<number>; | ||
representationIndices: Array<number>; | ||
length: number; | ||
@@ -14,2 +15,3 @@ representationStart: number; | ||
unreadCodePoint(n?: number): void; | ||
resetRepresentation(): void; | ||
} |
@@ -8,2 +8,3 @@ import { CSSToken } from './interfaces/token'; | ||
css: Stringer; | ||
unicodeRangesAllowed?: boolean; | ||
}, options?: { | ||
@@ -14,2 +15,3 @@ onParseError?: (error: ParseError) => void; | ||
css: Stringer; | ||
unicodeRangesAllowed?: boolean; | ||
}, options?: { | ||
@@ -16,0 +18,0 @@ onParseError?: (error: ParseError) => void; |
{ | ||
"name": "@csstools/css-tokenizer", | ||
"description": "Tokenize CSS", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"contributors": [ | ||
@@ -17,6 +17,12 @@ { | ||
"license": "MIT", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/csstools" | ||
}, | ||
"funding": [ | ||
{ | ||
"type": "github", | ||
"url": "https://github.com/sponsors/csstools" | ||
}, | ||
{ | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/csstools" | ||
} | ||
], | ||
"engines": { | ||
@@ -43,4 +49,4 @@ "node": "^14 || ^16 || >=18" | ||
"devDependencies": { | ||
"@rmenke/css-tokenizer-tests": "^1.0.9", | ||
"postcss-parser-tests": "^8.5.1" | ||
"@rmenke/css-tokenizer-tests": "^1.1.1", | ||
"postcss-parser-tests": "^8.6.0" | ||
}, | ||
@@ -47,0 +53,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
65075
10.25%38
5.56%551
11.54%1
Infinity%