Comparing version 7.1.2 to 7.2.0
@@ -19,3 +19,3 @@ import path from 'node:path'; | ||
try { | ||
const options = getOptions(params); | ||
const options = await getOptions(params); | ||
const {target = {}, base = process.cwd()} = options; | ||
@@ -22,0 +22,0 @@ const result = await create(options); |
{ | ||
"name": "critical", | ||
"version": "7.1.2", | ||
"version": "7.2.0", | ||
"description": "Extract & Inline Critical-path CSS from HTML", | ||
@@ -35,11 +35,12 @@ "author": "Addy Osmani", | ||
"dependencies": { | ||
"@adobe/css-tools": "^4.3.3", | ||
"@adobe/css-tools": "^4.4.0", | ||
"async-traverse-tree": "^1.1.0", | ||
"clean-css": "^5.3.3", | ||
"common-tags": "^1.8.2", | ||
"css-url-parser": "^1.1.3", | ||
"data-uri-to-buffer": "^6.0.1", | ||
"debug": "^4.3.4", | ||
"css-url-parser": "^1.1.4", | ||
"data-uri-to-buffer": "^6.0.2", | ||
"debug": "^4.3.6", | ||
"find-up": "^7.0.0", | ||
"get-stdin": "^9.0.0", | ||
"globby": "^14.0.1", | ||
"globby": "^14.0.2", | ||
"got": "^13.0.0", | ||
@@ -50,3 +51,3 @@ "group-args": "^0.1.0", | ||
"is-glob": "^4.0.3", | ||
"joi": "^17.12.2", | ||
"joi": "^17.13.3", | ||
"lodash": "^4.17.21", | ||
@@ -59,5 +60,5 @@ "lodash-es": "^4.17.21", | ||
"penthouse": "^2.3.3", | ||
"picocolors": "^1.0.0", | ||
"picocolors": "^1.0.1", | ||
"plugin-error": "^2.0.1", | ||
"postcss": "^8.4.38", | ||
"postcss": "^8.4.41", | ||
"postcss-discard": "^2.0.0", | ||
@@ -64,0 +65,0 @@ "postcss-image-inliner": "^7.0.1", |
import process from 'node:process'; | ||
import Joi from 'joi'; | ||
import debugBase from 'debug'; | ||
import {traverse, STOP} from 'async-traverse-tree'; | ||
import {ConfigError} from './errors.js'; | ||
@@ -78,4 +79,19 @@ | ||
export function getOptions(options = {}) { | ||
const {error, value} = schema.validate(options); | ||
export async function getOptions(options = {}) { | ||
const parsedOptions = await traverse(options, (key, value) => { | ||
if (['css', 'html', 'src'].includes(key)) { | ||
return STOP; | ||
} | ||
if (typeof value === 'string') { | ||
try { | ||
return JSON.parse(value); | ||
} catch {} | ||
} | ||
return value; | ||
}); | ||
const {error, value} = schema.validate(parsedOptions); | ||
const {inline, dimensions, penthouse = {}, target, ignore} = value || {}; | ||
@@ -82,0 +98,0 @@ |
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
95040
1651
34
+ Addedasync-traverse-tree@^1.1.0
+ Addedasync-traverse-tree@1.1.0(transitive)
Updated@adobe/css-tools@^4.4.0
Updatedcss-url-parser@^1.1.4
Updateddata-uri-to-buffer@^6.0.2
Updateddebug@^4.3.6
Updatedglobby@^14.0.2
Updatedjoi@^17.13.3
Updatedpicocolors@^1.0.1
Updatedpostcss@^8.4.41