@thedanbob/esbuild-plugin-sass 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,8 +5,15 @@ const importer = {
5
5
  findFileUrl: (url) => {
6
6
  if (!url.startsWith("~"))
7
7
  return null;
8
- const pkg = url.replace(/^~(.+?)\/.+/, "$1");
9
- return new URL(url.substring(1), import.meta.resolve(pkg).replace(/(?<=node_modules\/).+/, ""));
8
+ try {
9
+ // import.meta.resolve searches for an index file by default, which isn't guaranteed to exist.
10
+ // Instead, we attempt to resolve <package>/package.json
11
+ const file = url.replace(/^~(.+?)\/.+/, "$1/package.json");
12
+ return new URL(url.substring(1), import.meta.resolve(file).replace(/(?<=node_modules\/).+/, ""));
13
+ }
14
+ catch {
15
+ return null;
16
+ }
10
17
  }
11
18
  };
12
19
  export default ({ filter = /.(s[ac]ss|css)$/, quietDeps = false, silenceDeprecations = [], transform = undefined } = {}) => ({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@thedanbob/esbuild-plugin-sass",
3
3
  "author": "Dan Arnfield <npm@thedanbob.com>",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "repository": {