@web/config-loader
Advanced tools
Comparing version 0.0.3 to 0.0.4
# @web/config-loader | ||
## 0.0.4 | ||
### Patch Changes | ||
- 4112c2b: feat(config-loader): add jsdoc type checking | ||
## 0.0.3 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@web/config-loader", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"publishConfig": { | ||
@@ -16,3 +16,3 @@ "access": "public" | ||
"homepage": "https://github.com/modernweb-dev/web/tree/master/packages/config-loader", | ||
"main": "dist/index.js", | ||
"main": "src/index.js", | ||
"engines": { | ||
@@ -23,3 +23,3 @@ "node": ">=10.0.0" | ||
"build": "tsc", | ||
"test": "mocha test/**/*.test.js --require ts-node/register --reporter progress", | ||
"test": "mocha test/**/*.test.js --reporter progress", | ||
"test:ci": "yarn test", | ||
@@ -43,3 +43,4 @@ "test:watch": "mocha test/**/*.test.js --watch --watch-files .,src,test --reporter progress" | ||
"semver": "^7.3.2" | ||
} | ||
}, | ||
"types": "dist/index.d.ts" | ||
} |
@@ -11,3 +11,3 @@ const fs = require('fs').promises; | ||
*/ | ||
module.exports = async function getPackageType(basedir) { | ||
async function getPackageType(basedir) { | ||
let currentPath = basedir; | ||
@@ -30,2 +30,4 @@ try { | ||
return 'commonjs'; | ||
}; | ||
} | ||
module.exports = getPackageType; |
const semver = require('semver'); | ||
const { pathToFileURL} = require('url') | ||
const { pathToFileURL } = require('url'); | ||
const ConfigLoaderError = require('./ConfigLoaderError'); | ||
@@ -15,3 +15,6 @@ | ||
module.exports = async function importConfig(path) { | ||
/** | ||
* @param {string} path | ||
*/ | ||
async function importConfig(path) { | ||
if (!supportsEsm) { | ||
@@ -26,3 +29,3 @@ throw new ConfigLoaderError( | ||
try { | ||
const config = await import(pathToFileURL(path)); | ||
const config = await import(pathToFileURL(path).href); | ||
@@ -46,2 +49,4 @@ if (typeof config.default !== 'object') { | ||
} | ||
}; | ||
} | ||
module.exports = importConfig; |
@@ -5,2 +5,5 @@ const getPackageType = require('./getPackageType'); | ||
/** | ||
* @param {string} configPath | ||
*/ | ||
function importConfig(configPath) { | ||
@@ -13,3 +16,7 @@ // Conditionally requires importConfig function to avoid logging a warning on node v12 | ||
module.exports = async function importOrRequireConfig(configPath, basedir) { | ||
/** | ||
* @param {string} configPath | ||
* @param {string} basedir | ||
*/ | ||
async function importOrRequireConfig(configPath, basedir) { | ||
const packageType = await getPackageType(basedir); | ||
@@ -26,2 +33,4 @@ const ext = path.extname(configPath); | ||
} | ||
}; | ||
} | ||
module.exports = importOrRequireConfig; |
@@ -10,3 +10,6 @@ const ConfigLoaderError = require('./ConfigLoaderError'); | ||
module.exports = function requireConfig(path) { | ||
/** | ||
* @param {string} path | ||
*/ | ||
function requireConfig(path) { | ||
try { | ||
@@ -24,2 +27,4 @@ return require(path); | ||
} | ||
}; | ||
} | ||
module.exports = requireConfig; |
const fs = require('fs').promises; | ||
/** | ||
* @param {string} path | ||
*/ | ||
async function fileExists(path) { | ||
@@ -4,0 +7,0 @@ try { |
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
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
8980
166
0
10