@heyputer/puter.js 2.0.6 → 2.0.8
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
|
@@ -91,9 +91,6 @@ export class PuterJSFileSystemModule extends AdvancedBase {
|
|
|
91
91
|
* @returns {void}
|
|
92
92
|
*/
|
|
93
93
|
initializeSocket() {
|
|
94
|
-
if ( globalThis.puter.env === 'nodejs' ){
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
94
|
if ( this.socket ) {
|
|
98
95
|
this.socket.disconnect();
|
|
99
96
|
}
|
|
@@ -102,6 +99,7 @@ export class PuterJSFileSystemModule extends AdvancedBase {
|
|
|
102
99
|
auth: {
|
|
103
100
|
auth_token: this.authToken,
|
|
104
101
|
},
|
|
102
|
+
autoUnref: true,
|
|
105
103
|
});
|
|
106
104
|
|
|
107
105
|
this.bindSocketEvents();
|
package/src/safeLoadPuter.cjs
CHANGED
|
@@ -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(`${
|
|
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,10 +64,6 @@ export class FilesystemService extends putility.concepts.Service {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
async initializeSocket() {
|
|
67
|
-
if ( globalThis.puter.env === 'nodejs' ){
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
67
|
if ( this.socket ) {
|
|
72
68
|
this.socket.disconnect();
|
|
73
69
|
}
|
|
@@ -82,6 +78,7 @@ export class FilesystemService extends putility.concepts.Service {
|
|
|
82
78
|
|
|
83
79
|
this.socket = io(api_info.api_origin, {
|
|
84
80
|
auth: { auth_token: api_info.auth_token },
|
|
81
|
+
autoUnref: true,
|
|
85
82
|
});
|
|
86
83
|
|
|
87
84
|
this.bindSocketEvents();
|