New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@locker/trusted-types

Package Overview
Dependencies
Maintainers
0
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@locker/trusted-types - npm Package Compare versions

Comparing version

to
0.24.6

8

dist/index.cjs.d.ts

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

/// <reference types="trusted-types" />
// TrustedTypes inner policy https://github.com/w3c/trusted-types/blob/main/src/trustedtypes.js#L45-L48

@@ -7,7 +8,8 @@ type PolicyOptions = Object & {

};
declare function createTrustedTypesPolicy<T extends PolicyOptions>(name: string, options: T): T;
declare function createDuplicateSafeTrustedTypesPolicy<T extends PolicyOptions>(name: string, options: T): TrustedTypePolicy;
declare function createDuplicateSafeFallbackPolicy<T extends PolicyOptions>(name: string, options: T): T;
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
declare const createPolicy: typeof createTrustedTypesPolicy;
declare const trusted: PolicyOptions;
declare const createPolicy: typeof createDuplicateSafeTrustedTypesPolicy | typeof createDuplicateSafeFallbackPolicy;
declare const trusted: PolicyOptions | TrustedTypePolicy;
export { createPolicy, trusted };
//# sourceMappingURL=index.cjs.d.ts.map

@@ -12,11 +12,24 @@ /*!

const SUPPORTS_TRUSTED_TYPES = typeof trustedTypes !== 'undefined';
function createTrustedTypesPolicy(name, options) {
const trustedTypePolicyRegistry = {
__proto__: null
};
function createDuplicateSafeTrustedTypesPolicy(name, options) {
// istanbul ignore next: not testable in coverage collection
if (trustedTypePolicyRegistry[name]) {
return trustedTypePolicyRegistry[name];
}
// @ts-ignore: Prevent cannot find name 'trustedTypes' error.
return trustedTypes.createPolicy(name, options);
// eslint-disable-next-line no-return-assign
return trustedTypePolicyRegistry[name] = trustedTypes.createPolicy(name, options);
}
function createFallbackPolicy(_name, options) {
return options;
function createDuplicateSafeFallbackPolicy(name, options) {
if (trustedTypePolicyRegistry[name]) {
return trustedTypePolicyRegistry[name];
}
// @ts-ignore: Prevent cannot find name 'trustedTypes' error.
// eslint-disable-next-line no-return-assign
return trustedTypePolicyRegistry[name] = options;
}
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
const createPolicy = SUPPORTS_TRUSTED_TYPES ? createTrustedTypesPolicy : createFallbackPolicy;
const createPolicy = SUPPORTS_TRUSTED_TYPES ? createDuplicateSafeTrustedTypesPolicy : createDuplicateSafeFallbackPolicy;
const policyOptions = {

@@ -71,2 +84,2 @@ createHTML(value) {

exports.trusted = trusted;
/*! version: 0.24.5 */
/*! version: 0.24.6 */

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

/// <reference types="trusted-types" />
// TrustedTypes inner policy https://github.com/w3c/trusted-types/blob/main/src/trustedtypes.js#L45-L48

@@ -7,7 +8,8 @@ type PolicyOptions = Object & {

};
declare function createTrustedTypesPolicy<T extends PolicyOptions>(name: string, options: T): T;
declare function createDuplicateSafeTrustedTypesPolicy<T extends PolicyOptions>(name: string, options: T): TrustedTypePolicy;
declare function createDuplicateSafeFallbackPolicy<T extends PolicyOptions>(name: string, options: T): T;
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
declare const createPolicy: typeof createTrustedTypesPolicy;
declare const trusted: PolicyOptions;
declare const createPolicy: typeof createDuplicateSafeTrustedTypesPolicy | typeof createDuplicateSafeFallbackPolicy;
declare const trusted: PolicyOptions | TrustedTypePolicy;
export { createPolicy, trusted };
//# sourceMappingURL=index.mjs.d.ts.map

@@ -6,11 +6,24 @@ /*!

const SUPPORTS_TRUSTED_TYPES = typeof trustedTypes !== 'undefined';
function createTrustedTypesPolicy(name, options) {
const trustedTypePolicyRegistry = {
__proto__: null
};
function createDuplicateSafeTrustedTypesPolicy(name, options) {
// istanbul ignore next: not testable in coverage collection
if (trustedTypePolicyRegistry[name]) {
return trustedTypePolicyRegistry[name];
}
// @ts-ignore: Prevent cannot find name 'trustedTypes' error.
return trustedTypes.createPolicy(name, options);
// eslint-disable-next-line no-return-assign
return trustedTypePolicyRegistry[name] = trustedTypes.createPolicy(name, options);
}
function createFallbackPolicy(_name, options) {
return options;
function createDuplicateSafeFallbackPolicy(name, options) {
if (trustedTypePolicyRegistry[name]) {
return trustedTypePolicyRegistry[name];
}
// @ts-ignore: Prevent cannot find name 'trustedTypes' error.
// eslint-disable-next-line no-return-assign
return trustedTypePolicyRegistry[name] = options;
}
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
const createPolicy = SUPPORTS_TRUSTED_TYPES ? createTrustedTypesPolicy : createFallbackPolicy;
const createPolicy = SUPPORTS_TRUSTED_TYPES ? createDuplicateSafeTrustedTypesPolicy : createDuplicateSafeFallbackPolicy;
const policyOptions = {

@@ -64,2 +77,2 @@ createHTML(value) {

export { createPolicy, trusted };
/*! version: 0.24.5 */
/*! version: 0.24.6 */
{
"name": "@locker/trusted-types",
"version": "0.24.5",
"version": "0.24.6",
"license": "SEE LICENSE IN LICENSE.txt",

@@ -17,2 +17,5 @@ "author": "Salesforce UI Security Team",

},
"dependencies": {
"@locker/shared": "0.24.6"
},
"files": [

@@ -19,0 +22,0 @@ "dist/",