@heyputer/puter.js 2.0.6 → 2.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyputer/puter.js",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Puter.js - A JavaScript library for interacting with Puter services.",
5
5
  "main": "src/index.js",
6
6
  "types": "index.d.ts",
@@ -91,7 +91,7 @@ export class PuterJSFileSystemModule extends AdvancedBase {
91
91
  * @returns {void}
92
92
  */
93
93
  initializeSocket() {
94
- if ( globalThis.puter.env === 'nodejs' ){
94
+ if ( puter.env === 'nodejs' ){
95
95
  return;
96
96
  }
97
97
  if ( this.socket ) {
@@ -1,6 +1,6 @@
1
1
  const { readFileSync } = require('node:fs');
2
2
  const vm = require('node:vm');
3
-
3
+ const { resolve } = require('node:path');
4
4
  /**
5
5
  * Method for loading puter.js in Node.js environment
6
6
  * @param {string} authToken - Optional auth token to initialize puter with
@@ -16,7 +16,7 @@ const safeLoadPuterJs = (authToken) => {
16
16
  }
17
17
  });
18
18
  goodContext.globalThis = goodContext;
19
- const code = readFileSync(`${globalThis.__dirname}/../dist/puter.js`, 'utf8');
19
+ const code = readFileSync(`${resolve(__filename, '..')}/../dist/puter.js`, 'utf8');
20
20
  const context = vm.createContext(goodContext);
21
21
  vm.runInNewContext(code, context);
22
22
  if ( authToken ) {
@@ -64,7 +64,7 @@ export class FilesystemService extends putility.concepts.Service {
64
64
  }
65
65
 
66
66
  async initializeSocket() {
67
- if ( globalThis.puter.env === 'nodejs' ){
67
+ if ( puter.env === 'nodejs' ){
68
68
  return;
69
69
  }
70
70