Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@dr.pogodin/react-helmet

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dr.pogodin/react-helmet - npm Package Compare versions

Comparing version
3.0.2
to
3.0.3
+2
-0
build/common/Helmet.js

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

} = child;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion
if (typeof type === 'symbol') type = type.toString();

@@ -198,2 +199,3 @@ assertChildType(type, nestedChildren);

context.update(id, undefined);
context.clientApply();
}, [context, id]);

@@ -200,0 +202,0 @@ return null;

+11
-12

@@ -21,14 +21,13 @@ "use strict";

*/
const MetaTags = _ref => {
let {
children,
description,
extraMetaTags,
image,
siteName,
socialDescription,
socialTitle,
title,
url
} = _ref;
const MetaTags = ({
children,
description,
extraMetaTags,
image,
siteName,
socialDescription,
socialTitle,
title,
url
}) => {
// NOTE: I guess, in this very case, we should prefer title and description

@@ -35,0 +34,0 @@ // also to empty social title and decscription?

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

const Context = exports.Context = /*#__PURE__*/(0, _react.createContext)(undefined);
const HelmetProvider = _ref => {
let {
children,
context
} = _ref;
const HelmetProvider = ({
children,
context
}) => {
const {

@@ -62,2 +61,4 @@ current: heap

heap.serverState ??= (0, _server.newServerState)(heap);
// eslint-disable-next-line no-param-reassign
context.helmet = heap.serverState;

@@ -64,0 +65,0 @@ }

@@ -12,6 +12,5 @@ "use strict";

const SELF_CLOSING_TAGS = [_constants.TAG_NAMES.NOSCRIPT, _constants.TAG_NAMES.SCRIPT, _constants.TAG_NAMES.STYLE];
const encodeSpecialCharacters = function (str) {
let encode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
const encodeSpecialCharacters = (str, encode = true) => {
if (!encode) return str;
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
};

@@ -59,4 +58,3 @@ function generateElementAttributesAsString(attrs) {

function mapElementAttributesToProps(attributes) {
let ops = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
function mapElementAttributesToProps(attributes, ops = {}) {
const res = {};

@@ -107,2 +105,3 @@ if (ops.addHelmetDataAttr) res[_constants.HELMET_ATTRIBUTE] = true;

const getState = () => {
// eslint-disable-next-line no-param-reassign
heap.state ??= (0, _utils.calcAggregatedState)(heap.helmets);

@@ -109,0 +108,0 @@ return heap.state;

@@ -113,6 +113,3 @@ "use strict";

// with minimal updates, for now, then refactor it later.
return propsArray.map(_ref => {
let [, props] = _ref;
return props;
}).filter(props => {
return propsArray.map(([, props]) => props).filter(props => {
if (Array.isArray(props[tagName])) {

@@ -244,3 +241,6 @@ return true;

const tgt = target[array];
if (tgt) tgt.push(item);else target[array] = [item];
if (tgt) tgt.push(item);
// eslint-disable-next-line no-param-reassign
else target[array] = [item];
}

@@ -247,0 +247,0 @@ function calcAggregatedState(props) {

@@ -94,2 +94,3 @@ import { Children, use, useEffect, useId } from 'react';

} = child;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion
if (typeof type === 'symbol') type = type.toString();

@@ -192,2 +193,3 @@ assertChildType(type, nestedChildren);

context.update(id, undefined);
context.clientApply();
}, [context, id]);

@@ -194,0 +196,0 @@ return null;

@@ -14,14 +14,13 @@ import { createContext, useMemo } from 'react';

*/
const MetaTags = _ref => {
let {
children,
description,
extraMetaTags,
image,
siteName,
socialDescription,
socialTitle,
title,
url
} = _ref;
const MetaTags = ({
children,
description,
extraMetaTags,
image,
siteName,
socialDescription,
socialTitle,
title,
url
}) => {
// NOTE: I guess, in this very case, we should prefer title and description

@@ -28,0 +27,0 @@ // also to empty social title and decscription?

@@ -8,7 +8,6 @@ import { createContext, useRef } from 'react';

export const Context = /*#__PURE__*/createContext(undefined);
const HelmetProvider = _ref => {
let {
children,
context
} = _ref;
const HelmetProvider = ({
children,
context
}) => {
const {

@@ -56,2 +55,4 @@ current: heap

heap.serverState ??= newServerState(heap);
// eslint-disable-next-line no-param-reassign
context.helmet = heap.serverState;

@@ -58,0 +59,0 @@ }

@@ -6,6 +6,5 @@ import { createElement } from 'react';

const SELF_CLOSING_TAGS = [TAG_NAMES.NOSCRIPT, TAG_NAMES.SCRIPT, TAG_NAMES.STYLE];
const encodeSpecialCharacters = function (str) {
let encode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
const encodeSpecialCharacters = (str, encode = true) => {
if (!encode) return str;
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
};

@@ -53,4 +52,3 @@ function generateElementAttributesAsString(attrs) {

function mapElementAttributesToProps(attributes) {
let ops = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
function mapElementAttributesToProps(attributes, ops = {}) {
const res = {};

@@ -101,2 +99,3 @@ if (ops.addHelmetDataAttr) res[HELMET_ATTRIBUTE] = true;

const getState = () => {
// eslint-disable-next-line no-param-reassign
heap.state ??= calcAggregatedState(heap.helmets);

@@ -103,0 +102,0 @@ return heap.state;

@@ -97,6 +97,3 @@ import { HTML_TAG_MAP, TAG_NAMES, TAG_PROPERTIES, SEO_PRIORITY_TAGS } from './constants';

// with minimal updates, for now, then refactor it later.
return propsArray.map(_ref => {
let [, props] = _ref;
return props;
}).filter(props => {
return propsArray.map(([, props]) => props).filter(props => {
if (Array.isArray(props[tagName])) {

@@ -227,3 +224,6 @@ return true;

const tgt = target[array];
if (tgt) tgt.push(item);else target[array] = [item];
if (tgt) tgt.push(item);
// eslint-disable-next-line no-param-reassign
else target[array] = [item];
}

@@ -230,0 +230,0 @@ export function calcAggregatedState(props) {

@@ -7,22 +7,19 @@ /* eslint-disable import/no-extraneous-dependencies */

export default defineConfig([{
ignores: ['build/'],
}, {
extends: [
eslintConfigs.configs.javascript,
eslintConfigs.configs.typescript,
eslintConfigs.configs.react,
],
}, {
extends: [
eslintConfigs.configs.jest,
],
files: ['__tests__/**'],
}, {
files: ['config/jest/**', 'jest/**'],
rules: {
'import/no-extraneous-dependencies': ['error', {
devDependencies: true,
}],
export default defineConfig([
{ ignores: ['build/'] },
eslintConfigs.configs.javascript,
eslintConfigs.configs.typescript,
eslintConfigs.configs.react,
{
extends: [eslintConfigs.configs.jest],
files: ['__tests__/**'],
},
}]);
{
files: ['config/jest/**', 'jest/**'],
rules: {
'import/no-extraneous-dependencies': ['error', {
devDependencies: true,
}],
},
},
]);

@@ -1,2 +0,8 @@

import { type ReactNode, act, StrictMode } from 'react';
import {
type FunctionComponent,
type ReactNode,
act,
StrictMode,
} from 'react';
import { createRoot, type Root } from 'react-dom/client';

@@ -16,2 +22,13 @@

type WrapperProps = {
children?: ReactNode;
context?: HelmetDataContext;
};
const Wrapper: FunctionComponent<WrapperProps> = ({ children, context }) => (
<StrictMode>
<Provider context={context}>{children}</Provider>
</StrictMode>
);
export const renderClient = (node: ReactNode, context = {}): void => {

@@ -25,7 +42,3 @@ if (!root) {

act(() => {
root?.render(
<StrictMode>
<Provider context={context}>{node}</Provider>
</StrictMode>,
);
root?.render(<Wrapper context={context}>{node}</Wrapper>);
});

@@ -32,0 +45,0 @@ };

@@ -5,3 +5,2 @@ // TODO: Remove client-side utils from this module, they belong to browser-utils

import { type ReactNode, StrictMode } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';

@@ -8,0 +7,0 @@

{
"name": "@dr.pogodin/react-helmet",
"version": "3.0.2",
"version": "3.0.3",
"description": "Thread-safe Helmet for React 19+ and friends",

@@ -40,23 +40,23 @@ "main": "./build/common/index.js",

"dependencies": {
"@babel/runtime": "^7.27.1"
"@babel/runtime": "^7.28.4"
},
"devDependencies": {
"@babel/cli": "^7.27.1",
"@babel/plugin-transform-runtime": "^7.27.1",
"@babel/preset-env": "^7.27.1",
"@babel/cli": "^7.28.3",
"@babel/plugin-transform-runtime": "^7.28.3",
"@babel/preset-env": "^7.28.3",
"@babel/preset-react": "^7.27.1",
"@babel/preset-typescript": "^7.27.1",
"@dr.pogodin/eslint-configs": "^0.0.5",
"@jest/globals": "^29.7.0",
"@testing-library/jest-dom": "6.6.3",
"@dr.pogodin/eslint-configs": "^0.0.11",
"@jest/globals": "^30.1.2",
"@testing-library/jest-dom": "6.8.0",
"@testing-library/react": "16.3.0",
"@tsconfig/recommended": "^1.0.8",
"@types/jest": "^29.5.14",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"@tsconfig/recommended": "^1.0.10",
"@types/jest": "^30.0.0",
"@types/react": "^19.1.12",
"@types/react-dom": "^19.1.9",
"jest": "^30.1.3",
"jest-environment-jsdom": "^30.1.2",
"raf": "^3.4.1",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"rimraf": "6.0.1"

@@ -63,0 +63,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet