Skip to content

Commit

Permalink
Add css-tree module types
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnw committed Nov 22, 2024
1 parent 794d3aa commit 2ba65a4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
19 changes: 19 additions & 0 deletions src/@types/css-tree.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
declare module 'css-tree/walker' {
import { walk } from 'css-tree';

export default walk;
}
declare module 'css-tree/utils' {
export { clone, List } from 'css-tree';
}

declare module 'css-tree/generator' {
import { generate } from 'css-tree';

export default generate;
}
declare module 'css-tree/parser' {
import { parse } from 'css-tree';

export default parse;
}
2 changes: 1 addition & 1 deletion src/cascade.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Block, type CssNode, } from 'css-tree';
import { type Block, type CssNode } from 'css-tree';
import walk from 'css-tree/walker';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
type SelectorList,
type Value,
} from 'css-tree';
import { clone, List } from 'css-tree/utils';
import walk from 'css-tree/walker';
import {clone, List} from 'css-tree/utils';
import { nanoid } from 'nanoid/non-secure';

import { getCSSPropertyValue } from './dom.js';
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import {
type SelectorList,
type Value,
} from 'css-tree';
import {clone} from 'css-tree/utils';
import parse from 'css-tree/parser';
import generate from 'css-tree/generator';
import parse from 'css-tree/parser';
import { clone } from 'css-tree/utils';
import { nanoid } from 'nanoid/non-secure';

import type { Selector } from './dom.js';

export const INSTANCE_UUID = nanoid();

// https://github.com/import-js/eslint-plugin-import/issues/3019

export interface DeclarationWithValue extends Declaration {
value: Value;
}
Expand Down

0 comments on commit 2ba65a4

Please sign in to comment.