Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Replace @types/css-tree override with patch (#1783)

Bogdan Chadkinc40f5e507d0b
diff --git a/@types/css-tree.d.ts b/@types/css-tree.d.ts
deleted file mode 100644
index fd2e6dc9d6..0000000000
--- a/@types/css-tree.d.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-declare module "css-tree" {
- export function parse(
- text: string,
- options?: import("@types/css-tree").ParseOptions
- ): import("@types/css-tree").CssNode;
-
- export function walk(
- ast: import("@types/css-tree").CssNode,
- options:
- | import("@types/css-tree").WalkOptionsNoVisit
- | import("@types/css-tree").EnterOrLeaveFn
- ): void;
-
- export function generate(
- ast: import("@types/css-tree").CssNode,
- options?: import("@types/css-tree").GenerateOptions
- ): string;
-
- type Match =
- | {
- syntax: { type: "Property"; name: string };
- match: Match[];
- }
- | {
- syntax: { type: "Type"; name: string };
- match: Match[];
- }
- | {
- syntax: { type: "Keyword"; name: string };
- token: string;
- }
- | { syntax: null };
-
- type MatchProperty =
- | {
- matched: null;
- error: { message: string };
- }
- // eslint-disable-next-line @typescript-eslint/ban-types
- | {
- matched: Match;
- error: null;
- };
-
- export declare const lexer: {
- matchProperty: (
- property: string,
- ast: import("@types/css-tree").CssNode
- ) => MatchProperty;
- };
-}
diff --git a/package.json b/package.json
index c49d78716a..60b61df3aa 100644
--- a/package.json
+++ b/package.json
@@ -65,7 +65,8 @@
},
"patchedDependencies": {
"@stitches/[email protected]": "patches/@[email protected]",
+ "@types/[email protected]": "patches/@[email protected]"
}
}
}
diff --git a/packages/css-data/tsconfig.json b/packages/css-data/tsconfig.json
index 4a738235bd..bac8765395 100644
--- a/packages/css-data/tsconfig.json
+++ b/packages/css-data/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@webstudio-is/tsconfig/base.json",
- "include": ["src", "bin", "../../@types/**/*.d.ts"],
+ "include": ["src", "bin"],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020",
diff --git a/packages/css-engine/tsconfig.json b/packages/css-engine/tsconfig.json
index ddff9acf9e..243d0954f6 100644
--- a/packages/css-engine/tsconfig.json
+++ b/packages/css-engine/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@webstudio-is/tsconfig/base.json",
- "include": ["src", "../../@types/**/*.d.ts"],
+ "include": ["src"],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020",
diff --git a/packages/dashboard/tsconfig.json b/packages/dashboard/tsconfig.json
index ddff9acf9e..243d0954f6 100644
--- a/packages/dashboard/tsconfig.json
+++ b/packages/dashboard/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@webstudio-is/tsconfig/base.json",
- "include": ["src", "../../@types/**/*.d.ts"],
+ "include": ["src"],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020",
diff --git a/packages/domain/tsconfig.json b/packages/domain/tsconfig.json
index 292c6d9f01..74b8f3611b 100644
--- a/packages/domain/tsconfig.json
+++ b/packages/domain/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@webstudio-is/tsconfig/base.json",
- "include": ["src", "../../@types/**/*.d.ts"],
+ "include": ["src"],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020"
diff --git a/packages/form-handlers/tsconfig.json b/packages/form-handlers/tsconfig.json
index 292c6d9f01..74b8f3611b 100644
--- a/packages/form-handlers/tsconfig.json
+++ b/packages/form-handlers/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@webstudio-is/tsconfig/base.json",
- "include": ["src", "../../@types/**/*.d.ts"],
+ "include": ["src"],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020"
diff --git a/packages/project-build/tsconfig.json b/packages/project-build/tsconfig.json
index 292c6d9f01..74b8f3611b 100644
--- a/packages/project-build/tsconfig.json
+++ b/packages/project-build/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@webstudio-is/tsconfig/base.json",
- "include": ["src", "../../@types/**/*.d.ts"],
+ "include": ["src"],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020"
diff --git a/packages/project/tsconfig.json b/packages/project/tsconfig.json
index ddff9acf9e..243d0954f6 100644
--- a/packages/project/tsconfig.json
+++ b/packages/project/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@webstudio-is/tsconfig/base.json",
- "include": ["src", "../../@types/**/*.d.ts"],
+ "include": ["src"],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020",
diff --git a/packages/trpc-interface/tsconfig.json b/packages/trpc-interface/tsconfig.json
index ddff9acf9e..243d0954f6 100644
--- a/packages/trpc-interface/tsconfig.json
+++ b/packages/trpc-interface/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@webstudio-is/tsconfig/base.json",
- "include": ["src", "../../@types/**/*.d.ts"],
+ "include": ["src"],
"compilerOptions": {
"module": "ES2020",
"target": "ES2020",
diff --git a/patches/@[email protected] b/patches/@[email protected]
new file mode 100644
index 0000000000..0670d5ac12
--- /dev/null
+++ b/patches/@[email protected]
@@ -0,0 +1,97 @@
+diff --git a/index.d.ts b/index.d.ts
+index e6a09d2756a7d942d7dbf2d6b9437deb06e8eb31..46120815179b6176100a045a599b92ecaa6be89c 100755
+--- a/index.d.ts
++++ b/index.d.ts
+@@ -546,48 +546,7 @@ export interface WalkOptionsVisit<NodeType extends CssNode = CssNode> {
+ reverse?: boolean | undefined;
+ }
+
+-export type WalkOptions =
+- WalkOptionsVisit<AnPlusB>
+- | WalkOptionsVisit<Atrule>
+- | WalkOptionsVisit<AtrulePrelude>
+- | WalkOptionsVisit<AttributeSelector>
+- | WalkOptionsVisit<Block>
+- | WalkOptionsVisit<Brackets>
+- | WalkOptionsVisit<CDC>
+- | WalkOptionsVisit<CDO>
+- | WalkOptionsVisit<ClassSelector>
+- | WalkOptionsVisit<Combinator>
+- | WalkOptionsVisit<Comment>
+- | WalkOptionsVisit<Declaration>
+- | WalkOptionsVisit<DeclarationList>
+- | WalkOptionsVisit<Dimension>
+- | WalkOptionsVisit<FunctionNode>
+- | WalkOptionsVisit<Hash>
+- | WalkOptionsVisit<IdSelector>
+- | WalkOptionsVisit<Identifier>
+- | WalkOptionsVisit<MediaFeature>
+- | WalkOptionsVisit<MediaQuery>
+- | WalkOptionsVisit<MediaQueryList>
+- | WalkOptionsVisit<Nth>
+- | WalkOptionsVisit<NumberNode>
+- | WalkOptionsVisit<Operator>
+- | WalkOptionsVisit<Parentheses>
+- | WalkOptionsVisit<Percentage>
+- | WalkOptionsVisit<PseudoClassSelector>
+- | WalkOptionsVisit<PseudoElementSelector>
+- | WalkOptionsVisit<Ratio>
+- | WalkOptionsVisit<Raw>
+- | WalkOptionsVisit<Rule>
+- | WalkOptionsVisit<Selector>
+- | WalkOptionsVisit<SelectorList>
+- | WalkOptionsVisit<StringNode>
+- | WalkOptionsVisit<StyleSheet>
+- | WalkOptionsVisit<TypeSelector>
+- | WalkOptionsVisit<UnicodeRange>
+- | WalkOptionsVisit<Url>
+- | WalkOptionsVisit<Value>
+- | WalkOptionsVisit<WhiteSpace>
+- | WalkOptionsNoVisit;
++export type WalkOptions = WalkOptionsNoVisit;
+
+ export function walk(ast: CssNode, options: EnterOrLeaveFn | WalkOptions): void;
+
+@@ -851,9 +810,30 @@ export class SyntaxReferenceError extends SyntaxError {
+ reference: string;
+ }
+
+-export interface LexerMatchResult {
+- error: Error | SyntaxMatchError | SyntaxReferenceError | null;
+-}
++type Match =
++ | {
++ syntax: DSNodeProperty;
++ match: Match[];
++ }
++ | {
++ syntax: DSNodeType;
++ match: Match[];
++ }
++ | {
++ syntax: DSNodeKeyword;
++ token: string;
++ }
++ | { syntax: null };
++
++export type LexerMatchResult =
++ | {
++ matched: null;
++ error: Error | SyntaxMatchError | SyntaxReferenceError;
++ }
++ | {
++ matched: Match;
++ error: null;
++ };
+
+ export class Lexer {
+ matchAtruleDescriptor(atruleName: string, descriptorName: string, value: CssNode | string): LexerMatchResult;
+@@ -864,6 +844,8 @@ export class Lexer {
+ match(syntax: DSNode | string, value: CssNode | string): LexerMatchResult;
+ }
+
++export declare const lexer: Lexer;
++
+ export function fork(extension: {
+ atrules?: Record<string, string> | undefined,
+ properties?: Record<string, string> | undefined,
\ No newline at end of file
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2faa1087d8..e17426a18b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -9,6 +9,9 @@ patchedDependencies:
'@stitches/[email protected]':
hash: knml42mpr6mlzseo3d6gjljiq4
path: patches/@[email protected]
+ '@types/[email protected]':
+ hash: ac22lciodhaj6xmoeignv36gyq
+ path: patches/@[email protected]
hash: epgcmebti7rfrc2ej4odb3t4jy
path: patches/[email protected]
@@ -22,7 +25,7 @@ importers:
'@types/css-tree':
specifier: ^2.3.1
- version: 2.3.1
+ version: 2.3.1(patch_hash=ac22lciodhaj6xmoeignv36gyq)
'@webstudio-is/eslint-config-custom':
specifier: workspace:^
version: link:packages/eslint-config-custom
@@ -470,7 +473,7 @@ importers:
devDependencies:
'@types/css-tree':
specifier: ^2.3.1
- version: 2.3.1
+ version: 2.3.1(patch_hash=ac22lciodhaj6xmoeignv36gyq)
'@webstudio-is/jest-config':
specifier: workspace:^
version: link:../jest-config
@@ -8575,9 +8578,10 @@ packages:
resolution: {integrity: sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==}
+ /@types/[email protected](patch_hash=ac22lciodhaj6xmoeignv36gyq):
resolution: {integrity: sha512-3m636Jz4d9d+lHVMp6FNLsUWQrfOx1xpm1SBxPbQYSNNgXMe+XswcsDeo1ldyULiuzYyWKk1kmvkLTgNq+215Q==}
dev: true
+ patched: true
resolution: {integrity: sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==}