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

remix-utils

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-utils - npm Package Compare versions

Comparing version 6.1.0 to 6.3.0

8

browser/react/dynamic-links.d.ts
/// <reference types="react" />
import type { AppData, LinkDescriptor } from "@remix-run/server-runtime";
import { HandleConventionArguments } from "./handle-conventions";
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export interface DynamicLinksFunction<Data extends AppData = AppData> {
(args: HandleConventionArguments<Data>): LinkDescriptor[];
}
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export declare function DynamicLinks(): JSX.Element;

4

browser/react/dynamic-links.js
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
import { createElement as _createElement } from "react";
import { useLocation, useMatches } from "@remix-run/react";
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export function DynamicLinks() {

@@ -5,0 +9,0 @@ let location = useLocation();

@@ -5,2 +5,6 @@ /// <reference types="react" />

import { HandleConventionArguments } from "./handle-conventions";
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export declare type StructuredDatum<StructuredDataSchema extends Thing> = WithContext<StructuredDataSchema>;

@@ -10,2 +14,5 @@ /**

*
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*
* @example

@@ -22,2 +29,6 @@ * // This route uses the data to render structured data (e.g. BreadcrumbList and BlogPosting)

};
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export interface StructuredDataFunction<Data extends AppData = AppData, StructuredDataSchema extends Thing = Thing> {

@@ -28,2 +39,6 @@ (args: HandleConventionArguments<Data>): StructuredDatum<StructuredDataSchema> | StructuredDatum<StructuredDataSchema>[] | null;

* Render "application/ld+json" script tags for structured data (https://developers.google.com/search/docs/advanced/structured-data/intro-structured-data)
*
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*
* @example

@@ -30,0 +45,0 @@ * // This route uses the data to render structured data (e.g. BreadcrumbList and BlogPosting)

@@ -10,2 +10,6 @@ import { jsx as _jsx } from "react/jsx-runtime";

* Render "application/ld+json" script tags for structured data (https://developers.google.com/search/docs/advanced/structured-data/intro-structured-data)
*
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*
* @example

@@ -12,0 +16,0 @@ * // This route uses the data to render structured data (e.g. BreadcrumbList and BlogPosting)

@@ -9,2 +9,3 @@ /**

* - X-Forwarded-For
* - HTTP-X-Forwarded-For
* - Fly-Client-IP

@@ -11,0 +12,0 @@ * - CF-Connecting-IP

@@ -10,2 +10,3 @@ import isIP from "is-ip";

"X-Forwarded-For",
"HTTP-X-Forwarded-For",
"Fly-Client-IP",

@@ -12,0 +13,0 @@ "CF-Connecting-IP",

/// <reference types="react" />
import type { AppData, LinkDescriptor } from "@remix-run/server-runtime";
import { HandleConventionArguments } from "./handle-conventions";
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export interface DynamicLinksFunction<Data extends AppData = AppData> {
(args: HandleConventionArguments<Data>): LinkDescriptor[];
}
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export declare function DynamicLinks(): JSX.Element;

@@ -7,2 +7,6 @@ "use strict";

const react_2 = require("@remix-run/react");
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
function DynamicLinks() {

@@ -9,0 +13,0 @@ let location = (0, react_2.useLocation)();

@@ -5,2 +5,6 @@ /// <reference types="react" />

import { HandleConventionArguments } from "./handle-conventions";
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export declare type StructuredDatum<StructuredDataSchema extends Thing> = WithContext<StructuredDataSchema>;

@@ -10,2 +14,5 @@ /**

*
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*
* @example

@@ -22,2 +29,6 @@ * // This route uses the data to render structured data (e.g. BreadcrumbList and BlogPosting)

};
/**
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*/
export interface StructuredDataFunction<Data extends AppData = AppData, StructuredDataSchema extends Thing = Thing> {

@@ -28,2 +39,6 @@ (args: HandleConventionArguments<Data>): StructuredDatum<StructuredDataSchema> | StructuredDatum<StructuredDataSchema>[] | null;

* Render "application/ld+json" script tags for structured data (https://developers.google.com/search/docs/advanced/structured-data/intro-structured-data)
*
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*
* @example

@@ -30,0 +45,0 @@ * // This route uses the data to render structured data (e.g. BreadcrumbList and BlogPosting)

@@ -13,2 +13,6 @@ "use strict";

* Render "application/ld+json" script tags for structured data (https://developers.google.com/search/docs/advanced/structured-data/intro-structured-data)
*
* @deprecated Use new V2_MetaFunction instead
* @see https://remix.run/docs/en/main/route/meta-v2
*
* @example

@@ -15,0 +19,0 @@ * // This route uses the data to render structured data (e.g. BreadcrumbList and BlogPosting)

@@ -9,2 +9,3 @@ /**

* - X-Forwarded-For
* - HTTP-X-Forwarded-For
* - Fly-Client-IP

@@ -11,0 +12,0 @@ * - CF-Connecting-IP

@@ -16,2 +16,3 @@ "use strict";

"X-Forwarded-For",
"HTTP-X-Forwarded-For",
"Fly-Client-IP",

@@ -18,0 +19,0 @@ "CF-Connecting-IP",

2

package.json
{
"name": "remix-utils",
"version": "6.1.0",
"version": "6.3.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "engines": {

@@ -22,3 +22,3 @@ # Remix Utils

return json(
promiseHash({
await promiseHash({
user: getUser(request),

@@ -36,3 +36,3 @@ posts: getPosts(request),

return json(
promiseHash({
await promiseHash({
user: getUser(request),

@@ -384,3 +384,3 @@ posts: promiseHash({

```t
```ts
import { verifyAuthenticityToken, redirectBack } from "remix-utils";

@@ -401,2 +401,4 @@ import { getSession, commitSession } from "~/services/session.server";

> **Warning**: Deprecated in favor of the `V2_MetaFunction`. This will be removed in the next major version. Check below for the new way to do this.
If you need to create `<link />` tags based on the loader data instead of being static, you can use the `DynamicLinks` component together with the `DynamicLinksFunction` type.

@@ -460,2 +462,22 @@

If you want to upgrade to use the `V2_MetaFunction`, first enable it in your Remix app:
```js
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
future: { v2_meta: true },
};
```
Then you can use it like this:
```ts
export let meta: V2_MetaFunction<typeof loader> = ({ data }) => {
if (!data.user) return [];
return [
{ tagName: "link", rel: "preload", href: data.user.avatar, as: "image" },
];
};
```
### ExternalScripts

@@ -527,2 +549,4 @@

> **Warning**: Deprecated in favor of the V2_MetaFunction. This will be removed in the next major version. Check below for the new way to do this.
If you need to include structured data (JSON-LD) scripts on certain routes, you can use the `StructuredData` component together with the `HandleStructuredData` type or `StructuredDataFunction` type.

@@ -596,2 +620,31 @@

If you want to upgrade to use the `V2_MetaFunction`, first enable it in your Remix app:
```js
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
future: { v2_meta: true },
};
```
Then you can use it like this:
```ts
export let meta: V2_MetaFunction<typeof loader> = ({ data }) => {
let { post } = data;
return [
{
"script:ld+json": {
"@context": "https://schema.org",
"@type": "BlogPosting",
datePublished: post.published,
mainEntityOfPage: { "@type": "WebPage", "@id": post.postUrl },
image: post.featuredImage,
author: { "@type": "Person", name: post.authorName },
},
},
];
};
```
### useGlobalTransitionStates

@@ -1202,2 +1255,3 @@

```ts
// app/routes/sse.time.ts
import { eventStream } from "remix-utils";

@@ -1221,2 +1275,3 @@

```tsx
// app/components/counter.ts
import { useEventSource } from "remix-utils";

@@ -1243,2 +1298,4 @@

For Server-Sent Events to work, your server must support HTTP streaming. If you don't get SSE to work check if your deployment platform has support for it.
### Rolling Cookies

@@ -1245,0 +1302,0 @@

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