diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-05-14 14:05:49 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-05-14 14:05:49 +0800 |
| commit | 06823fbf1c2e763a5bf76c3990ca98fbbcd98691 (patch) | |
| tree | 4280bece3888d12a022093bf1a9cd1b049393602 /node_modules/stylehacks | |
| parent | 1368909b3cd552dbb0d12d5863c597f5be46177d (diff) | |
updated node_modules
Diffstat (limited to 'node_modules/stylehacks')
23 files changed, 77 insertions, 36 deletions
diff --git a/node_modules/stylehacks/package.json b/node_modules/stylehacks/package.json index d8c6a071..a718ebd7 100644 --- a/node_modules/stylehacks/package.json +++ b/node_modules/stylehacks/package.json @@ -1,6 +1,6 @@ { "name": "stylehacks", - "version": "6.0.2", + "version": "6.1.1", "description": "Detect/remove browser hacks from CSS files.", "main": "src/index.js", "types": "types/index.d.ts", @@ -28,8 +28,8 @@ }, "repository": "cssnano/cssnano", "dependencies": { - "browserslist": "^4.22.2", - "postcss-selector-parser": "^6.0.15" + "browserslist": "^4.23.0", + "postcss-selector-parser": "^6.0.16" }, "bugs": { "url": "https://github.com/cssnano/cssnano/issues" @@ -38,7 +38,7 @@ "node": "^14 || ^16 || >=18.0" }, "devDependencies": { - "postcss": "^8.4.32" + "postcss": "^8.4.37" }, "peerDependencies": { "postcss": "^8.4.31" diff --git a/node_modules/stylehacks/src/index.js b/node_modules/stylehacks/src/index.js index 6b8ce94c..378a61f6 100644 --- a/node_modules/stylehacks/src/index.js +++ b/node_modules/stylehacks/src/index.js @@ -1,8 +1,13 @@ 'use strict'; +const { dirname } = require('path'); const browserslist = require('browserslist'); const plugins = require('./plugins'); -/** @typedef {{lint?: boolean}} Options */ +/** + * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions + * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions + * @typedef {{lint?: boolean} & AutoprefixerOptions & BrowserslistOptions} Options + */ /** * @type {import('postcss').PluginCreator<Options>} @@ -13,36 +18,42 @@ function pluginCreator(opts = {}) { return { postcssPlugin: 'stylehacks', - OnceExit(css, { result }) { - /** @type {typeof result.opts & browserslist.Options} */ - const resultOpts = result.opts || {}; - const browsers = browserslist(null, { - stats: resultOpts.stats, - path: __dirname, - env: resultOpts.env, + /** + * @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result + */ + prepare(result) { + const { stats, env, from, file } = result.opts || {}; + const browsers = browserslist(opts.overrideBrowserslist, { + stats: opts.stats || stats, + path: opts.path || dirname(from || file || __filename), + env: opts.env || env, }); - /** @type {import('./plugin').Plugin[]} */ - const processors = []; - for (const Plugin of plugins) { - const hack = new Plugin(result); - if (!browsers.some((browser) => hack.targets.has(browser))) { - processors.push(hack); - } - } - css.walk((node) => { - processors.forEach((proc) => { - if (!proc.nodeTypes.has(node.type)) { - return; + return { + OnceExit(css) { + /** @type {import('./plugin').Plugin[]} */ + const processors = []; + for (const Plugin of plugins) { + const hack = new Plugin(result); + if (!browsers.some((browser) => hack.targets.has(browser))) { + processors.push(hack); + } } + css.walk((node) => { + processors.forEach((proc) => { + if (!proc.nodeTypes.has(node.type)) { + return; + } - if (opts.lint) { - return proc.detectAndWarn(node); - } + if (opts.lint) { + return proc.detectAndWarn(node); + } - return proc.detectAndResolve(node); - }); - }); + return proc.detectAndResolve(node); + }); + }); + }, + }; }, }; } diff --git a/node_modules/stylehacks/types/dictionary/browsers.d.ts b/node_modules/stylehacks/types/dictionary/browsers.d.ts index 297d830c..ff5bae3d 100644 --- a/node_modules/stylehacks/types/dictionary/browsers.d.ts +++ b/node_modules/stylehacks/types/dictionary/browsers.d.ts @@ -4,3 +4,4 @@ export const IE_6: "ie 6"; export const IE_7: "ie 7"; export const IE_8: "ie 8"; export const OP_9: "opera 9"; +//# sourceMappingURL=browsers.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/dictionary/identifiers.d.ts b/node_modules/stylehacks/types/dictionary/identifiers.d.ts index 6d8e0f4d..d9fa987d 100644 --- a/node_modules/stylehacks/types/dictionary/identifiers.d.ts +++ b/node_modules/stylehacks/types/dictionary/identifiers.d.ts @@ -2,3 +2,4 @@ export const MEDIA_QUERY: "media query"; export const PROPERTY: "property"; export const SELECTOR: "selector"; export const VALUE: "value"; +//# sourceMappingURL=identifiers.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/dictionary/postcss.d.ts b/node_modules/stylehacks/types/dictionary/postcss.d.ts index 02d3005a..5d45459f 100644 --- a/node_modules/stylehacks/types/dictionary/postcss.d.ts +++ b/node_modules/stylehacks/types/dictionary/postcss.d.ts @@ -1,3 +1,4 @@ export const ATRULE: "atrule"; export const DECL: "decl"; export const RULE: "rule"; +//# sourceMappingURL=postcss.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/dictionary/tags.d.ts b/node_modules/stylehacks/types/dictionary/tags.d.ts index 06fdc70b..b3ae5cbc 100644 --- a/node_modules/stylehacks/types/dictionary/tags.d.ts +++ b/node_modules/stylehacks/types/dictionary/tags.d.ts @@ -1,2 +1,3 @@ export const BODY: "body"; export const HTML: "html"; +//# sourceMappingURL=tags.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/exists.d.ts b/node_modules/stylehacks/types/exists.d.ts index b3adc065..23f5cd2d 100644 --- a/node_modules/stylehacks/types/exists.d.ts +++ b/node_modules/stylehacks/types/exists.d.ts @@ -1,2 +1,3 @@ declare function _exports(selector: import('postcss-selector-parser').Selector, index: number, value: string): boolean | undefined | ''; export = _exports; +//# sourceMappingURL=exists.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/index.d.ts b/node_modules/stylehacks/types/index.d.ts index 9c12a566..c6ef98af 100644 --- a/node_modules/stylehacks/types/index.d.ts +++ b/node_modules/stylehacks/types/index.d.ts @@ -1,5 +1,9 @@ export = pluginCreator; -/** @typedef {{lint?: boolean}} Options */ +/** + * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions + * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions + * @typedef {{lint?: boolean} & AutoprefixerOptions & BrowserslistOptions} Options + */ /** * @type {import('postcss').PluginCreator<Options>} * @param {Options} opts @@ -7,10 +11,16 @@ export = pluginCreator; */ declare function pluginCreator(opts?: Options): import('postcss').Plugin; declare namespace pluginCreator { - export { detect, postcss, Options }; + export { detect, postcss, AutoprefixerOptions, BrowserslistOptions, Options }; } type Options = { lint?: boolean; -}; +} & AutoprefixerOptions & BrowserslistOptions; declare function detect(node: import('postcss').Node): boolean; declare var postcss: true; +type AutoprefixerOptions = { + overrideBrowserslist?: string | string[]; +}; +type BrowserslistOptions = Pick<browserslist.Options, 'stats' | 'path' | 'env'>; +import browserslist = require("browserslist"); +//# sourceMappingURL=index.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/isMixin.d.ts b/node_modules/stylehacks/types/isMixin.d.ts index c15c4b0e..98f373d9 100644 --- a/node_modules/stylehacks/types/isMixin.d.ts +++ b/node_modules/stylehacks/types/isMixin.d.ts @@ -1,2 +1,3 @@ declare function _exports(node: import('postcss').Rule): boolean; export = _exports; +//# sourceMappingURL=isMixin.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugin.d.ts b/node_modules/stylehacks/types/plugin.d.ts index d0fd0713..c449a7bf 100644 --- a/node_modules/stylehacks/types/plugin.d.ts +++ b/node_modules/stylehacks/types/plugin.d.ts @@ -10,7 +10,7 @@ declare class BasePlugin { nodes: NodeWithInfo[]; targets: Set<string>; nodeTypes: Set<string>; - result: import("postcss/lib/result").default<import("postcss/lib/document").default | import("postcss/lib/root").default> | undefined; + result: import("postcss").Result<import("postcss").Document | import("postcss").Root> | undefined; /** * @param {import('postcss').Node} node * @param {{identifier: string, hack: string}} metadata @@ -58,3 +58,4 @@ type Plugin = { detectAndResolve: (node: import('postcss').Node) => void; detectAndWarn: (node: import('postcss').Node) => void; }; +//# sourceMappingURL=plugin.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/bodyEmpty.d.ts b/node_modules/stylehacks/types/plugins/bodyEmpty.d.ts index 46c43b40..c6fb27e4 100644 --- a/node_modules/stylehacks/types/plugins/bodyEmpty.d.ts +++ b/node_modules/stylehacks/types/plugins/bodyEmpty.d.ts @@ -15,3 +15,4 @@ declare class BodyEmpty extends BasePlugin { } import BasePlugin = require("../plugin"); import parser = require("postcss-selector-parser"); +//# sourceMappingURL=bodyEmpty.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/htmlCombinatorCommentBody.d.ts b/node_modules/stylehacks/types/plugins/htmlCombinatorCommentBody.d.ts index b5284974..f32ccbaf 100644 --- a/node_modules/stylehacks/types/plugins/htmlCombinatorCommentBody.d.ts +++ b/node_modules/stylehacks/types/plugins/htmlCombinatorCommentBody.d.ts @@ -14,3 +14,4 @@ declare class HtmlCombinatorCommentBody extends BasePlugin { } import BasePlugin = require("../plugin"); import parser = require("postcss-selector-parser"); +//# sourceMappingURL=htmlCombinatorCommentBody.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/htmlFirstChild.d.ts b/node_modules/stylehacks/types/plugins/htmlFirstChild.d.ts index f5f20f37..7700a60e 100644 --- a/node_modules/stylehacks/types/plugins/htmlFirstChild.d.ts +++ b/node_modules/stylehacks/types/plugins/htmlFirstChild.d.ts @@ -15,3 +15,4 @@ declare class HtmlFirstChild extends BasePlugin { } import BasePlugin = require("../plugin"); import parser = require("postcss-selector-parser"); +//# sourceMappingURL=htmlFirstChild.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/important.d.ts b/node_modules/stylehacks/types/plugins/important.d.ts index 42d6c456..ad559230 100644 --- a/node_modules/stylehacks/types/plugins/important.d.ts +++ b/node_modules/stylehacks/types/plugins/important.d.ts @@ -9,3 +9,4 @@ declare class Important extends BasePlugin { detect(decl: import('postcss').Declaration): void; } import BasePlugin = require("../plugin"); +//# sourceMappingURL=important.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/index.d.ts b/node_modules/stylehacks/types/plugins/index.d.ts index c89b5046..6f42aa70 100644 --- a/node_modules/stylehacks/types/plugins/index.d.ts +++ b/node_modules/stylehacks/types/plugins/index.d.ts @@ -1,8 +1,9 @@ declare const _exports: ({ - new (result?: import("postcss/lib/result").default<import("postcss/lib/document").default | import("postcss/lib/root").default> | undefined): important; + new (result?: import("postcss").Result<import("postcss").Document | import("postcss").Root> | undefined): important; } | { - new (result?: import("postcss/lib/result").default<import("postcss/lib/document").default | import("postcss/lib/root").default> | undefined): trailingSlashComma; + new (result?: import("postcss").Result<import("postcss").Document | import("postcss").Root> | undefined): trailingSlashComma; })[]; export = _exports; import important = require("./important"); import trailingSlashComma = require("./trailingSlashComma"); +//# sourceMappingURL=index.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/leadingStar.d.ts b/node_modules/stylehacks/types/plugins/leadingStar.d.ts index a9ea9683..03f35cac 100644 --- a/node_modules/stylehacks/types/plugins/leadingStar.d.ts +++ b/node_modules/stylehacks/types/plugins/leadingStar.d.ts @@ -9,3 +9,4 @@ declare class LeadingStar extends BasePlugin { detect(node: import('postcss').Declaration | import('postcss').AtRule): void; } import BasePlugin = require("../plugin"); +//# sourceMappingURL=leadingStar.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/leadingUnderscore.d.ts b/node_modules/stylehacks/types/plugins/leadingUnderscore.d.ts index f973a648..e94bdd22 100644 --- a/node_modules/stylehacks/types/plugins/leadingUnderscore.d.ts +++ b/node_modules/stylehacks/types/plugins/leadingUnderscore.d.ts @@ -9,3 +9,4 @@ declare class LeadingUnderscore extends BasePlugin { detect(decl: import('postcss').Declaration): void; } import BasePlugin = require("../plugin"); +//# sourceMappingURL=leadingUnderscore.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/mediaSlash0.d.ts b/node_modules/stylehacks/types/plugins/mediaSlash0.d.ts index 70ad4bf1..6351f065 100644 --- a/node_modules/stylehacks/types/plugins/mediaSlash0.d.ts +++ b/node_modules/stylehacks/types/plugins/mediaSlash0.d.ts @@ -9,3 +9,4 @@ declare class MediaSlash0 extends BasePlugin { detect(rule: import('postcss').AtRule): void; } import BasePlugin = require("../plugin"); +//# sourceMappingURL=mediaSlash0.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/mediaSlash0Slash9.d.ts b/node_modules/stylehacks/types/plugins/mediaSlash0Slash9.d.ts index 920d22ef..14163015 100644 --- a/node_modules/stylehacks/types/plugins/mediaSlash0Slash9.d.ts +++ b/node_modules/stylehacks/types/plugins/mediaSlash0Slash9.d.ts @@ -9,3 +9,4 @@ declare class MediaSlash0Slash9 extends BasePlugin { detect(rule: import('postcss').AtRule): void; } import BasePlugin = require("../plugin"); +//# sourceMappingURL=mediaSlash0Slash9.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/mediaSlash9.d.ts b/node_modules/stylehacks/types/plugins/mediaSlash9.d.ts index acbe9fb4..847318a9 100644 --- a/node_modules/stylehacks/types/plugins/mediaSlash9.d.ts +++ b/node_modules/stylehacks/types/plugins/mediaSlash9.d.ts @@ -9,3 +9,4 @@ declare class MediaSlash9 extends BasePlugin { detect(rule: import('postcss').AtRule): void; } import BasePlugin = require("../plugin"); +//# sourceMappingURL=mediaSlash9.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/slash9.d.ts b/node_modules/stylehacks/types/plugins/slash9.d.ts index ed514481..6f4cc902 100644 --- a/node_modules/stylehacks/types/plugins/slash9.d.ts +++ b/node_modules/stylehacks/types/plugins/slash9.d.ts @@ -9,3 +9,4 @@ declare class Slash9 extends BasePlugin { detect(decl: import('postcss').Declaration): void; } import BasePlugin = require("../plugin.js"); +//# sourceMappingURL=slash9.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/starHtml.d.ts b/node_modules/stylehacks/types/plugins/starHtml.d.ts index 5e5a495c..4ae36b5e 100644 --- a/node_modules/stylehacks/types/plugins/starHtml.d.ts +++ b/node_modules/stylehacks/types/plugins/starHtml.d.ts @@ -15,3 +15,4 @@ declare class StarHtml extends BasePlugin { } import BasePlugin = require("../plugin"); import parser = require("postcss-selector-parser"); +//# sourceMappingURL=starHtml.d.ts.map
\ No newline at end of file diff --git a/node_modules/stylehacks/types/plugins/trailingSlashComma.d.ts b/node_modules/stylehacks/types/plugins/trailingSlashComma.d.ts index 17f81fab..80df9286 100644 --- a/node_modules/stylehacks/types/plugins/trailingSlashComma.d.ts +++ b/node_modules/stylehacks/types/plugins/trailingSlashComma.d.ts @@ -9,3 +9,4 @@ declare class TrailingSlashComma extends BasePlugin { detect(rule: import('postcss').Rule): void; } import BasePlugin = require("../plugin"); +//# sourceMappingURL=trailingSlashComma.d.ts.map
\ No newline at end of file |
