Migrate CSS language to ES Module (#12341)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-02-21 14:22:51 +08:00
1 parent b05812737d
commit 1caec5de69
21 files changed
+105 -131

No files matched your search

+29 -27
View File
@@ -1,34 +1,18 @@
"use strict";
const getLast = require("../utils/get-last.js");
const {
import getLast from "../utils/get-last.js";
import {
printNumber,
printString,
hasNewline,
isFrontMatterNode,
isNextLineEmpty,
isNonEmptyArray,
} = require("../common/util.js");
const {
builders: {
join,
line,
hardline,
softline,
group,
fill,
indent,
dedent,
ifBreak,
breakParent,
},
utils: { removeLines, getDocParts },
} = require("../document/index.js");
const clean = require("./clean.js");
const embed = require("./embed.js");
const { insertPragma } = require("./pragma.js");
} from "../common/util.js";
import doc from "../document/index.js";
import clean from "./clean.js";
import embed from "./embed.js";
import { insertPragma } from "./pragma.js";
const {
import {
getAncestorNode,
getPropOfDeclNode,
maybeToLowerCase,
@@ -74,8 +58,24 @@ const {
isAtWordPlaceholderNode,
isConfigurationNode,
isParenGroupNode,
} = require("./utils/index.js");
const { locStart, locEnd } = require("./loc.js");
} from "./utils/index.js";
import { locStart, locEnd } from "./loc.js";
const {
builders: {
join,
line,
hardline,
softline,
group,
fill,
indent,
dedent,
ifBreak,
breakParent,
},
utils: { removeLines, getDocParts },
} = doc;
function shouldPrintComma(options) {
return options.trailingComma === "es5" || options.trailingComma === "all";
@@ -1118,9 +1118,11 @@ function printCssNumber(rawNumber) {
);
}
module.exports = {
const printer = {
print: genericPrint,
embed,
insertPragma,
massageAstNode: clean,
};
export default printer;