فهرست منبع

TS: activated strict type checking

Christian Kahlau 3 سال پیش
والد
کامیت
180dd7706c
8فایلهای تغییر یافته به همراه18 افزوده شده و 16 حذف شده
  1. 1 0
      file/index.d.ts
  2. 1 1
      file/index.d.ts.map
  3. 2 2
      package.json
  4. 1 1
      shell/index.d.ts.map
  5. 7 6
      shell/index.js
  6. 0 0
      shell/index.js.map
  7. 5 5
      shell/index.ts
  8. 1 1
      tsconfig.json

+ 1 - 0
file/index.d.ts

@@ -1,4 +1,5 @@
 /// <reference types="node" />
+/// <reference types="node" />
 import fs from 'fs';
 export declare function readFile(path: string, encoding?: BufferEncoding): Promise<string>;
 export declare function readJsonFile<T>(path: string, encoding?: BufferEncoding): Promise<T>;

+ 1 - 1
file/index.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAW/F;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAuB,GAAG,OAAO,CAAC,CAAC,CAAC,CAUjG;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAOzD;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAgBlG;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAO7D;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,CAoBvE"}
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAW/F;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAuB,GAAG,OAAO,CAAC,CAAC,CAAC,CAUjG;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAOzD;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAgBlG;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAO7D;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,CAoBvE"}

+ 2 - 2
package.json

@@ -4,7 +4,7 @@
   "description": "Shared common library for JavaScript in NodeJS",
   "repository": {
     "type": "git",
-    "url": "https://bitbucket.siriusonline.de/scm/npm/node-utils.git"
+    "url": "https://gogs.hostbbq.com/hostbbq/node-utils.git"
   },
   "main": "index.js",
   "scripts": {
@@ -16,4 +16,4 @@
     "@types/node": "^14.14.31",
     "typescript": "^4.2.2"
   }
-}
+}

+ 1 - 1
shell/index.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAIA,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,OAAA,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,OAAA,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,mBAqDzI;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,iBAqB9G"}
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAIA,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,WAAW,mBAqDvJ;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,iBAqB9G"}

+ 7 - 6
shell/index.js

@@ -5,11 +5,12 @@ var child_process_1 = require("child_process");
 var MAX_BUFFER = 10 * Math.pow(2, 20);
 function exec(command, stdout, stderr) {
     return new Promise(function (resolve, reject) {
+        var _a, _b, _c, _d;
         try {
             var stdoutbuf_1 = "";
             var stderrbuf_1 = "";
             // EXEC CHILD PROCESS
-            var p = child_process_1.exec(command, { maxBuffer: MAX_BUFFER }, function (err, out) {
+            var p = (0, child_process_1.exec)(command, { maxBuffer: MAX_BUFFER }, function (err, out) {
                 if (err)
                     return reject(err);
                 if (stdoutbuf_1.length > 0 && typeof stdout === 'function')
@@ -20,7 +21,7 @@ function exec(command, stdout, stderr) {
             });
             // PIPE STDOUT
             if (typeof stdout === 'function') {
-                p.stdout.on("data", function (chunk) {
+                (_a = p.stdout) === null || _a === void 0 ? void 0 : _a.on("data", function (chunk) {
                     stdoutbuf_1 += chunk;
                     var i = -1;
                     while ((i = stdoutbuf_1.indexOf('\n')) >= 0) {
@@ -33,11 +34,11 @@ function exec(command, stdout, stderr) {
                 });
             }
             else if (typeof stdout !== 'undefined') {
-                p.stdout.pipe(stdout);
+                (_b = p.stdout) === null || _b === void 0 ? void 0 : _b.pipe(stdout);
             }
             // PIPE STDERR
             if (typeof stderr === 'function') {
-                p.stderr.on("data", function (chunk) {
+                (_c = p.stderr) === null || _c === void 0 ? void 0 : _c.on("data", function (chunk) {
                     stderrbuf_1 += chunk;
                     var i = -1;
                     while ((i = stderrbuf_1.indexOf('\n')) >= 0) {
@@ -50,7 +51,7 @@ function exec(command, stdout, stderr) {
                 });
             }
             else if (typeof stderr !== 'undefined') {
-                p.stderr.pipe(stderr);
+                (_d = p.stderr) === null || _d === void 0 ? void 0 : _d.pipe(stderr);
             }
         }
         catch (err) {
@@ -62,7 +63,7 @@ exports.exec = exec;
 function spawn(command, args, stdout, stderr) {
     return new Promise(function (resolve, reject) {
         try {
-            var p = child_process_1.spawn(command, args);
+            var p = (0, child_process_1.spawn)(command, args);
             if (stdout)
                 p.stdout.pipe(stdout);
             if (stderr)

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
shell/index.js.map


+ 5 - 5
shell/index.ts

@@ -2,7 +2,7 @@ import { exec as shell_exec, spawn as shell_spawn } from 'child_process';
 
 const MAX_BUFFER = 10 * Math.pow(2, 20);
 
-export function exec(command: string, stdout?: ((...args) => void) | NodeJS.WriteStream, stderr?: ((...args) => void) | NodeJS.WriteStream) {
+export function exec(command: string, stdout?: ((...args: any[]) => void) | NodeJS.WriteStream, stderr?: ((...args: any[]) => void) | NodeJS.WriteStream) {
     return new Promise<string>((resolve, reject) => {
         try {
             let stdoutbuf = "";
@@ -20,7 +20,7 @@ export function exec(command: string, stdout?: ((...args) => void) | NodeJS.Writ
 
             // PIPE STDOUT
             if (typeof stdout === 'function') {
-                p.stdout.on("data", chunk => {
+                p.stdout?.on("data", chunk => {
                     stdoutbuf += chunk;
                     let i = -1;
                     while ((i = stdoutbuf.indexOf('\n')) >= 0) {
@@ -32,12 +32,12 @@ export function exec(command: string, stdout?: ((...args) => void) | NodeJS.Writ
                     }
                 });
             } else if (typeof stdout !== 'undefined') {
-                p.stdout.pipe(stdout);
+                p.stdout?.pipe(stdout);
             }
 
             // PIPE STDERR
             if (typeof stderr === 'function') {
-                p.stderr.on("data", chunk => {
+                p.stderr?.on("data", chunk => {
                     stderrbuf += chunk;
                     let i = -1;
                     while ((i = stderrbuf.indexOf('\n')) >= 0) {
@@ -49,7 +49,7 @@ export function exec(command: string, stdout?: ((...args) => void) | NodeJS.Writ
                     }
                 });
             } else if (typeof stderr !== 'undefined') {
-                p.stderr.pipe(stderr);
+                p.stderr?.pipe(stderr);
             }
         } catch (err) {
             reject(err);

+ 1 - 1
tsconfig.json

@@ -7,7 +7,7 @@
     "declarationMap": true,
     "sourceMap": true,
     "rootDir": "./",
-    "strict": false,
+    "strict": true,
     "esModuleInterop": true,
     "skipLibCheck": true,
     "forceConsistentCasingInFileNames": true

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است