├── src ├── utils │ └── pv.ts ├── types │ └── core.ts └── core │ └── index.ts ├── index.html ├── package.json ├── rollup.config.js ├── dist ├── index.d.ts ├── index.esm.js ├── index.cjs.js └── index.js ├── README.md └── tsconfig.json /src/utils/pv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | export const createHistoryEvnent = (type: T): () => any => { 7 | const origin = history[type]; 8 | return function (this: any) { 9 | const res = origin.apply(this, arguments) 10 | var e = new Event(type) 11 | window.dispatchEvent(e) 12 | return res; 13 | } 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zmy-tracker", 3 | "version": "1.0.4", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "module": "dist/index.esm.js", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1", 9 | "build": "rollup -c" 10 | }, 11 | "keywords": ["前端","埋点","tracker"], 12 | "author": "", 13 | "files": ["dist"], 14 | "license": "ISC", 15 | "devDependencies": { 16 | "rollup": "^2.76.0", 17 | "rollup-plugin-dts": "^4.2.2", 18 | "rollup-plugin-typescript2": "^0.32.1", 19 | "typescript": "^4.7.4" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/types/core.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @requestUrl 接口地址 3 | * @historyTracker history上报 4 | * @hashTracker hash上报 5 | * @domTracker 携带Tracker-key 点击事件上报 6 | * @historyTracker sdkVersion sdk版本 7 | * @historyTracker extra 透传字段 8 | * @jsError js 和 promise 报错异常上报 9 | */ 10 | export interface DefaultOptons { 11 | uuid: string | undefined, 12 | requestUrl: string | undefined, 13 | historyTracker: boolean, 14 | hashTracker: boolean, 15 | domTracker: boolean, 16 | sdkVersion: string | number, 17 | extra: Record | undefined, 18 | jsError:boolean 19 | } 20 | 21 | 22 | export interface Options extends Partial { 23 | requestUrl: string, 24 | } 25 | 26 | 27 | export enum TrackerConfig { 28 | version = '1.0.0' 29 | } 30 | 31 | export type reportTrackerData = { 32 | [key: string]: any, 33 | event: string, 34 | targetKey: string 35 | } -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import ts from 'rollup-plugin-typescript2' 2 | import path from 'path' 3 | import dts from 'rollup-plugin-dts'; 4 | export default [{ 5 | 6 | input: "./src/core/index.ts", 7 | output: [ 8 | { 9 | file: path.resolve(__dirname, './dist/index.esm.js'), 10 | format: "es" 11 | }, 12 | { 13 | file: path.resolve(__dirname, './dist/index.cjs.js'), 14 | format: "cjs" 15 | }, 16 | 17 | { 18 | input: "./src/core/index.ts", 19 | file: path.resolve(__dirname, './dist/index.js'), 20 | format: "umd", 21 | name: "tracker" 22 | } 23 | 24 | ], 25 | 26 | plugins: [ 27 | ts(), 28 | ] 29 | 30 | }, { 31 | input: "./src/core/index.ts", 32 | output:{ 33 | file: path.resolve(__dirname, './dist/index.d.ts'), 34 | format: "es", 35 | }, 36 | plugins: [dts()] 37 | }] -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @requestUrl 接口地址 3 | * @historyTracker history上报 4 | * @hashTracker hash上报 5 | * @domTracker 携带Tracker-key 点击事件上报 6 | * @historyTracker sdkVersion sdk版本 7 | * @historyTracker extra 透传字段 8 | * @jsError js 和 promise 报错异常上报 9 | */ 10 | interface DefaultOptons { 11 | uuid: string | undefined; 12 | requestUrl: string | undefined; 13 | historyTracker: boolean; 14 | hashTracker: boolean; 15 | domTracker: boolean; 16 | sdkVersion: string | number; 17 | extra: Record | undefined; 18 | jsError: boolean; 19 | } 20 | interface Options extends Partial { 21 | requestUrl: string; 22 | } 23 | declare type reportTrackerData = { 24 | [key: string]: any; 25 | event: string; 26 | targetKey: string; 27 | }; 28 | 29 | declare class Tracker { 30 | data: Options; 31 | private version; 32 | constructor(options: Options); 33 | private initDef; 34 | setUserId(uuid: T): void; 35 | setExtra(extra: T): void; 36 | sendTracker(data: T): void; 37 | private captureEvents; 38 | private installInnerTrack; 39 | private targetKeyReport; 40 | private jsError; 41 | private errorEvent; 42 | private promiseReject; 43 | private reportTracker; 44 | } 45 | 46 | export { Tracker as default }; 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tracker 2 | 这是一个埋点SDK 3 | This is a buried SDK 4 | 5 | 使用方法如下 6 | The usage is as follows 7 | 8 | 9 | 10 | 11 | ```js 12 | //接口上报 13 | import Tracker from 'zmy-tracker' 14 | 15 | const tr = new Tracker({ 16 | requestUrl:"xxxxxx" 17 | }) 18 | 19 | ``` 20 | options 介绍 21 | Options introduction 22 | ```ts 23 | 24 | /** 25 | * @requestUrl 接口地址 26 | * @historyTracker history上报 27 | * @hashTracker hash上报 28 | * @domTracker 携带Tracker-key 点击事件上报 29 | * @historyTracker sdkVersion sdk版本 30 | * @historyTracker extra 透传字段 31 | * @jsError js 和 promise 报错异常上报 32 | */ 33 | export interface DefaultOptons { 34 | uuid: string | undefined, 35 | requestUrl: string | undefined, 36 | historyTracker: boolean, 37 | hashTracker: boolean, 38 | domTracker: boolean, 39 | sdkVersion: string | number, 40 | extra: Record | undefined, 41 | jsError:boolean 42 | } 43 | ``` 44 | Dom上报 45 | DOM escalation 46 | ```js 47 | // 48 | //只要有target-key 就会自动上报 49 | const tr = new Tracker({ 50 | requestUrl:"http://localhost:3000/xxxx", //接口地址 51 | domTracker:true 52 | }) 53 | ``` 54 | 55 | 用法 56 | usage 57 | ```js 58 | const tr = new Tracker({ 59 | requestUrl:"http://localhost:3000/xxxx", //接口地址 60 | historyTracker:true, 61 | domTracker:true, 62 | jsError:true, 63 | }) 64 | //添加用户id 65 | tr.setUserId() 66 | 67 | //自定义上报 必须要有 event 和 targetKey 两个字段 68 | tr.sendTracker({xxx}) 69 | ``` 70 | 71 | -------------------------------------------------------------------------------- /dist/index.esm.js: -------------------------------------------------------------------------------- 1 | var TrackerConfig; 2 | (function (TrackerConfig) { 3 | TrackerConfig["version"] = "1.0.0"; 4 | })(TrackerConfig || (TrackerConfig = {})); 5 | 6 | const createHistoryEvnent = (type) => { 7 | const origin = history[type]; 8 | return function () { 9 | const res = origin.apply(this, arguments); 10 | var e = new Event(type); 11 | window.dispatchEvent(e); 12 | return res; 13 | }; 14 | }; 15 | 16 | const MouseEventList = ['click', 'dblclick', 'contextmenu', 'mousedown', 'mouseup', 'mouseenter', 'mouseout', 'mouseover']; 17 | class Tracker { 18 | constructor(options) { 19 | this.data = Object.assign(this.initDef(), options); 20 | this.installInnerTrack(); 21 | } 22 | initDef() { 23 | this.version = TrackerConfig.version; 24 | window.history['pushState'] = createHistoryEvnent("pushState"); 25 | window.history['replaceState'] = createHistoryEvnent('replaceState'); 26 | return { 27 | sdkVersion: this.version, 28 | historyTracker: false, 29 | hashTracker: false, 30 | domTracker: false, 31 | jsError: false 32 | }; 33 | } 34 | setUserId(uuid) { 35 | this.data.uuid = uuid; 36 | } 37 | setExtra(extra) { 38 | this.data.extra = extra; 39 | } 40 | sendTracker(data) { 41 | this.reportTracker(data); 42 | } 43 | captureEvents(MouseEventList, targetKey, data) { 44 | MouseEventList.forEach(event => { 45 | window.addEventListener(event, () => { 46 | this.reportTracker(Object.assign(this.data, { event, targetKey, time: new Date().getTime(), data })); 47 | }); 48 | }); 49 | } 50 | installInnerTrack() { 51 | if (this.data.historyTracker) { 52 | this.captureEvents(['pushState'], 'history-pv'); 53 | this.captureEvents(['replaceState'], 'history-pv'); 54 | this.captureEvents(['popstate'], 'history-pv'); 55 | } 56 | if (this.data.hashTracker) { 57 | this.captureEvents(['hashchange'], 'hash-pv'); 58 | } 59 | if (this.data.domTracker) { 60 | this.targetKeyReport(); 61 | } 62 | if (this.data.jsError) { 63 | this.jsError(); 64 | } 65 | } 66 | targetKeyReport() { 67 | MouseEventList.forEach(event => { 68 | window.addEventListener(event, (e) => { 69 | const target = e.target; 70 | const targetValue = target.getAttribute('target-key'); 71 | if (targetValue) { 72 | this.sendTracker({ 73 | targetKey: targetValue, 74 | event 75 | }); 76 | } 77 | }); 78 | }); 79 | } 80 | jsError() { 81 | this.errorEvent(); 82 | this.promiseReject(); 83 | } 84 | errorEvent() { 85 | window.addEventListener('error', (e) => { 86 | this.sendTracker({ 87 | targetKey: 'message', 88 | event: 'error', 89 | message: e.message 90 | }); 91 | }); 92 | } 93 | promiseReject() { 94 | window.addEventListener('unhandledrejection', (event) => { 95 | event.promise.catch(error => { 96 | this.sendTracker({ 97 | targetKey: "reject", 98 | event: "promise", 99 | message: error 100 | }); 101 | }); 102 | }); 103 | } 104 | reportTracker(data) { 105 | let headers = { 106 | type: 'application/x-www-form-urlencoded' 107 | }; 108 | let blob = new Blob([JSON.stringify(data)], headers); 109 | navigator.sendBeacon(this.data.requestUrl, blob); 110 | } 111 | } 112 | 113 | export { Tracker as default }; 114 | -------------------------------------------------------------------------------- /dist/index.cjs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var TrackerConfig; 4 | (function (TrackerConfig) { 5 | TrackerConfig["version"] = "1.0.0"; 6 | })(TrackerConfig || (TrackerConfig = {})); 7 | 8 | const createHistoryEvnent = (type) => { 9 | const origin = history[type]; 10 | return function () { 11 | const res = origin.apply(this, arguments); 12 | var e = new Event(type); 13 | window.dispatchEvent(e); 14 | return res; 15 | }; 16 | }; 17 | 18 | const MouseEventList = ['click', 'dblclick', 'contextmenu', 'mousedown', 'mouseup', 'mouseenter', 'mouseout', 'mouseover']; 19 | class Tracker { 20 | constructor(options) { 21 | this.data = Object.assign(this.initDef(), options); 22 | this.installInnerTrack(); 23 | } 24 | initDef() { 25 | this.version = TrackerConfig.version; 26 | window.history['pushState'] = createHistoryEvnent("pushState"); 27 | window.history['replaceState'] = createHistoryEvnent('replaceState'); 28 | return { 29 | sdkVersion: this.version, 30 | historyTracker: false, 31 | hashTracker: false, 32 | domTracker: false, 33 | jsError: false 34 | }; 35 | } 36 | setUserId(uuid) { 37 | this.data.uuid = uuid; 38 | } 39 | setExtra(extra) { 40 | this.data.extra = extra; 41 | } 42 | sendTracker(data) { 43 | this.reportTracker(data); 44 | } 45 | captureEvents(MouseEventList, targetKey, data) { 46 | MouseEventList.forEach(event => { 47 | window.addEventListener(event, () => { 48 | this.reportTracker(Object.assign(this.data, { event, targetKey, time: new Date().getTime(), data })); 49 | }); 50 | }); 51 | } 52 | installInnerTrack() { 53 | if (this.data.historyTracker) { 54 | this.captureEvents(['pushState'], 'history-pv'); 55 | this.captureEvents(['replaceState'], 'history-pv'); 56 | this.captureEvents(['popstate'], 'history-pv'); 57 | } 58 | if (this.data.hashTracker) { 59 | this.captureEvents(['hashchange'], 'hash-pv'); 60 | } 61 | if (this.data.domTracker) { 62 | this.targetKeyReport(); 63 | } 64 | if (this.data.jsError) { 65 | this.jsError(); 66 | } 67 | } 68 | targetKeyReport() { 69 | MouseEventList.forEach(event => { 70 | window.addEventListener(event, (e) => { 71 | const target = e.target; 72 | const targetValue = target.getAttribute('target-key'); 73 | if (targetValue) { 74 | this.sendTracker({ 75 | targetKey: targetValue, 76 | event 77 | }); 78 | } 79 | }); 80 | }); 81 | } 82 | jsError() { 83 | this.errorEvent(); 84 | this.promiseReject(); 85 | } 86 | errorEvent() { 87 | window.addEventListener('error', (e) => { 88 | this.sendTracker({ 89 | targetKey: 'message', 90 | event: 'error', 91 | message: e.message 92 | }); 93 | }); 94 | } 95 | promiseReject() { 96 | window.addEventListener('unhandledrejection', (event) => { 97 | event.promise.catch(error => { 98 | this.sendTracker({ 99 | targetKey: "reject", 100 | event: "promise", 101 | message: error 102 | }); 103 | }); 104 | }); 105 | } 106 | reportTracker(data) { 107 | let headers = { 108 | type: 'application/x-www-form-urlencoded' 109 | }; 110 | let blob = new Blob([JSON.stringify(data)], headers); 111 | navigator.sendBeacon(this.data.requestUrl, blob); 112 | } 113 | } 114 | 115 | module.exports = Tracker; 116 | -------------------------------------------------------------------------------- /src/core/index.ts: -------------------------------------------------------------------------------- 1 | import { DefaultOptons, Options, TrackerConfig, reportTrackerData } from "../types/core"; 2 | import { createHistoryEvnent } from "../utils/pv"; 3 | 4 | const MouseEventList: string[] = ['click', 'dblclick', 'contextmenu', 'mousedown', 'mouseup', 'mouseenter', 'mouseout', 'mouseover'] 5 | 6 | export default class Tracker { 7 | public data: Options; 8 | private version: string | undefined; 9 | 10 | public constructor(options: Options) { 11 | this.data = Object.assign(this.initDef(), options) 12 | this.installInnerTrack() 13 | } 14 | 15 | private initDef(): DefaultOptons { 16 | this.version = TrackerConfig.version; 17 | window.history['pushState'] = createHistoryEvnent("pushState") 18 | window.history['replaceState'] = createHistoryEvnent('replaceState') 19 | return { 20 | 21 | sdkVersion: this.version, 22 | historyTracker: false, 23 | hashTracker: false, 24 | domTracker: false, 25 | jsError: false 26 | } 27 | } 28 | 29 | 30 | public setUserId(uuid: T) { 31 | this.data.uuid = uuid; 32 | } 33 | 34 | public setExtra(extra: T) { 35 | this.data.extra = extra 36 | } 37 | 38 | public sendTracker(data: T) { 39 | this.reportTracker(data) 40 | } 41 | 42 | private captureEvents(MouseEventList: string[], targetKey: string, data?: T) { 43 | MouseEventList.forEach(event => { 44 | window.addEventListener(event, () => { 45 | this.reportTracker({ event, targetKey, data }) 46 | }) 47 | }) 48 | } 49 | 50 | private installInnerTrack() { 51 | if (this.data.historyTracker) { 52 | this.captureEvents(['pushState'], 'history-pv') 53 | this.captureEvents(['replaceState'], 'history-pv') 54 | this.captureEvents(['popstate'], 'history-pv') 55 | } 56 | if (this.data.hashTracker) { 57 | this.captureEvents(['hashchange'], 'hash-pv') 58 | } 59 | if (this.data.domTracker) { 60 | this.targetKeyReport() 61 | } 62 | if (this.data.jsError) { 63 | this.jsError() 64 | } 65 | } 66 | 67 | private targetKeyReport() { 68 | MouseEventList.forEach(event => { 69 | window.addEventListener(event, (e) => { 70 | const target = e.target as HTMLElement 71 | const targetValue = target.getAttribute('target-key') 72 | if (targetValue) { 73 | this.sendTracker({ 74 | targetKey: targetValue, 75 | event 76 | }) 77 | } 78 | }) 79 | }) 80 | } 81 | 82 | private jsError() { 83 | this.errorEvent() 84 | this.promiseReject() 85 | } 86 | 87 | private errorEvent() { 88 | window.addEventListener('error', (e) => { 89 | this.sendTracker({ 90 | targetKey: 'message', 91 | event: 'error', 92 | message: e.message 93 | }) 94 | }) 95 | } 96 | 97 | private promiseReject() { 98 | window.addEventListener('unhandledrejection', (event) => { 99 | event.promise.catch(error => { 100 | this.sendTracker({ 101 | targetKey: "reject", 102 | event: "promise", 103 | message: error 104 | }) 105 | }) 106 | }) 107 | } 108 | 109 | private reportTracker(data: T) { 110 | const params = Object.assign(this.data, data, { time: new Date().getTime() }) 111 | let headers = { 112 | type: 'application/x-www-form-urlencoded' 113 | }; 114 | let blob = new Blob([JSON.stringify(params)], headers); 115 | navigator.sendBeacon(this.data.requestUrl, blob) 116 | } 117 | 118 | } 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 | typeof define === 'function' && define.amd ? define(factory) : 4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tracker = factory()); 5 | })(this, (function () { 'use strict'; 6 | 7 | var TrackerConfig; 8 | (function (TrackerConfig) { 9 | TrackerConfig["version"] = "1.0.0"; 10 | })(TrackerConfig || (TrackerConfig = {})); 11 | 12 | const createHistoryEvnent = (type) => { 13 | const origin = history[type]; 14 | return function () { 15 | const res = origin.apply(this, arguments); 16 | var e = new Event(type); 17 | window.dispatchEvent(e); 18 | return res; 19 | }; 20 | }; 21 | 22 | const MouseEventList = ['click', 'dblclick', 'contextmenu', 'mousedown', 'mouseup', 'mouseenter', 'mouseout', 'mouseover']; 23 | class Tracker { 24 | constructor(options) { 25 | this.data = Object.assign(this.initDef(), options); 26 | this.installInnerTrack(); 27 | } 28 | initDef() { 29 | this.version = TrackerConfig.version; 30 | window.history['pushState'] = createHistoryEvnent("pushState"); 31 | window.history['replaceState'] = createHistoryEvnent('replaceState'); 32 | return { 33 | sdkVersion: this.version, 34 | historyTracker: false, 35 | hashTracker: false, 36 | domTracker: false, 37 | jsError: false 38 | }; 39 | } 40 | setUserId(uuid) { 41 | this.data.uuid = uuid; 42 | } 43 | setExtra(extra) { 44 | this.data.extra = extra; 45 | } 46 | sendTracker(data) { 47 | this.reportTracker(data); 48 | } 49 | captureEvents(MouseEventList, targetKey, data) { 50 | MouseEventList.forEach(event => { 51 | window.addEventListener(event, () => { 52 | this.reportTracker(Object.assign(this.data, { event, targetKey, time: new Date().getTime(), data })); 53 | }); 54 | }); 55 | } 56 | installInnerTrack() { 57 | if (this.data.historyTracker) { 58 | this.captureEvents(['pushState'], 'history-pv'); 59 | this.captureEvents(['replaceState'], 'history-pv'); 60 | this.captureEvents(['popstate'], 'history-pv'); 61 | } 62 | if (this.data.hashTracker) { 63 | this.captureEvents(['hashchange'], 'hash-pv'); 64 | } 65 | if (this.data.domTracker) { 66 | this.targetKeyReport(); 67 | } 68 | if (this.data.jsError) { 69 | this.jsError(); 70 | } 71 | } 72 | targetKeyReport() { 73 | MouseEventList.forEach(event => { 74 | window.addEventListener(event, (e) => { 75 | const target = e.target; 76 | const targetValue = target.getAttribute('target-key'); 77 | if (targetValue) { 78 | this.sendTracker({ 79 | targetKey: targetValue, 80 | event 81 | }); 82 | } 83 | }); 84 | }); 85 | } 86 | jsError() { 87 | this.errorEvent(); 88 | this.promiseReject(); 89 | } 90 | errorEvent() { 91 | window.addEventListener('error', (e) => { 92 | this.sendTracker({ 93 | targetKey: 'message', 94 | event: 'error', 95 | message: e.message 96 | }); 97 | }); 98 | } 99 | promiseReject() { 100 | window.addEventListener('unhandledrejection', (event) => { 101 | event.promise.catch(error => { 102 | this.sendTracker({ 103 | targetKey: "reject", 104 | event: "promise", 105 | message: error 106 | }); 107 | }); 108 | }); 109 | } 110 | reportTracker(data) { 111 | let headers = { 112 | type: 'application/x-www-form-urlencoded' 113 | }; 114 | let blob = new Blob([JSON.stringify(data)], headers); 115 | navigator.sendBeacon(this.data.requestUrl, blob); 116 | } 117 | } 118 | 119 | return Tracker; 120 | 121 | })); 122 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | /* Projects */ 5 | // "incremental": true, /* Enable incremental compilation */ 6 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 7 | // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ 8 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ 9 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 10 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 11 | /* Language and Environment */ 12 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 13 | "lib": ["DOM","DOM.Iterable","ESNext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 14 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 15 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 16 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 17 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ 18 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 19 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ 20 | // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ 21 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 22 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 23 | /* Modules */ 24 | "module": "esnext", /* Specify what module code is generated. */ 25 | // "rootDir": "./dist", /* Specify the root folder within your source files. */ 26 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 27 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 28 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 29 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 30 | // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ 31 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 32 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 33 | // "resolveJsonModule": true, /* Enable importing .json files */ 34 | // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ 35 | /* JavaScript Support */ 36 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ 37 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 38 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ 39 | /* Emit */ 40 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 41 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 42 | //"emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 43 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 44 | // "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. */ 45 | // "outDir": "./dist", /* Specify an output folder for all emitted files. */ 46 | // "removeComments": true, /* Disable emitting comments. */ 47 | // "noEmit": true, /* Disable emitting files from a compilation. */ 48 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 49 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ 50 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 51 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 52 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 53 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 54 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 55 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 56 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 57 | // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ 58 | // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ 59 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 60 | // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ 61 | // "declarationDir": "./dist", /* Specify the output directory for generated declaration files. */ 62 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 63 | /* Interop Constraints */ 64 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 65 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 66 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ 67 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 68 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 69 | /* Type Checking */ 70 | "strict": true, /* Enable all strict type-checking options. */ 71 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ 72 | // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ 73 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 74 | // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ 75 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 76 | // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ 77 | // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ 78 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 79 | // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ 80 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ 81 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 82 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 83 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 84 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 85 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 86 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ 87 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 88 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 89 | /* Completeness */ 90 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 91 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 92 | } 93 | } --------------------------------------------------------------------------------