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

@lwc/features

Package Overview
Dependencies
Maintainers
12
Versions
607
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwc/features - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1-alpha1

LICENSE

89

dist/flags.cjs.js

@@ -11,34 +11,3 @@ /**

*/
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
function invariant(value, msg) {
if (!value) {
throw new Error(`Invariant Violation: ${msg}`);
}
}
function isTrue(value, msg) {
if (!value) {
throw new Error(`Assert Violation: ${msg}`);
}
}
function isFalse(value, msg) {
if (value) {
throw new Error(`Assert Violation: ${msg}`);
}
}
function fail(msg) {
throw new Error(msg);
}
var assert = /*#__PURE__*/Object.freeze({
invariant: invariant,
isTrue: isTrue,
isFalse: isFalse,
fail: fail
});
/*

@@ -51,2 +20,5 @@ * Copyright (c) 2018, salesforce.com, inc.

const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, keys, seal, setPrototypeOf, } = Object;
function isUndefined(obj) {
return obj === undefined;
}
function isTrue$1(obj) {

@@ -72,27 +44,54 @@ return obj === true;

const hasNativeSymbolsSupport = Symbol('x').toString() === 'Symbol(x)';
/** version: 1.0.2 */
/** version: 1.1.0 */
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
const runtimeFlags = create(null);
// This function is not whitelisted for use within components and is meant for
// configuring runtime feature flags during app initialization.
function setFeatureFlag(name, value) {
assert.invariant(isTrue$1(value) || isFalse$1(value), `Runtime feature flags must be set to a boolean value but received a(n) ${typeof value} value for the '${name}' flag.`);
runtimeFlags[name] = value;
const isBoolean = isTrue$1(value) || isFalse$1(value);
if (!isBoolean) {
const message = `Invalid ${typeof value} value specified for the "${name}" flag. Runtime feature flags can only be set to a boolean value.`;
if (process.env.NODE_ENV === 'production') {
console.error(message);
}
else {
throw new TypeError(message);
}
}
if (!isUndefined(featureFlagLookup[name])) {
runtimeFlags[name] = value;
}
else {
console.warn(`LWC feature flag "${name}" is undefined. Possible reasons are that 1) it was misspelled or 2) it was removed from the @lwc/features package.`);
}
}
// This function is added to the LWC API whitelist (for testing purposes) so we
// add a check to make sure it is not invoked in production.
function setFeatureFlagForTest(name, value) {
if (process.env.NODE_ENV === 'production') {
// this method must not leak to production
throw new ReferenceError();
if (process.env.NODE_ENV !== 'production') {
if (isUndefined(featureFlagLookup[name])) {
throw new Error(`Feature flag "${name}" is undefined. Possible reasons are that 1) it was misspelled or 2) it was removed from the @lwc/features package.`);
}
return setFeatureFlag(name, value);
}
return setFeatureFlag(name, value);
}
const ENABLE_FOO = true;
const ENABLE_BAR = false;
const ENABLE_BAZ = null;
const featureFlagLookup = {
ENABLE_REACTIVE_SETTER: null,
ENABLE_ELEMENT_PATCH: null,
ENABLE_ELEMENT_QUERY_SELECTORS_PATCH: null,
ENABLE_ELEMENT_GET_ELEMENTS_BY_PATCH: null,
ENABLE_NODE_PATCH: null,
};
exports.ENABLE_BAR = ENABLE_BAR;
exports.ENABLE_BAZ = ENABLE_BAZ;
exports.ENABLE_FOO = ENABLE_FOO;
exports.default = featureFlagLookup;
exports.runtimeFlags = runtimeFlags;
exports.setFeatureFlag = setFeatureFlag;
exports.setFeatureFlagForTest = setFeatureFlagForTest;
/** version: 1.0.2 */
/** version: 1.1.0 */

@@ -7,34 +7,3 @@ /**

*/
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
function invariant(value, msg) {
if (!value) {
throw new Error(`Invariant Violation: ${msg}`);
}
}
function isTrue(value, msg) {
if (!value) {
throw new Error(`Assert Violation: ${msg}`);
}
}
function isFalse(value, msg) {
if (value) {
throw new Error(`Assert Violation: ${msg}`);
}
}
function fail(msg) {
throw new Error(msg);
}
var assert = /*#__PURE__*/Object.freeze({
invariant: invariant,
isTrue: isTrue,
isFalse: isFalse,
fail: fail
});
/*

@@ -47,2 +16,5 @@ * Copyright (c) 2018, salesforce.com, inc.

const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, keys, seal, setPrototypeOf, } = Object;
function isUndefined(obj) {
return obj === undefined;
}
function isTrue$1(obj) {

@@ -68,22 +40,52 @@ return obj === true;

const hasNativeSymbolsSupport = Symbol('x').toString() === 'Symbol(x)';
/** version: 1.0.2 */
/** version: 1.1.0 */
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
const runtimeFlags = create(null);
// This function is not whitelisted for use within components and is meant for
// configuring runtime feature flags during app initialization.
function setFeatureFlag(name, value) {
assert.invariant(isTrue$1(value) || isFalse$1(value), `Runtime feature flags must be set to a boolean value but received a(n) ${typeof value} value for the '${name}' flag.`);
runtimeFlags[name] = value;
const isBoolean = isTrue$1(value) || isFalse$1(value);
if (!isBoolean) {
const message = `Invalid ${typeof value} value specified for the "${name}" flag. Runtime feature flags can only be set to a boolean value.`;
if (process.env.NODE_ENV === 'production') {
console.error(message);
}
else {
throw new TypeError(message);
}
}
if (!isUndefined(featureFlagLookup[name])) {
runtimeFlags[name] = value;
}
else {
console.warn(`LWC feature flag "${name}" is undefined. Possible reasons are that 1) it was misspelled or 2) it was removed from the @lwc/features package.`);
}
}
// This function is added to the LWC API whitelist (for testing purposes) so we
// add a check to make sure it is not invoked in production.
function setFeatureFlagForTest(name, value) {
if (process.env.NODE_ENV === 'production') {
// this method must not leak to production
throw new ReferenceError();
if (process.env.NODE_ENV !== 'production') {
if (isUndefined(featureFlagLookup[name])) {
throw new Error(`Feature flag "${name}" is undefined. Possible reasons are that 1) it was misspelled or 2) it was removed from the @lwc/features package.`);
}
return setFeatureFlag(name, value);
}
return setFeatureFlag(name, value);
}
const ENABLE_FOO = true;
const ENABLE_BAR = false;
const ENABLE_BAZ = null;
const featureFlagLookup = {
ENABLE_REACTIVE_SETTER: null,
ENABLE_ELEMENT_PATCH: null,
ENABLE_ELEMENT_QUERY_SELECTORS_PATCH: null,
ENABLE_ELEMENT_GET_ELEMENTS_BY_PATCH: null,
ENABLE_NODE_PATCH: null,
};
export { ENABLE_BAR, ENABLE_BAZ, ENABLE_FOO, runtimeFlags, setFeatureFlag, setFeatureFlagForTest };
/** version: 1.0.2 */
export default featureFlagLookup;
export { runtimeFlags, setFeatureFlag, setFeatureFlagForTest };
/** version: 1.1.0 */
{
"name": "@lwc/features",
"version": "1.1.0",
"version": "1.1.1-alpha1",
"description": "LWC Features Flags",

@@ -19,7 +19,8 @@ "main": "dist/flags.cjs.js",

"devDependencies": {
"@lwc/shared": "1.1.0"
"@lwc/shared": "1.1.1-alpha1"
},
"publishConfig": {
"access": "public"
}
},
"gitHead": "191b03373c55a3c6626b3e0388703b272635ea1c"
}

@@ -1,5 +0,7 @@

export declare type FeatureFlag = boolean | null;
export declare const ENABLE_FOO: FeatureFlag;
export declare const ENABLE_BAR: FeatureFlag;
export declare const ENABLE_BAZ: FeatureFlag;
export declare type FeatureFlagValue = boolean | null;
export declare type FeatureFlagLookup = {
[name: string]: FeatureFlagValue;
};
declare const featureFlagLookup: FeatureFlagLookup;
export default featureFlagLookup;
export { runtimeFlags, setFeatureFlag, setFeatureFlagForTest } from './runtime';

@@ -1,8 +0,5 @@

import { FeatureFlag } from './flags';
interface FeatureFlagConfig {
[name: string]: FeatureFlag;
}
declare const runtimeFlags: FeatureFlagConfig;
declare function setFeatureFlag(name: string, value: FeatureFlag): void;
declare function setFeatureFlagForTest(name: string, value: FeatureFlag): void;
import { FeatureFlagLookup, FeatureFlagValue } from './flags';
declare const runtimeFlags: FeatureFlagLookup;
declare function setFeatureFlag(name: string, value: FeatureFlagValue): void;
declare function setFeatureFlagForTest(name: string, value: FeatureFlagValue): void;
export { runtimeFlags, setFeatureFlag, setFeatureFlagForTest };
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