@dewib/xhr-cache
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "@dewib/xhr-cache", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Cache api resources and serve it as static resource", |
@@ -34,10 +34,10 @@ export const libPrefix = '[xhr-cache]' | ||
if (process.server) { | ||
const { match } = require('@dewib/xhr-cache/node_modules/path-to-regexp/dist/index.js') | ||
const path = require('@dewib/xhr-cache/node_modules/path/path.js') | ||
const { match } = require('path-to-regexp') | ||
const { join } = require('path') | ||
const resource = resources.find((resource) => resource.middleware && match(resource.middleware.path, { decode: decodeURIComponent })(path.join(config.rootUrl, resourceUrl))) | ||
const resource = resources.find((resource) => resource.middleware && match(resource.middleware.path, { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl))) | ||
if (!resource) throw Error(`${libPrefix} Resource url ${resourceUrl} not found`) | ||
const matchResult = match(resource.middleware.path, { decode: decodeURIComponent })(path.join(config.rootUrl, resourceUrl)) | ||
const matchResult = match(resource.middleware.path, { decode: decodeURIComponent })(join(config.rootUrl, resourceUrl)) | ||
@@ -44,0 +44,0 @@ if (resource) return resource.middleware.handler(matchResult.params, { get: resource.get, store: resource.store }) |
@@ -1,2 +0,2 @@ | ||
# XHR Cache Module v2.0.0 | ||
# XHR Cache Module v2.0.1 | ||
@@ -3,0 +3,0 @@ > Cache application/json api resources and serve it as static resource |
19842