Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@neon-rs/load

Package Overview
Dependencies
Maintainers
1
Versions
197
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neon-rs/load - npm Package Compare versions

Comparing version 0.0.176 to 0.0.177

73

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.__UNSTABLE_proxy = exports.proxy = exports.__UNSTABLE_loader = exports.lazy = exports.bin = exports.currentTarget = void 0;
function currentTarget() {
exports.__UNSTABLE_proxy = exports.proxy = exports.__UNSTABLE_loader = exports.lazy = exports.bin = exports.currentTarget = exports.currentPlatform = void 0;
function currentPlatform() {
let os = null;

@@ -60,2 +60,7 @@ switch (process.platform) {

}
exports.currentPlatform = currentPlatform;
// DEPRECATE(0.1)
function currentTarget() {
return currentPlatform();
}
exports.currentTarget = currentTarget;

@@ -93,5 +98,6 @@ function isGlibc() {

function bin(scope, ...rest) {
return [...interleave(scope, rest)].join("") + "/" + currentTarget();
return [...interleave(scope, rest)].join("") + "/" + currentPlatform();
}
exports.bin = bin;
// DEPRECATE(0.1)
function lazyV1(loaders, exports) {

@@ -103,4 +109,12 @@ return lazyV2({

}
// DEPRECATE(0.1)
function lazyV2(options) {
const loaders = options.targets;
return lazyV3({
platforms: options.targets,
exports: options.exports,
debug: options.debug
});
}
function lazyV3(options) {
const loaders = options.platforms;
let loaded = null;

@@ -111,5 +125,5 @@ function load() {

}
const target = currentTarget();
if (!loaders.hasOwnProperty(target)) {
throw new Error(`no precompiled module found for ${target}`);
const platform = currentPlatform();
if (!loaders.hasOwnProperty(platform)) {
throw new Error(`no precompiled module found for ${platform}`);
}

@@ -125,3 +139,3 @@ if (options.debug) {

if (!loaded) {
loaded = loaders[target]();
loaded = loaders[platform]();
}

@@ -137,13 +151,15 @@ return loaded;

function lazy(optionsOrLoaders, exports) {
return exports
? lazyV1(optionsOrLoaders, exports)
: lazyV2(optionsOrLoaders);
return (!exports && !('targets' in optionsOrLoaders))
? lazyV3(optionsOrLoaders)
: !exports
? lazyV2(optionsOrLoaders)
: lazyV1(optionsOrLoaders, exports);
}
exports.lazy = lazy;
function __UNSTABLE_loader(loaders) {
const target = currentTarget();
if (!loaders.hasOwnProperty(target)) {
throw new Error(`no precompiled module found for ${target}`);
const platform = currentPlatform();
if (!loaders.hasOwnProperty(platform)) {
throw new Error(`no precompiled module found for ${platform}`);
}
const loader = loaders[target];
const loader = loaders[platform];
let loaded = null;

@@ -159,15 +175,21 @@ return () => {

exports.__UNSTABLE_loader = __UNSTABLE_loader;
function isTargetTable(options) {
return !('targets' in options);
// DEPRECATE(0.1)
function isDeprecatedProxyOptions(options) {
return 'targets' in options;
}
function isProxyOptions(options) {
return 'platforms' in options;
}
function proxy(options) {
if (isTargetTable(options)) {
options = { targets: options };
const opts = isProxyOptions(options)
? options
: !isDeprecatedProxyOptions(options)
? { platforms: options }
: { platforms: options.targets, debug: options.debug };
const platform = currentPlatform();
const loaders = opts.platforms;
if (!loaders.hasOwnProperty(platform)) {
throw new Error(`no precompiled module found for ${platform}`);
}
const target = currentTarget();
const loaders = options.targets;
if (!loaders.hasOwnProperty(target)) {
throw new Error(`no precompiled module found for ${target}`);
}
const loader = loaders[target];
const loader = loaders[platform];
let loaded = null;

@@ -228,2 +250,3 @@ function load() {

exports.proxy = proxy;
// DEPRECATE(0.1)
function __UNSTABLE_proxy(options) {

@@ -230,0 +253,0 @@ return proxy(options);

{
"name": "@neon-rs/load",
"version": "0.0.176",
"version": "0.0.177",
"description": "Utilities for loading Neon modules.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -0,4 +1,5 @@

export declare function currentPlatform(): string;
export declare function currentTarget(): string;
export declare function bin(scope: string[], ...rest: string[]): string;
export type LazyOptions = {
type __DEPRECATED_LazyOptions = {
targets: Record<string, () => any>;

@@ -8,12 +9,23 @@ exports: string[];

};
export type LazyOptions = {
platforms: Record<string, () => any>;
exports: string[];
debug?: () => any;
};
export declare function lazy(loaders: Record<string, () => any>, exports: string[]): any;
export declare function lazy(options: __DEPRECATED_LazyOptions): any;
export declare function lazy(options: LazyOptions): any;
export declare function __UNSTABLE_loader(loaders: Record<string, () => Record<string, any>>): () => Record<string, any>;
export type ModuleObject = Record<string, any>;
export type TargetTable = Record<string, () => ModuleObject>;
export type PlatformTable = Record<string, () => ModuleObject>;
export type __DEPRECATED_ProxyOptions = {
targets: PlatformTable;
debug?: () => ModuleObject;
};
export type ProxyOptions = {
targets: TargetTable;
platforms: PlatformTable;
debug?: () => ModuleObject;
};
export declare function proxy(options: TargetTable | ProxyOptions): any;
export declare function __UNSTABLE_proxy(options: TargetTable | ProxyOptions): any;
export declare function proxy(options: PlatformTable | ProxyOptions | __DEPRECATED_ProxyOptions): any;
export declare function __UNSTABLE_proxy(options: PlatformTable | ProxyOptions | __DEPRECATED_ProxyOptions): any;
export {};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc