@testring/utils
Advanced tools
@@ -12,3 +12,3 @@ "use strict"; | ||
| const requireResolveById = (id, options) => { | ||
| return module.require.resolve(id, options); | ||
| return require.resolve(id, options); | ||
| }; | ||
@@ -15,0 +15,0 @@ function resolvePackage(modulePath, parentModule) { |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.requirePlugin = void 0; | ||
| const path = require("path"); | ||
| const package_require_1 = require("./package-require"); | ||
@@ -20,5 +21,6 @@ const PREFIXES = ['@testring/plugin-', 'testring-plugin-', '@testring/']; | ||
| let resolvedPlugin; | ||
| const parentModule = path.join(__dirname, '../..'); | ||
| for (let index = 0; index < PREFIXES.length; index++) { | ||
| try { | ||
| resolvedPlugin = (0, package_require_1.resolvePackage)(PREFIXES[index] + pluginPath); | ||
| resolvedPlugin = (0, package_require_1.resolvePackage)(PREFIXES[index] + pluginPath, parentModule); | ||
| } | ||
@@ -25,0 +27,0 @@ catch (e) { |
+2
-2
| { | ||
| "name": "@testring/utils", | ||
| "version": "0.6.2", | ||
| "version": "0.6.3", | ||
| "main": "./dist/index.js", | ||
@@ -13,3 +13,3 @@ "types": "./src/index.ts", | ||
| "dependencies": { | ||
| "@testring/types": "0.6.2", | ||
| "@testring/types": "0.6.3", | ||
| "@types/bytes": "3.1.1", | ||
@@ -16,0 +16,0 @@ "@types/nanoid": "2.1.0", |
@@ -14,3 +14,3 @@ import * as path from 'path'; | ||
| const requireResolveById = (id, options?: {paths?: string[]}) => { | ||
| return (module.require as NodeRequire).resolve(id, options); | ||
| return require.resolve(id, options); | ||
| }; | ||
@@ -17,0 +17,0 @@ |
@@ -0,1 +1,2 @@ | ||
| import * as path from 'path'; | ||
| import {requirePackage, resolvePackage} from './package-require'; | ||
@@ -22,6 +23,7 @@ | ||
| let resolvedPlugin; | ||
| const parentModule = path.join(__dirname, '../..') | ||
| for (let index = 0; index < PREFIXES.length; index++) { | ||
| try { | ||
| resolvedPlugin = resolvePackage(PREFIXES[index] + pluginPath); | ||
| resolvedPlugin = resolvePackage(PREFIXES[index] + pluginPath, parentModule); | ||
| } catch (e) { | ||
@@ -28,0 +30,0 @@ continue; |
32700
0.52%956
0.42%+ Added
- Removed
Updated