@neon-rs/load 0.0.29 → 0.0.30

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
@@ -1,31 +1,7 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.custom = exports.scope = exports.debug = exports.currentTarget = void 0;
27
- const path = __importStar(require("path"));
28
- const fs = __importStar(require("fs"));
3
+ exports.custom = exports.scope = exports.currentTarget = void 0;
4
+ const node_module_1 = require("node:module");
29
5
  function currentTarget() {
30
6
  let os = null;
31
7
  switch (process.platform) {
@@ -95,19 +71,19 @@ function isGlibc() {
95
71
  !!header &&
96
72
  ('glibcVersionRuntime' in header);
97
73
  }
98
- function debug(...components) {
99
- if (components.length === 0 || !components[components.length - 1].endsWith(".node")) {
100
- components.push("index.node");
101
- }
102
- const pathSpec = path.join(...components);
103
- return fs.existsSync(pathSpec) ? require(pathSpec) : null;
104
- }
105
- exports.debug = debug;
74
+ // export function debug(...components: string[]) {
75
+ // if (components.length === 0 || !components[components.length - 1].endsWith(".node")) {
76
+ // components.push("index.node");
77
+ // }
78
+ // const pathSpec = path.join(...components);
79
+ // return fs.existsSync(pathSpec) ? require(pathSpec) : null;
80
+ // }
81
+ const requireAbsolute = (0, node_module_1.createRequire)(process.cwd());
106
82
  function scope(scope) {
107
- return require(scope + "/" + currentTarget());
83
+ return requireAbsolute(scope + "/" + currentTarget());
108
84
  }
109
85
  exports.scope = scope;
110
86
  function custom(toRequireSpec) {
111
- return require(toRequireSpec(currentTarget()));
87
+ return requireAbsolute(toRequireSpec(currentTarget()));
112
88
  }
113
89
  exports.custom = custom;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon-rs/load",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
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,4 +1,3 @@
1
1
  export declare function currentTarget(): string;
2
- export declare function debug(...components: string[]): any;
3
2
  export declare function scope(scope: string): any;
4
3
  export declare function custom(toRequireSpec: (target: string) => string): any;