@web/config-loader
Advanced tools
Comparing version 0.0.2 to 0.0.3
# @web/config-loader | ||
## 0.0.3 | ||
### Patch Changes | ||
- 588a971: fix loading esm config on windows | ||
## 0.0.2 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@web/config-loader", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"publishConfig": { | ||
@@ -39,5 +39,5 @@ "access": "public" | ||
], | ||
"devDependencies": { | ||
"dependencies": { | ||
"semver": "^7.3.2" | ||
} | ||
} |
@@ -0,3 +1,7 @@ | ||
const semver = require('semver'); | ||
const { pathToFileURL} = require('url') | ||
const ConfigLoaderError = require('./ConfigLoaderError'); | ||
const supportsEsm = semver.satisfies(process.version, '>=12.17.0'); | ||
// These strings may be node-version dependent and need updating over time | ||
@@ -11,13 +15,4 @@ // They're just to display a helpful error message | ||
async function supportsEsm() { | ||
try { | ||
await import(__filename); | ||
} catch (error) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
module.exports = async function importConfig(path) { | ||
if (!(await supportsEsm())) { | ||
if (!supportsEsm) { | ||
throw new ConfigLoaderError( | ||
@@ -31,3 +26,3 @@ 'You are trying to load a config as es module but your version of node does not support it. ' + | ||
try { | ||
const config = await import(path); | ||
const config = await import(pathToFileURL(path)); | ||
@@ -34,0 +29,0 @@ if (typeof config.default !== 'object') { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
8706
0
11
1
147
1
+ Addedsemver@^7.3.2
+ Addedsemver@7.6.3(transitive)