From 7581c5aab107e373561854ab6fa123b84d154c98 Mon Sep 17 00:00:00 2001 From: Clayton Wilson Date: Mon, 11 Mar 2024 01:49:18 -0500 Subject: [PATCH] Improve rollop output. Harden tsconfig --- rollup.config.js | 4 ++++ src/Logger.ts | 4 +--- tsconfig.json | 32 ++++++++++++++++---------------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index d0c5f61..a59ffba 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -14,7 +14,9 @@ const productionBuildMinified = { plugins: [ typescript({ sourceMap: false, + inlineSourceMap: false, inlineSources: false, + removeComments: true, }), terser(), @@ -35,7 +37,9 @@ const productionBuild = { plugins: [ typescript({ sourceMap: false, + inlineSourceMap: false, inlineSources: false, + removeComments: true, }), ], watch: { diff --git a/src/Logger.ts b/src/Logger.ts index 61ea738..754f9cb 100644 --- a/src/Logger.ts +++ b/src/Logger.ts @@ -387,9 +387,7 @@ export class Logger { let logs = [...this.buffer]; - for (let i = this.bucketIndex.length - 1; i >= 0; i--) { - // Get name from index - const bucket = this.bucketIndex[i]; + for (const bucket of this.bucketIndex) { // Get data from bucket const gzipped = GM_getValue(bucket.name, undefined); if (gzipped === undefined) { diff --git a/tsconfig.json b/tsconfig.json index 184fe06..f49549f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -53,11 +53,11 @@ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, + "declarationMap": true /* Create sourcemaps for d.ts files. */, // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + "inlineSourceMap": true /* Include sourcemap files inside the emitted JavaScript. */, // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ "outDir": "dist" /* Specify an output folder for all emitted files. */, // "removeComments": true, /* Disable emitting comments. */ @@ -67,7 +67,7 @@ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + "inlineSources": true /* Include source code in the sourcemaps inside the emitted JavaScript. */, // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ // "newLine": "crlf", /* Set the newline character for emitting files. */ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ @@ -86,22 +86,22 @@ /* Type Checking */ "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + "noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied 'any' type. */, + "strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */, + "strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */, // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + "strictPropertyInitialization": true /* Check for class properties that are declared but not set in the constructor. */, // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + "useUnknownInCatchVariables": true /* Default catch clause variables as 'unknown' instead of 'any'. */, + "alwaysStrict": true /* Ensure 'use strict' is always emitted. */, + "noUnusedLocals": true /* Enable error reporting when local variables aren't read. */, + "noUnusedParameters": true /* Raise an error when a function parameter isn't read. */, + "exactOptionalPropertyTypes": true /* Interpret optional property types as written, rather than adding 'undefined'. */, // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + "noUncheckedIndexedAccess": true /* Add 'undefined' to a type when accessed using an index. */, + "noImplicitOverride": true /* Ensure overriding members in derived classes are marked with an override modifier. */, + "noPropertyAccessFromIndexSignature": true /* Enforces using indexed accessors for keys declared using an indexed type. */, // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */