@neon-rs/load
Advanced tools
Comparing version 0.0.29 to 0.0.30
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.custom = exports.scope = exports.debug = exports.currentTarget = void 0; | ||
const path = __importStar(require("path")); | ||
const fs = __importStar(require("fs")); | ||
exports.custom = exports.scope = exports.currentTarget = void 0; | ||
const node_module_1 = require("node:module"); | ||
function currentTarget() { | ||
@@ -98,17 +74,17 @@ let os = null; | ||
} | ||
function debug(...components) { | ||
if (components.length === 0 || !components[components.length - 1].endsWith(".node")) { | ||
components.push("index.node"); | ||
} | ||
const pathSpec = path.join(...components); | ||
return fs.existsSync(pathSpec) ? require(pathSpec) : null; | ||
} | ||
exports.debug = debug; | ||
// export function debug(...components: string[]) { | ||
// if (components.length === 0 || !components[components.length - 1].endsWith(".node")) { | ||
// components.push("index.node"); | ||
// } | ||
// const pathSpec = path.join(...components); | ||
// return fs.existsSync(pathSpec) ? require(pathSpec) : null; | ||
// } | ||
const requireAbsolute = (0, node_module_1.createRequire)(process.cwd()); | ||
function scope(scope) { | ||
return require(scope + "/" + currentTarget()); | ||
return requireAbsolute(scope + "/" + currentTarget()); | ||
} | ||
exports.scope = scope; | ||
function custom(toRequireSpec) { | ||
return require(toRequireSpec(currentTarget())); | ||
return requireAbsolute(toRequireSpec(currentTarget())); | ||
} | ||
exports.custom = custom; |
{ | ||
"name": "@neon-rs/load", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"description": "Utilities for loading Neon modules.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
export declare function currentTarget(): string; | ||
export declare function debug(...components: string[]): any; | ||
export declare function scope(scope: string): any; | ||
export declare function custom(toRequireSpec: (target: string) => string): any; |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
5105
92