Comparing version 0.4.0 to 0.5.0
'use strict'; | ||
var isFileEsm = require('is-file-esm'); | ||
var url = require('url'); | ||
var glob = require('glob'); | ||
var util = require('util'); | ||
var path = require('path'); | ||
var util = require('util'); | ||
var fs = require('fs'); | ||
@@ -453,2 +455,13 @@ | ||
} | ||
function pathToLocatorInfo(input, skipResolve) { | ||
if (!skipResolve && !path.isAbsolute(input)) { | ||
input = path.resolve(process.cwd(), input); | ||
} | ||
var info = path.parse(input); | ||
return { | ||
path: info.dir.split('/').join(path.sep), | ||
name: info.name, | ||
extension: info.ext | ||
}; | ||
} | ||
@@ -461,3 +474,3 @@ var globAsync = util.promisify(glob.glob); | ||
_locateFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(pattern, options) { | ||
var patterns, items, i, j, files, k, fileInfo; | ||
var patterns, items, i, j, files, k; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -492,8 +505,3 @@ while (1) { | ||
for (k = 0; k < files.length; k++) { | ||
fileInfo = path.parse(files[k]); | ||
items.push({ | ||
path: fileInfo.dir.split('/').join(path.sep), | ||
name: fileInfo.name, | ||
extension: fileInfo.ext | ||
}); | ||
items.push(pathToLocatorInfo(files[k], true)); | ||
} | ||
@@ -524,3 +532,3 @@ case 11: | ||
_locateFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pattern, options) { | ||
var patterns, i, j, files, element, fileInfo; | ||
var patterns, i, j, files, element; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
@@ -535,3 +543,3 @@ while (1) { | ||
if (!(i < patterns.length)) { | ||
_context2.next = 19; | ||
_context2.next = 18; | ||
break; | ||
@@ -542,3 +550,3 @@ } | ||
if (!(j < options.path.length)) { | ||
_context2.next = 16; | ||
_context2.next = 15; | ||
break; | ||
@@ -557,22 +565,17 @@ } | ||
if (!element) { | ||
_context2.next = 13; | ||
_context2.next = 12; | ||
break; | ||
} | ||
fileInfo = path.parse(element); | ||
return _context2.abrupt("return", { | ||
path: fileInfo.dir.split('/').join(path.sep), | ||
name: fileInfo.name, | ||
extension: fileInfo.ext | ||
}); | ||
case 13: | ||
return _context2.abrupt("return", pathToLocatorInfo(element, true)); | ||
case 12: | ||
j++; | ||
_context2.next = 5; | ||
break; | ||
case 16: | ||
case 15: | ||
i++; | ||
_context2.next = 3; | ||
break; | ||
case 18: | ||
return _context2.abrupt("return", undefined); | ||
case 19: | ||
return _context2.abrupt("return", undefined); | ||
case 20: | ||
case "end": | ||
@@ -606,8 +609,3 @@ return _context2.stop(); | ||
for (var k = 0; k < files.length; k++) { | ||
var fileInfo = path.parse(files[k]); | ||
items.push({ | ||
path: fileInfo.dir.split('/').join(path.sep), | ||
name: fileInfo.name, | ||
extension: fileInfo.ext | ||
}); | ||
items.push(pathToLocatorInfo(files[k], true)); | ||
} | ||
@@ -631,8 +629,3 @@ } | ||
if (element) { | ||
var fileInfo = path.parse(element); | ||
return { | ||
path: fileInfo.dir.split('/').join(path.sep), | ||
name: fileInfo.name, | ||
extension: fileInfo.ext | ||
}; | ||
return pathToLocatorInfo(element, true); | ||
} | ||
@@ -650,4 +643,7 @@ } | ||
*/ | ||
function buildLoaderFilePath(info) { | ||
return path.join(info.path, info.name) + (info.extension === '.json' ? '.json' : ''); | ||
function buildLoaderFilePath(info, withExtension) { | ||
if (withExtension) { | ||
return path.join(info.path, info.name) + info.extension; | ||
} | ||
return path.join(info.path, info.name); | ||
} | ||
@@ -660,3 +656,3 @@ | ||
_loadScriptFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) { | ||
var filePath; | ||
var locatorInfo, filePath, check; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -666,13 +662,36 @@ while (1) { | ||
case 0: | ||
filePath = isLocatorInfo(data) ? buildLoaderFilePath(data) : data; | ||
if (typeof data === 'string') { | ||
filePath = data; | ||
locatorInfo = pathToLocatorInfo(data); | ||
} else { | ||
filePath = buildLoaderFilePath(data, true); | ||
locatorInfo = data; | ||
} | ||
_context.prev = 1; | ||
_context.next = 4; | ||
if (!(['.js', '.mjs', '.cjs'].indexOf(locatorInfo.extension) !== -1)) { | ||
_context.next = 10; | ||
break; | ||
} | ||
_context.next = 5; | ||
return isFileEsm(filePath); | ||
case 5: | ||
check = _context.sent; | ||
if (!check.esm) { | ||
_context.next = 10; | ||
break; | ||
} | ||
_context.next = 9; | ||
return import(url.pathToFileURL(filePath).href); | ||
case 9: | ||
return _context.abrupt("return", _context.sent); | ||
case 10: | ||
_context.next = 12; | ||
return import(filePath); | ||
case 4: | ||
case 12: | ||
return _context.abrupt("return", _context.sent); | ||
case 7: | ||
_context.prev = 7; | ||
case 15: | ||
_context.prev = 15; | ||
_context.t0 = _context["catch"](1); | ||
return _context.abrupt("return", handleFileLoadError(_context.t0)); | ||
case 10: | ||
case 18: | ||
case "end": | ||
@@ -682,3 +701,3 @@ return _context.stop(); | ||
} | ||
}, _callee, null, [[1, 7]]); | ||
}, _callee, null, [[1, 15]]); | ||
})); | ||
@@ -692,3 +711,3 @@ return _loadScriptFile.apply(this, arguments); | ||
_loadScriptFileExport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, filterFn) { | ||
var filePath, _data; | ||
var output; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
@@ -698,20 +717,19 @@ while (1) { | ||
case 0: | ||
filePath = isLocatorInfo(data) ? buildLoaderFilePath(data) : data; | ||
_context2.prev = 1; | ||
_context2.next = 4; | ||
return loadScriptFile(filePath); | ||
case 4: | ||
_data = _context2.sent; | ||
if (!(_typeof(_data) === 'object')) { | ||
_context2.next = 7; | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return loadScriptFile(data); | ||
case 3: | ||
output = _context2.sent; | ||
if (!(_typeof(output) === 'object')) { | ||
_context2.next = 6; | ||
break; | ||
} | ||
return _context2.abrupt("return", getExportItem(_data, filterFn)); | ||
case 7: | ||
return _context2.abrupt("return", getExportItem(output, filterFn)); | ||
case 6: | ||
return _context2.abrupt("return", undefined); | ||
case 10: | ||
_context2.prev = 10; | ||
_context2.t0 = _context2["catch"](1); | ||
case 9: | ||
_context2.prev = 9; | ||
_context2.t0 = _context2["catch"](0); | ||
return _context2.abrupt("return", handleFileLoadError(_context2.t0)); | ||
case 13: | ||
case 12: | ||
case "end": | ||
@@ -721,3 +739,3 @@ return _context2.stop(); | ||
} | ||
}, _callee2, null, [[1, 10]]); | ||
}, _callee2, null, [[0, 9]]); | ||
})); | ||
@@ -753,4 +771,4 @@ return _loadScriptFileExport.apply(this, arguments); | ||
function _loadJsonFile() { | ||
_loadJsonFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(filePath) { | ||
var file; | ||
_loadJsonFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(info) { | ||
var filePath, file; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -760,13 +778,14 @@ while (1) { | ||
case 0: | ||
_context.prev = 0; | ||
_context.next = 3; | ||
filePath = buildLoaderFilePath(info, true); | ||
_context.prev = 1; | ||
_context.next = 4; | ||
return fs.promises.readFile(filePath); | ||
case 3: | ||
case 4: | ||
file = _context.sent; | ||
return _context.abrupt("return", JSON.parse(file.toString('utf-8'))); | ||
case 7: | ||
_context.prev = 7; | ||
_context.t0 = _context["catch"](0); | ||
case 8: | ||
_context.prev = 8; | ||
_context.t0 = _context["catch"](1); | ||
return _context.abrupt("return", handleFileLoadError(_context.t0)); | ||
case 10: | ||
case 11: | ||
case "end": | ||
@@ -776,7 +795,8 @@ return _context.stop(); | ||
} | ||
}, _callee, null, [[0, 7]]); | ||
}, _callee, null, [[1, 8]]); | ||
})); | ||
return _loadJsonFile.apply(this, arguments); | ||
} | ||
function loadJsonFileSync(filePath) { | ||
function loadJsonFileSync(info) { | ||
var filePath = buildLoaderFilePath(info, true); | ||
try { | ||
@@ -794,4 +814,4 @@ var file = fs.readFileSync(filePath); | ||
function _loadFile() { | ||
_loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(info) { | ||
var filePath; | ||
_loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) { | ||
var info; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -801,3 +821,3 @@ while (1) { | ||
case 0: | ||
if (info) { | ||
if (input) { | ||
_context.next = 2; | ||
@@ -808,3 +828,7 @@ break; | ||
case 2: | ||
filePath = buildLoaderFilePath(info); | ||
if (typeof input === 'string') { | ||
info = pathToLocatorInfo(input); | ||
} else { | ||
info = input; | ||
} | ||
if (!(info.extension === '.json')) { | ||
@@ -814,5 +838,5 @@ _context.next = 5; | ||
} | ||
return _context.abrupt("return", loadJsonFile(filePath)); | ||
return _context.abrupt("return", loadJsonFile(info)); | ||
case 5: | ||
return _context.abrupt("return", loadScriptFile(filePath)); | ||
return _context.abrupt("return", loadScriptFile(info)); | ||
case 6: | ||
@@ -827,11 +851,16 @@ case "end": | ||
} | ||
function loadFileSync(info) { | ||
if (!info) { | ||
function loadFileSync(input) { | ||
if (!input) { | ||
return undefined; | ||
} | ||
var filePath = buildLoaderFilePath(info); | ||
var info; | ||
if (typeof input === 'string') { | ||
info = pathToLocatorInfo(input); | ||
} else { | ||
info = input; | ||
} | ||
if (info.extension === '.json') { | ||
return loadJsonFileSync(filePath); | ||
return loadJsonFileSync(info); | ||
} | ||
return loadScriptFileSync(filePath); | ||
return loadScriptFileSync(info); | ||
} | ||
@@ -857,3 +886,4 @@ | ||
exports.locateFilesSync = locateFilesSync; | ||
exports.pathToLocatorInfo = pathToLocatorInfo; | ||
exports.removeFileNameExtension = removeFileNameExtension; | ||
exports.toArray = toArray; |
@@ -0,4 +1,6 @@ | ||
import isFileEsm from 'is-file-esm'; | ||
import { pathToFileURL } from 'url'; | ||
import { glob, sync } from 'glob'; | ||
import { promisify } from 'util'; | ||
import path from 'path'; | ||
import { promisify } from 'util'; | ||
import fs from 'fs'; | ||
@@ -451,2 +453,13 @@ | ||
} | ||
function pathToLocatorInfo(input, skipResolve) { | ||
if (!skipResolve && !path.isAbsolute(input)) { | ||
input = path.resolve(process.cwd(), input); | ||
} | ||
var info = path.parse(input); | ||
return { | ||
path: info.dir.split('/').join(path.sep), | ||
name: info.name, | ||
extension: info.ext | ||
}; | ||
} | ||
@@ -459,3 +472,3 @@ var globAsync = promisify(glob); | ||
_locateFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(pattern, options) { | ||
var patterns, items, i, j, files, k, fileInfo; | ||
var patterns, items, i, j, files, k; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -490,8 +503,3 @@ while (1) { | ||
for (k = 0; k < files.length; k++) { | ||
fileInfo = path.parse(files[k]); | ||
items.push({ | ||
path: fileInfo.dir.split('/').join(path.sep), | ||
name: fileInfo.name, | ||
extension: fileInfo.ext | ||
}); | ||
items.push(pathToLocatorInfo(files[k], true)); | ||
} | ||
@@ -522,3 +530,3 @@ case 11: | ||
_locateFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pattern, options) { | ||
var patterns, i, j, files, element, fileInfo; | ||
var patterns, i, j, files, element; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
@@ -533,3 +541,3 @@ while (1) { | ||
if (!(i < patterns.length)) { | ||
_context2.next = 19; | ||
_context2.next = 18; | ||
break; | ||
@@ -540,3 +548,3 @@ } | ||
if (!(j < options.path.length)) { | ||
_context2.next = 16; | ||
_context2.next = 15; | ||
break; | ||
@@ -555,22 +563,17 @@ } | ||
if (!element) { | ||
_context2.next = 13; | ||
_context2.next = 12; | ||
break; | ||
} | ||
fileInfo = path.parse(element); | ||
return _context2.abrupt("return", { | ||
path: fileInfo.dir.split('/').join(path.sep), | ||
name: fileInfo.name, | ||
extension: fileInfo.ext | ||
}); | ||
case 13: | ||
return _context2.abrupt("return", pathToLocatorInfo(element, true)); | ||
case 12: | ||
j++; | ||
_context2.next = 5; | ||
break; | ||
case 16: | ||
case 15: | ||
i++; | ||
_context2.next = 3; | ||
break; | ||
case 18: | ||
return _context2.abrupt("return", undefined); | ||
case 19: | ||
return _context2.abrupt("return", undefined); | ||
case 20: | ||
case "end": | ||
@@ -604,8 +607,3 @@ return _context2.stop(); | ||
for (var k = 0; k < files.length; k++) { | ||
var fileInfo = path.parse(files[k]); | ||
items.push({ | ||
path: fileInfo.dir.split('/').join(path.sep), | ||
name: fileInfo.name, | ||
extension: fileInfo.ext | ||
}); | ||
items.push(pathToLocatorInfo(files[k], true)); | ||
} | ||
@@ -629,8 +627,3 @@ } | ||
if (element) { | ||
var fileInfo = path.parse(element); | ||
return { | ||
path: fileInfo.dir.split('/').join(path.sep), | ||
name: fileInfo.name, | ||
extension: fileInfo.ext | ||
}; | ||
return pathToLocatorInfo(element, true); | ||
} | ||
@@ -648,4 +641,7 @@ } | ||
*/ | ||
function buildLoaderFilePath(info) { | ||
return path.join(info.path, info.name) + (info.extension === '.json' ? '.json' : ''); | ||
function buildLoaderFilePath(info, withExtension) { | ||
if (withExtension) { | ||
return path.join(info.path, info.name) + info.extension; | ||
} | ||
return path.join(info.path, info.name); | ||
} | ||
@@ -658,3 +654,3 @@ | ||
_loadScriptFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) { | ||
var filePath; | ||
var locatorInfo, filePath, check; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -664,13 +660,36 @@ while (1) { | ||
case 0: | ||
filePath = isLocatorInfo(data) ? buildLoaderFilePath(data) : data; | ||
if (typeof data === 'string') { | ||
filePath = data; | ||
locatorInfo = pathToLocatorInfo(data); | ||
} else { | ||
filePath = buildLoaderFilePath(data, true); | ||
locatorInfo = data; | ||
} | ||
_context.prev = 1; | ||
_context.next = 4; | ||
if (!(['.js', '.mjs', '.cjs'].indexOf(locatorInfo.extension) !== -1)) { | ||
_context.next = 10; | ||
break; | ||
} | ||
_context.next = 5; | ||
return isFileEsm(filePath); | ||
case 5: | ||
check = _context.sent; | ||
if (!check.esm) { | ||
_context.next = 10; | ||
break; | ||
} | ||
_context.next = 9; | ||
return import(pathToFileURL(filePath).href); | ||
case 9: | ||
return _context.abrupt("return", _context.sent); | ||
case 10: | ||
_context.next = 12; | ||
return import(filePath); | ||
case 4: | ||
case 12: | ||
return _context.abrupt("return", _context.sent); | ||
case 7: | ||
_context.prev = 7; | ||
case 15: | ||
_context.prev = 15; | ||
_context.t0 = _context["catch"](1); | ||
return _context.abrupt("return", handleFileLoadError(_context.t0)); | ||
case 10: | ||
case 18: | ||
case "end": | ||
@@ -680,3 +699,3 @@ return _context.stop(); | ||
} | ||
}, _callee, null, [[1, 7]]); | ||
}, _callee, null, [[1, 15]]); | ||
})); | ||
@@ -690,3 +709,3 @@ return _loadScriptFile.apply(this, arguments); | ||
_loadScriptFileExport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, filterFn) { | ||
var filePath, _data; | ||
var output; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
@@ -696,20 +715,19 @@ while (1) { | ||
case 0: | ||
filePath = isLocatorInfo(data) ? buildLoaderFilePath(data) : data; | ||
_context2.prev = 1; | ||
_context2.next = 4; | ||
return loadScriptFile(filePath); | ||
case 4: | ||
_data = _context2.sent; | ||
if (!(_typeof(_data) === 'object')) { | ||
_context2.next = 7; | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return loadScriptFile(data); | ||
case 3: | ||
output = _context2.sent; | ||
if (!(_typeof(output) === 'object')) { | ||
_context2.next = 6; | ||
break; | ||
} | ||
return _context2.abrupt("return", getExportItem(_data, filterFn)); | ||
case 7: | ||
return _context2.abrupt("return", getExportItem(output, filterFn)); | ||
case 6: | ||
return _context2.abrupt("return", undefined); | ||
case 10: | ||
_context2.prev = 10; | ||
_context2.t0 = _context2["catch"](1); | ||
case 9: | ||
_context2.prev = 9; | ||
_context2.t0 = _context2["catch"](0); | ||
return _context2.abrupt("return", handleFileLoadError(_context2.t0)); | ||
case 13: | ||
case 12: | ||
case "end": | ||
@@ -719,3 +737,3 @@ return _context2.stop(); | ||
} | ||
}, _callee2, null, [[1, 10]]); | ||
}, _callee2, null, [[0, 9]]); | ||
})); | ||
@@ -751,4 +769,4 @@ return _loadScriptFileExport.apply(this, arguments); | ||
function _loadJsonFile() { | ||
_loadJsonFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(filePath) { | ||
var file; | ||
_loadJsonFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(info) { | ||
var filePath, file; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -758,13 +776,14 @@ while (1) { | ||
case 0: | ||
_context.prev = 0; | ||
_context.next = 3; | ||
filePath = buildLoaderFilePath(info, true); | ||
_context.prev = 1; | ||
_context.next = 4; | ||
return fs.promises.readFile(filePath); | ||
case 3: | ||
case 4: | ||
file = _context.sent; | ||
return _context.abrupt("return", JSON.parse(file.toString('utf-8'))); | ||
case 7: | ||
_context.prev = 7; | ||
_context.t0 = _context["catch"](0); | ||
case 8: | ||
_context.prev = 8; | ||
_context.t0 = _context["catch"](1); | ||
return _context.abrupt("return", handleFileLoadError(_context.t0)); | ||
case 10: | ||
case 11: | ||
case "end": | ||
@@ -774,7 +793,8 @@ return _context.stop(); | ||
} | ||
}, _callee, null, [[0, 7]]); | ||
}, _callee, null, [[1, 8]]); | ||
})); | ||
return _loadJsonFile.apply(this, arguments); | ||
} | ||
function loadJsonFileSync(filePath) { | ||
function loadJsonFileSync(info) { | ||
var filePath = buildLoaderFilePath(info, true); | ||
try { | ||
@@ -792,4 +812,4 @@ var file = fs.readFileSync(filePath); | ||
function _loadFile() { | ||
_loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(info) { | ||
var filePath; | ||
_loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) { | ||
var info; | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
@@ -799,3 +819,3 @@ while (1) { | ||
case 0: | ||
if (info) { | ||
if (input) { | ||
_context.next = 2; | ||
@@ -806,3 +826,7 @@ break; | ||
case 2: | ||
filePath = buildLoaderFilePath(info); | ||
if (typeof input === 'string') { | ||
info = pathToLocatorInfo(input); | ||
} else { | ||
info = input; | ||
} | ||
if (!(info.extension === '.json')) { | ||
@@ -812,5 +836,5 @@ _context.next = 5; | ||
} | ||
return _context.abrupt("return", loadJsonFile(filePath)); | ||
return _context.abrupt("return", loadJsonFile(info)); | ||
case 5: | ||
return _context.abrupt("return", loadScriptFile(filePath)); | ||
return _context.abrupt("return", loadScriptFile(info)); | ||
case 6: | ||
@@ -825,13 +849,18 @@ case "end": | ||
} | ||
function loadFileSync(info) { | ||
if (!info) { | ||
function loadFileSync(input) { | ||
if (!input) { | ||
return undefined; | ||
} | ||
var filePath = buildLoaderFilePath(info); | ||
var info; | ||
if (typeof input === 'string') { | ||
info = pathToLocatorInfo(input); | ||
} else { | ||
info = input; | ||
} | ||
if (info.extension === '.json') { | ||
return loadJsonFileSync(filePath); | ||
return loadJsonFileSync(info); | ||
} | ||
return loadScriptFileSync(filePath); | ||
return loadScriptFileSync(info); | ||
} | ||
export { buildLoaderFilePath, buildLocatorOptions, getExportItem, handleFileLoadError, hasOwnProperty, isLocatorInfo, loadFile, loadFileSync, loadJsonFile, loadJsonFileSync, loadScriptFile, loadScriptFileExport, loadScriptFileExportSync, loadScriptFileSync, locateFile, locateFileSync, locateFiles, locateFilesSync, removeFileNameExtension, toArray }; | ||
export { buildLoaderFilePath, buildLocatorOptions, getExportItem, handleFileLoadError, hasOwnProperty, isLocatorInfo, loadFile, loadFileSync, loadJsonFile, loadJsonFileSync, loadScriptFile, loadScriptFileExport, loadScriptFileExportSync, loadScriptFileSync, locateFile, locateFileSync, locateFiles, locateFilesSync, pathToLocatorInfo, removeFileNameExtension, toArray }; |
@@ -1,2 +0,3 @@ | ||
export declare function loadJsonFile(filePath: string): Promise<unknown | undefined>; | ||
export declare function loadJsonFileSync(filePath: string): unknown | undefined; | ||
import { LocatorInfo } from '../../locator'; | ||
export declare function loadJsonFile(info: LocatorInfo): Promise<unknown | undefined>; | ||
export declare function loadJsonFileSync(info: LocatorInfo): unknown | undefined; |
import { LocatorInfo } from '../locator'; | ||
export declare function loadFile(info: LocatorInfo): Promise<unknown | undefined>; | ||
export declare function loadFileSync(info: LocatorInfo): unknown | undefined; | ||
export declare function loadFile(input: LocatorInfo | string): Promise<unknown | undefined>; | ||
export declare function loadFileSync(input: LocatorInfo | string): unknown | undefined; |
import { LocatorInfo } from '../locator'; | ||
export declare function buildLoaderFilePath(info: LocatorInfo): string; | ||
export declare function buildLoaderFilePath(info: LocatorInfo, withExtension?: boolean): string; |
import { LocatorInfo, LocatorOptions } from './type'; | ||
export declare function buildLocatorOptions(options?: Partial<LocatorOptions>): LocatorOptions; | ||
export declare function isLocatorInfo(data: unknown): data is LocatorInfo; | ||
export declare function pathToLocatorInfo(input: string, skipResolve?: boolean): LocatorInfo; |
{ | ||
"name": "locter", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "A library to locate a file by criteria and load it", | ||
@@ -50,6 +50,6 @@ "author": { | ||
"@rollup/plugin-node-resolve": "^15.0.0", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"@semantic-release/changelog": "^6.0.2", | ||
"@semantic-release/commit-analyzer": "^9.0.2", | ||
"@semantic-release/git": "^10.0.1", | ||
"@semantic-release/github": "^8.0.6", | ||
"@semantic-release/github": "^8.0.7", | ||
"@semantic-release/npm": "^9.0.1", | ||
@@ -59,2 +59,3 @@ "@semantic-release/release-notes-generator": "^10.0.3", | ||
"@types/glob": "^8.0.0", | ||
"@types/is-file-esm": "^1.0.0", | ||
"@types/jest": "^27.5.0", | ||
@@ -76,3 +77,4 @@ "@types/node": "^18.11.9", | ||
"dependencies": { | ||
"glob": "^8.0.3" | ||
"glob": "^8.0.3", | ||
"is-file-esm": "^1.0.0" | ||
}, | ||
@@ -79,0 +81,0 @@ "config": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
70500
1736
0
2
33
+ Addedis-file-esm@^1.0.0
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@types/normalize-package-data@2.4.4(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.16.0(transitive)
+ Addedis-file-esm@1.0.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedread-pkg@5.2.0(transitive)
+ Addedread-pkg-up@7.0.1(transitive)
+ Addedresolve@1.22.9(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtype-fest@0.6.00.8.1(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)