@nexrender/core 1.54.0 → 1.54.4

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": "@nexrender/core",
3
- "version": "1.54.0",
3
+ "version": "1.54.4",
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": "f17e8f7bc7b185785fefa6edeedb20ac8e49a156"
44
+ "gitHead": "a24bdf4c6f52af40da51039a71b6a7d07b373f2e"
45
45
  }
@@ -1,4 +1,6 @@
1
- module.exports = /*syntax:js*/`
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";
@@ -1,6 +1,6 @@
1
1
  const fs = require('fs')
2
2
  const path = require('path')
3
- const {spawn} = require('child_process')
3
+ const {spawn, exec} = require('child_process')
4
4
  const {expandEnvironmentVariables, checkForWSL} = require('../helpers/path')
5
5
 
6
6
  const translations = {
@@ -27,6 +27,38 @@ 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
+
39
+ function killProcessByName(settings, processName) {
40
+ if (process.platform !== 'win32') {
41
+ return;
42
+ }
43
+
44
+ const command = `taskkill /IM ${processName} /F`;
45
+
46
+ exec(command, (error, stdout, stderr) => {
47
+ if (error) {
48
+ settings.logger.log(`Error killing process: ${error.message}`);
49
+ return;
50
+ }
51
+
52
+ if (stderr) {
53
+ settings.logger.log(`Error: ${stderr}`);
54
+ return;
55
+ }
56
+
57
+ settings.logger.log(`Process ${processName} killed successfully.`);
58
+ settings.logger.log(stdout);
59
+ });
60
+ }
61
+
30
62
  /**
31
63
  * This task creates rendering process
32
64
  */
@@ -249,7 +281,7 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
249
281
  clearTimeout(timeoutID);
250
282
  settings.trackSync('Job Render Failed', { job_id: job.uid, error: 'aerender_no_update' });
251
283
  reject(new Error(`No update from aerender for ${settings.maxUpdateTimeout} seconds`));
252
- instance.kill('SIGINT');
284
+ crossPlatformKill(instance)
253
285
  }
254
286
  }, 5000)
255
287
 
@@ -261,7 +293,8 @@ Estimated date of change to the new behavior: 2023-06-01.\n`);
261
293
  clearTimeout(timeoutID);
262
294
  settings.trackSync('Job Render Failed', { job_id: job.uid, error: 'aerender_timeout' });
263
295
  reject(new Error(`Maximum rendering time exceeded`));
264
- instance.kill('SIGINT');
296
+ crossPlatformKill(instance)
297
+ killProcessByName('AfterFX.com')
265
298
  },
266
299
  timeout
267
300
  );