nimiq-supply-calculator 0.0.1-security → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nimiq-supply-calculator might be problematic. Click here for more details.
- package/.eslintignore +11 -0
- package/LICENSE.md +13 -0
- package/README.md +3 -3
- package/dist/CookieContext.d.ts +10 -0
- package/dist/CookieContext.js +182 -0
- package/dist/TrackingManagerContext.d.ts +6 -0
- package/dist/TrackingManagerContext.js +53 -0
- package/dist/analytics.js +119 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +32 -0
- package/dist/examples/config.d.ts +28 -0
- package/dist/examples/config.js +77 -0
- package/dist/hooks/useHasConsent.d.ts +2 -0
- package/dist/hooks/useHasConsent.js +14 -0
- package/dist/hooks/useRequiredCategories.d.ts +3 -0
- package/dist/hooks/useRequiredCategories.js +10 -0
- package/dist/hooks/useSavedTrackingPreference.d.ts +3 -0
- package/dist/hooks/useSavedTrackingPreference.js +38 -0
- package/dist/hooks/useSetTrackingPreference.d.ts +3 -0
- package/dist/hooks/useSetTrackingPreference.js +27 -0
- package/dist/hooks/useTrackingPreference.d.ts +3 -0
- package/dist/hooks/useTrackingPreference.js +16 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +39 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.js +28 -0
- package/dist/utils/areCookiesEnabled.d.ts +2 -0
- package/dist/utils/areCookiesEnabled.js +14 -0
- package/dist/utils/getAllCookies.d.ts +3 -0
- package/dist/utils/getAllCookies.js +64 -0
- package/dist/utils/getDefaultTrackingPreference.d.ts +3 -0
- package/dist/utils/getDefaultTrackingPreference.js +28 -0
- package/dist/utils/getDomain.d.ts +2 -0
- package/dist/utils/getDomain.js +21 -0
- package/dist/utils/getTrackerCategory.d.ts +3 -0
- package/dist/utils/getTrackerCategory.js +11 -0
- package/dist/utils/getTrackerInfo.d.ts +3 -0
- package/dist/utils/getTrackerInfo.js +12 -0
- package/dist/utils/hasConsent.d.ts +11 -0
- package/dist/utils/hasConsent.js +29 -0
- package/dist/utils/isMaxKBSize.d.ts +2 -0
- package/dist/utils/isMaxKBSize.js +7 -0
- package/dist/utils/isOptOut.d.ts +16 -0
- package/dist/utils/isOptOut.js +25 -0
- package/dist/utils/persistMobileAppPreferences.d.ts +2 -0
- package/dist/utils/persistMobileAppPreferences.js +36 -0
- package/dist/utils/setGTMVariables.d.ts +3 -0
- package/dist/utils/setGTMVariables.js +14 -0
- package/dist/utils/setTrackingPreference.d.ts +4 -0
- package/dist/utils/setTrackingPreference.js +22 -0
- package/dist/utils/trackerMatches.d.ts +3 -0
- package/dist/utils/trackerMatches.js +12 -0
- package/jest.config.ts +204 -0
- package/package.json +30 -3
- package/src/CookieContext.test.tsx +105 -0
- package/src/CookieContext.tsx +215 -0
- package/src/TrackingManagerContext.tsx +25 -0
- package/src/analytics.ts +65 -0
- package/src/constants.ts +35 -0
- package/src/examples/config.ts +76 -0
- package/src/global.d.ts +3 -0
- package/src/hooks/useHasConsent.ts +11 -0
- package/src/hooks/useRequiredCaregories.test.tsx +43 -0
- package/src/hooks/useRequiredCategories.ts +11 -0
- package/src/hooks/useSavedTrackingPreference.ts +47 -0
- package/src/hooks/useSetTrackingPreference.test.tsx +82 -0
- package/src/hooks/useSetTrackingPreference.ts +31 -0
- package/src/hooks/useTrackingPreference.ts +15 -0
- package/src/index.ts +20 -0
- package/src/types.ts +71 -0
- package/src/utils/areCookiesEnabled.ts +13 -0
- package/src/utils/getAllCookies.test.ts +35 -0
- package/src/utils/getAllCookies.ts +68 -0
- package/src/utils/getDefaultTrackingPreference.test.ts +16 -0
- package/src/utils/getDefaultTrackingPreference.ts +28 -0
- package/src/utils/getDomain.test.ts +16 -0
- package/src/utils/getDomain.ts +19 -0
- package/src/utils/getTrackerCategory.test.ts +34 -0
- package/src/utils/getTrackerCategory.ts +11 -0
- package/src/utils/getTrackerInfo.test.ts +11 -0
- package/src/utils/getTrackerInfo.ts +10 -0
- package/src/utils/hasConsent.test.ts +64 -0
- package/src/utils/hasConsent.ts +32 -0
- package/src/utils/isMaxKBSize.test.ts +10 -0
- package/src/utils/isMaxKBSize.ts +7 -0
- package/src/utils/isOptOut.test.ts +14 -0
- package/src/utils/isOptOut.ts +28 -0
- package/src/utils/persistMobileAppPreferences.ts +32 -0
- package/src/utils/setGTMVariables.test.ts +20 -0
- package/src/utils/setGTMVariables.ts +17 -0
- package/src/utils/setTrackingPreference.ts +36 -0
- package/src/utils/trackerMatches.test.ts +13 -0
- package/src/utils/trackerMatches.ts +12 -0
- package/tsconfig.json +112 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Config } from '../types';
|
2
|
+
import getTrackerCategory from './getTrackerCategory';
|
3
|
+
import trackerMatches from './trackerMatches';
|
4
|
+
|
5
|
+
const getTrackerInfo = (trackerId: string, config: Config) => {
|
6
|
+
const trackingCategory = getTrackerCategory(trackerId, config);
|
7
|
+
return trackingCategory?.trackers.find((tracker) => trackerMatches(tracker, trackerId));
|
8
|
+
};
|
9
|
+
|
10
|
+
export default getTrackerInfo;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { REQUIRED_COOKIE_MANAGER_COOKIES } from '../constants';
|
2
|
+
import config from '../examples/config';
|
3
|
+
import { Region, TrackingCategory, TrackingPreference } from '../types';
|
4
|
+
import hasConsent from './hasConsent';
|
5
|
+
|
6
|
+
describe('hasConsent', () => {
|
7
|
+
let preference: TrackingPreference;
|
8
|
+
beforeEach(() => {
|
9
|
+
preference = {
|
10
|
+
region: Region.DEFAULT,
|
11
|
+
consent: [
|
12
|
+
TrackingCategory.NECESSARY,
|
13
|
+
TrackingCategory.PERFORMANCE,
|
14
|
+
TrackingCategory.FUNCTIONAL,
|
15
|
+
TrackingCategory.TARGETING,
|
16
|
+
],
|
17
|
+
};
|
18
|
+
});
|
19
|
+
|
20
|
+
it('defaults to false if cookie is uncategorized', () => {
|
21
|
+
expect(hasConsent('random_cookie', config, preference)).toEqual(false);
|
22
|
+
});
|
23
|
+
|
24
|
+
it('returns true for required cookie', () => {
|
25
|
+
preference = {
|
26
|
+
region: Region.DEFAULT,
|
27
|
+
consent: [TrackingCategory.PERFORMANCE],
|
28
|
+
};
|
29
|
+
|
30
|
+
expect(hasConsent('logged_in', config, preference)).toEqual(true);
|
31
|
+
});
|
32
|
+
|
33
|
+
it('returns true for cookies that are required to function', () => {
|
34
|
+
preference = {
|
35
|
+
region: Region.DEFAULT,
|
36
|
+
consent: [TrackingCategory.PERFORMANCE],
|
37
|
+
};
|
38
|
+
REQUIRED_COOKIE_MANAGER_COOKIES.map((c) => {
|
39
|
+
expect(hasConsent(c, config, preference)).toEqual(true);
|
40
|
+
});
|
41
|
+
});
|
42
|
+
|
43
|
+
it('returns the correct consent', () => {
|
44
|
+
preference = {
|
45
|
+
region: Region.DEFAULT,
|
46
|
+
consent: [TrackingCategory.PERFORMANCE],
|
47
|
+
};
|
48
|
+
// Default
|
49
|
+
expect(hasConsent('device_id', config, preference)).toEqual(true);
|
50
|
+
expect(hasConsent('locale', config, preference)).toEqual(true);
|
51
|
+
|
52
|
+
// EU
|
53
|
+
preference = {
|
54
|
+
region: Region.EU,
|
55
|
+
consent: [TrackingCategory.PERFORMANCE],
|
56
|
+
};
|
57
|
+
expect(hasConsent('device_id', config, preference)).toEqual(true);
|
58
|
+
preference = {
|
59
|
+
region: Region.EU,
|
60
|
+
consent: [TrackingCategory.FUNCTIONAL],
|
61
|
+
};
|
62
|
+
expect(hasConsent('g_clid', config, preference)).toEqual(false);
|
63
|
+
});
|
64
|
+
});
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { REQUIRED_COOKIE_MANAGER_COOKIES } from '../constants';
|
2
|
+
import { Config, TrackingPreference } from '../types';
|
3
|
+
import getTrackerCategory from './getTrackerCategory';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Used for determining if a specific tracker has user consent.
|
7
|
+
* It follows the following logic in order:
|
8
|
+
* 1) If we don't have a tracker category in the config then dont allow
|
9
|
+
* 2) If cookie is in a required category then allow
|
10
|
+
* 3) If cookie is required for cookie manager to function then allow
|
11
|
+
* 4) Determine consent from user consent preferences
|
12
|
+
*/
|
13
|
+
const hasConsent = (
|
14
|
+
tracker: string,
|
15
|
+
config: Config,
|
16
|
+
trackingPreference: TrackingPreference
|
17
|
+
): boolean => {
|
18
|
+
const trackingCategory = getTrackerCategory(tracker, config);
|
19
|
+
|
20
|
+
if (REQUIRED_COOKIE_MANAGER_COOKIES.includes(tracker)) {
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
if (!trackingCategory) {
|
24
|
+
return false;
|
25
|
+
}
|
26
|
+
if (trackingCategory.required) {
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
return trackingPreference.consent.includes(trackingCategory.id);
|
30
|
+
};
|
31
|
+
|
32
|
+
export default hasConsent;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import isMaxKBSize from './isMaxKBSize';
|
2
|
+
|
3
|
+
describe('isMaxKBSize', () => {
|
4
|
+
it('returns true when string exceeds max kb size', () => {
|
5
|
+
expect(isMaxKBSize('helloooooooo', 0.01)).toEqual(true);
|
6
|
+
});
|
7
|
+
it('returns false when string does not max kb size', () => {
|
8
|
+
expect(isMaxKBSize('hello', 0.01)).toEqual(false);
|
9
|
+
});
|
10
|
+
});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Region } from '../types';
|
2
|
+
import isOptOut from './isOptOut';
|
3
|
+
|
4
|
+
describe('isOptOut', () => {
|
5
|
+
it('uses default rule if there is no rule for a region', () => {
|
6
|
+
// @ts-expect-error we are deliberately passing a wrong value
|
7
|
+
expect(isOptOut('US')).toEqual(true);
|
8
|
+
});
|
9
|
+
|
10
|
+
it('returns the correct value', () => {
|
11
|
+
expect(isOptOut(Region.EU)).toEqual(false);
|
12
|
+
expect(isOptOut(Region.DEFAULT)).toEqual(true);
|
13
|
+
});
|
14
|
+
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { GEOLOCATION_RULES } from '../constants';
|
2
|
+
import { Framework, Region } from '../types';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Used for determining the if current region is using the optOut framework
|
6
|
+
* It follows the following logic in order:
|
7
|
+
* 1) If there's no geolocation rule for the specified region
|
8
|
+
* then use the rule for DEFAULT region
|
9
|
+
* - Otherwise use the DEFAULT_FRAMEWORK
|
10
|
+
* 2) Use geolocation rule
|
11
|
+
*/
|
12
|
+
|
13
|
+
/**
|
14
|
+
* optIn: Users must opt in to tracking (EU)
|
15
|
+
* optOut: Users must opt out of tracking (non-EU)
|
16
|
+
* We use the most restrictive framework (optIn) if we don't know the framework
|
17
|
+
*/
|
18
|
+
|
19
|
+
const isOptOut = (region: Region) => {
|
20
|
+
const rule = GEOLOCATION_RULES.find((r) => r.region === region);
|
21
|
+
|
22
|
+
if (!rule) {
|
23
|
+
return true;
|
24
|
+
}
|
25
|
+
return rule.framework === Framework.OPT_OUT;
|
26
|
+
};
|
27
|
+
|
28
|
+
export default isOptOut;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
* The purpose here is to allow the iOS/Android app to send a is_mobile_app=true
|
3
|
+
* parameter that should indicate to the web surfaces not to show the
|
4
|
+
* cookie banner
|
5
|
+
*
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { IS_MOBILE_APP } from '../constants';
|
9
|
+
import { getDomainWithoutSubdomain } from './getDomain';
|
10
|
+
|
11
|
+
export function persistMobileAppPreferences() {
|
12
|
+
try {
|
13
|
+
const isMobileApp = getIsMobileAppFromQueryParams();
|
14
|
+
if (isMobileApp) {
|
15
|
+
document.cookie = `${IS_MOBILE_APP}=true; domain=${getDomainWithoutSubdomain()}`;
|
16
|
+
}
|
17
|
+
} catch (e) {
|
18
|
+
// Ignore, we are not in a browser.
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
export function getIsMobileAppFromQueryParams() {
|
23
|
+
try {
|
24
|
+
const params = new URLSearchParams(window.location.search);
|
25
|
+
const isWebView = params.get('webview') === 'true';
|
26
|
+
const isMobileApp = params.get(IS_MOBILE_APP) === 'true';
|
27
|
+
return Boolean(isWebView || isMobileApp);
|
28
|
+
} catch (e) {
|
29
|
+
// Ignore, we are not in a browser.
|
30
|
+
}
|
31
|
+
return false;
|
32
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { AdTrackingPreference, Region, TrackingCategory, TrackingPreference } from '../types';
|
2
|
+
import setGTMVariables from './setGTMVariables';
|
3
|
+
|
4
|
+
describe('SetGTMVariables', () => {
|
5
|
+
it('is able to set GTM Variables', () => {
|
6
|
+
const preference: TrackingPreference = {
|
7
|
+
consent: [TrackingCategory.NECESSARY],
|
8
|
+
region: Region.EU,
|
9
|
+
};
|
10
|
+
const adTrackingPreference: AdTrackingPreference = {
|
11
|
+
value: true,
|
12
|
+
updated_at: 1,
|
13
|
+
};
|
14
|
+
setGTMVariables(preference, adTrackingPreference);
|
15
|
+
expect(window.dataLayer).toEqual([
|
16
|
+
{ consent: [TrackingCategory.NECESSARY] },
|
17
|
+
{ adConsent: 'true' },
|
18
|
+
]);
|
19
|
+
});
|
20
|
+
});
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { AdTrackingPreference, TrackingPreference } from '../types';
|
2
|
+
|
3
|
+
const setGTMVariables = (
|
4
|
+
preference: TrackingPreference,
|
5
|
+
adTrackingPreference: AdTrackingPreference
|
6
|
+
) => {
|
7
|
+
if (typeof window !== 'undefined') {
|
8
|
+
if (!window.dataLayer) window.dataLayer = [];
|
9
|
+
const gtmData = [
|
10
|
+
{ consent: preference.consent },
|
11
|
+
{ adConsent: adTrackingPreference.value.toString() },
|
12
|
+
];
|
13
|
+
window.dataLayer.push(...gtmData);
|
14
|
+
}
|
15
|
+
};
|
16
|
+
|
17
|
+
export default setGTMVariables;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { CookieAttributes } from 'js-cookie';
|
2
|
+
|
3
|
+
import {
|
4
|
+
DEFAULT_CONSENT_PREFERENCES_COOKIE,
|
5
|
+
EU_CONSENT_PREFERENCES_COOKIE,
|
6
|
+
PREFERENCE_EXPIRATION_YEAR,
|
7
|
+
} from '../constants';
|
8
|
+
import { Region, TrackingPreference } from '../types';
|
9
|
+
import { getDomainWithoutSubdomain } from './getDomain';
|
10
|
+
|
11
|
+
const setTrackingPreference = (
|
12
|
+
setCookie: (name: string, value: any, options?: CookieAttributes) => void,
|
13
|
+
newConsentPreference: TrackingPreference,
|
14
|
+
region: Region,
|
15
|
+
onPreferenceChange?: (preference: TrackingPreference) => void
|
16
|
+
) => {
|
17
|
+
const expiration = PREFERENCE_EXPIRATION_YEAR * 365;
|
18
|
+
|
19
|
+
const cookieOptions = {
|
20
|
+
expires: expiration,
|
21
|
+
domain: getDomainWithoutSubdomain(),
|
22
|
+
path: '/',
|
23
|
+
};
|
24
|
+
|
25
|
+
if (region === 'EU') {
|
26
|
+
setCookie(EU_CONSENT_PREFERENCES_COOKIE, newConsentPreference, cookieOptions);
|
27
|
+
} else {
|
28
|
+
setCookie(DEFAULT_CONSENT_PREFERENCES_COOKIE, newConsentPreference, cookieOptions);
|
29
|
+
}
|
30
|
+
|
31
|
+
if (onPreferenceChange) {
|
32
|
+
onPreferenceChange(newConsentPreference);
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
export default setTrackingPreference;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Tracker, TrackerType } from '../types';
|
2
|
+
import trackerMatches from './trackerMatches';
|
3
|
+
|
4
|
+
describe('TrackerMatches', () => {
|
5
|
+
it('it is able to detect the cookie matches the tracker', () => {
|
6
|
+
const tracker: Tracker = {
|
7
|
+
id: 'id-regex',
|
8
|
+
type: TrackerType.COOKIE,
|
9
|
+
regex: 'id(?:_[a-f0-9]{32}|undefined)(?:.*)',
|
10
|
+
};
|
11
|
+
expect(trackerMatches(tracker, 'id_ac7a5c3da45e3612b44543a702e42b01')).toEqual(true);
|
12
|
+
});
|
13
|
+
});
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Tracker } from '../types';
|
2
|
+
|
3
|
+
const trackerMatches = (tracker: Tracker, id: string) => {
|
4
|
+
if (tracker.regex) {
|
5
|
+
const re = new RegExp(tracker.regex);
|
6
|
+
return re.test(id);
|
7
|
+
} else {
|
8
|
+
return tracker.id === id;
|
9
|
+
}
|
10
|
+
};
|
11
|
+
|
12
|
+
export default trackerMatches;
|
package/tsconfig.json
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"jsx": "react",
|
4
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
5
|
+
|
6
|
+
/* Projects */
|
7
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
8
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
9
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
10
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
11
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
12
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
13
|
+
|
14
|
+
/* Language and Environment */
|
15
|
+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
16
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
17
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
18
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
19
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
20
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
21
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
22
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
23
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
24
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
25
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
26
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
27
|
+
|
28
|
+
/* Modules */
|
29
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
30
|
+
"rootDir": "./src", /* Specify the root folder within your source files. */
|
31
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
32
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
33
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
34
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
35
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
36
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
37
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
38
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
39
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
40
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
41
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
42
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
43
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
44
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
45
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
46
|
+
|
47
|
+
/* JavaScript Support */
|
48
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
49
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
50
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
51
|
+
|
52
|
+
/* Emit */
|
53
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
54
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
55
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
56
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
57
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
58
|
+
// "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. */
|
59
|
+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
60
|
+
// "removeComments": true, /* Disable emitting comments. */
|
61
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
62
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
63
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
64
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
65
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
66
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
67
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
68
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
69
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
70
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
71
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
72
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
73
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
74
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
75
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
76
|
+
|
77
|
+
/* Interop Constraints */
|
78
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
79
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
80
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
81
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
82
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
83
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
84
|
+
|
85
|
+
/* Type Checking */
|
86
|
+
"strict": true, /* Enable all strict type-checking options. */
|
87
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
88
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
89
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
90
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
91
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
92
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
93
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
94
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
95
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
96
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
97
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
98
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
99
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
100
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
101
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
102
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
103
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
104
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
105
|
+
|
106
|
+
/* Completeness */
|
107
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
108
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
109
|
+
},
|
110
|
+
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
111
|
+
"exclude": ["./src/**/*.test.ts", "./src/**/*.test.tsx"]
|
112
|
+
}
|