load-plugin 6.0.1 → 6.0.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAqGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,iCAPW,MAAM,YAEN,SAAS,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,GAEtC,QAAQ,OAAO,CAAC,CAY5B;AAED;;;;;;;;;GASG;AACH,oCAPW,MAAM,YAEN,SAAS,cAAc,CAAC,GAAG,IAAI,GAAG,SAAS,GAEzC,QAAQ,MAAM,CAAC,CAyE3B;;;;0BAlNY,sBAAsB,GAAG,cAAc;;;;;;;;;;;;;UAKtC,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;WAUnC,cAAc,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;aAGjF,OAAO,GAAG,IAAI,GAAG,SAAS;;;;aAY1B,MAAM,GAAG,IAAI,GAAG,SAAS"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA8FA;;;;;;;;;;;;;;;;;;GAkBG;AACH,iCAPW,MAAM,YAEN,SAAS,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,GAEtC,QAAQ,OAAO,CAAC,CAY5B;AAED;;;;;;;;;GASG;AACH,oCAPW,MAAM,YAEN,SAAS,cAAc,CAAC,GAAG,IAAI,GAAG,SAAS,GAEzC,QAAQ,MAAM,CAAC,CAyE3B;;;;0BA3MY,sBAAsB,GAAG,cAAc;;;;;;;;;;;;;UAKtC,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;WAUnC,cAAc,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;aAGjF,OAAO,GAAG,IAAI,GAAG,SAAS;;;;aAY1B,MAAM,GAAG,IAAI,GAAG,SAAS"}
package/lib/index.js CHANGED
@@ -33,7 +33,7 @@
33
33
  * Prefix to search for (optional).
34
34
  */
35
35
 
36
- import fs from 'node:fs/promises'
36
+ import fs from 'node:fs'
37
37
  import path from 'node:path'
38
38
  import process from 'node:process'
39
39
  import {fileURLToPath, pathToFileURL} from 'node:url'
@@ -88,15 +88,8 @@ let globalFolder = new URL(nodeModules, pathToFileURL(npmPrefix) + '/')
88
88
  // Luckily NVM leaks some environment variables that we can pick up on to try
89
89
  // and detect the actual modules.
90
90
  /* c8 ignore next 10 -- Electron. */
91
- if (electron && nvm) {
92
- try {
93
- await fs.stat(globalFolder)
94
- } catch (error) {
95
- const cause = /** @type {NodeJS.ErrnoException} */ (error)
96
- if (cause && cause.code === 'ENOENT') {
97
- globalFolder = new URL(nodeModules, pathToFileURL(nvm))
98
- }
99
- }
91
+ if (electron && nvm && !fs.existsSync(globalFolder)) {
92
+ globalFolder = new URL(nodeModules, pathToFileURL(nvm))
100
93
  }
101
94
 
102
95
  /**
@@ -125,8 +118,8 @@ export async function loadPlugin(name, options) {
125
118
  return typeof settings.key === 'string'
126
119
  ? module[settings.key]
127
120
  : settings.key === false
128
- ? module
129
- : module.default
121
+ ? module
122
+ : module.default
130
123
  }
131
124
 
132
125
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "load-plugin",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Load a submodule, plugin, or file",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^20.0.0",
37
- "c8": "^8.0.0",
37
+ "c8": "^9.0.0",
38
38
  "prettier": "^3.0.0",
39
39
  "remark-cli": "^11.0.0",
40
40
  "remark-lint": "^9.0.0",