diff options
author | Mats Larsen <me@supergrecko.com> | 2021-12-26 16:05:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-26 16:05:19 +0000 |
commit | 5f871fed673a973c7aa606dd80fadc44f9e47468 (patch) | |
tree | 853d6ff54516e65aa52dbfb26e906e7bf45c8f5e | |
parent | 80811615b52384724baa596b2dc9eabe0494b435 (diff) | |
parent | 2933cca811d5d6e9c5235f1597d01de56f320021 (diff) | |
download | compiler-explorer-gh-1471.tar.gz compiler-explorer-gh-1471.zip |
Merge 2933cca811d5d6e9c5235f1597d01de56f320021 into 80811615b52384724baa596b2dc9eabe0494b435gh-1471
-rw-r--r-- | gh-dist-files.txt | 3 | ||||
-rw-r--r-- | lib/handlers/base-assembly-documentation-handler.ts (renamed from lib/handlers/base-assembly-documentation-handler.js) | 19 | ||||
-rw-r--r-- | static/api/api.ts | 2 | ||||
-rw-r--r-- | static/tsconfig.json | 12 | ||||
-rw-r--r-- | tsconfig.backend.json | 14 | ||||
-rw-r--r-- | tsconfig.base.json | 13 | ||||
-rw-r--r-- | tsconfig.frontend.json | 10 | ||||
-rw-r--r-- | tsconfig.json | 70 | ||||
-rw-r--r-- | types/features/assembly-documentation.interfaces.ts (renamed from static/api/assemblydocumentation.interfaces.ts) | 0 |
9 files changed, 48 insertions, 95 deletions
diff --git a/gh-dist-files.txt b/gh-dist-files.txt index 2364cb8bf..36714561d 100644 --- a/gh-dist-files.txt +++ b/gh-dist-files.txt @@ -14,3 +14,6 @@ app.js package-lock.json package.json tsconfig.json +tsconfig.backend.json +tsconfig.base.json +tsconfig.frontend.json diff --git a/lib/handlers/base-assembly-documentation-handler.js b/lib/handlers/base-assembly-documentation-handler.ts index c3a1b1c17..90efe15cc 100644 --- a/lib/handlers/base-assembly-documentation-handler.js +++ b/lib/handlers/base-assembly-documentation-handler.ts @@ -22,24 +22,18 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -/** - * @typedef {object} AssemblyInstructionInfo - * @property {string} url - URL to more in-depth documentation - * @property {string} html - Raw HTML to embed into the popup - * @property {string} tooltip - Text snippet to show in the tooltip - */ +import express from 'express'; + +import { AssemblyDocumentationResponse } from '../../types/features/assembly-documentation.interfaces'; export class BaseAssemblyDocumentationHandler { /** * Gather the assembly instruction information by the instruction name. * * Implementors should return null if the instruction is not supported. - * - * @param {string} instruction - * @returns {AssemblyInstructionInfo | null} */ // eslint-disable-next-line no-unused-vars - getInstructionInformation(instruction) { + getInstructionInformation(instruction: string): AssemblyDocumentationResponse | null { return null; } @@ -47,11 +41,8 @@ export class BaseAssemblyDocumentationHandler { * Handle a request for assembly instruction documentation. * * Implementors should not have to override this. - * - * @param {e.Request} request - * @param {e.Response} response */ - handle(request, response) { + handle(request: express.Request, response: express.Response) { // If the request had no opcode parameter, we should fail. This assumes // no assembly language has a __unknown_opcode instruction. const instruction = (request.params.opcode || '__UNKNOWN_OPCODE').toUpperCase(); diff --git a/static/api/api.ts b/static/api/api.ts index 03a39b59d..f3728c6e3 100644 --- a/static/api/api.ts +++ b/static/api/api.ts @@ -24,7 +24,7 @@ import _ from 'underscore'; -import { AssemblyDocumentationResponse, AssemblyDocumentationRequest } from './assemblydocumentation.interfaces'; +import { AssemblyDocumentationResponse, AssemblyDocumentationRequest } from '../../types/features/assembly-documentation.interfaces'; import { FormattingRequest, FormattingResponse } from './formatting.interfaces'; /** Type wrapper allowing .json() to resolve to a concrete type */ diff --git a/static/tsconfig.json b/static/tsconfig.json index 28db24f30..f65028e78 100644 --- a/static/tsconfig.json +++ b/static/tsconfig.json @@ -1,13 +1,3 @@ { - "compilerOptions": { - /* Module options */ - "target": "es5", - "rootDir": ".", - /* Code emitting options */ - "sourceMap": true, - "downlevelIteration": true, - "importHelpers": true, - /* Interoperability constraints */ - "esModuleInterop": true - } + "extends": "../tsconfig.frontend.json" } diff --git a/tsconfig.backend.json b/tsconfig.backend.json new file mode 100644 index 000000000..abdafdc52 --- /dev/null +++ b/tsconfig.backend.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.base.json", + "include": ["lib/**/*"], + "exclude": ["static/**/*"], + "compilerOptions": { + /* Module resolution */ + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + /* Code generation */ + "outDir": "./out/app", + "typeRoots": ["./typings", "./node_modules/@types"] + } +} diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 000000000..c1058b205 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + /* Code generation */ + "sourceMap": true, + "downlevelIteration": true, + "importHelpers": true, + /* Module resolution */ + "esModuleInterop": true, + /* Other options */ + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + } +} diff --git a/tsconfig.frontend.json b/tsconfig.frontend.json new file mode 100644 index 000000000..daaeccb06 --- /dev/null +++ b/tsconfig.frontend.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + /* Module resolution */ + "target": "es5", + "rootDirs": ["./static", "./types"], + /* Code generation */ + "inlineSources": true, + } +} diff --git a/tsconfig.json b/tsconfig.json index 79d079aee..3c586996c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,71 +1,3 @@ { - "include": ["lib/**/*"], - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, - "module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./out/app" /* Redirect output structure to the directory. */, - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - // "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - "typeRoots": ["./typings", "./node_modules/@types"], - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - "sourceRoot": "/" /* Specify the location where debugger should locate TypeScript files instead of source locations. */, - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - "inlineSourceMap": true /* Emit a single file with source maps instead of having a separate file. */, - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "skipLibCheck": true /* Skip type checking of declaration files. */, - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - } + "extends": "./tsconfig.backend.json" } diff --git a/static/api/assemblydocumentation.interfaces.ts b/types/features/assembly-documentation.interfaces.ts index 21e390bdc..21e390bdc 100644 --- a/static/api/assemblydocumentation.interfaces.ts +++ b/types/features/assembly-documentation.interfaces.ts |