@neon-rs/load
Advanced tools
Comparing version 0.0.69 to 0.0.70
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.bin = exports.currentTarget = void 0; | ||
exports.lazy = exports.bin = exports.currentTarget = void 0; | ||
function currentTarget() { | ||
@@ -95,1 +95,21 @@ let os = null; | ||
exports.bin = bin; | ||
function lazy(loaders, exports) { | ||
let loaded = null; | ||
function load() { | ||
if (loaded) { | ||
return loaded; | ||
} | ||
const target = currentTarget(); | ||
if (!loaders.hasOwnProperty(target)) { | ||
throw new Error(`no precompiled module found for ${target}`); | ||
} | ||
loaded = loaders[target](); | ||
return loaded; | ||
} | ||
let module = {}; | ||
for (const key of exports) { | ||
Object.defineProperty(module, key, { get() { return load()[key]; } }); | ||
} | ||
return module; | ||
} | ||
exports.lazy = lazy; |
{ | ||
"name": "@neon-rs/load", | ||
"version": "0.0.69", | ||
"version": "0.0.70", | ||
"description": "Utilities for loading Neon modules.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
export declare function currentTarget(): string; | ||
export declare function bin(scope: string[], ...rest: string[]): string; | ||
export declare function lazy(loaders: Record<string, () => any>, exports: 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
5724
117