Comparing version 3.0.12 to 3.0.13
@@ -22,4 +22,3 @@ 'use strict'; | ||
const NAMESPACES = { node, npm, metarhia, process }; | ||
const POLY = { fetch: metarhia.metautil.fetch }; | ||
const SANDBOX = { ...COMMON_CONTEXT, ...ERRORS, ...NAMESPACES, ...POLY }; | ||
const SANDBOX = { ...COMMON_CONTEXT, ...ERRORS, ...NAMESPACES }; | ||
@@ -75,5 +74,6 @@ const ERR_INIT = 'Can not initialize an Application'; | ||
async load() { | ||
async load({ invoke }) { | ||
this.startWatch(); | ||
this.createSandbox(); | ||
this.sandbox.application.invoke = invoke; | ||
this.sandbox.application.emit('loading'); | ||
@@ -96,2 +96,3 @@ await this.parallel([ | ||
this.sandbox.application.emit('loaded'); | ||
await this.start(); | ||
} | ||
@@ -98,0 +99,0 @@ |
@@ -109,11 +109,18 @@ 'use strict'; | ||
const { size } = stat; | ||
const range = metarhia.metautil.parseRange(transport.req.headers.range); | ||
const { start, end = size - 1 } = range; | ||
if (start >= end || start >= size || end >= size) { | ||
file = this.find(filePath, 416); | ||
return void transport.write(file.data, 416, fileExt); | ||
const options = { size }; | ||
let code = 200; | ||
const { headers } = transport.req; | ||
if (headers.range) { | ||
const range = metarhia.metautil.parseRange(headers.range); | ||
const { start, end = size - 1 } = range; | ||
if (start >= end || start >= size || end >= size) { | ||
file = this.find(filePath, 416); | ||
return void transport.write(file.data, 416, fileExt); | ||
} | ||
options.start = start; | ||
options.end = end; | ||
code = 206; | ||
} | ||
const options = { start, end, size }; | ||
const readable = node.fs.createReadStream(absPath, options); | ||
return void transport.write(readable, 206, fileExt, options); | ||
return void transport.write(readable, code, fileExt, options); | ||
} | ||
@@ -120,0 +127,0 @@ } |
@@ -99,7 +99,5 @@ 'use strict'; | ||
await application.load(); | ||
application.sandbox.application.invoke = invoke; | ||
await application.start(); | ||
await application.load({ invoke }); | ||
console.info(`Application started in worker ${threadId}`); | ||
parentPort.postMessage({ name: 'started', kind: workerData.kind }); | ||
})().catch(logError(`Can not start worker ${threadId}`)); |
{ | ||
"name": "impress", | ||
"version": "3.0.12", | ||
"version": "3.0.13", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -41,3 +41,3 @@ "description": "Enterprise application server for Node.js", | ||
"type": "git", | ||
"url": "https://github.com/metarhia/impress" | ||
"url": "git+https://github.com/metarhia/impress.git" | ||
}, | ||
@@ -63,3 +63,3 @@ "bugs": { | ||
"engines": { | ||
"node": "18 || 20" | ||
"node": "18 || 20 || 21" | ||
}, | ||
@@ -72,3 +72,3 @@ "dependencies": { | ||
"metautil": "^3.15.0", | ||
"metavm": "^1.3.0", | ||
"metavm": "^1.4.0", | ||
"metawatch": "^1.1.1" | ||
@@ -75,0 +75,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69162
1804
Updatedmetavm@^1.4.0