@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 +9 -16
- package/package.json +1 -1
- package/types/index.d.ts +3 -14
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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.
|
|
110
|
+
exports.custom = custom;
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
export declare function currentTarget(): string;
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
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;
|