@casterly/components
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -8,3 +8,4 @@ import React from 'react'; | ||
function __webpack_require__(assetPath: string): any; | ||
const __webpack_public_path__: string; | ||
} | ||
export declare const RootBrowser: React.FC; |
@@ -108,3 +108,6 @@ "use strict"; | ||
var addScript = function (scriptAsset) { | ||
if (document.querySelector("script[src=\"" + scriptAsset + "\"]")) { | ||
var url = __webpack_public_path__ + | ||
// remove leading slash | ||
scriptAsset.slice(1); | ||
if (document.querySelector("script[src=\"" + url + "\"]")) { | ||
return Promise.resolve(); | ||
@@ -114,3 +117,3 @@ } | ||
return new Promise(function (resolve, reject) { | ||
script.src = scriptAsset; | ||
script.src = url; | ||
script.defer = true; | ||
@@ -123,3 +126,6 @@ script.onload = resolve; | ||
var addStylesheet = function (styleAsset) { | ||
if (document.querySelector("link[href=\"" + styleAsset + "\"]")) { | ||
var url = __webpack_public_path__ + | ||
// remove leading slash | ||
styleAsset.slice(1); | ||
if (document.querySelector("link[href=\"" + url + "\"]")) { | ||
return Promise.resolve(); | ||
@@ -129,3 +135,3 @@ } | ||
return new Promise(function (resolve, reject) { | ||
link.href = styleAsset; | ||
link.href = url; | ||
link.type = 'text/css'; | ||
@@ -139,6 +145,7 @@ link.rel = 'stylesheet'; | ||
var fetchRouteData = function (path, version) { return __awaiter(void 0, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, fetch("/__route-manifest?" + new URLSearchParams({ | ||
var res, resEtag; | ||
var _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, fetch("/_casterly/route-manifest?" + new URLSearchParams({ | ||
path: path, | ||
@@ -148,4 +155,5 @@ v: version !== null && version !== void 0 ? version : '', | ||
case 1: | ||
res = _a.sent(); | ||
if (res.status === 200 && res.headers.get('Etag') === version) { | ||
res = _c.sent(); | ||
resEtag = (_b = (_a = res.headers.get('Etag')) === null || _a === void 0 ? void 0 : _a.match(/W\/"(.*)"/)) === null || _b === void 0 ? void 0 : _b[1]; | ||
if (res.status === 200 && resEtag === version) { | ||
return [2 /*return*/, res.json()]; | ||
@@ -152,0 +160,0 @@ } |
@@ -60,4 +60,4 @@ "use strict"; | ||
.filter(function (file) { return file.endsWith('.js'); }) | ||
.map(function (scriptSource) { return (react_1.default.createElement("script", __assign({ key: scriptSource }, props, { defer: true, src: scriptSource }))); }))); | ||
.map(function (scriptSource) { return (react_1.default.createElement("script", __assign({ key: scriptSource }, props, { defer: true, src: "/_casterly" + scriptSource }))); }))); | ||
}; | ||
exports.Scripts = Scripts; |
@@ -44,4 +44,4 @@ "use strict"; | ||
.filter(function (file) { return file.endsWith('.css'); }) | ||
.map(function (file) { return (react_1.default.createElement("link", __assign({ key: file }, props, { rel: "stylesheet", type: "text/css", href: file }))); }))); | ||
.map(function (file) { return (react_1.default.createElement("link", __assign({ key: file }, props, { rel: "stylesheet", type: "text/css", href: "/_casterly" + file }))); }))); | ||
}; | ||
exports.Styles = Styles; |
{ | ||
"name": "@casterly/components", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Base Casterly components", | ||
@@ -54,3 +54,3 @@ "author": "Lucas Cordeiro <ecdb.lucas@gmail.com>", | ||
}, | ||
"gitHead": "0715d5479ccec7241b057cfe6580a86b7a6b89b9" | ||
"gitHead": "ecc8a1681dd0a82faaf578842261ff047df12745" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29011
575