@neon-rs/load 0.0.17 → 0.0.20

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.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.currentTarget = void 0;
26
+ exports.custom = exports.scope = exports.debug = exports.currentTarget = void 0;
27
27
  const path = __importStar(require("path"));
28
28
  const fs = __importStar(require("fs"));
29
29
  function currentTarget() {
@@ -99,19 +99,12 @@ function debug(dirname) {
99
99
  const m = path.join(dirname, "index.node");
100
100
  return fs.existsSync(m) ? require(m) : null;
101
101
  }
102
- function load(options) {
103
- let debugModule = null;
104
- if (options.debug && (debugModule = debug(options.debug))) {
105
- return debugModule;
106
- }
107
- if ("dir" in options) {
108
- return require(path.join(options.dir, "index.node"));
109
- }
110
- if ("scope" in options) {
111
- return require(options.scope + "/" + currentTarget());
112
- }
113
- if ("custom" in options) {
114
- return require(options.custom(currentTarget()));
115
- }
102
+ exports.debug = debug;
103
+ function scope(scope) {
104
+ return require(scope + "/" + currentTarget());
105
+ }
106
+ exports.scope = scope;
107
+ function custom(toRequireSpec) {
108
+ return require(toRequireSpec(currentTarget()));
116
109
  }
117
- exports.default = load;
110
+ exports.custom = custom;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon-rs/load",
3
- "version": "0.0.17",
3
+ "version": "0.0.20",
4
4
  "description": "Utilities for loading Neon modules.",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -1,15 +1,4 @@
1
1
  export declare function currentTarget(): string;
2
- export type LoadDir = {
3
- debug?: string;
4
- dir: string;
5
- };
6
- export type LoadScope = {
7
- debug?: string;
8
- scope: string;
9
- };
10
- export type LoadCustom = {
11
- debug?: string;
12
- custom: (target: string) => string;
13
- };
14
- export type LoadOptions = LoadDir | LoadScope | LoadCustom;
15
- export default function load(options: LoadOptions): any;
2
+ export declare function debug(dirname: string): any;
3
+ export declare function scope(scope: string): any;
4
+ export declare function custom(toRequireSpec: (target: string) => string): any;