fix: avoid ESM lexer imports in migration bundles

This commit is contained in:
ajnart committed 2026-09-12 23:56:54 +02:00
1 parent a6bdbbb4ea
commit fbde111f01
2 files changed
+29 -1

No files matched your search

@@ -1,4 +1,13 @@
import { generate, ident, parse, walk } from "css-tree"; // Consumers compile this source directly and need the modular export declarations.
// oxlint-disable-next-line typescript/triple-slash-reference
/// <reference path="../css-tree.d.ts" />
import generate from "css-tree/generator";
import parse from "css-tree/parser";
import { ident } from "css-tree/utils";
import walk from "css-tree/walker";
// The full entrypoint loads lexer data through import.meta.url, which cannot run in bundled CJS migrations.
const allowedAtRules = new Set(["media", "supports", "container", "keyframes", "-webkit-keyframes"]); const allowedAtRules = new Set(["media", "supports", "container", "keyframes", "-webkit-keyframes"]);
const animationKeywords = new Set([ const animationKeywords = new Set([
+19
View File
@@ -0,0 +1,19 @@
// css-tree's modular exports use the same APIs as its typed root entrypoint.
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;
}
declare module "css-tree/utils" {
export { ident } from "css-tree";
}
declare module "css-tree/walker" {
import { walk } from "css-tree";
export default walk;
}