Selaa lähdekoodia

Fixed install in PowerShell. Added some eslint rules. Dependencies update.

sanex 4 vuotta sitten
vanhempi
commit
ccc070bdf5

+ 13 - 0
.eslintrc.js

@@ -329,8 +329,21 @@ module.exports = {
         ],
         "unicorn/no-nested-ternary": "error",
         "unicorn/no-unreadable-array-destructuring": "error",
+        "unicorn/numeric-separators-style": [
+            "error",
+            {
+                number: {
+                    minimumDigits: 7,
+                    groupLength: 3
+                }
+            }
+        ],
+        "unicorn/prefer-array-find": "error",
         "unicorn/prefer-includes": "error",
+        "unicorn/prefer-optional-catch-binding": "error",
         "unicorn/prefer-starts-ends-with": "error",
+        "unicorn/prefer-set-has": "error",
+        "unicorn/prefer-string-slice": "error",
         "unicorn/prefer-trim-start-end": "error",
         "use-isnan": "error",
         "valid-typeof": "error",

+ 4 - 0
CHANGELOG.md

@@ -1,5 +1,9 @@
 Change Log
 
+v2.6.2
+---
+* Fixed installation in `PowerShell`. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/783
+
 v2.6.1
 ---
 * Fixed missing rename of object pattern properties in some cases. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/781

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/index.browser.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/index.cli.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/index.js


+ 10 - 10
package.json

@@ -1,6 +1,6 @@
 {
   "name": "javascript-obfuscator",
-  "version": "2.6.1",
+  "version": "2.6.2",
   "description": "JavaScript obfuscator",
   "keywords": [
     "obfuscator",
@@ -58,37 +58,37 @@
     "@types/mkdirp": "1.0.1",
     "@types/mocha": "8.0.3",
     "@types/multimatch": "4.0.0",
-    "@types/node": "14.11.10",
+    "@types/node": "14.14.0",
     "@types/rimraf": "3.0.0",
     "@types/sinon": "9.0.8",
     "@types/string-template": "1.0.2",
     "@types/webpack-env": "1.15.3",
-    "@typescript-eslint/eslint-plugin": "4.4.1",
-    "@typescript-eslint/parser": "4.4.1",
+    "@typescript-eslint/eslint-plugin": "4.5.0",
+    "@typescript-eslint/parser": "4.5.0",
     "chai": "4.2.0",
     "chai-exclude": "2.0.2",
     "coveralls": "3.1.0",
     "cross-env": "7.0.2",
     "eslint": "7.11.0",
     "eslint-plugin-import": "2.22.1",
-    "eslint-plugin-jsdoc": "30.6.5",
+    "eslint-plugin-jsdoc": "30.7.3",
     "eslint-plugin-no-null": "1.0.2",
     "eslint-plugin-prefer-arrow": "1.2.2",
-    "eslint-plugin-unicorn": "22.0.0",
+    "eslint-plugin-unicorn": "23.0.0",
     "fork-ts-checker-notifier-webpack-plugin": "3.0.0",
     "fork-ts-checker-webpack-plugin": "5.2.0",
-    "mocha": "8.1.3",
+    "mocha": "8.2.0",
     "nyc": "15.1.0",
     "pjson": "1.0.9",
     "pre-commit": "1.2.2",
     "rimraf": "3.0.2",
     "sinon": "9.2.0",
     "threads": "1.6.3",
-    "ts-loader": "8.0.5",
+    "ts-loader": "8.0.6",
     "ts-node": "9.0.0",
     "typescript": "4.1.0-beta",
     "webpack": "5.1.3",
-    "webpack-cli": "4.0.0",
+    "webpack-cli": "4.1.0",
     "webpack-node-externals": "2.5.2"
   },
   "repository": {
@@ -113,7 +113,7 @@
     "eslint": "eslint src/**/*.ts",
     "travis": "yarn run eslint && yarn run test",
     "git:addFiles": "git add .",
-    "postinstall": "opencollective || exit 0"
+    "postinstall": "opencollective"
   },
   "pre-commit": [
     "build",

+ 1 - 1
src/ASTParserFacade.ts

@@ -106,7 +106,7 @@ export class ASTParserFacade {
 
         const formattedPointer: string = ASTParserFacade.colorError('>');
         const formattedCodeSlice: string = `...${
-            errorLine.substring(startErrorIndex, endErrorIndex).replace(/^\s+/, '')
+            errorLine.slice(startErrorIndex, endErrorIndex).replace(/^\s+/, '')
         }...`;
 
         throw new Error(

+ 2 - 2
src/decorators/Initializable.ts

@@ -67,7 +67,7 @@ function initializeTargetMetadata (metadataKey: string, metadataValue: any, targ
  */
 function wrapTargetMethodsInInitializedCheck (target: IInitializable, initializeMethodName: string): void {
     const ownPropertyNames: string[] = Object.getOwnPropertyNames(target);
-    const prohibitedPropertyNames: string[] = [initializeMethodName, constructorMethodName];
+    const prohibitedPropertyNames: Set<string> = new Set([initializeMethodName, constructorMethodName]);
 
     ownPropertyNames.forEach((propertyName: string) => {
         const initializablePropertiesSet: Set <string | symbol> = Reflect
@@ -75,7 +75,7 @@ function wrapTargetMethodsInInitializedCheck (target: IInitializable, initialize
         const wrappedMethodsSet: Set <string | symbol> = Reflect
             .getMetadata(wrappedMethodsSetMetadataKey, target);
 
-        const isProhibitedPropertyName: boolean = prohibitedPropertyNames.includes(propertyName)
+        const isProhibitedPropertyName: boolean = prohibitedPropertyNames.has(propertyName)
             || initializablePropertiesSet.has(propertyName)
             || wrappedMethodsSet.has(propertyName);
 

+ 1 - 1
src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts

@@ -40,7 +40,7 @@ export class HexadecimalIdentifierNamesGenerator extends AbstractIdentifierNames
         const prefixLength: number = Utils.hexadecimalPrefix.length;
         const baseNameLength: number = (nameLength ?? HexadecimalIdentifierNamesGenerator.baseIdentifierNameLength)
             + prefixLength;
-        const baseIdentifierName: string = hexadecimalNumber.substr(0, baseNameLength);
+        const baseIdentifierName: string = hexadecimalNumber.slice(0, baseNameLength);
         const identifierName: string = `_${baseIdentifierName}`;
 
         if (!this.isValidIdentifierName(identifierName)) {

+ 1 - 1
src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts

@@ -210,7 +210,7 @@ export class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGene
                 const lastNameSequenceIndex: number = nameSequenceLength - 1;
 
                 if (indexInSequence !== lastNameSequenceIndex) {
-                    const previousNamePart: string = name.substring(0, index);
+                    const previousNamePart: string = name.slice(0, index);
                     const nextCharacter: string = nameSequence[indexInSequence + 1];
                     const zeroSequenceLength: number = nameLength - (index + 1);
                     const zeroSequenceCharacters: string = zeroSequence(zeroSequenceLength);

+ 1 - 0
src/node-transformers/converting-transformers/SplitStringTransformer.ts

@@ -68,6 +68,7 @@ export class SplitStringTransformer extends AbstractNodeTransformer {
             chunkIndex < chunksCount;
             ++chunkIndex, nextChunkStartIndex += chunkSize
         ) {
+            // eslint-disable-next-line unicorn/prefer-string-slice
             chunks[chunkIndex] = stringz.substr(string, nextChunkStartIndex, chunkSize);
         }
 

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 5 - 853
yarn.lock


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä