This repository was archived by the owner on Feb 28, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +18
-17
lines changed Expand file tree Collapse file tree 5 files changed +18
-17
lines changed Original file line number Diff line number Diff line change 44
44
"@babel/polyfill" : " ^7.0.0" ,
45
45
"@babel/preset-env" : " ^7.1.0" ,
46
46
"assert" : " ^1.4.1" ,
47
+ "axios" : " ~0.21.1" ,
47
48
"babel-loader" : " ^8.0.4" ,
48
49
"cache-control-esm" : " 1.0.0" ,
49
50
"codecov" : " ^3.0.0" ,
61
62
"karma-webpack" : " ^2.0.3" ,
62
63
"localforage" : " ^1.7.2" ,
63
64
"localforage-memoryStorageDriver" : " ^0.9.2" ,
65
+ "lodash" : " ^4.17.11" ,
64
66
"mocha" : " ^5.0.4" ,
65
67
"mockdate" : " ^2.0.2" ,
66
68
"puppeteer" : " ^3.1.0" ,
70
72
"snazzy" : " ^7.0.0" ,
71
73
"standard" : " ^14.3.1" ,
72
74
"webpack" : " ^4.1.1" ,
73
- "webpack-cli " : " ^3.1.1 " ,
74
- "axios " : " ~0.21 .1"
75
+ "webpack-bundle-analyzer " : " ^4.4.0 " ,
76
+ "webpack-cli " : " ^3.1 .1"
75
77
},
76
78
"dependencies" : {
77
79
"cache-control-esm" : " 1.0.0" ,
78
- "lodash" : " ^4.17.11" ,
79
- "md5" : " ^2.2.1" ,
80
- "whatwg-url" : " ^7.1.0"
80
+ "md5" : " ^2.2.1"
81
81
},
82
82
"peerDependencies" : {
83
83
"axios" : " ~0.21.1"
Original file line number Diff line number Diff line change 1
- import isString from 'lodash/isString'
2
- import isFunction from 'lodash/isFunction'
1
+ import { isString , isFunction } from './utilities'
3
2
import md5 from 'md5'
4
- import { URL } from 'whatwg-url'
5
3
6
4
import serialize from './serialize'
7
5
@@ -71,14 +69,14 @@ function key (config) {
71
69
let cacheKey
72
70
if ( isString ( config . key ) ) {
73
71
cacheKey = req => {
74
- const url = new URL ( req . url , req . baseURL )
75
- const key = `${ config . key } /${ url . href } ${ serializeQuery ( req ) } `
72
+ const url = ` ${ req . baseURL ? req . baseURL : '' } ${ req . url } `
73
+ const key = `${ config . key } /${ url } ${ serializeQuery ( req ) } `
76
74
return req . data ? key + md5 ( req . data ) : key
77
75
}
78
76
} else {
79
77
cacheKey = req => {
80
- const url = new URL ( req . url , req . baseURL )
81
- const key = url . href + serializeQuery ( req )
78
+ const url = ` ${ req . baseURL ? req . baseURL : '' } ${ req . url } `
79
+ const key = url + serializeQuery ( req )
82
80
return req . data ? key + md5 ( req . data ) : key
83
81
}
84
82
}
Original file line number Diff line number Diff line change @@ -136,11 +136,11 @@ describe('Cache store', () => {
136
136
let cacheKey = cache . key ( { key : 'my-key' } )
137
137
138
138
assert . ok ( isFunction ( cacheKey ) )
139
- assert . equal ( cacheKey ( { url : 'https://httpbin.org' } ) , 'my-key/https://httpbin.org/' )
139
+ assert . equal ( cacheKey ( { url : 'https://httpbin.org/ ' } ) , 'my-key/https://httpbin.org/' )
140
140
141
141
cacheKey = cache . key ( { } )
142
142
143
143
assert . ok ( isFunction ( cacheKey ) )
144
- assert . equal ( cacheKey ( { url : 'https://httpbin.org' } ) , 'https://httpbin.org/' )
144
+ assert . equal ( cacheKey ( { url : 'https://httpbin.org/ ' } ) , 'https://httpbin.org/' )
145
145
} )
146
146
} )
Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ describe('Integration', function () {
322
322
const url = 'https://httpbin.org/status/404'
323
323
const api5 = setup ( {
324
324
cache : {
325
- // debug: true,
325
+ debug : true ,
326
326
maxAge : 1 ,
327
327
readOnError : ( err , config ) => {
328
328
return err . response . status === 404
Original file line number Diff line number Diff line change 1
1
const path = require ( 'path' )
2
2
const webpack = require ( 'webpack' )
3
3
const HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
4
+ // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
4
5
5
6
const cwd = process . cwd ( )
6
7
@@ -9,7 +10,9 @@ let filename = 'cache[version].js'
9
10
let version = [ '' ]
10
11
11
12
// Start with empty list of plugins and externals and an undefined devtool
12
- const plugins = [ ]
13
+ const plugins = [
14
+ // new BundleAnalyzerPlugin()
15
+ ]
13
16
let externals = { }
14
17
15
18
let mode = 'development'
@@ -170,7 +173,7 @@ const test = {
170
173
port : 3000
171
174
} ,
172
175
target : 'web' ,
173
- devtool : 'inline- source-map'
176
+ devtool : 'source-map'
174
177
}
175
178
176
179
module . exports = process . env . NODE_ENV === 'test' ? test : build
You can’t perform that action at this time.
0 commit comments