sliftutils 0.7.12 → 0.7.13

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.
@@ -48,7 +48,7 @@ export function bundleRequire(config: BundleRequireConfig) {
48
48
  events: class EventEmitter { },
49
49
  };
50
50
  if (typeof document === "undefined" && typeof require !== "undefined") {
51
- const builtInRequire = globalThis.require;
51
+ const builtInRequire = require;
52
52
  let allBuiltInModules = new Set<string>();
53
53
  allBuiltInModules.add("electron");
54
54
  allBuiltInModules.add("original-fs");
@@ -161,7 +161,7 @@ export function bundleRequire(config: BundleRequireConfig) {
161
161
  loaded: false,
162
162
  path: dirname(resolveAbsolutePath),
163
163
  paths: serialized?.paths || [],
164
- require,
164
+ require: requireFnc,
165
165
  load,
166
166
  } as any;
167
167
  newModule.exports.default = newModule.exports;
@@ -175,10 +175,10 @@ export function bundleRequire(config: BundleRequireConfig) {
175
175
  resolve.paths = (request: string) => [];
176
176
 
177
177
  requireCache[newModule.id] = newModule;
178
- require.resolve = resolve;
179
- require.cache = requireCache;
180
- require.main = newModule;
181
- require.extensions = "extension not implemented yet" as any;
178
+ requireFnc.resolve = resolve;
179
+ requireFnc.cache = requireCache;
180
+ requireFnc.main = newModule;
181
+ requireFnc.extensions = "extension not implemented yet" as any;
182
182
 
183
183
  // Resolves file extensions
184
184
  function innerResolve(path: string): string {
@@ -216,7 +216,7 @@ export function bundleRequire(config: BundleRequireConfig) {
216
216
  // throw new Error(`Module ${path} not found`);
217
217
  }
218
218
 
219
- function require(path: string) {
219
+ function requireFnc(path: string) {
220
220
  if (path in builtInModuleExports) {
221
221
  return builtInModuleExports[path as keyof typeof builtInModuleExports];
222
222
  }
@@ -235,7 +235,7 @@ export function bundleRequire(config: BundleRequireConfig) {
235
235
  newModule.loaded = true;
236
236
 
237
237
  if (serialized) {
238
- serialized.moduleFnc(newModule.exports, require, newModule, newModule.filename, newModule.path);
238
+ serialized.moduleFnc(newModule.exports, requireFnc, newModule, newModule.filename, newModule.path);
239
239
  } else {
240
240
  // If we are being imported by the root module, we need to throw an error
241
241
  if (!config.parentModule?.parent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "0.7.12",
3
+ "version": "0.7.13",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {