postcss-import-glob 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -17,9 +17,12 @@ export const importGlob = options => ({
17
17
 
18
18
  const read = path => readFile(`${options.cwd}/${path}`)
19
19
  .then(parse)
20
- .catch(result.error)
20
+ .catch(node.error)
21
21
 
22
22
  const css = await glob(pattern, options, read)
23
+ if (css.length === 0)
24
+ node.warn(result, `${node.params} did not match any files`)
25
+
23
26
  node.replaceWith(...css)
24
27
 
25
28
  const metadata = css.map(file => ({
package/lib/utils.js CHANGED
@@ -7,11 +7,12 @@ export const raw = string =>
7
7
  string.match(/^(?:url\()?["']?(.+\.css)["')]/)?.at(1)
8
8
 
9
9
  export function basedir(path) {
10
+ if (path == null) return process.cwd()
10
11
  const { dir, base, name } = parse(path)
11
12
  return base === name ? dir.length ? join(dir, name) : name : dir
12
13
  }
13
14
 
14
- export function glob(pattern, options, method) {
15
+ export function glob(pattern = [], options, method) {
15
16
  options ??= {}
16
17
  const patterns = [pattern].flat()
17
18
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.1",
2
+ "version": "0.2.0",
3
3
  "name": "postcss-import-glob",
4
4
  "description": "PostCSS plugin to inline CSS @imports, with support for glob patterns.",
5
5
  "keywords": [