Skip to content

Commit

Permalink
Merge branch 'master' into pr/35
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Oct 10, 2024
2 parents bc9a5dc + fa83ce9 commit 7a26af2
Show file tree
Hide file tree
Showing 5 changed files with 1,246 additions and 1,084 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## next

- Bumped `csstree` to [^3.0.0](https://github.com/csstree/csstree/releases/tag/v3.0.0)

## 3.0.0 (December 13, 2021)

- Added custom reporters support in CLI, e.g. `csstree-validator --reporter path/to/reporter.js` or `csstree-validator --reporter reporter-package`
Expand Down
6 changes: 4 additions & 2 deletions fixtures/custom-reporter/node_modules/dual/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions lib/cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import fs from 'fs';
import resolve from 'resolve';
import resolve from 'enhanced-resolve';
import { command as createCommand, Error as CliError } from 'clap';
import * as reporters from './reporter/index.js';
import { validatePath, validateString } from './helpers.js';
Expand Down Expand Up @@ -29,6 +29,10 @@ function printResult(result, reporter) {
}
}

const nodeResolver = resolve.create.sync({
conditionNames: ['node', 'import']
});

const command = createCommand('csstree-validate [fileOrDir]')
.version(version)
.option(
Expand All @@ -43,7 +47,7 @@ const command = createCommand('csstree-validate [fileOrDir]')

if (!hasOwnProperty.call(reporters, nameOrFile)) {
try {
const resolvedPath = resolve.sync(nameOrFile, { basedir: process.cwd() });
const resolvedPath = nodeResolver(process.cwd(), nameOrFile);
return import(resolvedPath);
} catch (e) {}

Expand Down
Loading

0 comments on commit 7a26af2

Please sign in to comment.