Socket
Socket
Sign inDemoInstall

@parcel/feature-flags

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/feature-flags - npm Package Compare versions

Comparing version 2.12.1-dev.3238 to 2.12.1-dev.3262

test/feature-flags.test.js

16

lib/index.js

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

exports.DEFAULT_FEATURE_FLAGS = void 0;
exports.getFeatureFlag = getFeatureFlag;
exports.setFeatureFlags = setFeatureFlags;
// We need to do these gymnastics as we don't want flow-to-ts to touch DEFAULT_FEATURE_FLAGS,
// but we want to export FeatureFlags for Flow
const DEFAULT_FEATURE_FLAGS = exports.DEFAULT_FEATURE_FLAGS = {
exampleFeature: false
};
exampleFeature: false,
configKeyInvalidation: false
};
let featureFlagValues = {
...DEFAULT_FEATURE_FLAGS
};
function setFeatureFlags(flags) {
featureFlagValues = flags;
}
function getFeatureFlag(flagName) {
return featureFlagValues[flagName];
}
export type FeatureFlags = {
// This feature flag mostly exists to test the feature flag system, and doesn't have any build/runtime effect
readonly exampleFeature: boolean;
/**
* Enables content hash based invalidation for config keys used in plugins.
* This allows Assets not to be invalidated when using
* `config.getConfigFrom(..., {packageKey: '...'})` and the value itself hasn't changed.
*/
readonly configKeyInvalidation: boolean;
};

4

package.json
{
"name": "@parcel/feature-flags",
"version": "2.12.1-dev.3238+7f6b4dbbc",
"version": "2.12.1-dev.3262+8b1749694",
"description": "Blazing fast, zero configuration web application bundler",

@@ -27,3 +27,3 @@ "license": "MIT",

},
"gitHead": "7f6b4dbbc56a203e0fce8794856c03598c4f6708"
"gitHead": "8b1749694c0ef79cefdacad40bb90c869a93993a"
}

@@ -10,2 +10,13 @@ // @flow strict

exampleFeature: false,
configKeyInvalidation: false,
};
let featureFlagValues: FeatureFlags = {...DEFAULT_FEATURE_FLAGS};
export function setFeatureFlags(flags: FeatureFlags) {
featureFlagValues = flags;
}
export function getFeatureFlag(flagName: $Keys<FeatureFlags>): boolean {
return featureFlagValues[flagName];
}

@@ -6,2 +6,8 @@ // @flow strict

+exampleFeature: boolean,
/**
* Enables content hash based invalidation for config keys used in plugins.
* This allows Assets not to be invalidated when using
* `config.getConfigFrom(..., {packageKey: '...'})` and the value itself hasn't changed.
*/
+configKeyInvalidation: boolean,
|};
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