Skip to content

Commit

Permalink
Release 4.4.1 - Update bundler version (Parcel)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Philippe Zolesio committed Nov 14, 2024
1 parent ed65a61 commit d745281
Show file tree
Hide file tree
Showing 11 changed files with 668 additions and 671 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'yarn'
- name: install
run: yarn install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobe/css-tools",
"version": "4.4.0",
"version": "4.4.1",
"description": "CSS parser / stringifier",
"source": "src/index.ts",
"main": "./dist/index.cjs",
Expand All @@ -17,17 +17,17 @@
"Readme.md"
],
"devDependencies": {
"@parcel/packager-ts": "2.12.0",
"@parcel/transformer-typescript-types": "2.12.0",
"@parcel/packager-ts": "2.13.0",
"@parcel/transformer-typescript-types": "2.13.0",
"@types/benchmark": "^2.1.1",
"@types/bytes": "^3.1.1",
"@types/jest": "^29.5.3",
"@types/node": "^22.7.5",
"benchmark": "^2.1.4",
"bytes": "^3.1.0",
"gts": "^5.0.0",
"gts": "^6.0.2",
"jest": "^29.6.2",
"parcel": "^2.12.0",
"parcel": "^2.13.0",
"ts-jest": "^29.1.1",
"typescript": "^5.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion src/CssParseError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class CssParseError extends Error {
msg: string,
lineno: number,
column: number,
css: string
css: string,
) {
super(filename + ':' + lineno + ':' + column + ': ' + msg);
this.reason = msg;
Expand Down
2 changes: 1 addition & 1 deletion src/CssPosition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class Position {
constructor(
start: {line: number; column: number},
end: {line: number; column: number},
source: string
source: string,
) {
this.start = start;
this.end = end;
Expand Down
18 changes: 9 additions & 9 deletions src/parse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const commentre = /\/\*[^]*?(?:\*\/|$)/g;

export const parse = (
css: string,
options?: {source?: string; silent?: boolean}
options?: {source?: string; silent?: boolean},
): CssStylesheetAST => {
options = options || {};

Expand All @@ -59,12 +59,12 @@ export const parse = (
function position() {
const start = {line: lineno, column: column};
return function <T1 extends CssCommonPositionAST>(
node: Omit<T1, 'position'>
node: Omit<T1, 'position'>,
): T1 {
(node as T1).position = new Position(
start,
{line: lineno, column: column},
options?.source || ''
options?.source || '',
);
whitespace();
return node as T1;
Expand All @@ -82,7 +82,7 @@ export const parse = (
msg,
lineno,
column,
css
css,
);

if (options?.silent) {
Expand Down Expand Up @@ -166,7 +166,7 @@ export const parse = (
* Parse comments;
*/
function comments<T1 extends CssCommonPositionAST>(
rules?: Array<T1 | CssCommentAST>
rules?: Array<T1 | CssCommentAST>,
) {
let c;
rules = rules || [];
Expand Down Expand Up @@ -201,7 +201,7 @@ export const parse = (
function findClosingParenthese(
str: string,
start: number,
depth: number
depth: number,
): number {
let ptr = start + 1;
let found = false;
Expand All @@ -212,7 +212,7 @@ export const parse = (
const nextSearch = findClosingParenthese(
str,
nextParentheses + 1,
depth + 1
depth + 1,
);
ptr = nextSearch + 1;
closeParentheses = str.indexOf(')', ptr);
Expand Down Expand Up @@ -725,12 +725,12 @@ export const parse = (
* Parse non-block at-rules
*/
function _compileAtrule<T1 extends CssCommonPositionAST>(
name: string
name: string,
): () => T1 | void {
const re = new RegExp(
'^@' +
name +
'\\s*((?::?[^;\'"]|"(?:\\\\"|[^"])*?"|\'(?:\\\\\'|[^\'])*?\')+)(?:;|$)'
'\\s*((?::?[^;\'"]|"(?:\\\\"|[^"])*?"|\'(?:\\\\\'|[^\'])*?\')+)(?:;|$)',
);

// ^@import\s*([^;"']|("|')(?:\\\2|.)*?\2)+(;|$)
Expand Down
8 changes: 4 additions & 4 deletions src/stringify/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class Compiler {
return (
this.emit(
'@' + (node.vendor || '') + 'keyframes ' + node.name,
node.position
node.position,
) +
this.emit('{') +
this.mapVisit(node.keyframes) +
Expand All @@ -303,7 +303,7 @@ class Compiler {
return (
this.emit(
'@' + (node.vendor || '') + 'keyframes ' + node.name,
node.position
node.position,
) +
this.emit(' {\n' + this.indent(1)) +
this.mapVisit(node.keyframes, '\n') +
Expand Down Expand Up @@ -408,7 +408,7 @@ class Compiler {
customMedia(node: CssCustomMediaAST) {
return this.emit(
'@custom-media ' + node.name + ' ' + node.media + ';',
node.position
node.position,
);
}

Expand Down Expand Up @@ -438,7 +438,7 @@ class Compiler {
return indent + s;
})
.join(',\n'),
node.position
node.position,
) +
this.emit(' {\n') +
this.emit(this.indent(1)) +
Expand Down
2 changes: 1 addition & 1 deletion src/stringify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Compiler from './compiler';

export default (
node: CssStylesheetAST,
options?: ConstructorParameters<typeof Compiler>[0]
options?: ConstructorParameters<typeof Compiler>[0],
) => {
const compiler = new Compiler(options || {});
return compiler.compile(node);
Expand Down
4 changes: 2 additions & 2 deletions test/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('parse(str)', () => {
{
silent: true,
source: 'foo.css',
}
},
);

const rules = result.stylesheet.rules;
Expand All @@ -85,7 +85,7 @@ describe('parse(str)', () => {
it('should set parent property', () => {
const result = parse(
'thing { test: value; }\n' +
'@media (min-width: 100px) { thing { test: value; } }'
'@media (min-width: 100px) { thing { test: value; } }',
);

// expect(result).not.toHaveProperty('parent');
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"resolveJsonModule": true
},
"include": [
"src/**/*.ts"
"src/**/*.ts",
"test/**/*.ts",
"generate-tests.ts"
]
}
Loading

0 comments on commit d745281

Please sign in to comment.