swpp-backends 2.0.5 → 2.0.6

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.
@@ -272,11 +272,6 @@ function zipJson(json) {
272
272
  * + **执行该函数前必须调用过 [calcEjectValues]**
273
273
  */
274
274
  function getShorthand(url, offset = 0) {
275
- if (url.endsWith('/')) {
276
- const startIndex = url.indexOf('//') + 2;
277
- if (url.indexOf('/', startIndex) === url.length - 1)
278
- return '/';
279
- }
280
275
  const map = (0, Variant_1.readMergeVersionMap)();
281
276
  let collide = new Set();
282
277
  for (let mapKey in map) {
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ const VersionAnalyzer_1 = require("./VersionAnalyzer");
10
10
  const DomBuilder_1 = require("./DomBuilder");
11
11
  // noinspection JSUnusedGlobalSymbols
12
12
  exports.default = {
13
- version: '2.0.5',
13
+ version: '2.0.6',
14
14
  cache: {
15
15
  readEjectData: Utils_1.readEjectData, readUpdateJson: Variant_1.readUpdateJson,
16
16
  readRules: Variant_1.readRules, readMergeVersionMap: Variant_1.readMergeVersionMap,
@@ -194,8 +194,9 @@
194
194
  if (this.force) return true
195
195
  else if (this.refresh) return findCache(url).clean
196
196
  else {
197
+ const obj = new URL(url)
197
198
  for (let it of list) {
198
- if (it.match(url)) return true
199
+ if (it.match(obj)) return true
199
200
  }
200
201
  }
201
202
  return false
@@ -230,13 +231,14 @@
230
231
  case 'html':
231
232
  return url => url.match(/(\/|\.html)$/)
232
233
  case 'end':
233
- return url => forEachValues(value => url.endsWith(value))
234
+ return url => forEachValues(value => url.href.endsWith(value))
234
235
  case 'begin':
235
- return url => forEachValues(value => url.startsWith(value))
236
+ return url => forEachValues(value => url.pathname.startsWith(value))
236
237
  case 'str':
237
- return url => forEachValues(value => url.includes(value))
238
+ return url => forEachValues(value => url.href.includes(value))
238
239
  case 'reg':
239
- return url => forEachValues(value => url.match(new RegExp(value, 'i')))
240
+ // noinspection JSCheckFunctionSignatures
241
+ return url => forEachValues(value => url.href.match(new RegExp(value, 'i')))
240
242
  default: throw `未知表达式:${JSON.stringify(json)}`
241
243
  }
242
244
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swpp-backends",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "main": "dist/index.js",
5
5
  "typings": "types/index.d.ts",
6
6
  "description": "Generate a powerful ServiceWorker for your website.",