@nexrender/core 1.54.0 → 1.54.3
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 +2 -2
- package/src/assets/nexrender.jsx +3 -1
- package/src/tasks/render.js +11 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexrender/core",
|
|
3
|
-
"version": "1.54.
|
|
3
|
+
"version": "1.54.3",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"author": "Inlife",
|
|
6
6
|
"homepage": "https://www.nexrender.com",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "824d935a15b522de53e52d78c5fc1fa54864e3fa"
|
|
45
45
|
}
|
package/src/assets/nexrender.jsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// simple string literal to avoid any syntax errors and highlight code in some editors
|
|
2
|
+
const js = String.raw;
|
|
3
|
+
module.exports = js`
|
|
2
4
|
try{Object.defineProperty({},'a',{value:0})}catch(err){(function(){var defineProperty=Object.defineProperty;Object.defineProperty=function(object,property,descriptor){delete descriptor.configurable;delete descriptor.enumerable;delete descriptor.writable;try{return defineProperty(object,property,descriptor)}catch(err){object[property]=descriptor.value}}}())}Object.defineProperties||(Object.defineProperties=function defineProperties(object,descriptors){var property;for(property in descriptors){Object.defineProperty(object,property,descriptors[property])}return object});var lambda=function(l){var fn=l.match(/\((.*)\)\s*=>\s*(.*)/);var p=[];var b="";if(fn.length>0){fn.shift()}if(fn.length>0){b=fn.pop()}if(fn.length>0){p=fn.pop().replace(/^\s*|\s(?=\s)|\s*$|,/g,'').split(' ')}fn=((!/\s*return\s+/.test(b))?"return ":"")+b;p.push(fn);try{return Function.apply({},p)}catch(e){return null}};if(typeof(Array.prototype.where)==='undefined'){Array.prototype.where=function(f){var fn=f;if(typeof f=="string"){if((fn=lambda(fn))===null){throw "Syntax error in lambda string: "+f}}var res=[];var l=this.length;var p=[0,0,res];for(var i=1;i<arguments.length;i+=1){p.push(arguments[i])}for(var j=0;j<l;j+=1){if(typeof this[j]=="undefined"){continue}p[0]=this[j];p[1]=j;if(!!fn.apply(this,p)){res.push(this[j])}}return res}}if(!Array.prototype.forEach){Array.prototype.forEach=function(callback,thisArg){var T,k;if(this===null){throw new TypeError(' this is null or not defined')}var O=Object(this);var len=O.length>>>0;if(typeof callback!=="function"){throw new TypeError(callback+' is not a function')}if(arguments.length>1){T=thisArg}k=0;while(k<len){var kValue;if(k in O){kValue=O[k];callback.call(T,kValue,k,O)}k+=1}}}if(!Array.prototype.filter){Array.prototype.filter=function(fun ){'use strict';if(this===void 0||this===null){throw new TypeError()}var t=Object(this);var len=t.length>>>0;if(typeof fun!=='function'){throw new TypeError()}var res=[];var thisArg=arguments.length>=2?arguments[1]:void 0;for(var i=0;i<len;i+=1){if(i in t){var val=t[i];if(fun.call(thisArg,val,i,t)){res.push(val)}}}return res}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(searchElement,fromIndex){var k;if(this===null){throw new TypeError('"this" is null or not defined')}var O=Object(this);var len=O.length>>>0;if(len===0){return -1}var n= +fromIndex||0;if(Math.abs(n)===Infinity){n=0}if(n>=len){return -1}k=Math.max(n>=0?n:len-Math.abs(n),0);while(k<len){var kValue;if(k in O&&O[k]===searchElement){return k}k+=1}return -1}}if(typeof(String.prototype.localeCompare)==='undefined'){String.prototype.localeCompare=function(str,locale,options){return((this==str)?0:((this>str)?1:-1))}}
|
|
3
5
|
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
4
6
|
"use strict";
|
package/src/tasks/render.js
CHANGED
|
@@ -27,6 +27,15 @@ const seconds = (string) => string.split(':')
|
|
|
27
27
|
.map((e, i) => (i < 3) ? +e * Math.pow(60, 2 - i) : +e * 10e-6)
|
|
28
28
|
.reduce((acc, val) => acc + val);
|
|
29
29
|
|
|
30
|
+
const crossPlatformKill = (instance) => {
|
|
31
|
+
if (process.platform === 'win32') {
|
|
32
|
+
// kill the aerender process and all its children
|
|
33
|
+
spawn('taskkill', ['/pid', instance.pid, '/f', '/t']);
|
|
34
|
+
} else {
|
|
35
|
+
instance.kill('SIGINT');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
/**
|
|
31
40
|
* This task creates rendering process
|
|
32
41
|
*/
|
|
@@ -249,7 +258,7 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
249
258
|
clearTimeout(timeoutID);
|
|
250
259
|
settings.trackSync('Job Render Failed', { job_id: job.uid, error: 'aerender_no_update' });
|
|
251
260
|
reject(new Error(`No update from aerender for ${settings.maxUpdateTimeout} seconds`));
|
|
252
|
-
instance
|
|
261
|
+
crossPlatformKill(instance)
|
|
253
262
|
}
|
|
254
263
|
}, 5000)
|
|
255
264
|
|
|
@@ -261,7 +270,7 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
|
|
|
261
270
|
clearTimeout(timeoutID);
|
|
262
271
|
settings.trackSync('Job Render Failed', { job_id: job.uid, error: 'aerender_timeout' });
|
|
263
272
|
reject(new Error(`Maximum rendering time exceeded`));
|
|
264
|
-
instance
|
|
273
|
+
crossPlatformKill(instance)
|
|
265
274
|
},
|
|
266
275
|
timeout
|
|
267
276
|
);
|