diff --git a/src/loaders/postcss/import/index.ts b/src/loaders/postcss/import/index.ts index 94d354a1..d5362c7b 100644 --- a/src/loaders/postcss/import/index.ts +++ b/src/loaders/postcss/import/index.ts @@ -42,7 +42,7 @@ const plugin: postcss.Plugin = postcss.plugin( delete opts?.map; const { file } = css.source.input; - const importSet = new Set<{ importRule: postcss.AtRule; url: string }>(); + const importList: { importRule: postcss.AtRule; url: string }[] = []; const basedir = path.dirname(file); css.walkAtRules(/^import$/i, importRule => { @@ -95,10 +95,10 @@ const plugin: postcss.Plugin = postcss.plugin( return; } - importSet.add({ importRule, url }); + importList.push({ importRule, url }); }); - for await (const { importRule, url } of importSet) { + for await (const { importRule, url } of importList) { try { const { source, from } = await resolve(url, basedir, extensions); diff --git a/src/loaders/postcss/url/index.ts b/src/loaders/postcss/url/index.ts index a5f2bd1c..f152321b 100644 --- a/src/loaders/postcss/url/index.ts +++ b/src/loaders/postcss/url/index.ts @@ -1,12 +1,9 @@ import path from "path"; import postcss from "postcss"; import valueParser, { Node, ParsedValue } from "postcss-value-parser"; - import { mm } from "../../../utils/sourcemap"; import { normalizePath, isAbsolutePath } from "../../../utils/path"; - import { firstExtRe, dataURIRe } from "../common"; - import resolveDefault, { UrlResolve } from "./resolve"; import generateName from "./generate"; import { walkUrls, isDeclWithUrl } from "./utils"; @@ -77,13 +74,13 @@ const plugin: postcss.Plugin = postcss.plugin( const { file } = css.source.input; const map = await mm(css.source.input.map?.text).resolve(path.dirname(file)).toConsumer(); - const nodeSet = new Set<{ + const urlList: { node: Node; url: string; decl: postcss.Declaration; parsed: ParsedValue; basedir: string; - }>(); + }[] = []; const imported = res.messages .filter(msg => msg.type === "dependency") @@ -121,7 +118,7 @@ const plugin: postcss.Plugin = postcss.plugin( // Use PostCSS imports if (decl.source?.input.file && imported.includes(decl.source.input.file)) { const basedir = path.dirname(decl.source.input.file); - nodeSet.add({ node, url, decl, parsed, basedir }); + urlList.push({ node, url, decl, parsed, basedir }); return; } @@ -131,21 +128,21 @@ const plugin: postcss.Plugin = postcss.plugin( const realPos = map?.originalPositionFor(pos); const basedir = realPos?.source && path.dirname(realPos.source); if (basedir) { - nodeSet.add({ node, url, decl, parsed, basedir }); + urlList.push({ node, url, decl, parsed, basedir }); return; } } // Use current file const basedir = path.dirname(file); - nodeSet.add({ node, url, decl, parsed, basedir }); + urlList.push({ node, url, decl, parsed, basedir }); }); }); map?.destroy(); const usedNames = new Map(); - for await (const { node, url, decl, parsed, basedir } of nodeSet) { + for await (const { node, url, decl, parsed, basedir } of urlList) { try { const { source, from } = await resolve(url, basedir); diff --git a/src/shims/less.d.ts b/src/shims/less.d.ts index b96b06f4..0a44ee48 100644 --- a/src/shims/less.d.ts +++ b/src/shims/less.d.ts @@ -61,6 +61,7 @@ declare namespace less { } interface Less { + // eslint-disable-next-line @typescript-eslint/naming-convention AbstractFileManager: typeof AbstractFileManager; render(input: string, options?: Options): Promise; }