locter 0.5.2 → 0.5.3

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.
package/dist/index.cjs.js CHANGED
@@ -729,7 +729,7 @@ function _loadScriptFile() {
729
729
  _context.next = 17;
730
730
  break;
731
731
  }
732
- if (!(_context.t0.code === 'ERR_MODULE_NOT_FOUND' || _context.t0.code === 'MODULE_NOT_FOUND')) {
732
+ if (!(!options.withExtension && (_context.t0.code === 'ERR_MODULE_NOT_FOUND' || _context.t0.code === 'MODULE_NOT_FOUND'))) {
733
733
  _context.next = 15;
734
734
  break;
735
735
  }
@@ -737,7 +737,7 @@ function _loadScriptFile() {
737
737
  withExtension: true
738
738
  })));
739
739
  case 15:
740
- if (!(_context.t0.code === 'ERR_UNSUPPORTED_ESM_URL_SCHEME' || _context.t0.code === 'UNSUPPORTED_ESM_URL_SCHEME')) {
740
+ if (!(!options.withFilePrefix && (_context.t0.code === 'ERR_UNSUPPORTED_ESM_URL_SCHEME' || _context.t0.code === 'UNSUPPORTED_ESM_URL_SCHEME'))) {
741
741
  _context.next = 17;
742
742
  break;
743
743
  }
@@ -804,8 +804,9 @@ function loadScriptFileSync(data, options) {
804
804
  // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require,import/no-dynamic-require
805
805
  return require(filePath);
806
806
  } catch (e) {
807
+ /* istanbul ignore next */
807
808
  if (isObject(e) && hasOwnProperty(e, 'code')) {
808
- if (e.code === 'ERR_MODULE_NOT_FOUND' || e.code === 'MODULE_NOT_FOUND') {
809
+ if (!options.withExtension && (e.code === 'ERR_MODULE_NOT_FOUND' || e.code === 'MODULE_NOT_FOUND')) {
809
810
  return loadScriptFileSync(locatorInfo, _objectSpread2(_objectSpread2({}, options), {}, {
810
811
  withExtension: true
811
812
  }));
package/dist/index.esm.js CHANGED
@@ -727,7 +727,7 @@ function _loadScriptFile() {
727
727
  _context.next = 17;
728
728
  break;
729
729
  }
730
- if (!(_context.t0.code === 'ERR_MODULE_NOT_FOUND' || _context.t0.code === 'MODULE_NOT_FOUND')) {
730
+ if (!(!options.withExtension && (_context.t0.code === 'ERR_MODULE_NOT_FOUND' || _context.t0.code === 'MODULE_NOT_FOUND'))) {
731
731
  _context.next = 15;
732
732
  break;
733
733
  }
@@ -735,7 +735,7 @@ function _loadScriptFile() {
735
735
  withExtension: true
736
736
  })));
737
737
  case 15:
738
- if (!(_context.t0.code === 'ERR_UNSUPPORTED_ESM_URL_SCHEME' || _context.t0.code === 'UNSUPPORTED_ESM_URL_SCHEME')) {
738
+ if (!(!options.withFilePrefix && (_context.t0.code === 'ERR_UNSUPPORTED_ESM_URL_SCHEME' || _context.t0.code === 'UNSUPPORTED_ESM_URL_SCHEME'))) {
739
739
  _context.next = 17;
740
740
  break;
741
741
  }
@@ -802,8 +802,9 @@ function loadScriptFileSync(data, options) {
802
802
  // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require,import/no-dynamic-require
803
803
  return require(filePath);
804
804
  } catch (e) {
805
+ /* istanbul ignore next */
805
806
  if (isObject(e) && hasOwnProperty(e, 'code')) {
806
- if (e.code === 'ERR_MODULE_NOT_FOUND' || e.code === 'MODULE_NOT_FOUND') {
807
+ if (!options.withExtension && (e.code === 'ERR_MODULE_NOT_FOUND' || e.code === 'MODULE_NOT_FOUND')) {
807
808
  return loadScriptFileSync(locatorInfo, _objectSpread2(_objectSpread2({}, options), {}, {
808
809
  withExtension: true
809
810
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locter",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "A library to locate a file by criteria and load it",
5
5
  "author": {
6
6
  "name": "Peter Placzek",