From 4592d180c40cc236f3461fe893e10011d1c51f9e Mon Sep 17 00:00:00 2001 From: Hazork Date: Wed, 1 Sep 2021 16:30:37 -0300 Subject: [PATCH] fix: comments to outputs and removed # path alias --- .prettierignore | 1 - src/axios/cache.ts | 8 ++++---- src/axios/types.ts | 2 +- src/interceptors/request.ts | 6 +++--- src/interceptors/response.ts | 2 +- src/storage/types.ts | 2 +- src/test.ts | 16 ---------------- src/utils/key-generator.ts | 2 +- tsconfig.json | 6 ++---- 9 files changed, 13 insertions(+), 32 deletions(-) delete mode 100644 src/test.ts diff --git a/.prettierignore b/.prettierignore index d0aabb55..a7e7357c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,2 @@ -/dist /ignore /node_modules \ No newline at end of file diff --git a/src/axios/cache.ts b/src/axios/cache.ts index 78ea2024..a86e5daa 100644 --- a/src/axios/cache.ts +++ b/src/axios/cache.ts @@ -1,7 +1,7 @@ -import { applyRequestInterceptor } from '#/interceptors/request'; -import { applyResponseInterceptor } from '#/interceptors/response'; -import { MemoryStorage } from '#/storage/memory'; -import { defaultKeyGenerator } from '#/utils/key-generator'; +import { applyRequestInterceptor } from '../interceptors/request'; +import { applyResponseInterceptor } from '../interceptors/response'; +import { MemoryStorage } from '../storage/memory'; +import { defaultKeyGenerator } from '../utils/key-generator'; import { AxiosInstance } from 'axios'; import { AxiosCacheInstance, CacheInstance, CacheRequestConfig } from './types'; diff --git a/src/axios/types.ts b/src/axios/types.ts index b03b2f9f..43880045 100644 --- a/src/axios/types.ts +++ b/src/axios/types.ts @@ -1,4 +1,4 @@ -import { CacheStorage } from '#/storage/types'; +import { CacheStorage } from '../storage/types'; import type { AxiosInstance, AxiosInterceptorManager, diff --git a/src/interceptors/request.ts b/src/interceptors/request.ts index 2ef762db..a2b204e9 100644 --- a/src/interceptors/request.ts +++ b/src/interceptors/request.ts @@ -1,9 +1,9 @@ -import { AxiosCacheInstance } from '#/axios/types'; +import { AxiosCacheInstance } from '../axios/types'; import { CACHED_RESPONSE_STATUS, CACHED_RESPONSE_STATUS_TEXT -} from '#/constants'; -import { Deferred } from '#/utils/deferred'; +} from '../constants'; +import { Deferred } from '../utils/deferred'; export function applyRequestInterceptor(axios: AxiosCacheInstance) { axios.interceptors.request.use(async (config) => { diff --git a/src/interceptors/response.ts b/src/interceptors/response.ts index ca74e20d..b163fbd7 100644 --- a/src/interceptors/response.ts +++ b/src/interceptors/response.ts @@ -1,4 +1,4 @@ -import { AxiosCacheInstance } from '#/axios/types'; +import { AxiosCacheInstance } from '../axios/types'; import { parse } from '@tusbar/cache-control'; export function applyResponseInterceptor(axios: AxiosCacheInstance) { diff --git a/src/storage/types.ts b/src/storage/types.ts index 429643ba..36a55901 100644 --- a/src/storage/types.ts +++ b/src/storage/types.ts @@ -1,4 +1,4 @@ -import { Deferred } from '#/utils/deferred'; +import { Deferred } from '../utils/deferred'; export interface CacheStorage { /** diff --git a/src/test.ts b/src/test.ts deleted file mode 100644 index c498b1f7..00000000 --- a/src/test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import axios from 'axios'; -import { createCache } from './'; -import { SessionCacheStorage } from './storage'; - -// My own api -const api = axios.create(); - -const cache = createCache(api, { - // Store values on window.sessionStorage - storage: new SessionCacheStorage(), - - // Use the max-age header to determina the cache expiration time - interpretHeader: true -}); - -cache.get('http://example.com/'); diff --git a/src/utils/key-generator.ts b/src/utils/key-generator.ts index 3a91ded6..fc00623f 100644 --- a/src/utils/key-generator.ts +++ b/src/utils/key-generator.ts @@ -1,4 +1,4 @@ -import { CacheRequestConfig } from '#/axios/types'; +import { CacheRequestConfig } from '../axios/types'; export function defaultKeyGenerator({ baseURL, diff --git a/tsconfig.json b/tsconfig.json index 79f23fd3..edc42b36 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,7 @@ // "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. */, + // "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'. */, @@ -45,9 +45,7 @@ /* 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": { - "#/*": ["./src/*"] - } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */, + // "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. */ // "types": [], /* Type declaration files to be included in compilation. */