sliftutils 0.7.10 → 0.7.12

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.
@@ -12,6 +12,8 @@ export function bundleRequire(config: BundleRequireConfig) {
12
12
  versions: {},
13
13
  on: () => { },
14
14
  };
15
+ // Use production, for consistency (and so mobx doesn't break)
16
+ globalThis.process.env.NODE_ENV = globalThis.process.env.NODE_ENV || "production";
15
17
  (globalThis as any).window = (globalThis as any).window || globalThis;
16
18
  (globalThis as any).global = (globalThis as any).global || globalThis;
17
19
  (globalThis as any).setImmediate = (globalThis as any).setImmediate || globalThis.setTimeout;
@@ -45,25 +47,25 @@ export function bundleRequire(config: BundleRequireConfig) {
45
47
  child_process: {},
46
48
  events: class EventEmitter { },
47
49
  };
48
- // If is nodeJs
49
- let allBuiltInModules = new Set<string>();
50
- // Electron
51
- allBuiltInModules.add("electron");
52
- allBuiltInModules.add("original-fs");
53
- allBuiltInModules.add("vscode");
54
50
  if (typeof document === "undefined" && typeof require !== "undefined") {
51
+ const builtInRequire = globalThis.require;
52
+ let allBuiltInModules = new Set<string>();
53
+ allBuiltInModules.add("electron");
54
+ allBuiltInModules.add("original-fs");
55
+ allBuiltInModules.add("vscode");
55
56
  // Change the builts ins to use the actual built ins!
56
57
  let { builtinModules } = require("node:module");
57
58
  for (let key of builtinModules) {
58
59
  allBuiltInModules.add(key);
59
60
  }
60
- }
61
- for (let key of allBuiltInModules) {
62
- Object.defineProperty(builtInModuleExports, key, {
63
- get() {
64
- return require(key);
65
- },
66
- });
61
+
62
+ for (let key of allBuiltInModules) {
63
+ Object.defineProperty(builtInModuleExports, key, {
64
+ get() {
65
+ return builtInRequire(key);
66
+ },
67
+ });
68
+ }
67
69
  }
68
70
 
69
71
  // Just path.resolve (but needs to be reimplemented, because we can't use imports)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "0.7.10",
3
+ "version": "0.7.12",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {