Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jscrambler

Package Overview
Dependencies
Maintainers
7
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jscrambler - npm Package Compare versions

Comparing version 5.2.1 to 5.2.6

.npmignore

4

dist/bin/jscrambler.js

@@ -67,4 +67,4 @@ #!/usr/bin/env node

if (config.jscramblerVersion && !/^\d+\.\d+$/.test(config.jscramblerVersion)) {
console.error('The Jscrambler version must be in the form of $major.$minor (e.g. 5.1)');
if (config.jscramblerVersion && !/^(?:\d+\.\d+(?:-f)?|stable|latest)$/.test(config.jscramblerVersion)) {
console.error('The Jscrambler version must be in the form of $major.$minor or the words stable and latest. (e.g. 5.2, stable, latest)');
process.exit(1);

@@ -71,0 +71,0 @@ }

@@ -7,6 +7,46 @@ 'use strict';

var _introspection = require('./introspection');
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var introspection = _interopRequireWildcard(_introspection);
var getIntrospection = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(client, typeName) {
var _introspection;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_introspection = void 0;
_context.prev = 1;
_context.next = 4;
return introspection.type(client, typeName);
case 4:
_introspection = _context.sent;
_context.next = 9;
break;
case 7:
_context.prev = 7;
_context.t0 = _context['catch'](1);
case 9:
return _context.abrupt('return', _introspection);
case 10:
case 'end':
return _context.stop();
}
}
}, _callee, this, [[1, 7]]);
}));
return function getIntrospection(_x, _x2) {
return _ref.apply(this, arguments);
};
}();
var _introspection2 = require('./introspection');
var introspection = _interopRequireWildcard(_introspection2);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

@@ -16,40 +56,119 @@

function fragmentToQL(fragment) {
var iterate = function iterate(i) {
return Object.keys(i).map(function (key) {
var result;
var value = i[key];
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
result = key + ' { ' + iterate(value) + ' }';
} else {
result = key;
}
return result;
}).join(',');
};
return iterate(fragment);
}
function getAvaliableFragments(a, b) {
var fragment = {};
Object.keys(b).forEach(function (field) {
var _field = a.find(function (f) {
return f.name === field;
});
if (_field) {
if (_typeof(b[field]) === 'object' && _field.type.ofType.kind === 'OBJECT') {
fragment[field] = b[field];
} else {
fragment[field] = 1;
}
}
});
return fragment;
}
var protectionFields = {
_id: 1,
state: 1,
bail: 1,
growthWarning: 1,
errorMessage: 1,
size: 1,
transformedSize: 1
};
var deprecationFields = {
type: 1,
entity: 1
};
var sourceFields = {
filename: 1
};
var errorMessageFields = {
message: 1,
line: 1,
column: 1,
fatal: 1
};
exports.default = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(client) {
var appProtection, deprecations, isNewFormat;
return regeneratorRuntime.wrap(function _callee$(_context) {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(client) {
var appProtection, deprecation, source, errorMessage, fragments;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:
_context.next = 2;
return introspection.type(client, 'ApplicationProtection');
_context2.next = 2;
return getIntrospection(client, 'ApplicationProtection');
case 2:
appProtection = _context.sent;
deprecations = 'deprecations';
isNewFormat = appProtection.fields.find(function (f) {
return f.name === 'deprecations';
}).type.ofType.kind === 'OBJECT';
appProtection = _context2.sent;
_context2.next = 5;
return getIntrospection(client, 'Deprecation');
case 5:
deprecation = _context2.sent;
_context2.next = 8;
return getIntrospection(client, 'ApplicationSource');
if (isNewFormat) {
deprecations = 'deprecations {\n type\n entity\n }';
}
case 8:
source = _context2.sent;
_context2.next = 11;
return getIntrospection(client, 'ErrorMessages');
return _context.abrupt('return', {
application: '\n name\n ',
applicationProtection: '\n _id\n state\n bail\n ' + deprecations + '\n errorMessage\n sources {\n filename\n errorMessages {\n message\n line\n column\n fatal\n }\n }\n '
case 11:
errorMessage = _context2.sent;
fragments = {
application: {
name: 1
},
applicationProtection: {}
};
fragments.applicationProtection = appProtection && getAvaliableFragments(appProtection.fields, protectionFields);
fragments.applicationProtection.deprecations = deprecation && getAvaliableFragments(deprecation.fields, deprecationFields);
fragments.applicationProtection.sources = source && getAvaliableFragments(source.fields, sourceFields);
fragments.applicationProtection.sources.errorMessages = errorMessage && getAvaliableFragments(errorMessage.fields, errorMessageFields);
return _context2.abrupt('return', {
application: fragmentToQL(fragments.application),
applicationProtection: fragmentToQL(fragments.applicationProtection)
});
case 7:
case 18:
case 'end':
return _context.stop();
return _context2.stop();
}
}
}, _callee, this);
}, _callee2, this);
}));
return function (_x) {
return _ref.apply(this, arguments);
return function (_x3) {
return _ref2.apply(this, arguments);
};
}();

@@ -159,3 +159,3 @@ 'use strict';

var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(configPathOrObject, destCallback) {
var _config, finalConfig, applicationId, host, port, protocol, cafile, keys, sources, _finalConfig$stream, stream, cwd, params, applicationTypes, languageSpecifications, sourceMaps, randomizationSeed, areSubscribersOrdered, useRecommendedOrder, bail, jscramblerVersion, debugMode, accessKey, secretKey, client, filesSrc, filesDest, removeSourceRes, hadNoSources, zipped, _filesSrc, i, l, content, updateData, applicationUpdate, updateApplicationRes, createApplicationProtectionRes, protectionId, protection, errors, download;
var _config, finalConfig, applicationId, host, port, protocol, cafile, keys, sources, _finalConfig$stream, stream, cwd, params, applicationTypes, languageSpecifications, sourceMaps, randomizationSeed, areSubscribersOrdered, useRecommendedOrder, bail, jscramblerVersion, debugMode, accessKey, secretKey, client, filesSrc, filesDest, removeSourceRes, hadNoSources, zipped, _filesSrc, i, l, content, updateData, applicationUpdate, updateApplicationRes, createApplicationProtectionRes, protectionId, protection, url, errors, download;

@@ -398,3 +398,7 @@ return regeneratorRuntime.wrap(function _callee$(_context) {

if (protection.growthWarning) {
url = 'https://app.jscrambler.com/app/' + applicationId + '/protections/' + protectionId;
console.warn('Warning: Your protected application has surpassed a reasonable file growth.\nFor more information on what might have caused this, please see the Protection Report.\nLink: ' + url);
}
if (debug) {

@@ -417,3 +421,3 @@ console.log('Finished protecting');

if (!(!bail && errors.length > 0)) {
_context.next = 82;
_context.next = 83;
break;

@@ -425,8 +429,8 @@ }

});
_context.next = 85;
_context.next = 86;
break;
case 82:
case 83:
if (!(bail && protection.state === 'errored')) {
_context.next = 85;
_context.next = 86;
break;

@@ -440,3 +444,3 @@ }

case 85:
case 86:

@@ -456,6 +460,6 @@ if (protection.deprecations) {

}
_context.next = 89;
_context.next = 90;
return this.downloadApplicationProtection(client, protectionId);
case 89:
case 90:
download = _context.sent;

@@ -480,3 +484,3 @@

case 96:
case 97:
case 'end':

@@ -483,0 +487,0 @@ return _context.stop();

@@ -36,11 +36,2 @@ module.exports = function(grunt) {

},
jasmine_node: {
options: {
forceExit: true,
match: '.',
matchall: true,
extensions: 'js'
},
test: ['test/specs/']
},
watch: {

@@ -61,7 +52,5 @@ options: {

grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.registerTask('default', ['test']);
grunt.registerTask('build', ['clean:build', 'copy', 'babel']);
grunt.registerTask('test', ['clean:test', 'jasmine_node', 'clean:test']);
};
{
"name": "jscrambler",
"description": "Jscrambler API client.",
"version": "5.2.1",
"version": "5.2.6",
"homepage": "https://github.com/jscrambler/jscrambler",

@@ -26,3 +26,2 @@ "author": {

"build": "babel src --out-dir dist",
"test": "grunt test 2> /dev/null",
"watch": "grunt watch",

@@ -60,8 +59,7 @@ "prepublish": "npm run build"

"babel-preset-env": "^1.6.1",
"grunt": "^1.0.1",
"grunt": "^1.0.2",
"grunt-cli": "^1.2.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-jasmine-node": "^0.3.1"
"grunt-contrib-watch": "^1.0.0"
},

@@ -68,0 +66,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc