postcss-load-config
Advanced tools
Comparing version 5.1.0 to 6.0.0
{ | ||
"name": "postcss-load-config", | ||
"version": "5.1.0", | ||
"version": "6.0.0", | ||
"description": "Autoload Config for PostCSS", | ||
@@ -24,4 +24,3 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"lilconfig": "^3.1.1", | ||
"yaml": "^2.4.2" | ||
"lilconfig": "^3.1.1" | ||
}, | ||
@@ -31,3 +30,4 @@ "peerDependencies": { | ||
"postcss": ">=8.0.9", | ||
"tsx": "^4.8.1" | ||
"tsx": "^4.8.1", | ||
"yaml": "^2.4.2" | ||
}, | ||
@@ -43,2 +43,5 @@ "peerDependenciesMeta": { | ||
"optional": true | ||
}, | ||
"yaml": { | ||
"optional": true | ||
} | ||
@@ -45,0 +48,0 @@ }, |
@@ -86,2 +86,5 @@ | ||
> [!NOTE] | ||
> For YAML configs, you must have [yaml](https://www.npmjs.com/package/yaml) installed as a peer dependency. | ||
### `.postcssrc.js` or `postcss.config.js` | ||
@@ -104,3 +107,3 @@ | ||
> [!NOTE] | ||
> [!NOTE] | ||
> For TypeScript configs, you must have [tsx](https://www.npmjs.com/package/tsx) or [jiti](https://www.npmjs.com/package/jiti) installed as a peer dependency. | ||
@@ -107,0 +110,0 @@ |
@@ -5,3 +5,2 @@ // @ts-check | ||
const config = require('lilconfig') | ||
const yaml = require('yaml') | ||
@@ -79,2 +78,17 @@ const loadOptions = require('./options.js') | ||
let yaml | ||
async function yamlLoader(_, content) { | ||
if (!yaml) { | ||
try { | ||
yaml = await import('yaml') | ||
} catch (e) { | ||
/* c8 ignore start */ | ||
throw new Error( | ||
`'yaml' is required for the YAML configuration files. Make sure it is installed\nError: ${e.message}` | ||
) | ||
} | ||
} | ||
return yaml.parse(content); | ||
} | ||
/** @return {import('lilconfig').Options} */ | ||
@@ -94,4 +108,4 @@ const withLoaders = (options = {}) => { | ||
'.ts': loader, | ||
'.yaml': (_, content) => yaml.parse(content), | ||
'.yml': (_, content) => yaml.parse(content) | ||
'.yaml': yamlLoader, | ||
'.yml': yamlLoader | ||
}, | ||
@@ -98,0 +112,0 @@ searchPlaces: [ |
@@ -73,3 +73,2 @@ // @ts-check | ||
if ( | ||
// eslint-disable-next-line | ||
!( | ||
@@ -76,0 +75,0 @@ (typeof plugin === 'object' && Array.isArray(plugin.plugins)) || |
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
22606
385
475
- Removedyaml@^2.4.2