@atlaspack/feature-flags 2.14.1-dev.118 → 2.14.1-dev.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.flow +3 -0
- package/package.json +7 -12
- package/lib/index.js +0 -73
- package/lib/types.d.ts +0 -88
- package/lib/types.js +0 -1
- package/src/index.js +0 -108
- package/src/types.js +0 -80
- package/test/feature-flags.test.js +0 -105
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @atlaspack/feature-flags
|
|
2
2
|
|
|
3
|
+
## 2.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#582](https://github.com/atlassian-labs/atlaspack/pull/582) [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b) Thanks [@matt-koko](https://github.com/matt-koko)! - Export DEFAULT_FEATURE_FLAGS so it will be included in the associate type declaration file and able to be imported elsewhere.
|
|
8
|
+
|
|
9
|
+
This will enable patterns like:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
import type { FeatureFlags } from '@atlaspack/feature-flags';
|
|
13
|
+
import { DEFAULT_FEATURE_FLAGS } from '@atlaspack/feature-flags';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#503](https://github.com/atlassian-labs/atlaspack/pull/503) [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818) Thanks [@JakeLane](https://github.com/JakeLane)! - Fix conditional bundling reporter when condition is reused
|
|
19
|
+
|
|
20
|
+
## 2.15.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#551](https://github.com/atlassian-labs/atlaspack/pull/551) [`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b) Thanks [@yamadapc](https://github.com/yamadapc)! - Log request tracker invalidation counts on start-up
|
|
25
|
+
|
|
26
|
+
## 2.15.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- [#547](https://github.com/atlassian-labs/atlaspack/pull/547) [`a1773d2`](https://github.com/atlassian-labs/atlaspack/commit/a1773d2a62d0ef7805ac7524621dcabcc1afe929) Thanks [@benjervis](https://github.com/benjervis)! - Add a feature flag for resolving the configuration for `@atlaspack/bundler-default` from CWD, rather than exclusively from the project root.
|
|
31
|
+
|
|
32
|
+
## 2.14.4
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [#542](https://github.com/atlassian-labs/atlaspack/pull/542) [`e0f5337`](https://github.com/atlassian-labs/atlaspack/commit/e0f533757bd1019dbd108a04952c87da15286e09) Thanks [@yamadapc](https://github.com/yamadapc)! - Add feature-flagged option to use rayon thread-pool to optimize inline requires
|
|
37
|
+
|
|
38
|
+
## 2.14.3
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- [#511](https://github.com/atlassian-labs/atlaspack/pull/511) [`11d6f16`](https://github.com/atlassian-labs/atlaspack/commit/11d6f16b6397dee2f217167e5c98b39edb63f7a7) Thanks [@yamadapc](https://github.com/yamadapc)! - Clean-up dylib worker threads segmentation fault bug fix feature-flag
|
|
43
|
+
|
|
44
|
+
## 2.14.2
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- [#494](https://github.com/atlassian-labs/atlaspack/pull/494) [`9b85d3e`](https://github.com/atlassian-labs/atlaspack/commit/9b85d3e645b10bd027eed2304afc970a5ba40062) Thanks [@JakeLane](https://github.com/JakeLane)! - When conditionalBundlingReporterDuplicateFix is enabled, avoid duplicated writes to the descriptor and logging
|
|
49
|
+
|
|
50
|
+
- [#510](https://github.com/atlassian-labs/atlaspack/pull/510) [`17b9579`](https://github.com/atlassian-labs/atlaspack/commit/17b9579484eced0ed8f23e2aba6d23b3c7238c39) Thanks [@yamadapc](https://github.com/yamadapc)! - Add unused feature-flag for cache rework changes
|
|
51
|
+
|
|
52
|
+
- [#512](https://github.com/atlassian-labs/atlaspack/pull/512) [`8f4e6c1`](https://github.com/atlassian-labs/atlaspack/commit/8f4e6c1b0e7c1fd48624afda48c1dcc599f1460f) Thanks [@yamadapc](https://github.com/yamadapc)! - Remove LMDB cache back-end
|
|
53
|
+
|
|
3
54
|
## 2.14.1
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@atlaspack/unified/feature-flags';
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@atlaspack/unified/feature-flags');
|
package/index.js.flow
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/feature-flags",
|
|
3
|
-
"version": "2.14.1-dev.
|
|
3
|
+
"version": "2.14.1-dev.123+5a11f33c5",
|
|
4
4
|
"description": "Provides internal feature-flags for the atlaspack codebase.",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,16 +10,11 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
12
12
|
},
|
|
13
|
-
"main": "
|
|
14
|
-
"
|
|
15
|
-
"types": "lib/types.d.ts",
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build-ts": "mkdir -p lib && flow-to-ts src/types.js > lib/types.d.ts",
|
|
18
|
-
"check-ts": "tsc --noEmit lib/types.d.ts"
|
|
19
|
-
},
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">= 16.0.0"
|
|
22
|
-
},
|
|
13
|
+
"main": "index.js",
|
|
14
|
+
"types": "types.d.ts",
|
|
23
15
|
"type": "commonjs",
|
|
24
|
-
"
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@atlaspack/unified": "2.14.2-dev.3834+5a11f33c5"
|
|
18
|
+
},
|
|
19
|
+
"gitHead": "5a11f33c51ff74d1cf8d4b72cfa0fda833aa980a"
|
|
25
20
|
}
|
package/lib/index.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DEFAULT_FEATURE_FLAGS = void 0;
|
|
7
|
-
exports.getFeatureFlag = getFeatureFlag;
|
|
8
|
-
exports.getFeatureFlagValue = getFeatureFlagValue;
|
|
9
|
-
exports.runWithConsistencyCheck = runWithConsistencyCheck;
|
|
10
|
-
exports.setFeatureFlags = setFeatureFlags;
|
|
11
|
-
// We need to do these gymnastics as we don't want flow-to-ts to touch DEFAULT_FEATURE_FLAGS,
|
|
12
|
-
// but we want to export FeatureFlags for Flow
|
|
13
|
-
const DEFAULT_FEATURE_FLAGS = exports.DEFAULT_FEATURE_FLAGS = {
|
|
14
|
-
exampleConsistencyCheckFeature: 'OLD',
|
|
15
|
-
exampleFeature: false,
|
|
16
|
-
atlaspackV3: false,
|
|
17
|
-
useWatchmanWatcher: false,
|
|
18
|
-
importRetry: false,
|
|
19
|
-
fixQuadraticCacheInvalidation: 'OLD',
|
|
20
|
-
useLmdbJsLite: true,
|
|
21
|
-
conditionalBundlingApi: false,
|
|
22
|
-
vcsMode: 'OLD',
|
|
23
|
-
loadableSideEffects: false,
|
|
24
|
-
reduceResolverStringCreation: false,
|
|
25
|
-
inlineBundlesSourceMapFixes: false,
|
|
26
|
-
conditionalBundlingNestedRuntime: false,
|
|
27
|
-
patchProjectPaths: false,
|
|
28
|
-
enableRustWorkerThreadDylibHack: true,
|
|
29
|
-
inlineStringReplacementPerf: false,
|
|
30
|
-
conditionalBundlingAsyncRuntime: false
|
|
31
|
-
};
|
|
32
|
-
let featureFlagValues = {
|
|
33
|
-
...DEFAULT_FEATURE_FLAGS
|
|
34
|
-
};
|
|
35
|
-
function setFeatureFlags(flags) {
|
|
36
|
-
featureFlagValues = flags;
|
|
37
|
-
}
|
|
38
|
-
function getFeatureFlag(flagName) {
|
|
39
|
-
const value = featureFlagValues[flagName];
|
|
40
|
-
return value === true || value === 'NEW';
|
|
41
|
-
}
|
|
42
|
-
function getFeatureFlagValue(flagName) {
|
|
43
|
-
return featureFlagValues[flagName];
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Run a function with a consistency check.
|
|
47
|
-
*/
|
|
48
|
-
function runWithConsistencyCheck(flag, oldFn, newFn, diffFn, report) {
|
|
49
|
-
const value = featureFlagValues[flag];
|
|
50
|
-
if (!value || value === false || value === 'OLD') {
|
|
51
|
-
return oldFn();
|
|
52
|
-
}
|
|
53
|
-
if (value === true || value === 'NEW') {
|
|
54
|
-
return newFn();
|
|
55
|
-
}
|
|
56
|
-
const oldStartTime = performance.now();
|
|
57
|
-
const oldResult = oldFn();
|
|
58
|
-
const oldExecutionTimeMs = performance.now() - oldStartTime;
|
|
59
|
-
const newStartTime = performance.now();
|
|
60
|
-
const newResult = newFn();
|
|
61
|
-
const newExecutionTimeMs = performance.now() - newStartTime;
|
|
62
|
-
const diff = diffFn(oldResult, newResult);
|
|
63
|
-
report({
|
|
64
|
-
isDifferent: diff.isDifferent,
|
|
65
|
-
oldExecutionTimeMs,
|
|
66
|
-
newExecutionTimeMs,
|
|
67
|
-
custom: diff.custom
|
|
68
|
-
}, oldResult, newResult);
|
|
69
|
-
if (value === 'NEW_AND_CHECK') {
|
|
70
|
-
return newResult;
|
|
71
|
-
}
|
|
72
|
-
return oldResult;
|
|
73
|
-
}
|
package/lib/types.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export type FeatureFlags = {
|
|
2
|
-
// This feature flag mostly exists to test the feature flag system, and doesn't have any build/runtime effect
|
|
3
|
-
readonly exampleFeature: boolean;
|
|
4
|
-
readonly exampleConsistencyCheckFeature: ConsistencyCheckFeatureFlagValue;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Rust backed requests
|
|
8
|
-
*/
|
|
9
|
-
readonly atlaspackV3: boolean;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Use node.js implementation of @parcel/watcher watchman backend
|
|
13
|
-
*/
|
|
14
|
-
readonly useWatchmanWatcher: boolean;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Configure runtime to enable retriable dynamic imports
|
|
18
|
-
*/
|
|
19
|
-
importRetry: boolean;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Enable Rust based LMDB wrapper library
|
|
23
|
-
*/
|
|
24
|
-
useLmdbJsLite: boolean;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Fixes quadratic cache invalidation issue
|
|
28
|
-
*/
|
|
29
|
-
fixQuadraticCacheInvalidation: ConsistencyCheckFeatureFlagValue;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Enables an experimental "conditional bundling" API - this allows the use of `importCond` syntax
|
|
33
|
-
* in order to have (consumer) feature flag driven bundling. This feature is very experimental,
|
|
34
|
-
* and requires server-side support.
|
|
35
|
-
*/
|
|
36
|
-
conditionalBundlingApi: boolean;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Enable VCS mode. Expected values are:
|
|
40
|
-
* - OLD - default value, return watchman result
|
|
41
|
-
* - NEW_AND_CHECK - Return VCS result but still call watchman
|
|
42
|
-
* - NEW: Return VCS result, but don't call watchman
|
|
43
|
-
*/
|
|
44
|
-
vcsMode: ConsistencyCheckFeatureFlagValue;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Enable scanning for the presence of loadable to determine side effects
|
|
48
|
-
*/
|
|
49
|
-
loadableSideEffects: boolean;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Enable performance optimization for the resolver specifier to_string
|
|
53
|
-
* conversions
|
|
54
|
-
*/
|
|
55
|
-
reduceResolverStringCreation: boolean;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Fixes source maps for inline bundles
|
|
59
|
-
*/
|
|
60
|
-
inlineBundlesSourceMapFixes: boolean;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Enable nested loading of bundles in the runtime with conditional bundling
|
|
64
|
-
*/
|
|
65
|
-
conditionalBundlingNestedRuntime: boolean;
|
|
66
|
-
|
|
67
|
-
/** Enable patch project paths. This will patch the project paths to be relative to the project root.
|
|
68
|
-
* This feature is experimental and should not be used in production. It will used to test downloadble cache artefacts.
|
|
69
|
-
*/
|
|
70
|
-
patchProjectPaths: boolean;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Enable loading of the parcel dylib in the main thread.
|
|
74
|
-
*/
|
|
75
|
-
enableRustWorkerThreadDylibHack: boolean;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Enables optimized inline string replacement perf for the packager.
|
|
79
|
-
* Used heavily for inline bundles.
|
|
80
|
-
*/
|
|
81
|
-
inlineStringReplacementPerf: boolean;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Enable support for the async bundle runtime (unstable_asyncBundleRuntime) in conditional bundling
|
|
85
|
-
*/
|
|
86
|
-
conditionalBundlingAsyncRuntime: boolean;
|
|
87
|
-
};
|
|
88
|
-
export type ConsistencyCheckFeatureFlagValue = "NEW" | "OLD" | "NEW_AND_CHECK" | "OLD_AND_CHECK";
|
package/lib/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/src/index.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
// @flow strict
|
|
2
|
-
|
|
3
|
-
import type {FeatureFlags as _FeatureFlags} from './types';
|
|
4
|
-
// We need to do these gymnastics as we don't want flow-to-ts to touch DEFAULT_FEATURE_FLAGS,
|
|
5
|
-
// but we want to export FeatureFlags for Flow
|
|
6
|
-
export type FeatureFlags = _FeatureFlags;
|
|
7
|
-
|
|
8
|
-
export const DEFAULT_FEATURE_FLAGS: FeatureFlags = {
|
|
9
|
-
exampleConsistencyCheckFeature: 'OLD',
|
|
10
|
-
exampleFeature: false,
|
|
11
|
-
atlaspackV3: false,
|
|
12
|
-
useWatchmanWatcher: false,
|
|
13
|
-
importRetry: false,
|
|
14
|
-
fixQuadraticCacheInvalidation: 'OLD',
|
|
15
|
-
useLmdbJsLite: true,
|
|
16
|
-
conditionalBundlingApi: false,
|
|
17
|
-
vcsMode: 'OLD',
|
|
18
|
-
loadableSideEffects: false,
|
|
19
|
-
reduceResolverStringCreation: false,
|
|
20
|
-
inlineBundlesSourceMapFixes: false,
|
|
21
|
-
conditionalBundlingNestedRuntime: false,
|
|
22
|
-
patchProjectPaths: false,
|
|
23
|
-
enableRustWorkerThreadDylibHack: true,
|
|
24
|
-
inlineStringReplacementPerf: false,
|
|
25
|
-
conditionalBundlingAsyncRuntime: false,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
let featureFlagValues: FeatureFlags = {...DEFAULT_FEATURE_FLAGS};
|
|
29
|
-
|
|
30
|
-
export function setFeatureFlags(flags: FeatureFlags) {
|
|
31
|
-
featureFlagValues = flags;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function getFeatureFlag(flagName: $Keys<FeatureFlags>): boolean {
|
|
35
|
-
const value = featureFlagValues[flagName];
|
|
36
|
-
return value === true || value === 'NEW';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function getFeatureFlagValue(
|
|
40
|
-
flagName: $Keys<FeatureFlags>,
|
|
41
|
-
): boolean | string | number {
|
|
42
|
-
return featureFlagValues[flagName];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type DiffResult<CustomDiagnostic> = {|
|
|
46
|
-
isDifferent: boolean,
|
|
47
|
-
custom: CustomDiagnostic,
|
|
48
|
-
|};
|
|
49
|
-
|
|
50
|
-
export type Diagnostic<CustomDiagnostic> = {|
|
|
51
|
-
isDifferent: boolean,
|
|
52
|
-
oldExecutionTimeMs: number,
|
|
53
|
-
newExecutionTimeMs: number,
|
|
54
|
-
custom: CustomDiagnostic,
|
|
55
|
-
|};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Run a function with a consistency check.
|
|
59
|
-
*/
|
|
60
|
-
export function runWithConsistencyCheck<Result, CustomDiagnostic>(
|
|
61
|
-
flag: string,
|
|
62
|
-
oldFn: () => Result,
|
|
63
|
-
newFn: () => Result,
|
|
64
|
-
diffFn: (
|
|
65
|
-
oldResult: Result,
|
|
66
|
-
newResult: Result,
|
|
67
|
-
) => DiffResult<CustomDiagnostic>,
|
|
68
|
-
report: (
|
|
69
|
-
diagnostic: Diagnostic<CustomDiagnostic>,
|
|
70
|
-
oldResult: Result,
|
|
71
|
-
newResult: Result,
|
|
72
|
-
) => void,
|
|
73
|
-
): Result {
|
|
74
|
-
const value = featureFlagValues[flag];
|
|
75
|
-
if (!value || value === false || value === 'OLD') {
|
|
76
|
-
return oldFn();
|
|
77
|
-
}
|
|
78
|
-
if (value === true || value === 'NEW') {
|
|
79
|
-
return newFn();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const oldStartTime = performance.now();
|
|
83
|
-
const oldResult = oldFn();
|
|
84
|
-
const oldExecutionTimeMs = performance.now() - oldStartTime;
|
|
85
|
-
|
|
86
|
-
const newStartTime = performance.now();
|
|
87
|
-
const newResult = newFn();
|
|
88
|
-
const newExecutionTimeMs = performance.now() - newStartTime;
|
|
89
|
-
|
|
90
|
-
const diff = diffFn(oldResult, newResult);
|
|
91
|
-
|
|
92
|
-
report(
|
|
93
|
-
{
|
|
94
|
-
isDifferent: diff.isDifferent,
|
|
95
|
-
oldExecutionTimeMs,
|
|
96
|
-
newExecutionTimeMs,
|
|
97
|
-
custom: diff.custom,
|
|
98
|
-
},
|
|
99
|
-
oldResult,
|
|
100
|
-
newResult,
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
if (value === 'NEW_AND_CHECK') {
|
|
104
|
-
return newResult;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return oldResult;
|
|
108
|
-
}
|
package/src/types.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// @flow strict
|
|
2
|
-
|
|
3
|
-
export type FeatureFlags = {|
|
|
4
|
-
// This feature flag mostly exists to test the feature flag system, and doesn't have any build/runtime effect
|
|
5
|
-
+exampleFeature: boolean,
|
|
6
|
-
+exampleConsistencyCheckFeature: ConsistencyCheckFeatureFlagValue,
|
|
7
|
-
/**
|
|
8
|
-
* Rust backed requests
|
|
9
|
-
*/
|
|
10
|
-
+atlaspackV3: boolean,
|
|
11
|
-
/**
|
|
12
|
-
* Use node.js implementation of @parcel/watcher watchman backend
|
|
13
|
-
*/
|
|
14
|
-
+useWatchmanWatcher: boolean,
|
|
15
|
-
/**
|
|
16
|
-
* Configure runtime to enable retriable dynamic imports
|
|
17
|
-
*/
|
|
18
|
-
importRetry: boolean,
|
|
19
|
-
/**
|
|
20
|
-
* Enable Rust based LMDB wrapper library
|
|
21
|
-
*/
|
|
22
|
-
useLmdbJsLite: boolean,
|
|
23
|
-
/**
|
|
24
|
-
* Fixes quadratic cache invalidation issue
|
|
25
|
-
*/
|
|
26
|
-
fixQuadraticCacheInvalidation: ConsistencyCheckFeatureFlagValue,
|
|
27
|
-
/**
|
|
28
|
-
* Enables an experimental "conditional bundling" API - this allows the use of `importCond` syntax
|
|
29
|
-
* in order to have (consumer) feature flag driven bundling. This feature is very experimental,
|
|
30
|
-
* and requires server-side support.
|
|
31
|
-
*/
|
|
32
|
-
conditionalBundlingApi: boolean,
|
|
33
|
-
/**
|
|
34
|
-
* Enable VCS mode. Expected values are:
|
|
35
|
-
* - OLD - default value, return watchman result
|
|
36
|
-
* - NEW_AND_CHECK - Return VCS result but still call watchman
|
|
37
|
-
* - NEW: Return VCS result, but don't call watchman
|
|
38
|
-
*/
|
|
39
|
-
vcsMode: ConsistencyCheckFeatureFlagValue,
|
|
40
|
-
/**
|
|
41
|
-
* Enable scanning for the presence of loadable to determine side effects
|
|
42
|
-
*/
|
|
43
|
-
loadableSideEffects: boolean,
|
|
44
|
-
/**
|
|
45
|
-
* Enable performance optimization for the resolver specifier to_string
|
|
46
|
-
* conversions
|
|
47
|
-
*/
|
|
48
|
-
reduceResolverStringCreation: boolean,
|
|
49
|
-
/**
|
|
50
|
-
* Fixes source maps for inline bundles
|
|
51
|
-
*/
|
|
52
|
-
inlineBundlesSourceMapFixes: boolean,
|
|
53
|
-
/**
|
|
54
|
-
* Enable nested loading of bundles in the runtime with conditional bundling
|
|
55
|
-
*/
|
|
56
|
-
conditionalBundlingNestedRuntime: boolean,
|
|
57
|
-
/** Enable patch project paths. This will patch the project paths to be relative to the project root.
|
|
58
|
-
* This feature is experimental and should not be used in production. It will used to test downloadble cache artefacts.
|
|
59
|
-
*/
|
|
60
|
-
patchProjectPaths: boolean,
|
|
61
|
-
/**
|
|
62
|
-
* Enable loading of the parcel dylib in the main thread.
|
|
63
|
-
*/
|
|
64
|
-
enableRustWorkerThreadDylibHack: boolean,
|
|
65
|
-
/**
|
|
66
|
-
* Enables optimized inline string replacement perf for the packager.
|
|
67
|
-
* Used heavily for inline bundles.
|
|
68
|
-
*/
|
|
69
|
-
inlineStringReplacementPerf: boolean,
|
|
70
|
-
/**
|
|
71
|
-
* Enable support for the async bundle runtime (unstable_asyncBundleRuntime) in conditional bundling
|
|
72
|
-
*/
|
|
73
|
-
conditionalBundlingAsyncRuntime: boolean,
|
|
74
|
-
|};
|
|
75
|
-
|
|
76
|
-
export type ConsistencyCheckFeatureFlagValue =
|
|
77
|
-
| 'NEW'
|
|
78
|
-
| 'OLD'
|
|
79
|
-
| 'NEW_AND_CHECK'
|
|
80
|
-
| 'OLD_AND_CHECK';
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// @flow strict
|
|
2
|
-
import assert from 'assert';
|
|
3
|
-
import {
|
|
4
|
-
getFeatureFlag,
|
|
5
|
-
DEFAULT_FEATURE_FLAGS,
|
|
6
|
-
setFeatureFlags,
|
|
7
|
-
runWithConsistencyCheck,
|
|
8
|
-
} from '../src';
|
|
9
|
-
import sinon from 'sinon';
|
|
10
|
-
|
|
11
|
-
describe('feature-flag test', () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
setFeatureFlags(DEFAULT_FEATURE_FLAGS);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('has defaults', () => {
|
|
17
|
-
assert.equal(
|
|
18
|
-
getFeatureFlag('exampleFeature'),
|
|
19
|
-
DEFAULT_FEATURE_FLAGS.exampleFeature,
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('can override', () => {
|
|
24
|
-
setFeatureFlags({...DEFAULT_FEATURE_FLAGS, exampleFeature: true});
|
|
25
|
-
assert.equal(getFeatureFlag('exampleFeature'), true);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('consistency checks', () => {
|
|
29
|
-
it('runs the old function if the flag is off', () => {
|
|
30
|
-
setFeatureFlags({
|
|
31
|
-
...DEFAULT_FEATURE_FLAGS,
|
|
32
|
-
exampleConsistencyCheckFeature: 'OLD',
|
|
33
|
-
});
|
|
34
|
-
const result = runWithConsistencyCheck(
|
|
35
|
-
'exampleConsistencyCheckFeature',
|
|
36
|
-
() => 'old',
|
|
37
|
-
() => 'new',
|
|
38
|
-
sinon.spy(),
|
|
39
|
-
sinon.spy(),
|
|
40
|
-
);
|
|
41
|
-
assert.equal(result, 'old');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('runs the new function if the flag is on', () => {
|
|
45
|
-
setFeatureFlags({
|
|
46
|
-
...DEFAULT_FEATURE_FLAGS,
|
|
47
|
-
exampleConsistencyCheckFeature: 'NEW',
|
|
48
|
-
});
|
|
49
|
-
const result = runWithConsistencyCheck(
|
|
50
|
-
'exampleConsistencyCheckFeature',
|
|
51
|
-
() => 'old',
|
|
52
|
-
() => 'new',
|
|
53
|
-
sinon.spy(),
|
|
54
|
-
sinon.spy(),
|
|
55
|
-
);
|
|
56
|
-
assert.equal(result, 'new');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('diffs old and new values if there is a diff value', () => {
|
|
60
|
-
setFeatureFlags({
|
|
61
|
-
...DEFAULT_FEATURE_FLAGS,
|
|
62
|
-
exampleConsistencyCheckFeature: 'OLD_AND_CHECK',
|
|
63
|
-
});
|
|
64
|
-
const reportSpy = sinon.spy();
|
|
65
|
-
const result = runWithConsistencyCheck(
|
|
66
|
-
'exampleConsistencyCheckFeature',
|
|
67
|
-
() => 'old',
|
|
68
|
-
() => 'new',
|
|
69
|
-
() => ({isDifferent: false, custom: 'diff'}),
|
|
70
|
-
reportSpy,
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
assert.equal(result, 'old');
|
|
74
|
-
sinon.assert.calledWith(reportSpy, {
|
|
75
|
-
isDifferent: false,
|
|
76
|
-
oldExecutionTimeMs: sinon.match.number,
|
|
77
|
-
newExecutionTimeMs: sinon.match.number,
|
|
78
|
-
custom: 'diff',
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('diffs old and new values if there is a diff new value', () => {
|
|
83
|
-
setFeatureFlags({
|
|
84
|
-
...DEFAULT_FEATURE_FLAGS,
|
|
85
|
-
exampleConsistencyCheckFeature: 'NEW_AND_CHECK',
|
|
86
|
-
});
|
|
87
|
-
const reportSpy = sinon.spy();
|
|
88
|
-
const result = runWithConsistencyCheck(
|
|
89
|
-
'exampleConsistencyCheckFeature',
|
|
90
|
-
() => 'old',
|
|
91
|
-
() => 'new',
|
|
92
|
-
() => ({isDifferent: true, custom: 'diff'}),
|
|
93
|
-
reportSpy,
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
assert.equal(result, 'new');
|
|
97
|
-
sinon.assert.calledWith(reportSpy, {
|
|
98
|
-
isDifferent: true,
|
|
99
|
-
oldExecutionTimeMs: sinon.match.number,
|
|
100
|
-
newExecutionTimeMs: sinon.match.number,
|
|
101
|
-
custom: 'diff',
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|