react/packages/react-devtools-shared/buildUtils.js
Ruslan Lesiutin 96c5846610
feat[devtools]: add package for fusebox integration (#28553)
## Summary

Stacked on https://github.com/facebook/react/pull/28552. Review only the
[last commit at the
top](c69952f1bf).

These changes add new package `react-devtools-fusebox`, which is the
entrypoint for the RDT Frontend, which will be used in Chrome DevTools
panel. The main differences from other frontend shells (extension,
standalone) are:
1. This package builds scripts in ESM format, this is required by Chrome
DevTools, see webpack config:

c69952f1bf/packages/react-devtools-fusebox/webpack.config.frontend.js (L50-L52)
2. The build includes styles in a separate `.css` file, which is
required for Chrome DevTools: styles are loaded lazily once panel is
mounted.
2024-04-12 15:29:35 +01:00

44 lines
1.0 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
const {resolve} = require('path');
function resolveFeatureFlags(target) {
let flagsPath;
switch (target) {
case 'inline':
case 'shell':
case 'fusebox':
flagsPath = 'DevToolsFeatureFlags.default';
break;
case 'core/backend-oss':
case 'core/standalone-oss':
flagsPath = 'DevToolsFeatureFlags.core-oss';
break;
case 'core/backend-fb':
case 'core/standalone-fb':
flagsPath = 'DevToolsFeatureFlags.core-fb';
break;
case 'extension-oss':
flagsPath = 'DevToolsFeatureFlags.extension-oss';
break;
case 'extension-fb':
flagsPath = 'DevToolsFeatureFlags.extension-fb';
break;
default:
console.error(`Invalid target "${target}"`);
process.exit(1);
}
return resolve(__dirname, 'src/config/', flagsPath);
}
module.exports = {
resolveFeatureFlags,
};