Comparing version 6.0.0 to 6.0.1
@@ -5,5 +5,5 @@ #!/usr/bin/env node | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { PassThrough } from 'stream'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import { PassThrough } from 'node:stream'; | ||
@@ -75,7 +75,7 @@ import browserslist from 'browserslist'; | ||
} | ||
} catch (err) { | ||
if (err && err.code === FILE_NOT_FOUND) { | ||
console.error('Config file not found', err); | ||
} catch (error) { | ||
if (error && error.code === FILE_NOT_FOUND) { | ||
console.error('Config file not found', error); | ||
} else { | ||
console.error(err); | ||
console.error(error); | ||
} | ||
@@ -92,3 +92,6 @@ } | ||
// Informational output | ||
if (argv.l) { argv.v = ++argv.verbose; } | ||
if (argv.l) { | ||
argv.verbose += 1; | ||
argv.v = argv.verbose; | ||
} | ||
if (argv.verbose >= 1) { | ||
@@ -105,3 +108,3 @@ const browsers = browserslist(argv.browsers) | ||
.join(', '); | ||
console.log(`[doiuse] Browsers: ${browsers}`); | ||
process.stdout.write(`[doiuse] Browsers: ${browsers}\n`); | ||
} | ||
@@ -111,9 +114,8 @@ | ||
const { features } = new DoIUse(argv.browsers).info(); | ||
console.log('\n[doiuse] Unsupported features:'); | ||
process.stdout.write('[doiuse] Unsupported features:\n'); | ||
for (const feature of Object.values(features)) { | ||
const out = [feature.caniuseData.title]; | ||
process.stdout.write(`${feature.caniuseData.title}\n`); | ||
if (argv.verbose >= 3) { | ||
out.push('\n', feature.missing, '\n'); | ||
process.stdout.write(`\n${feature.missing}\n`); | ||
} | ||
console.log(out.join('')); | ||
} | ||
@@ -154,3 +156,3 @@ } | ||
stream.pipe(new CssUsageDuplex({ browsers: argv.browsers, ignore: argv.ignore }, file)) | ||
.on('error', (err) => { console.error(err); }) | ||
.on('error', (error) => { console.error(error); }) | ||
.pipe(outStream); | ||
@@ -157,0 +159,0 @@ } |
@@ -6,4 +6,6 @@ { | ||
"object-shorthand": ["error", "consistent"], | ||
"quote-props": ["error", "always"] | ||
"quote-props": ["error", "always"], | ||
"unicorn/no-empty-file": "off", | ||
"max-len": "off" | ||
} | ||
} |
@@ -22,3 +22,3 @@ import { checkSelector } from '../../utils/util.js'; | ||
} | ||
return (str) => pattern.test(str.replace(REGEXES.BRACKET_PARENS, '')); | ||
return (string) => pattern.test(string.replaceAll(REGEXES.BRACKET_PARENS, '')); | ||
} | ||
@@ -25,0 +25,0 @@ |
@@ -1,2 +0,9 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export { default } from '../lib/stream/CssUsageDuplex.js'; | ||
import CssUsageDuplex from '../lib/stream/CssUsageDuplex.js'; | ||
/** | ||
* @param {ConstructorParameters<typeof CssUsageDuplex>} options | ||
* @return {CssUsageDuplex} | ||
*/ | ||
export default function index(...options) { | ||
return new CssUsageDuplex(...options); | ||
} |
@@ -22,2 +22,10 @@ import multimatch from 'multimatch'; | ||
/** | ||
* @typedef {Object} DoIUseOptions | ||
* @prop {ConstructorParameters<typeof BrowserSelection>[0]} [browsers] | ||
* @prop {FeatureKeys[]} [ignore] | ||
* @prop {OnFeatureUsage} [onFeatureUsage] | ||
* @prop {string[]} [ignoreFiles] | ||
*/ | ||
export default class DoIUse { | ||
@@ -27,9 +35,8 @@ static default = null; | ||
/** | ||
* @param {Object} [options] | ||
* @param {ConstructorParameters<typeof BrowserSelection>[0]} [options.browsers] | ||
* @param {FeatureKeys[]} [options.ignore] | ||
* @param {OnFeatureUsage} [options.onFeatureUsage] | ||
* @param {string[]} [options.ignoreFiles] | ||
* @param {DoIUseOptions} [optionsOrBrowserQuery] | ||
*/ | ||
constructor(options = {}) { | ||
constructor(optionsOrBrowserQuery) { | ||
const options = (typeof optionsOrBrowserQuery === 'string') | ||
? { browsers: optionsOrBrowserQuery } | ||
: { ...optionsOrBrowserQuery }; | ||
this.browserQuery = options.browsers; | ||
@@ -44,7 +51,7 @@ this.onFeatureUsage = options.onFeatureUsage; | ||
/** | ||
* @param {Object} [opts] | ||
* @param {ConstructorParameters<typeof BrowserSelection>[1]} [opts.from] | ||
* @param {Object} [options] | ||
* @param {ConstructorParameters<typeof BrowserSelection>[1]} [options.from] | ||
*/ | ||
info(opts = {}) { | ||
const { browsers, features } = BrowserSelection.missingSupport(this.browserQuery, opts.from); | ||
info(options = {}) { | ||
const { browsers, features } = BrowserSelection.missingSupport(this.browserQuery, options.from); | ||
@@ -51,0 +58,0 @@ return { |
/* eslint-disable no-underscore-dangle */ | ||
import { pipeline } from 'stream'; | ||
import { pipeline } from 'node:stream'; | ||
@@ -19,3 +19,3 @@ import Tokenize from 'css-tokenize'; | ||
* @param {boolean} [options.skipErrors] | ||
* @param {string} [filename] Filename for outputting source code locations. | ||
* @param {string} [filename] Filename for outputting source code locations. | ||
*/ | ||
@@ -29,3 +29,3 @@ constructor(options, filename) { | ||
pipeline( | ||
// @ts-ignore Bad typings | ||
// @ts-expect-error Bad typings | ||
...streams, | ||
@@ -36,4 +36,4 @@ () => { | ||
); | ||
super(streams[0], streams[streams.length - 1], { objectMode: true }); | ||
super(streams[0], streams.at(-1), { objectMode: true }); | ||
} | ||
} |
/* eslint-disable no-underscore-dangle */ | ||
import { Transform } from 'stream'; | ||
import { Transform } from 'node:stream'; | ||
@@ -34,3 +34,2 @@ import postcss from 'postcss'; | ||
ignore: options.ignore, | ||
// @ts-ignore Bad typings | ||
onFeatureUsage: (usage) => { | ||
@@ -56,5 +55,5 @@ this.push(usage); | ||
let ocol = rule.column; | ||
for (let line = 0; line < lines.length; line++) { | ||
for (const [lineNumber, content] of lines.entries()) { | ||
mapper.addMapping({ | ||
generated: { line: line + 1, column: 1 }, | ||
generated: { line: lineNumber + 1, column: 1 }, | ||
original: { line: oline, column: ocol }, | ||
@@ -64,15 +63,17 @@ source: this.#filename, | ||
mapper.addMapping({ | ||
generated: { line: line + 1, column: lines[line].length }, | ||
original: { line: oline, column: ocol + lines[line].length }, | ||
generated: { line: lineNumber + 1, column: content.length }, | ||
original: { line: oline, column: ocol + content.length }, | ||
source: this.#filename, | ||
}); | ||
oline++; | ||
oline += 1; | ||
ocol = 1; | ||
} | ||
await this.#processor.process(rule.content, { from: this.#filename, map: { prev: mapper.toString() } }); | ||
} catch (err) { | ||
await this.#processor.process(rule.content, { | ||
from: this.#filename, map: { prev: mapper.toString() }, | ||
}); | ||
} catch (error) { | ||
if (this.#skipErrors) { | ||
this.emit('warning', err); | ||
this.emit('warning', error); | ||
} else { | ||
caughtError = err; | ||
caughtError = error; | ||
} | ||
@@ -79,0 +80,0 @@ } |
/* eslint-disable no-underscore-dangle */ | ||
import { Transform } from 'stream'; | ||
import { Transform } from 'node:stream'; | ||
@@ -40,3 +40,3 @@ const NEW_LINE_CHAR = '\n'.codePointAt(0); | ||
if ((type === 'rule_start' || type === 'atrule_start')) { | ||
this.#depth++; | ||
this.#depth += 1; | ||
} | ||
@@ -47,3 +47,3 @@ if (this.#depth > 0 && !this.#current) { | ||
if (type === 'rule_end' || type === 'atrule_end') { | ||
this.#depth--; | ||
this.#depth -= 1; | ||
} | ||
@@ -65,8 +65,8 @@ | ||
// Update position | ||
for (let i = 0; i < buf.length; i++) { | ||
if (buf[i] === NEW_LINE_CHAR) { | ||
this.#line++; | ||
for (const char of buf) { | ||
if (char === NEW_LINE_CHAR) { | ||
this.#line += 1; | ||
this.#column = 1; | ||
} else { | ||
this.#column++; | ||
this.#column += 1; | ||
} | ||
@@ -73,0 +73,0 @@ } |
{ | ||
"name": "doiuse", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "Lint CSS for browser support against caniuse database", | ||
@@ -58,3 +58,4 @@ "main:": "./exports/index.cjs", | ||
"@types/caniuse-lite": "^1.0.1", | ||
"@types/node": "^14.18.36", | ||
"@types/duplexify": "^3.6.1", | ||
"@types/node": "^16.18.34", | ||
"@types/tap": "^15.0.8", | ||
@@ -68,9 +69,7 @@ "@types/yargs": "^17.0.22", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-canonical": "^2.6.0", | ||
"eslint-plugin-github": "^4.6.1", | ||
"eslint-plugin-canonical": "^4.2.2", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jsdoc": "^40.0.0", | ||
"eslint-plugin-n": "^15.6.1", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-unicorn": "^45.0.2", | ||
"eslint-plugin-jsdoc": "^46.4.3", | ||
"eslint-plugin-n": "^16.0.0", | ||
"eslint-plugin-unicorn": "^47.0.0", | ||
"mock-fs": "^4.14.0", | ||
@@ -81,3 +80,3 @@ "postcss-import": "^14.1.0", | ||
"tap": "^16.3.4", | ||
"typescript": "^4.9.5" | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -94,8 +93,8 @@ "files": [ | ||
"scripts": { | ||
"pretest": "eslint ./bin/**/*.js ./data/**/*.js ./lib/**/*.js ./test/**/*.js", | ||
"pretest": "eslint ./bin/**/*.js ./data/**/*.js ./lib/**/*.js ./test/**/*.js && tsc --noEmit", | ||
"test": "c8 tap --no-coverage", | ||
"prepare": "rollup -c rollup.config.js", | ||
"prepublishOnly": "tsc", | ||
"prepublishOnly": "tsc --emitDeclarationOnly", | ||
"updateFeatures": "scripts/update-caniuse.sh && node scripts/update-features.js" | ||
} | ||
} |
@@ -264,3 +264,3 @@ declare const _default: { | ||
}; | ||
'css-any-link': (rule: import("postcss").ChildNode) => boolean; | ||
'css-any-link': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-appearance': { | ||
@@ -271,8 +271,8 @@ appearance: boolean; | ||
}; | ||
'css-at-counter-style': (rule: import("postcss").ChildNode) => boolean; | ||
'css-autofill': (rule: import("postcss").ChildNode) => boolean; | ||
'css-at-counter-style': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-autofill': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-backdrop-filter': { | ||
'backdrop-filter': boolean; | ||
}; | ||
'css-background-offsets': (rule: import("postcss").ChildNode) => boolean; | ||
'css-background-offsets': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-backgroundblendmode': { | ||
@@ -285,3 +285,3 @@ 'background-blend-mode': boolean; | ||
}; | ||
'css-canvas': (rule: import("postcss").ChildNode) => boolean; | ||
'css-canvas': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-caret-color': Feature; | ||
@@ -306,3 +306,3 @@ 'css-cascade-layers': Feature; | ||
'css-container-queries': Feature; | ||
'css-container-queries-style': (rule: import("postcss").ChildNode) => boolean; | ||
'css-container-queries-style': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-container-query-units': { | ||
@@ -330,3 +330,3 @@ '': string[]; | ||
'css-exclusions': Feature; | ||
'css-featurequeries': (rule: import("postcss").ChildNode) => boolean; | ||
'css-featurequeries': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-file-selector-button': Feature; | ||
@@ -349,3 +349,3 @@ 'css-filter-function': Feature; | ||
}; | ||
'css-gencontent': (rule: import("postcss").ChildNode) => boolean; | ||
'css-gencontent': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-gradients': { | ||
@@ -500,3 +500,3 @@ background: RegExp; | ||
}; | ||
'css-matches-pseudo': (rule: import("postcss").ChildNode) => boolean; | ||
'css-matches-pseudo': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-math-functions': { | ||
@@ -506,6 +506,6 @@ '': string[]; | ||
'css-media-interaction': Feature; | ||
'css-media-range-syntax': (rule: import("postcss").ChildNode) => boolean; | ||
'css-media-resolution': (rule: import("postcss").ChildNode) => boolean; | ||
'css-media-range-syntax': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-media-resolution': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-media-scripting': Feature; | ||
'css-mediaqueries': (rule: import("postcss").ChildNode) => boolean; | ||
'css-mediaqueries': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-mixblendmode': { | ||
@@ -538,3 +538,3 @@ 'mix-blend-mode': boolean; | ||
'css-paint-api': Feature; | ||
'css-placeholder': ((rule: import("postcss").ChildNode) => boolean)[]; | ||
'css-placeholder': ((rule: import("postcss/lib/node.js").ChildNode) => boolean)[]; | ||
'css-placeholder-shown': Feature; | ||
@@ -568,5 +568,5 @@ 'css-print-color-adjust': { | ||
}; | ||
'css-sel2': (rule: import("postcss").ChildNode) => boolean; | ||
'css-sel3': (rule: import("postcss").ChildNode) => boolean; | ||
'css-selection': (rule: import("postcss").ChildNode) => boolean; | ||
'css-sel2': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-sel3': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-selection': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-shapes': { | ||
@@ -609,3 +609,3 @@ 'shape-outside': boolean; | ||
}; | ||
'css-variables': (rule: import("postcss").ChildNode) => boolean; | ||
'css-variables': (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
'css-when-else': Feature; | ||
@@ -668,4 +668,4 @@ 'css-widows-orphans': Feature; | ||
'font-variant-numeric': Feature; | ||
fontface: ((rule: import("postcss").ChildNode) => boolean)[]; | ||
fullscreen: (rule: import("postcss").ChildNode) => boolean; | ||
fontface: ((rule: import("postcss/lib/node.js").ChildNode) => boolean)[]; | ||
fullscreen: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
getcomputedstyle: Feature; | ||
@@ -714,3 +714,3 @@ 'inline-block': { | ||
}; | ||
multibackgrounds: (rule: import("postcss").ChildNode) => boolean; | ||
multibackgrounds: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
multicolumn: { | ||
@@ -717,0 +717,0 @@ columns: boolean; |
declare namespace _default { | ||
const all: boolean; | ||
let all: boolean; | ||
} | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
declare namespace _default { | ||
const filter: boolean; | ||
let filter: boolean; | ||
} | ||
export default _default; |
declare namespace _default { | ||
const position: string; | ||
let position: string; | ||
} | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
declare namespace _default { | ||
const hyphens: boolean; | ||
let hyphens: boolean; | ||
} | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
declare namespace _default { | ||
const opacity: boolean; | ||
let opacity: boolean; | ||
} | ||
export default _default; |
declare namespace _default { | ||
const overflow: string; | ||
let overflow: string; | ||
} | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: ((rule: import("postcss").ChildNode) => boolean)[]; | ||
declare const _default: ((rule: import("postcss/lib/node.js").ChildNode) => boolean)[]; | ||
export default _default; |
declare namespace _default { | ||
const resize: boolean; | ||
let resize: boolean; | ||
} | ||
export default _default; |
export namespace REGEXES { | ||
const HAS_ATTRIBUTE: RegExp; | ||
const MATCH_ATTRIBUTE: RegExp; | ||
const WORD_ATTRIBUTE: RegExp; | ||
const SUBCODE_ATTRIBUTE: RegExp; | ||
const BRACKET_PARENS: RegExp; | ||
let HAS_ATTRIBUTE: RegExp; | ||
let MATCH_ATTRIBUTE: RegExp; | ||
let WORD_ATTRIBUTE: RegExp; | ||
let SUBCODE_ATTRIBUTE: RegExp; | ||
let BRACKET_PARENS: RegExp; | ||
} | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
export namespace REGEXES { | ||
const SIBLING_SELECTOR: RegExp; | ||
const STARTSWITH_ATTRIBUTE: RegExp; | ||
const ENDSWITH_ATTRIBUTE: RegExp; | ||
const INSENSITIVE_ATTRIBUTE: RegExp; | ||
let SIBLING_SELECTOR: RegExp; | ||
let STARTSWITH_ATTRIBUTE: RegExp; | ||
let ENDSWITH_ATTRIBUTE: RegExp; | ||
let INSENSITIVE_ATTRIBUTE: RegExp; | ||
} | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
declare namespace _default { | ||
const position: string; | ||
let position: string; | ||
} | ||
export default _default; |
declare namespace _default { | ||
const display: string[]; | ||
let display: string[]; | ||
} | ||
export default _default; |
declare namespace _default { | ||
const cursor: string[]; | ||
let cursor: string[]; | ||
} | ||
export default _default; |
declare namespace _default { | ||
const cursor: string[]; | ||
let cursor: string[]; | ||
} | ||
export default _default; |
declare namespace _default { | ||
const cursor: string[]; | ||
let cursor: string[]; | ||
} | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: ((rule: import("postcss").ChildNode) => boolean)[]; | ||
declare const _default: ((rule: import("postcss/lib/node.js").ChildNode) => boolean)[]; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
declare const _default: (rule: import("postcss").ChildNode) => boolean; | ||
declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; | ||
export default _default; |
declare namespace _default { | ||
const display: string; | ||
let display: string; | ||
} | ||
export default _default; |
@@ -5,8 +5,3 @@ /** | ||
*/ | ||
export default function index(options?: { | ||
browsers?: string | readonly string[]; | ||
ignore?: ("outline" | "background-attachment" | "pointer" | "flow-root" | "font-kerning" | "font-smooth" | "font-variant-alternates" | "font-variant-numeric" | "inline-block" | "prefers-color-scheme" | "prefers-reduced-motion" | "rem" | "run-in" | "text-emphasis" | "text-stroke" | "webkit-user-drag" | "border-image" | "border-radius" | "font-size-adjust" | "text-decoration" | "object-fit" | "pointer-events" | "text-overflow" | "text-size-adjust" | "will-change" | "word-break" | "alternate-stylesheet" | "background-clip-text" | "background-img-opts" | "background-position-x-y" | "background-repeat-round-space" | "calc" | "ch-unit" | "css-all" | "css-animation" | "css-any-link" | "css-appearance" | "css-at-counter-style" | "css-autofill" | "css-backdrop-filter" | "css-background-offsets" | "css-backgroundblendmode" | "css-boxdecorationbreak" | "css-boxshadow" | "css-canvas" | "css-caret-color" | "css-cascade-layers" | "css-case-insensitive" | "css-clip-path" | "css-color-adjust" | "css-color-function" | "css-conic-gradients" | "css-container-queries" | "css-container-queries-style" | "css-container-query-units" | "css-containment" | "css-content-visibility" | "css-counters" | "css-crisp-edges" | "css-cross-fade" | "css-default-pseudo" | "css-descendant-gtgt" | "css-deviceadaptation" | "css-dir-pseudo" | "css-display-contents" | "css-element-function" | "css-env-function" | "css-exclusions" | "css-featurequeries" | "css-file-selector-button" | "css-filter-function" | "css-filters" | "css-first-letter" | "css-first-line" | "css-fixed" | "css-focus-visible" | "css-focus-within" | "css-font-palette" | "css-font-rendering-controls" | "css-font-stretch" | "css-gencontent" | "css-gradients" | "css-grid" | "css-grid-animation" | "css-hanging-punctuation" | "css-has" | "css-hyphens" | "css-image-orientation" | "css-image-set" | "css-in-out-of-range" | "css-indeterminate-pseudo" | "css-initial-letter" | "css-initial-value" | "css-lch-lab" | "css-letter-spacing" | "css-line-clamp" | "css-logical-props" | "css-marker-pseudo" | "css-masks" | "css-matches-pseudo" | "css-math-functions" | "css-media-interaction" | "css-media-range-syntax" | "css-media-resolution" | "css-media-scripting" | "css-mediaqueries" | "css-mixblendmode" | "css-motion-paths" | "css-namespaces" | "css-nesting" | "css-not-sel-list" | "css-nth-child-of" | "css-opacity" | "css-optional-pseudo" | "css-overflow" | "css-overflow-anchor" | "css-overflow-overlay" | "css-overscroll-behavior" | "css-page-break" | "css-paged-media" | "css-paint-api" | "css-placeholder" | "css-placeholder-shown" | "css-print-color-adjust" | "css-read-only-write" | "css-rebeccapurple" | "css-reflections" | "css-regions" | "css-relative-colors" | "css-repeating-gradients" | "css-resize" | "css-revert-value" | "css-rrggbbaa" | "css-scroll-behavior" | "css-scroll-timeline" | "css-scrollbar" | "css-sel2" | "css-sel3" | "css-selection" | "css-shapes" | "css-snappoints" | "css-sticky" | "css-subgrid" | "css-supports-api" | "css-table" | "css-text-align-last" | "css-text-box-trim" | "css-text-indent" | "css-text-justify" | "css-text-orientation" | "css-text-spacing" | "css-textshadow" | "css-touch-action" | "css-transitions" | "css-unicode-bidi" | "css-unset-value" | "css-variables" | "css-when-else" | "css-widows-orphans" | "css-width-stretch" | "css-writing-mode" | "css-zoom" | "css3-attr" | "css3-boxsizing" | "css3-colors" | "css3-cursors" | "css3-cursors-grab" | "css3-cursors-newer" | "css3-tabsize" | "currentcolor" | "devicepixelratio" | "extended-system-fonts" | "flexbox" | "flexbox-gap" | "font-family-system-ui" | "font-feature" | "font-loading" | "font-unicode-range" | "fontface" | "fullscreen" | "getcomputedstyle" | "intrinsic-width" | "justify-content-space-evenly" | "kerning-pairs-ligatures" | "mdn-css-unicode-bidi-isolate" | "mdn-css-unicode-bidi-isolate-override" | "mdn-css-unicode-bidi-plaintext" | "mdn-text-decoration-color" | "mdn-text-decoration-line" | "mdn-text-decoration-shorthand" | "mdn-text-decoration-style" | "minmaxwh" | "multibackgrounds" | "multicolumn" | "style-scoped" | "svg-css" | "transforms2d" | "transforms3d" | "ttf" | "user-select-none" | "variable-fonts" | "viewport-unit-variants" | "viewport-units" | "wordwrap")[]; | ||
onFeatureUsage?: import("../lib/DoIUse.js").OnFeatureUsage; | ||
ignoreFiles?: string[]; | ||
}): DoIUse; | ||
import DoIUse from "../lib/DoIUse.js"; | ||
export default function index(optionsOrBrowserQuery?: import("../lib/DoIUse.js").DoIUseOptions): DoIUse; | ||
import DoIUse from '../lib/DoIUse.js'; |
@@ -1,1 +0,10 @@ | ||
export { default } from "../lib/stream/CssUsageDuplex.js"; | ||
/** | ||
* @param {ConstructorParameters<typeof CssUsageDuplex>} options | ||
* @return {CssUsageDuplex} | ||
*/ | ||
export default function index(options: { | ||
browsers: string; | ||
ignore?: ("outline" | "background-attachment" | "pointer" | "flow-root" | "font-kerning" | "font-smooth" | "font-variant-alternates" | "font-variant-numeric" | "inline-block" | "prefers-color-scheme" | "prefers-reduced-motion" | "rem" | "run-in" | "text-emphasis" | "text-stroke" | "webkit-user-drag" | "border-image" | "border-radius" | "font-size-adjust" | "text-decoration" | "object-fit" | "pointer-events" | "text-overflow" | "text-size-adjust" | "will-change" | "word-break" | "alternate-stylesheet" | "background-clip-text" | "background-img-opts" | "background-position-x-y" | "background-repeat-round-space" | "calc" | "ch-unit" | "css-all" | "css-animation" | "css-any-link" | "css-appearance" | "css-at-counter-style" | "css-autofill" | "css-backdrop-filter" | "css-background-offsets" | "css-backgroundblendmode" | "css-boxdecorationbreak" | "css-boxshadow" | "css-canvas" | "css-caret-color" | "css-cascade-layers" | "css-case-insensitive" | "css-clip-path" | "css-color-adjust" | "css-color-function" | "css-conic-gradients" | "css-container-queries" | "css-container-queries-style" | "css-container-query-units" | "css-containment" | "css-content-visibility" | "css-counters" | "css-crisp-edges" | "css-cross-fade" | "css-default-pseudo" | "css-descendant-gtgt" | "css-deviceadaptation" | "css-dir-pseudo" | "css-display-contents" | "css-element-function" | "css-env-function" | "css-exclusions" | "css-featurequeries" | "css-file-selector-button" | "css-filter-function" | "css-filters" | "css-first-letter" | "css-first-line" | "css-fixed" | "css-focus-visible" | "css-focus-within" | "css-font-palette" | "css-font-rendering-controls" | "css-font-stretch" | "css-gencontent" | "css-gradients" | "css-grid" | "css-grid-animation" | "css-hanging-punctuation" | "css-has" | "css-hyphens" | "css-image-orientation" | "css-image-set" | "css-in-out-of-range" | "css-indeterminate-pseudo" | "css-initial-letter" | "css-initial-value" | "css-lch-lab" | "css-letter-spacing" | "css-line-clamp" | "css-logical-props" | "css-marker-pseudo" | "css-masks" | "css-matches-pseudo" | "css-math-functions" | "css-media-interaction" | "css-media-range-syntax" | "css-media-resolution" | "css-media-scripting" | "css-mediaqueries" | "css-mixblendmode" | "css-motion-paths" | "css-namespaces" | "css-nesting" | "css-not-sel-list" | "css-nth-child-of" | "css-opacity" | "css-optional-pseudo" | "css-overflow" | "css-overflow-anchor" | "css-overflow-overlay" | "css-overscroll-behavior" | "css-page-break" | "css-paged-media" | "css-paint-api" | "css-placeholder" | "css-placeholder-shown" | "css-print-color-adjust" | "css-read-only-write" | "css-rebeccapurple" | "css-reflections" | "css-regions" | "css-relative-colors" | "css-repeating-gradients" | "css-resize" | "css-revert-value" | "css-rrggbbaa" | "css-scroll-behavior" | "css-scroll-timeline" | "css-scrollbar" | "css-sel2" | "css-sel3" | "css-selection" | "css-shapes" | "css-snappoints" | "css-sticky" | "css-subgrid" | "css-supports-api" | "css-table" | "css-text-align-last" | "css-text-box-trim" | "css-text-indent" | "css-text-justify" | "css-text-orientation" | "css-text-spacing" | "css-textshadow" | "css-touch-action" | "css-transitions" | "css-unicode-bidi" | "css-unset-value" | "css-variables" | "css-when-else" | "css-widows-orphans" | "css-width-stretch" | "css-writing-mode" | "css-zoom" | "css3-attr" | "css3-boxsizing" | "css3-colors" | "css3-cursors" | "css3-cursors-grab" | "css3-cursors-newer" | "css3-tabsize" | "currentcolor" | "devicepixelratio" | "extended-system-fonts" | "flexbox" | "flexbox-gap" | "font-family-system-ui" | "font-feature" | "font-loading" | "font-unicode-range" | "fontface" | "fullscreen" | "getcomputedstyle" | "intrinsic-width" | "justify-content-space-evenly" | "kerning-pairs-ligatures" | "mdn-css-unicode-bidi-isolate" | "mdn-css-unicode-bidi-isolate-override" | "mdn-css-unicode-bidi-plaintext" | "mdn-text-decoration-color" | "mdn-text-decoration-line" | "mdn-text-decoration-shorthand" | "mdn-text-decoration-style" | "minmaxwh" | "multibackgrounds" | "multicolumn" | "style-scoped" | "svg-css" | "transforms2d" | "transforms3d" | "ttf" | "user-select-none" | "variable-fonts" | "viewport-unit-variants" | "viewport-units" | "wordwrap")[]; | ||
skipErrors?: boolean; | ||
}, filename?: string): CssUsageDuplex; | ||
import CssUsageDuplex from '../lib/stream/CssUsageDuplex.js'; |
@@ -51,7 +51,3 @@ /** | ||
*/ | ||
filterStats(stats: Readonly<{ | ||
[agentID: string]: Readonly<{ | ||
[version: string]: string; | ||
}>; | ||
}>): Filter<Record<string, Record<string, string>>>; | ||
filterStats(stats: import('caniuse-lite').StatsByAgentID): Filter<Record<string, Record<string, string>>>; | ||
/** | ||
@@ -516,2 +512,2 @@ * Get data on CSS features not supported by the given autoprefixer-like | ||
}; | ||
import * as caniuse from "caniuse-lite"; | ||
import * as caniuse from 'caniuse-lite'; |
@@ -14,17 +14,15 @@ /** @typedef {import('../data/features.js').FeatureKeys} FeatureKeys */ | ||
*/ | ||
/** | ||
* @typedef {Object} DoIUseOptions | ||
* @prop {ConstructorParameters<typeof BrowserSelection>[0]} [browsers] | ||
* @prop {FeatureKeys[]} [ignore] | ||
* @prop {OnFeatureUsage} [onFeatureUsage] | ||
* @prop {string[]} [ignoreFiles] | ||
*/ | ||
export default class DoIUse { | ||
static default: any; | ||
/** | ||
* @param {Object} [options] | ||
* @param {ConstructorParameters<typeof BrowserSelection>[0]} [options.browsers] | ||
* @param {FeatureKeys[]} [options.ignore] | ||
* @param {OnFeatureUsage} [options.onFeatureUsage] | ||
* @param {string[]} [options.ignoreFiles] | ||
* @param {DoIUseOptions} [optionsOrBrowserQuery] | ||
*/ | ||
constructor(options?: { | ||
browsers?: [query?: string | readonly string[], from?: string | false][0]; | ||
ignore?: FeatureKeys[]; | ||
onFeatureUsage?: OnFeatureUsage; | ||
ignoreFiles?: string[]; | ||
}); | ||
constructor(optionsOrBrowserQuery?: DoIUseOptions); | ||
browserQuery: string | readonly string[]; | ||
@@ -35,6 +33,6 @@ onFeatureUsage: OnFeatureUsage; | ||
/** | ||
* @param {Object} [opts] | ||
* @param {ConstructorParameters<typeof BrowserSelection>[1]} [opts.from] | ||
* @param {Object} [options] | ||
* @param {ConstructorParameters<typeof BrowserSelection>[1]} [options.from] | ||
*/ | ||
info(opts?: { | ||
info(options?: { | ||
from?: [query?: string | readonly string[], from?: string | false][1]; | ||
@@ -45,3 +43,3 @@ }): { | ||
}; | ||
postcss(root: import("postcss").Root, result: import("postcss").Result): void | Promise<void>; | ||
postcss(root: import("postcss/lib/root.js").default, result: import("postcss/lib/result.js").default): void | Promise<void>; | ||
} | ||
@@ -56,1 +54,7 @@ export type FeatureKeys = import('../data/features.js').FeatureKeys; | ||
export type OnFeatureUsage = (result: OnFeatureUsageArguments) => any; | ||
export type DoIUseOptions = { | ||
browsers?: [query?: string | readonly string[], from?: string | false][0]; | ||
ignore?: FeatureKeys[]; | ||
onFeatureUsage?: OnFeatureUsage; | ||
ignoreFiles?: string[]; | ||
}; |
/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */ | ||
export default class CssUsageDuplex { | ||
export default class CssUsageDuplex extends Duplexify.Duplexify { | ||
/** | ||
@@ -8,3 +8,3 @@ * @param {Object} options | ||
* @param {boolean} [options.skipErrors] | ||
* @param {string} [filename] Filename for outputting source code locations. | ||
* @param {string} [filename] Filename for outputting source code locations. | ||
*/ | ||
@@ -18,1 +18,2 @@ constructor(options: { | ||
export type FeatureKeys = import('../../data/features.js').FeatureKeys; | ||
import Duplexify from 'duplexify'; |
@@ -26,2 +26,2 @@ /** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */ | ||
export type SourceMapTransformation = import('./SourceMapTransform.js').SourceMapTransformation; | ||
import { Transform } from "stream"; | ||
import { Transform } from 'node:stream'; |
@@ -22,2 +22,2 @@ /** | ||
}; | ||
import { Transform } from "stream"; | ||
import { Transform } from 'node:stream'; |
/** | ||
* given a kebab-case string, returns a camelCase string | ||
* @param {string} str the kebab-case string | ||
* @param {string} kebab the kebab-case string | ||
* @return {string} the camelCase string | ||
*/ | ||
export function kebabToCamel(str) { | ||
return str.replace(/-([a-z])/g, (match, letter) => letter.toUpperCase()); | ||
export function kebabToCamel(kebab) { | ||
return kebab.replaceAll(/-([a-z])/g, (match, letter) => letter.toUpperCase()); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
433039
22
448
11635
1
0