Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@casterly/components

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@casterly/components - npm Package Compare versions

Comparing version 0.9.0-alpha.11 to 0.9.0-alpha.12

2

lib/RootBrowser.d.ts

@@ -11,3 +11,3 @@ import React from 'react';

export declare const RootBrowser: React.FC<{
appContext: unknown;
appContext?: unknown;
}>;

@@ -121,3 +121,3 @@ "use strict";

scriptAsset.slice(1);
if (document.querySelector("script[src=\"" + url + "\"]")) {
if (document.querySelector("script[src=\"".concat(url, "\"]"))) {
return Promise.resolve();

@@ -138,3 +138,3 @@ }

styleAsset.slice(1);
if (document.querySelector("link[href=\"" + url + "\"]")) {
if (document.querySelector("link[href=\"".concat(url, "\"]"))) {
return Promise.resolve();

@@ -157,6 +157,6 @@ }

switch (_d.label) {
case 0: return [4 /*yield*/, fetch("/_casterly/route-manifest?" + new URLSearchParams({
case 0: return [4 /*yield*/, fetch("/_casterly/route-manifest?".concat(new URLSearchParams({
path: path,
v: version !== null && version !== void 0 ? version : '',
}))];
})))];
case 1:

@@ -205,7 +205,7 @@ res = _d.sent();

var InternalRoot = function (_a) {
var location = _a.location, action = _a.action, navigator = _a.navigator, appContext = _a.appContext, children = _a.children;
var preload = react_1.useMemo(function () {
return private_casterly_loader_1.createPreloadForContext(appContext);
var location = _a.location, navigationType = _a.navigationType, navigator = _a.navigator, appContext = _a.appContext, children = _a.children;
var preload = (0, react_1.useMemo)(function () {
return (0, private_casterly_loader_1.createPreloadForContext)(appContext);
}, []);
var _b = react_1.useState(function () {
var _b = (0, react_1.useState)(function () {
var _a, _b;

@@ -217,6 +217,6 @@ var routes = (_b = (_a = window.__serverContext) === null || _a === void 0 ? void 0 : _a.matchedRoutes.reduceRight(function (routeList, routeMatch) {

}), context = _b[0], setContext = _b[1];
var _c = react_1.useState(location), stateLocation = _c[0], setStateLocation = _c[1];
var _d = react_1.useState(false), routePending = _d[0], setRoutePending = _d[1];
var prevLocationRef = react_1.useRef(location);
react_1.useEffect(function () {
var _c = (0, react_1.useState)(location), stateLocation = _c[0], setStateLocation = _c[1];
var _d = (0, react_1.useState)(false), routePending = _d[0], setRoutePending = _d[1];
var prevLocationRef = (0, react_1.useRef)(location);
(0, react_1.useEffect)(function () {
if (prevLocationRef.current === location) {

@@ -264,18 +264,18 @@ return;

react_1.default.createElement(RoutePendingContext_1.RoutePendingContextProvider, { value: routePending },
react_1.default.createElement(react_router_1.Router, { action: action, location: stateLocation, navigator: navigator }, children))));
react_1.default.createElement(react_router_1.Router, { navigationType: navigationType, location: stateLocation, navigator: navigator }, children))));
};
var RootBrowser = function (_a) {
var appContext = _a.appContext, children = _a.children;
var historyRef = react_1.useRef();
var historyRef = (0, react_1.useRef)();
if (historyRef.current == null) {
historyRef.current = history_1.createBrowserHistory();
historyRef.current = (0, history_1.createBrowserHistory)();
}
var history = historyRef.current;
var _b = react_1.useReducer(function (_, action) { return action; }, {
var _b = (0, react_1.useReducer)(function (_, action) { return action; }, {
action: history.action,
location: history.location,
}), state = _b[0], dispatch = _b[1];
react_1.useLayoutEffect(function () { return history.listen(dispatch); }, [history]);
return (react_1.default.createElement(InternalRoot, { action: state.action, location: state.location, navigator: history, appContext: appContext }, children));
(0, react_1.useLayoutEffect)(function () { return history.listen(dispatch); }, [history]);
return (react_1.default.createElement(InternalRoot, { navigationType: state.action, location: state.location, navigator: history, appContext: appContext }, children));
};
exports.RootBrowser = RootBrowser;

@@ -26,3 +26,3 @@ "use strict";

var useRootContext = function () {
var value = react_1.useContext(ctx);
var value = (0, react_1.useContext)(ctx);
if (value == null) {

@@ -29,0 +29,0 @@ throw new Error('You must wrap your app in either <RootServer /> or <RootBrowser />');

@@ -24,5 +24,5 @@ "use strict";

var react_1 = __importStar(require("react"));
var ctx = react_1.createContext(undefined);
var ctx = (0, react_1.createContext)(undefined);
var useIsRoutePending = function () {
var contextValue = react_1.useContext(ctx);
var contextValue = (0, react_1.useContext)(ctx);
if (contextValue == null) {

@@ -29,0 +29,0 @@ throw new Error('You must use useIsRoutePending in a descendant of either <RootBrowser /> or <RootServer />');

@@ -11,6 +11,6 @@ "use strict";

var Routes = function () {
var routes = RootContext_1.useRootContext().routes;
var element = react_router_1.useRoutes(routes);
var routes = (0, RootContext_1.useRootContext)().routes;
var element = (0, react_router_1.useRoutes)(routes);
return react_1.default.createElement(react_1.default.Fragment, null, element);
};
exports.Routes = Routes;

@@ -50,3 +50,3 @@ "use strict";

async = _a.async, props = __rest(_a, ["nonce", "src", "type", "defer", "async"]);
var _b = RootContext_1.useRootContext(), matchedRoutesAssets = _b.matchedRoutesAssets, matchedRoutes = _b.matchedRoutes, mainAssets = _b.mainAssets, version = _b.version, devServerPort = _b.devServerPort;
var _b = (0, RootContext_1.useRootContext)(), matchedRoutesAssets = _b.matchedRoutesAssets, matchedRoutes = _b.matchedRoutes, mainAssets = _b.mainAssets, version = _b.version, devServerPort = _b.devServerPort;
return (react_1.default.createElement(react_1.default.Fragment, null,

@@ -71,4 +71,4 @@ react_1.default.createElement("script", {

.filter(function (file) { return file.endsWith('.js'); })
.map(function (scriptSource) { return (react_1.default.createElement("script", __assign({ key: scriptSource }, props, { async: true, src: "/_casterly" + scriptSource }))); })));
.map(function (scriptSource) { return (react_1.default.createElement("script", __assign({ key: scriptSource }, props, { async: true, src: "/_casterly".concat(scriptSource) }))); })));
};
exports.Scripts = Scripts;

@@ -40,8 +40,8 @@ "use strict";

href = _a.href, props = __rest(_a, ["type", "rel", "href"]);
var _b = RootContext_1.useRootContext(), matchedRoutesAssets = _b.matchedRoutesAssets, mainAssets = _b.mainAssets;
var _b = (0, RootContext_1.useRootContext)(), matchedRoutesAssets = _b.matchedRoutesAssets, mainAssets = _b.mainAssets;
return (react_1.default.createElement(react_1.default.Fragment, null, matchedRoutesAssets
.concat(mainAssets)
.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: "/_casterly" + file }))); })));
.map(function (file) { return (react_1.default.createElement("link", __assign({ key: file }, props, { rel: "stylesheet", type: "text/css", href: "/_casterly".concat(file) }))); })));
};
exports.Styles = Styles;
{
"name": "@casterly/components",
"version": "0.9.0-alpha.11",
"version": "0.9.0-alpha.12",
"description": "Base Casterly components",

@@ -45,6 +45,6 @@ "author": "Lucas Cordeiro <ecdb.lucas@gmail.com>",

"react-dom": "^16.9.0 || ^17.0.1",
"react-router": "^6.0.0-beta.6",
"react-router-dom": "^6.0.0-beta.6"
"react-router": "^6.0.0",
"react-router-dom": "^6.0.0"
},
"gitHead": "381cb03f7180821192c33c7391505535cbba77b3"
"gitHead": "fb8674c9ca054f4d9a65103f21a1369a5a20a007"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc