repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/env/ExpandEnvVariables.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/env/ExpandEnvVariables.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ReactDOMClient from 'react-dom/client';
import ExpandEnvVariables from './ExpandEnvVariables';
import { flushSync } from 'react-dom';
describe('expand .env variables', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<ExpandEnvVariables />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/env/FileEnvVariables.js | packages/react-scripts/fixtures/kitchensink/template/src/features/env/FileEnvVariables.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
const FileEnvVariables = () => (
<span>
<span id="feature-file-env-original-1">
{process.env.REACT_APP_ORIGINAL_1}
</span>
<span id="feature-file-env-original-2">
{process.env.REACT_APP_ORIGINAL_2}
</span>
<span id="feature-file-env">
{process.env.REACT_APP_DEVELOPMENT}
{process.env.REACT_APP_PRODUCTION}
</span>
<span id="feature-file-env-x">{process.env.REACT_APP_X}</span>
</span>
);
export default FileEnvVariables;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/env/PublicUrl.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/env/PublicUrl.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import PublicUrl from './PublicUrl';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('PUBLIC_URL', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<PublicUrl />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/env/ShellEnvVariables.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/env/ShellEnvVariables.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ShellEnvVariables from './ShellEnvVariables';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('shell env variables', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<ShellEnvVariables />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SassInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SassInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import './assets/sass-styles.sass';
const SassInclusion = () => (
<p id="feature-sass-inclusion">We love useless text.</p>
);
export default SassInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgInCss.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgInCss.test.js | import React from 'react';
import SvgInCss from './SvgInCss';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('svg in css', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<SvgInCss />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/NoExtInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/NoExtInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import NoExtInclusion from './NoExtInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('no ext inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<NoExtInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ScssInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ScssInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import './assets/scss-styles.scss';
const ScssInclusion = () => (
<p id="feature-scss-inclusion">We love useless text.</p>
);
export default ScssInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SassModulesInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SassModulesInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import SassModulesInclusion from './SassModulesInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('sass modules inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<SassModulesInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import logo from './assets/logo.svg';
const SvgInclusion = () => (
<img id="feature-svg-inclusion" src={logo} alt="logo" />
);
export default SvgInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/UnknownExtInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/UnknownExtInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import aFileWithExtUnknown from './assets/aFileWithExt.unknown';
const text = aFileWithExtUnknown.includes('base64')
? atob(aFileWithExtUnknown.split('base64,')[1]).trim()
: aFileWithExtUnknown;
const UnknownExtInclusion = () => (
<a id="feature-unknown-ext-inclusion" href={text}>
aFileWithExtUnknown
</a>
);
export default UnknownExtInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ImageInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ImageInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import tiniestCat from './assets/tiniest-cat.jpg';
const ImageInclusion = () => (
<img id="feature-image-inclusion" src={tiniestCat} alt="tiniest cat" />
);
export default ImageInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/CssModulesInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/CssModulesInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import styles from './assets/style.module.css';
import indexStyles from './assets/index.module.css';
const CssModulesInclusion = () => (
<div>
<p className={styles.cssModulesInclusion}>CSS Modules are working!</p>
<p className={indexStyles.cssModulesInclusion}>
CSS Modules with index are working!
</p>
</div>
);
export default CssModulesInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ScssModulesInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ScssModulesInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import styles from './assets/scss-styles.module.scss';
import indexStyles from './assets/index.module.scss';
const ScssModulesInclusion = () => (
<div>
<p className={styles.scssModulesInclusion}>SCSS Modules are working!</p>
<p className={indexStyles.scssModulesIndexInclusion}>
SCSS Modules with index are working!
</p>
</div>
);
export default ScssModulesInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import SvgInclusion from './SvgInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('svg inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<SvgInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ImageInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ImageInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ImageInclusion from './ImageInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('image inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<ImageInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgComponent.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgComponent.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import { ReactComponent as Logo } from './assets/logo.svg';
const SvgComponent = () => {
return <Logo id="feature-svg-component" />;
};
export const SvgComponentWithRef = React.forwardRef((props, ref) => (
<Logo id="feature-svg-component-with-ref" ref={ref} />
));
export default SvgComponent;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgInCss.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgInCss.js | import React from 'react';
import './assets/svg.css';
const SvgInCss = () => <div id="feature-svg-in-css" />;
export default SvgInCss;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SassModulesInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SassModulesInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import styles from './assets/sass-styles.module.sass';
import indexStyles from './assets/index.module.sass';
const SassModulesInclusion = () => (
<div>
<p className={styles.sassModulesInclusion}>SASS Modules are working!</p>
<p className={indexStyles.sassModulesIndexInclusion}>
SASS Modules with index are working!
</p>
</div>
);
export default SassModulesInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/NoExtInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/NoExtInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import aFileWithoutExt from './assets/aFileWithoutExt';
const text = aFileWithoutExt.includes('base64')
? atob(aFileWithoutExt.split('base64,')[1]).trim()
: aFileWithoutExt;
const NoExtInclusion = () => (
<a id="feature-no-ext-inclusion" href={text}>
aFileWithoutExt
</a>
);
export default NoExtInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/UnknownExtInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/UnknownExtInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import UnknownExtInclusion from './UnknownExtInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('unknown ext inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<UnknownExtInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ScssModulesInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ScssModulesInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ScssModulesInclusion from './ScssModulesInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('scss modules inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<ScssModulesInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/CssInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/CssInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import CssInclusion from './CssInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('css inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<CssInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/LinkedModules.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/LinkedModules.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import './assets/style.css';
import { test, version } from 'test-integrity';
const LinkedModules = () => {
const v = version();
if (!test() || v !== '2.0.0') {
throw new Error('Functionality test did not pass.');
}
return <p id="feature-linked-modules">{v}</p>;
};
export default LinkedModules;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/CssInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/CssInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import './assets/style.css';
const CssInclusion = () => (
<p id="feature-css-inclusion">We love useless text.</p>
);
export default CssInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SassInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SassInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import SassInclusion from './SassInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('sass inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<SassInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/DynamicImport.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/DynamicImport.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('dynamic import', () => {
it('renders without crashing', async () => {
const DynamicImport = (await import('./DynamicImport')).default;
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<DynamicImport />);
});
expect(div.textContent).toBe('Hello World!');
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/LinkedModules.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/LinkedModules.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ReactDOMClient from 'react-dom/client';
import { test, version } from 'test-integrity';
import LinkedModules from './LinkedModules';
import { flushSync } from 'react-dom';
describe('linked modules', () => {
it('has integrity', () => {
expect(test()).toBeTruthy();
expect(version() === '2.0.0').toBeTruthy();
});
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<LinkedModules />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/CssModulesInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/CssModulesInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import CssModulesInclusion from './CssModulesInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('css modules inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<CssModulesInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/JsonInclusion.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/JsonInclusion.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import abstractJson from './assets/abstract.json';
const { abstract } = abstractJson;
const JsonInclusion = () => (
<summary id="feature-json-inclusion">{abstract}</summary>
);
export default JsonInclusion;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgComponent.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgComponent.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import SvgComponent, { SvgComponentWithRef } from './SvgComponent';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
// TODO: these fail with React 19 due to the JSX transform mismatch.
describe.skip('svg component', () => {
it('renders without crashing', async () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<SvgComponent />);
});
expect(div.textContent).toBe('logo.svg');
});
it('svg root element equals the passed ref', async () => {
const div = document.createElement('div');
const someRef = React.createRef();
flushSync(() => {
ReactDOMClient.createRoot(div).render(
<SvgComponentWithRef ref={someRef} />
);
});
const svgElement = div.getElementsByTagName('svg');
expect(svgElement).toHaveLength(1);
expect(svgElement[0]).toBe(someRef.current);
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ScssInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/ScssInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ScssInclusion from './ScssInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('scss inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<ScssInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/DynamicImport.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/DynamicImport.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
const DynamicImport = () => {
return <>Hello World!</>;
};
export default DynamicImport;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/JsonInclusion.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/JsonInclusion.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import JsonInclusion from './JsonInclusion';
import ReactDOMClient from 'react-dom/client';
import { flushSync } from 'react-dom';
describe('JSON inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
flushSync(() => {
ReactDOMClient.createRoot(div).render(<JsonInclusion />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/DefaultParameters.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/DefaultParameters.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import DefaultParameters from './DefaultParameters';
import ReactDOMClient from 'react-dom/client';
describe('default parameters', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<DefaultParameters onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArrayDestructuring.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArrayDestructuring.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ArrayDestructuring from './ArrayDestructuring';
import ReactDOMClient from 'react-dom/client';
describe('array destructuring', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<ArrayDestructuring onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/Promises.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/Promises.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load() {
return Promise.resolve([
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
]);
}
export default class Promises extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
componentDidMount() {
load().then(users => {
this.setState({ users });
});
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-promises">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/NullishCoalescing.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/NullishCoalescing.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import NullishCoalescing from './NullishCoalescing';
import ReactDOMClient from 'react-dom/client';
describe('nullish coalescing', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<NullishCoalescing onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/RestParameters.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/RestParameters.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import RestParameters from './RestParameters';
import ReactDOMClient from 'react-dom/client';
describe('rest parameters', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<RestParameters onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/NullishCoalescing.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/NullishCoalescing.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load() {
return [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
];
}
export default class NullishCoalescing extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-nullish-coalescing">
{this.state.users.map(user => (
<div key={user.id}>{user.name ?? 'John Doe'}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ObjectSpread.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ObjectSpread.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ObjectSpread from './ObjectSpread';
import ReactDOMClient from 'react-dom/client';
describe('object spread', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(<ObjectSpread onReady={resolve} />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/TemplateInterpolation.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/TemplateInterpolation.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(name) {
return [
{ id: 1, name: `${name}1` },
{ id: 2, name: `${name}2` },
{ id: 3, name: `${name}3` },
{ id: 4, name: `${name}4` },
];
}
export default class TemplateInterpolation extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load('user_');
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-template-interpolation">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ComputedProperties.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ComputedProperties.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ComputedProperties from './ComputedProperties';
import ReactDOMClient from 'react-dom/client';
describe('computed properties', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<ComputedProperties onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ClassProperties.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ClassProperties.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ClassProperties from './ClassProperties';
import ReactDOMClient from 'react-dom/client';
describe('class properties', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<ClassProperties onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ClassProperties.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ClassProperties.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default class ClassProperties extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
users = [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
];
componentDidMount() {
this.props.onReady();
}
render() {
return (
<div id="feature-class-properties">
{this.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/AsyncAwait.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/AsyncAwait.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
async function load() {
return [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
];
}
/* eslint-disable */
// Regression test for https://github.com/facebook/create-react-app/issues/3055
const x = async (
/* prettier-ignore */
y: void
) => {
const z = await y;
};
/* eslint-enable */
export default class AsyncAwait extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = await load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-async-await">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/DestructuringAndAwait.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/DestructuringAndAwait.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import DestructuringAndAwait from './DestructuringAndAwait';
import ReactDOMClient from 'react-dom/client';
describe('destructuring and await', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<DestructuringAndAwait onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ObjectSpread.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ObjectSpread.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(baseUser) {
return [
{ id: 1, name: '1', ...baseUser },
{ id: 2, name: '2', ...baseUser },
{ id: 3, name: '3', ...baseUser },
{ id: 4, name: '4', ...baseUser },
];
}
export default class ObjectSpread extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load({ age: 42 });
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-object-spread">
{this.state.users.map(user => (
<div key={user.id}>
{user.name}: {user.age}
</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArraySpread.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArraySpread.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ArraySpread from './ArraySpread';
import ReactDOMClient from 'react-dom/client';
describe('array spread', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(<ArraySpread onReady={resolve} />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/OptionalChaining.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/OptionalChaining.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import OptionalChaining from './OptionalChaining';
import ReactDOMClient from 'react-dom/client';
describe('optional chaining', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<OptionalChaining onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/AsyncAwait.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/AsyncAwait.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import AsyncAwait from './AsyncAwait';
import ReactDOMClient from 'react-dom/client';
describe('async/await', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(<AsyncAwait onReady={resolve} />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArraySpread.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArraySpread.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(users) {
return [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
...users,
];
}
export default class ArraySpread extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load([{ id: 42, name: '42' }]);
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-array-spread">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/CustomInterpolation.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/CustomInterpolation.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import CustomInterpolation from './CustomInterpolation';
import ReactDOMClient from 'react-dom/client';
describe('custom interpolation', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<CustomInterpolation onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/Generators.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/Generators.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function* load(limit) {
let i = 1;
while (i <= limit) {
yield { id: i, name: i };
i++;
}
}
export default class Generators extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
componentDidMount() {
const users = [];
for (let user of load(4)) {
users.push(user);
}
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-generators">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ObjectDestructuring.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ObjectDestructuring.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ObjectDestructuring from './ObjectDestructuring';
import ReactDOMClient from 'react-dom/client';
describe('object destructuring', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<ObjectDestructuring onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/DefaultParameters.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/DefaultParameters.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(id = 0) {
return [
{ id: id + 1, name: '1' },
{ id: id + 2, name: '2' },
{ id: id + 3, name: '3' },
{ id: id + 4, name: '4' },
];
}
export default class DefaultParameters extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-default-parameters">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/Promises.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/Promises.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ReactDOMClient from 'react-dom/client';
describe('promises', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return import('./Promises').then(({ default: Promises }) => {
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(<Promises onReady={resolve} />);
});
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/RestAndDefault.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/RestAndDefault.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load({ id, ...rest } = { id: 0, user: { id: 42, name: '42' } }) {
return [
{ id: id + 1, name: '1' },
{ id: id + 2, name: '2' },
{ id: id + 3, name: '3' },
rest.user,
];
}
export default class RestAndDefault extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-rest-and-default">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ObjectDestructuring.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ObjectDestructuring.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load() {
return [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
];
}
export default class ObjectDestructuring extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-object-destructuring">
{this.state.users.map(user => {
const { id, ...rest } = user;
// eslint-disable-next-line no-unused-vars
const [{ name, ...innerRest }] = [{ ...rest }];
return <div key={id}>{name}</div>;
})}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/RestParameters.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/RestParameters.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load({ id = 0, ...rest }) {
return [
{ id: id + 1, name: '1' },
{ id: id + 2, name: '2' },
{ id: id + 3, name: '3' },
rest.user,
];
}
export default class RestParameters extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load({ id: 0, user: { id: 42, name: '42' } });
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-rest-parameters">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/RestAndDefault.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/RestAndDefault.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import RestAndDefault from './RestAndDefault';
import ReactDOMClient from 'react-dom/client';
describe('rest + default', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<RestAndDefault onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ComputedProperties.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ComputedProperties.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load(prefix) {
return [
{ id: 1, [`${prefix} name`]: '1' },
{ id: 2, [`${prefix} name`]: '2' },
{ id: 3, [`${prefix} name`]: '3' },
{ id: 4, [`${prefix} name`]: '4' },
];
}
export default class ComputedProperties extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load('user_');
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-computed-properties">
{this.state.users.map(user => (
<div key={user.id}>{user.user_name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/DestructuringAndAwait.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/DestructuringAndAwait.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
async function load() {
return {
users: [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
],
};
}
export default class DestructuringAndAwait extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const { users } = await load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-destructuring-and-await">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/TemplateInterpolation.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/TemplateInterpolation.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import TemplateInterpolation from './TemplateInterpolation';
import ReactDOMClient from 'react-dom/client';
describe('template interpolation', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(
<TemplateInterpolation onReady={resolve} />
);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/Generators.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/Generators.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Generators from './Generators';
import ReactDOMClient from 'react-dom/client';
describe('generators', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(<Generators onReady={resolve} />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArrayDestructuring.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArrayDestructuring.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load() {
return [
[1, '1'],
[2, '2'],
[3, '3'],
[4, '4'],
];
}
export default class ArrayDestructuring extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-array-destructuring">
{this.state.users.map(user => {
const [id, name] = user;
return <div key={id}>{name}</div>;
})}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/OptionalChaining.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/OptionalChaining.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load() {
return [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
];
}
export default class OptionalChaining extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load?.();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-optional-chaining">
{this.state.users.map(user => (
<div key={user.id}>{user?.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/CustomInterpolation.js | packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/CustomInterpolation.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
const styled = ([style]) =>
style
.trim()
.split(/\s*;\s*/)
.map(rule => rule.split(/\s*:\s*/))
.reduce((rules, rule) => ({ ...rules, [rule[0]]: rule[1] }), {});
function load() {
return [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
];
}
export default class CustomInterpolation extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
const veryInlineStyle = styled`
background: palevioletred;
color: papayawhip;
`;
return (
<div id="feature-custom-interpolation">
{this.state.users.map(user => (
<div key={user.id} style={veryInlineStyle}>
{user.name}
</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/config/BaseUrl.test.js | packages/react-scripts/fixtures/kitchensink/template/src/features/config/BaseUrl.test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ReactDOMClient from 'react-dom/client';
import NodePath from './BaseUrl';
describe('BASE_URL', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOMClient.createRoot(div).render(<NodePath onReady={resolve} />);
});
});
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/fixtures/kitchensink/template/src/features/config/BaseUrl.js | packages/react-scripts/fixtures/kitchensink/template/src/features/config/BaseUrl.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import load from 'absoluteLoad';
export default class BaseUrl extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-base-url">
{this.state.users.map(user => (
<div key={user.id}>{user.name}</div>
))}
</div>
);
}
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/bin/react-scripts.js | packages/react-scripts/bin/react-scripts.js | #!/usr/bin/env node
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
const spawn = require('react-dev-utils/crossSpawn');
const args = process.argv.slice(2);
const scriptIndex = args.findIndex(
x => x === 'build' || x === 'eject' || x === 'start' || x === 'test'
);
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
if (['build', 'eject', 'start', 'test'].includes(script)) {
const result = spawn.sync(
process.execPath,
nodeArgs
.concat(require.resolve('../scripts/' + script))
.concat(args.slice(scriptIndex + 1)),
{ stdio: 'inherit' }
);
if (result.signal) {
if (result.signal === 'SIGKILL') {
console.log(
'The build failed because the process exited too early. ' +
'This probably means the system ran out of memory or someone called ' +
'`kill -9` on the process.'
);
} else if (result.signal === 'SIGTERM') {
console.log(
'The build failed because the process exited too early. ' +
'Someone might have called `kill` or `killall`, or the system could ' +
'be shutting down.'
);
}
process.exit(1);
}
process.exit(result.status);
} else {
console.log('Unknown script "' + script + '".');
console.log('Perhaps you need to update react-scripts?');
console.log(
'See: https://facebook.github.io/create-react-app/docs/updating-to-new-releases'
);
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/env.js | packages/react-scripts/config/env.js | // @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
const fs = require('fs');
const path = require('path');
const paths = require('./paths');
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];
const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV environment variable is required but was not specified.'
);
}
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
const dotenvFiles = [
`${paths.dotenv}.${NODE_ENV}.local`,
// Don't include `.env.local` for `test` environment
// since normally you expect tests to produce the same
// results for everyone
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
`${paths.dotenv}.${NODE_ENV}`,
paths.dotenv,
].filter(Boolean);
// Load environment variables from .env* files. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set. Variable expansion is supported in .env files.
// https://github.com/motdotla/dotenv
// https://github.com/motdotla/dotenv-expand
dotenvFiles.forEach(dotenvFile => {
if (fs.existsSync(dotenvFile)) {
require('dotenv-expand')(
require('dotenv').config({
path: dotenvFile,
})
);
}
});
// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebook/create-react-app/issues/253.
// It works similar to `NODE_PATH` in Node itself:
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
// Otherwise, we risk importing Node.js core modules into an app instead of webpack shims.
// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
// We also resolve them to make sure all tools using them work consistently.
const appDirectory = fs.realpathSync(process.cwd());
process.env.NODE_PATH = (process.env.NODE_PATH || '')
.split(path.delimiter)
.filter(folder => folder && !path.isAbsolute(folder))
.map(folder => path.resolve(appDirectory, folder))
.join(path.delimiter);
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in webpack configuration.
const REACT_APP = /^REACT_APP_/i;
function getClientEnvironment(publicUrl) {
const raw = Object.keys(process.env)
.filter(key => REACT_APP.test(key))
.reduce(
(env, key) => {
env[key] = process.env[key];
return env;
},
{
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: process.env.NODE_ENV || 'development',
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: publicUrl,
// We support configuring the sockjs pathname during development.
// These settings let a developer run multiple simultaneous projects.
// They are used as the connection `hostname`, `pathname` and `port`
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
// and `sockPort` options in webpack-dev-server.
WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
// Whether or not react-refresh is enabled.
// It is defined here so it is available in the webpackHotDevClient.
FAST_REFRESH: process.env.FAST_REFRESH !== 'false',
}
);
// Stringify all values so we can feed into webpack DefinePlugin
const stringified = {
'process.env': Object.keys(raw).reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
return env;
}, {}),
};
return { raw, stringified };
}
module.exports = getClientEnvironment;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/modules.js | packages/react-scripts/config/modules.js | // @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
const fs = require('fs');
const path = require('path');
const paths = require('./paths');
const chalk = require('react-dev-utils/chalk');
const resolve = require('resolve');
/**
* Get additional module paths based on the baseUrl of a compilerOptions object.
*
* @param {Object} options
*/
function getAdditionalModulePaths(options = {}) {
const baseUrl = options.baseUrl;
if (!baseUrl) {
return '';
}
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
// We don't need to do anything if `baseUrl` is set to `node_modules`. This is
// the default behavior.
if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
return null;
}
// Allow the user set the `baseUrl` to `appSrc`.
if (path.relative(paths.appSrc, baseUrlResolved) === '') {
return [paths.appSrc];
}
// If the path is equal to the root directory we ignore it here.
// We don't want to allow importing from the root directly as source files are
// not transpiled outside of `src`. We do allow importing them with the
// absolute path (e.g. `src/Components/Button.js`) but we set that up with
// an alias.
if (path.relative(paths.appPath, baseUrlResolved) === '') {
return null;
}
// Otherwise, throw an error.
throw new Error(
chalk.red.bold(
"Your project's `baseUrl` can only be set to `src` or `node_modules`." +
' Create React App does not support other values at this time.'
)
);
}
/**
* Get webpack aliases based on the baseUrl of a compilerOptions object.
*
* @param {*} options
*/
function getWebpackAliases(options = {}) {
const baseUrl = options.baseUrl;
if (!baseUrl) {
return {};
}
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
if (path.relative(paths.appPath, baseUrlResolved) === '') {
return {
src: paths.appSrc,
};
}
}
/**
* Get jest aliases based on the baseUrl of a compilerOptions object.
*
* @param {*} options
*/
function getJestAliases(options = {}) {
const baseUrl = options.baseUrl;
if (!baseUrl) {
return {};
}
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
if (path.relative(paths.appPath, baseUrlResolved) === '') {
return {
'^src/(.*)$': '<rootDir>/src/$1',
};
}
}
function getModules() {
// Check if TypeScript is setup
const hasTsConfig = fs.existsSync(paths.appTsConfig);
const hasJsConfig = fs.existsSync(paths.appJsConfig);
if (hasTsConfig && hasJsConfig) {
throw new Error(
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
);
}
let config;
// If there's a tsconfig.json we assume it's a
// TypeScript project and set up the config
// based on tsconfig.json
if (hasTsConfig) {
const ts = require(resolve.sync('typescript', {
basedir: paths.appNodeModules,
}));
config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
// Otherwise we'll check if there is jsconfig.json
// for non TS projects.
} else if (hasJsConfig) {
config = require(paths.appJsConfig);
}
config = config || {};
const options = config.compilerOptions || {};
const additionalModulePaths = getAdditionalModulePaths(options);
return {
additionalModulePaths: additionalModulePaths,
webpackAliases: getWebpackAliases(options),
jestAliases: getJestAliases(options),
hasTsConfig,
};
}
module.exports = getModules();
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/getHttpsConfig.js | packages/react-scripts/config/getHttpsConfig.js | // @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const chalk = require('react-dev-utils/chalk');
const paths = require('./paths');
// Ensure the certificate and key provided are valid and if not
// throw an easy to debug error
function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
let encrypted;
try {
// publicEncrypt will throw an error with an invalid cert
encrypted = crypto.publicEncrypt(cert, Buffer.from('test'));
} catch (err) {
throw new Error(
`The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`
);
}
try {
// privateDecrypt will throw an error with an invalid key
crypto.privateDecrypt(key, encrypted);
} catch (err) {
throw new Error(
`The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${
err.message
}`
);
}
}
// Read file and throw an error if it doesn't exist
function readEnvFile(file, type) {
if (!fs.existsSync(file)) {
throw new Error(
`You specified ${chalk.cyan(
type
)} in your env, but the file "${chalk.yellow(file)}" can't be found.`
);
}
return fs.readFileSync(file);
}
// Get the https config
// Return cert files if provided in env, otherwise just true or false
function getHttpsConfig() {
const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
const isHttps = HTTPS === 'true';
if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
const config = {
cert: readEnvFile(crtFile, 'SSL_CRT_FILE'),
key: readEnvFile(keyFile, 'SSL_KEY_FILE'),
};
validateKeyAndCerts({ ...config, keyFile, crtFile });
return config;
}
return isHttps;
}
module.exports = getHttpsConfig;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/webpackDevServer.config.js | packages/react-scripts/config/webpackDevServer.config.js | // @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
const fs = require('fs');
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const ignoredFiles = require('react-dev-utils/ignoredFiles');
const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
const paths = require('./paths');
const getHttpsConfig = require('./getHttpsConfig');
const host = process.env.HOST || '0.0.0.0';
const sockHost = process.env.WDS_SOCKET_HOST;
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
const sockPort = process.env.WDS_SOCKET_PORT;
module.exports = function (proxy, allowedHost) {
const disableFirewall =
!proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
return {
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
// websites from potentially accessing local content through DNS rebinding:
// https://github.com/webpack/webpack-dev-server/issues/887
// https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
// However, it made several existing use cases such as development in cloud
// environment or subdomains in development significantly more complicated:
// https://github.com/facebook/create-react-app/issues/2271
// https://github.com/facebook/create-react-app/issues/2233
// While we're investigating better solutions, for now we will take a
// compromise. Since our WDS configuration only serves files in the `public`
// folder we won't consider accessing them a vulnerability. However, if you
// use the `proxy` feature, it gets more dangerous because it can expose
// remote code execution vulnerabilities in backends like Django and Rails.
// So we will disable the host check normally, but enable it if you have
// specified the `proxy` setting. Finally, we let you override it if you
// really know what you're doing with a special environment variable.
// Note: ["localhost", ".localhost"] will support subdomains - but we might
// want to allow setting the allowedHosts manually for more complex setups
allowedHosts: disableFirewall ? 'all' : [allowedHost],
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': '*',
'Access-Control-Allow-Headers': '*',
},
// Enable gzip compression of generated files.
compress: true,
static: {
// By default WebpackDevServer serves physical files from current directory
// in addition to all the virtual build products that it serves from memory.
// This is confusing because those files won’t automatically be available in
// production build folder unless we copy them. However, copying the whole
// project directory is dangerous because we may expose sensitive files.
// Instead, we establish a convention that only files in `public` directory
// get served. Our build script will copy `public` into the `build` folder.
// In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
// <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
// In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
// Note that we only recommend to use `public` folder as an escape hatch
// for files like `favicon.ico`, `manifest.json`, and libraries that are
// for some reason broken when imported through webpack. If you just want to
// use an image, put it in `src` and `import` it from JavaScript instead.
directory: paths.appPublic,
publicPath: [paths.publicUrlOrPath],
// By default files from `contentBase` will not trigger a page reload.
watch: {
// Reportedly, this avoids CPU overload on some systems.
// https://github.com/facebook/create-react-app/issues/293
// src/node_modules is not ignored to support absolute imports
// https://github.com/facebook/create-react-app/issues/1065
ignored: ignoredFiles(paths.appSrc),
},
},
client: {
webSocketURL: {
// Enable custom sockjs pathname for websocket connection to hot reloading server.
// Enable custom sockjs hostname, pathname and port for websocket connection
// to hot reloading server.
hostname: sockHost,
pathname: sockPath,
port: sockPort,
},
overlay: {
errors: true,
warnings: false,
},
},
devMiddleware: {
// It is important to tell WebpackDevServer to use the same "publicPath" path as
// we specified in the webpack config. When homepage is '.', default to serving
// from the root.
// remove last slash so user can land on `/test` instead of `/test/`
publicPath: paths.publicUrlOrPath.slice(0, -1),
},
https: getHttpsConfig(),
host,
historyApiFallback: {
// Paths with dots should still use the history fallback.
// See https://github.com/facebook/create-react-app/issues/387.
disableDotRule: true,
index: paths.publicUrlOrPath,
},
// `proxy` is run between `before` and `after` `webpack-dev-server` hooks
proxy,
onBeforeSetupMiddleware(devServer) {
// Keep `evalSourceMapMiddleware`
// middlewares before `redirectServedPath` otherwise will not have any effect
// This lets us fetch source contents from webpack for the error overlay
devServer.app.use(evalSourceMapMiddleware(devServer));
if (fs.existsSync(paths.proxySetup)) {
// This registers user provided middleware for proxy reasons
require(paths.proxySetup)(devServer.app);
}
},
onAfterSetupMiddleware(devServer) {
// Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
devServer.app.use(redirectServedPath(paths.publicUrlOrPath));
// This service worker file is effectively a 'no-op' that will reset any
// previous service worker registered for the same host:port combination.
// We do this in development to avoid hitting the production cache if
// it used the same host and port.
// https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
},
};
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/webpack.config.js | packages/react-scripts/config/webpack.config.js | // @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const resolve = require('resolve');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const ESLintPlugin = require('eslint-webpack-plugin');
const paths = require('./paths');
const modules = require('./modules');
const getClientEnvironment = require('./env');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
const ForkTsCheckerWebpackPlugin =
process.env.TSC_COMPILE_ON_ERROR === 'true'
? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
: require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
// @remove-on-eject-begin
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
// @remove-on-eject-end
const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
const reactRefreshWebpackPluginRuntimeEntry = require.resolve(
'@pmmmwh/react-refresh-webpack-plugin'
);
const babelRuntimeEntry = require.resolve('babel-preset-react-app');
const babelRuntimeEntryHelpers = require.resolve(
'@babel/runtime/helpers/esm/assertThisInitialized',
{ paths: [babelRuntimeEntry] }
);
const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
paths: [babelRuntimeEntry],
});
// Some apps do not need the benefits of saving a web request, so not inlining the chunk
// makes for a smoother build process.
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true';
const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true';
const imageInlineSizeLimit = parseInt(
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
);
// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig);
// Check if Tailwind config exists
const useTailwind = fs.existsSync(
path.join(paths.appPath, 'tailwind.config.js')
);
// Get the path to the uncompiled service worker (if it exists).
const swSrc = paths.swSrc;
// style files regexes
const cssRegex = /\.css$/;
const cssModuleRegex = /\.module\.css$/;
const sassRegex = /\.(scss|sass)$/;
const sassModuleRegex = /\.module\.(scss|sass)$/;
const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
return false;
}
try {
require.resolve('react/jsx-runtime');
return true;
} catch (e) {
return false;
}
})();
// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function (webpackEnv) {
const isEnvDevelopment = webpackEnv === 'development';
const isEnvProduction = webpackEnv === 'production';
// Variable used for enabling profiling in Production
// passed into alias object. Uses a flag if passed into the build command
const isEnvProductionProfile =
isEnvProduction && process.argv.includes('--profile');
// We will provide `paths.publicUrlOrPath` to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
// Get environment variables to inject into our app.
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
const shouldUseReactRefresh = env.raw.FAST_REFRESH;
// common function to get style loaders
const getStyleLoaders = (cssOptions, preProcessor) => {
const loaders = [
isEnvDevelopment && require.resolve('style-loader'),
isEnvProduction && {
loader: MiniCssExtractPlugin.loader,
// css is located in `static/css`, use '../../' to locate index.html folder
// in production `paths.publicUrlOrPath` can be a relative path
options: paths.publicUrlOrPath.startsWith('.')
? { publicPath: '../../' }
: {},
},
{
loader: require.resolve('css-loader'),
options: cssOptions,
},
{
// Options for PostCSS as we reference these options twice
// Adds vendor prefixing based on your specified browser support in
// package.json
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: {
// Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
config: false,
plugins: !useTailwind
? [
'postcss-flexbugs-fixes',
[
'postcss-preset-env',
{
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
},
],
// Adds PostCSS Normalize as the reset css with default options,
// so that it honors browserslist config in package.json
// which in turn let's users customize the target behavior as per their needs.
'postcss-normalize',
]
: [
'tailwindcss',
'postcss-flexbugs-fixes',
[
'postcss-preset-env',
{
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
},
],
],
},
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
},
},
].filter(Boolean);
if (preProcessor) {
loaders.push(
{
loader: require.resolve('resolve-url-loader'),
options: {
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
root: paths.appSrc,
},
},
{
loader: require.resolve(preProcessor),
options: {
sourceMap: true,
},
}
);
}
return loaders;
};
return {
target: ['browserslist'],
// Webpack noise constrained to errors and warnings
stats: 'errors-warnings',
mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
// Stop compilation early in production
bail: isEnvProduction,
devtool: isEnvProduction
? shouldUseSourceMap
? 'source-map'
: false
: isEnvDevelopment && 'cheap-module-source-map',
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
entry: paths.appIndexJs,
output: {
// The build folder.
path: paths.appBuild,
// Add /* filename */ comments to generated require()s in the output.
pathinfo: isEnvDevelopment,
// There will be one main bundle, and one file per asynchronous chunk.
// In development, it does not produce real files.
filename: isEnvProduction
? 'static/js/[name].[contenthash:8].js'
: isEnvDevelopment && 'static/js/bundle.js',
// There are also additional JS chunk files if you use code splitting.
chunkFilename: isEnvProduction
? 'static/js/[name].[contenthash:8].chunk.js'
: isEnvDevelopment && 'static/js/[name].chunk.js',
assetModuleFilename: 'static/media/[name].[hash][ext]',
// webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: paths.publicUrlOrPath,
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: isEnvProduction
? info =>
path
.relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/')
: isEnvDevelopment &&
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
},
cache: {
type: 'filesystem',
version: createEnvironmentHash(env.raw),
cacheDirectory: paths.appWebpackCache,
store: 'pack',
buildDependencies: {
defaultWebpack: ['webpack/lib/'],
config: [__filename],
tsconfig: [paths.appTsConfig, paths.appJsConfig].filter(f =>
fs.existsSync(f)
),
},
},
infrastructureLogging: {
level: 'none',
},
optimization: {
minimize: isEnvProduction,
minimizer: [
// This is only used in production mode
new TerserPlugin({
terserOptions: {
parse: {
// We want terser to parse ecma 8 code. However, we don't want it
// to apply any minification steps that turns valid ecma 5 code
// into invalid ecma 5 code. This is why the 'compress' and 'output'
// sections only apply transformations that are ecma 5 safe
// https://github.com/facebook/create-react-app/pull/4234
ecma: 8,
},
compress: {
ecma: 5,
warnings: false,
// Disabled because of an issue with Uglify breaking seemingly valid code:
// https://github.com/facebook/create-react-app/issues/2376
// Pending further investigation:
// https://github.com/mishoo/UglifyJS2/issues/2011
comparisons: false,
// Disabled because of an issue with Terser breaking valid code:
// https://github.com/facebook/create-react-app/issues/5250
// Pending further investigation:
// https://github.com/terser-js/terser/issues/120
inline: 2,
},
mangle: {
safari10: true,
},
// Added for profiling in devtools
keep_classnames: isEnvProductionProfile,
keep_fnames: isEnvProductionProfile,
output: {
ecma: 5,
comments: false,
// Turned on because emoji and regex is not minified properly using default
// https://github.com/facebook/create-react-app/issues/2488
ascii_only: true,
},
},
}),
// This is only used in production mode
new CssMinimizerPlugin(),
],
},
resolve: {
// This allows you to set a fallback for where webpack should look for modules.
// We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebook/create-react-app/issues/253
modules: ['node_modules', paths.appNodeModules].concat(
modules.additionalModulePaths || []
),
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebook/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: paths.moduleFileExtensions
.map(ext => `.${ext}`)
.filter(ext => useTypeScript || !ext.includes('ts')),
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
// Allows for better profiling with ReactDevTools
...(isEnvProductionProfile && {
'react-dom$': 'react-dom/profiling',
'scheduler/tracing': 'scheduler/tracing-profiling',
}),
...(modules.webpackAliases || {}),
},
plugins: [
// Prevents users from importing files from outside of src/ (or node_modules/).
// This often causes confusion because we only process files within src/ with babel.
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
new ModuleScopePlugin(paths.appSrc, [
paths.appPackageJson,
reactRefreshRuntimeEntry,
reactRefreshWebpackPluginRuntimeEntry,
babelRuntimeEntry,
babelRuntimeEntryHelpers,
babelRuntimeRegenerator,
]),
],
},
module: {
strictExportPresence: true,
rules: [
// Handle node_modules packages that contain sourcemaps
shouldUseSourceMap && {
enforce: 'pre',
exclude: /@babel(?:\/|\\{1,2})runtime/,
test: /\.(js|mjs|jsx|ts|tsx|css)$/,
loader: require.resolve('source-map-loader'),
},
{
// "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall
// back to the "file" loader at the end of the loader list.
oneOf: [
// TODO: Merge this config once `image/avif` is in the mime-db
// https://github.com/jshttp/mime-db
{
test: [/\.avif$/],
type: 'asset',
mimetype: 'image/avif',
parser: {
dataUrlCondition: {
maxSize: imageInlineSizeLimit,
},
},
},
// "url" loader works like "file" loader except that it embeds assets
// smaller than specified limit in bytes as data URLs to avoid requests.
// A missing `test` is equivalent to a match.
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: imageInlineSizeLimit,
},
},
},
{
test: /\.svg$/,
use: [
{
loader: require.resolve('@svgr/webpack'),
options: {
prettier: false,
svgo: false,
svgoConfig: {
plugins: [{ removeViewBox: false }],
},
titleProp: true,
ref: true,
},
},
{
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash].[ext]',
},
},
],
issuer: {
and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
},
},
// Process application JS with Babel.
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve(
'babel-preset-react-app/webpack-overrides'
),
presets: [
[
require.resolve('babel-preset-react-app'),
{
runtime: hasJsxRuntime ? 'automatic' : 'classic',
},
],
],
// @remove-on-eject-begin
babelrc: false,
configFile: false,
// Make sure we have a unique cache identifier, erring on the
// side of caution.
// We remove this when the user ejects because the default
// is sane and uses Babel options. Instead of options, we use
// the react-scripts and babel-preset-react-app versions.
cacheIdentifier: getCacheIdentifier(
isEnvProduction
? 'production'
: isEnvDevelopment && 'development',
[
'babel-plugin-named-asset-import',
'babel-preset-react-app',
'react-dev-utils',
'react-scripts',
]
),
// @remove-on-eject-end
plugins: [
isEnvDevelopment &&
shouldUseReactRefresh &&
require.resolve('react-refresh/babel'),
].filter(Boolean),
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
compact: isEnvProduction,
},
},
// Process any JS outside of the app with Babel.
// Unlike the application JS, we only compile the standard ES features.
{
test: /\.(js|mjs)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve('babel-loader'),
options: {
babelrc: false,
configFile: false,
compact: false,
presets: [
[
require.resolve('babel-preset-react-app/dependencies'),
{ helpers: true },
],
],
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
// @remove-on-eject-begin
cacheIdentifier: getCacheIdentifier(
isEnvProduction
? 'production'
: isEnvDevelopment && 'development',
[
'babel-plugin-named-asset-import',
'babel-preset-react-app',
'react-dev-utils',
'react-scripts',
]
),
// @remove-on-eject-end
// Babel sourcemaps are needed for debugging into node_modules
// code. Without the options below, debuggers like VSCode
// show incorrect code and set breakpoints on the wrong lines.
sourceMaps: shouldUseSourceMap,
inputSourceMap: shouldUseSourceMap,
},
},
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
// "style" loader turns CSS into JS modules that inject <style> tags.
// In production, we use MiniCSSExtractPlugin to extract that CSS
// to a file, but in development "style" loader enables hot editing
// of CSS.
// By default we support CSS Modules with the extension .module.css
{
test: cssRegex,
exclude: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
modules: {
mode: 'icss',
},
}),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true,
},
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
// using the extension .module.css
{
test: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
modules: {
mode: 'local',
getLocalIdent: getCSSModuleLocalIdent,
},
}),
},
// Opt-in support for SASS (using .scss or .sass extensions).
// By default we support SASS Modules with the
// extensions .module.scss or .module.sass
{
test: sassRegex,
exclude: sassModuleRegex,
use: getStyleLoaders(
{
importLoaders: 3,
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
modules: {
mode: 'icss',
},
},
'sass-loader'
),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true,
},
// Adds support for CSS Modules, but using SASS
// using the extension .module.scss or .module.sass
{
test: sassModuleRegex,
use: getStyleLoaders(
{
importLoaders: 3,
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
modules: {
mode: 'local',
getLocalIdent: getCSSModuleLocalIdent,
},
},
'sass-loader'
),
},
// "file" loader makes sure those assets get served by WebpackDevServer.
// When you `import` an asset, you get its (virtual) filename.
// In production, they would get copied to the `build` folder.
// This loader doesn't use a "test" so it will catch all modules
// that fall through the other loaders.
{
// Exclude `js` files to keep "css" loader working as it injects
// its runtime that would otherwise be processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
type: 'asset/resource',
},
// ** STOP ** Are you adding a new loader?
// Make sure to add the new loader(s) before the "file" loader.
],
},
].filter(Boolean),
},
plugins: [
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin(
Object.assign(
{},
{
inject: true,
template: paths.appHtml,
},
isEnvProduction
? {
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}
: undefined
)
),
// Inlines the webpack runtime script. This script is too small to warrant
// a network request.
// https://github.com/facebook/create-react-app/issues/5358
isEnvProduction &&
shouldInlineRuntimeChunk &&
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
// Makes some environment variables available in index.html.
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
// It will be an empty string unless you specify "homepage"
// in `package.json`, in which case it will be the pathname of that URL.
new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
// This gives some necessary context to module not found errors, such as
// the requesting resource.
new ModuleNotFoundPlugin(paths.appPath),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
// It is absolutely essential that NODE_ENV is set to production
// during a production build.
// Otherwise React will be compiled in the very slow development mode.
new webpack.DefinePlugin(env.stringified),
// Experimental hot reloading for React .
// https://github.com/facebook/react/tree/main/packages/react-refresh
isEnvDevelopment &&
shouldUseReactRefresh &&
new ReactRefreshWebpackPlugin({
overlay: false,
}),
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebook/create-react-app/issues/240
isEnvDevelopment && new CaseSensitivePathsPlugin(),
isEnvProduction &&
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: 'static/css/[name].[contenthash:8].css',
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
}),
// Generate an asset manifest file with the following content:
// - "files" key: Mapping of all asset filenames to their corresponding
// output file so that tools can pick it up without having to parse
// `index.html`
// - "entrypoints" key: Array of files which are included in `index.html`,
// can be used to reconstruct the HTML if necessary
new WebpackManifestPlugin({
fileName: 'asset-manifest.json',
publicPath: paths.publicUrlOrPath,
generate: (seed, files, entrypoints) => {
const manifestFiles = files.reduce((manifest, file) => {
manifest[file.name] = file.path;
return manifest;
}, seed);
const entrypointFiles = entrypoints.main.filter(
fileName => !fileName.endsWith('.map')
);
return {
files: manifestFiles,
entrypoints: entrypointFiles,
};
},
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the webpack build.
isEnvProduction &&
fs.existsSync(swSrc) &&
new WorkboxWebpackPlugin.InjectManifest({
swSrc,
dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./,
exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/],
// Bump up the default maximum size (2mb) that's precached,
// to make lazy-loading failure scenarios less likely.
// See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
}),
// TypeScript type checking
useTypeScript &&
new ForkTsCheckerWebpackPlugin({
async: isEnvDevelopment,
typescript: {
typescriptPath: resolve.sync('typescript', {
basedir: paths.appNodeModules,
}),
configOverwrite: {
compilerOptions: {
sourceMap: isEnvProduction
? shouldUseSourceMap
: isEnvDevelopment,
skipLibCheck: true,
inlineSourceMap: false,
declarationMap: false,
noEmit: true,
incremental: true,
tsBuildInfoFile: paths.appTsBuildInfoFile,
},
},
context: paths.appPath,
diagnosticOptions: {
syntactic: true,
},
mode: 'write-references',
// profile: true,
},
issue: {
// This one is specifically to match during CI tests,
// as micromatch doesn't match
// '../cra-template-typescript/template/src/App.tsx'
// otherwise.
include: [
{ file: '../**/src/**/*.{ts,tsx}' },
{ file: '**/src/**/*.{ts,tsx}' },
],
exclude: [
{ file: '**/src/**/__tests__/**' },
{ file: '**/src/**/?(*.){spec|test}.*' },
{ file: '**/src/setupProxy.*' },
{ file: '**/src/setupTests.*' },
],
},
logger: {
infrastructure: 'silent',
},
}),
!disableESLintPlugin &&
new ESLintPlugin({
// Plugin options
extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
context: paths.appSrc,
cache: true,
cacheLocation: path.resolve(
paths.appNodeModules,
'.cache/.eslintcache'
),
// ESLint class options
cwd: paths.appPath,
resolvePluginsRelativeTo: __dirname,
baseConfig: {
extends: [require.resolve('eslint-config-react-app/base')],
rules: {
...(!hasJsxRuntime && {
'react/react-in-jsx-scope': 'error',
}),
},
},
}),
].filter(Boolean),
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
performance: false,
};
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/paths.js | packages/react-scripts/config/paths.js | // @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
const path = require('path');
const fs = require('fs');
const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebook/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
// webpack needs to know it to put the right <script> hrefs into HTML even in
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
const publicUrlOrPath = getPublicUrlOrPath(
process.env.NODE_ENV === 'development',
require(resolveApp('package.json')).homepage,
process.env.PUBLIC_URL
);
const buildPath = process.env.BUILD_PATH || 'build';
const moduleFileExtensions = [
'web.mjs',
'mjs',
'web.js',
'js',
'web.ts',
'ts',
'web.tsx',
'tsx',
'json',
'web.jsx',
'jsx',
];
// Resolve file paths in the same order as webpack
const resolveModule = (resolveFn, filePath) => {
const extension = moduleFileExtensions.find(extension =>
fs.existsSync(resolveFn(`${filePath}.${extension}`))
);
if (extension) {
return resolveFn(`${filePath}.${extension}`);
}
return resolveFn(`${filePath}.js`);
};
// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp(buildPath),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
appTsConfig: resolveApp('tsconfig.json'),
appJsConfig: resolveApp('jsconfig.json'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
proxySetup: resolveApp('src/setupProxy.js'),
appNodeModules: resolveApp('node_modules'),
appWebpackCache: resolveApp('node_modules/.cache'),
appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
swSrc: resolveModule(resolveApp, 'src/service-worker'),
publicUrlOrPath,
};
// @remove-on-eject-begin
const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath);
// config before eject: we're in ./node_modules/react-scripts/config/
module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp(buildPath),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
appTsConfig: resolveApp('tsconfig.json'),
appJsConfig: resolveApp('jsconfig.json'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
proxySetup: resolveApp('src/setupProxy.js'),
appNodeModules: resolveApp('node_modules'),
appWebpackCache: resolveApp('node_modules/.cache'),
appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
swSrc: resolveModule(resolveApp, 'src/service-worker'),
publicUrlOrPath,
// These properties only exist before ejecting:
ownPath: resolveOwn('.'),
ownNodeModules: resolveOwn('node_modules'), // This is empty on npm 3
appTypeDeclarations: resolveApp('src/react-app-env.d.ts'),
ownTypeDeclarations: resolveOwn('lib/react-app.d.ts'),
};
const ownPackageJson = require('../package.json');
const reactScriptsPath = resolveApp(`node_modules/${ownPackageJson.name}`);
const reactScriptsLinked =
fs.existsSync(reactScriptsPath) &&
fs.lstatSync(reactScriptsPath).isSymbolicLink();
// config before publish: we're in ./packages/react-scripts/config/
if (
!reactScriptsLinked &&
__dirname.indexOf(path.join('packages', 'react-scripts', 'config')) !== -1
) {
const templatePath = '../cra-template/template';
module.exports = {
dotenv: resolveOwn(`${templatePath}/.env`),
appPath: resolveApp('.'),
appBuild: resolveOwn(path.join('../..', buildPath)),
appPublic: resolveOwn(`${templatePath}/public`),
appHtml: resolveOwn(`${templatePath}/public/index.html`),
appIndexJs: resolveModule(resolveOwn, `${templatePath}/src/index`),
appPackageJson: resolveOwn('package.json'),
appSrc: resolveOwn(`${templatePath}/src`),
appTsConfig: resolveOwn(`${templatePath}/tsconfig.json`),
appJsConfig: resolveOwn(`${templatePath}/jsconfig.json`),
yarnLockFile: resolveOwn(`${templatePath}/yarn.lock`),
testsSetup: resolveModule(resolveOwn, `${templatePath}/src/setupTests`),
proxySetup: resolveOwn(`${templatePath}/src/setupProxy.js`),
appNodeModules: resolveOwn('node_modules'),
appWebpackCache: resolveOwn('node_modules/.cache'),
appTsBuildInfoFile: resolveOwn('node_modules/.cache/tsconfig.tsbuildinfo'),
swSrc: resolveModule(resolveOwn, `${templatePath}/src/service-worker`),
publicUrlOrPath,
// These properties only exist before ejecting:
ownPath: resolveOwn('.'),
ownNodeModules: resolveOwn('node_modules'),
appTypeDeclarations: resolveOwn(`${templatePath}/src/react-app-env.d.ts`),
ownTypeDeclarations: resolveOwn('lib/react-app.d.ts'),
};
}
// @remove-on-eject-end
module.exports.moduleFileExtensions = moduleFileExtensions;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/jest/fileTransform.js | packages/react-scripts/config/jest/fileTransform.js | 'use strict';
const path = require('path');
const camelcase = require('camelcase');
// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process(src, filename) {
const assetFilename = JSON.stringify(path.basename(filename));
if (filename.match(/\.svg$/)) {
// Based on how SVGR generates a component name:
// https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
const pascalCaseFilename = camelcase(path.parse(filename).name, {
pascalCase: true,
});
const componentName = `Svg${pascalCaseFilename}`;
return `const React = require('react');
module.exports = {
__esModule: true,
default: ${assetFilename},
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
return {
$$typeof: Symbol.for('react.element'),
type: 'svg',
ref: ref,
key: null,
props: Object.assign({}, props, {
children: ${assetFilename}
})
};
}),
};`;
}
return `module.exports = ${assetFilename};`;
},
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/jest/babelTransform.js | packages/react-scripts/config/jest/babelTransform.js | // @remove-on-eject-begin
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
const babelJest = require('babel-jest').default;
const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
return false;
}
try {
require.resolve('react/jsx-runtime');
return true;
} catch (e) {
return false;
}
})();
module.exports = babelJest.createTransformer({
presets: [
[
require.resolve('babel-preset-react-app'),
{
runtime: hasJsxRuntime ? 'automatic' : 'classic',
},
],
],
babelrc: false,
configFile: false,
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/jest/cssTransform.js | packages/react-scripts/config/jest/cssTransform.js | // @remove-on-eject-begin
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process() {
return 'module.exports = {};';
},
getCacheKey() {
// The output is always the same.
return 'cssTransform';
},
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/webpack/persistentCache/createEnvironmentHash.js | packages/react-scripts/config/webpack/persistentCache/createEnvironmentHash.js | 'use strict';
const { createHash } = require('crypto');
module.exports = env => {
const hash = createHash('md5');
hash.update(JSON.stringify(env));
return hash.digest('hex');
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/eslint-config-react-app/base.js | packages/eslint-config-react-app/base.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
// Fix eslint shareable config (https://github.com/eslint/eslint/issues/3458)
require('@rushstack/eslint-patch/modern-module-resolution');
// This file contains the minimum ESLint configuration required for Create
// React App support, and is used as the `baseConfig` for `eslint-loader`
// to ensure that user-provided configs don't need this boilerplate.
module.exports = {
root: true,
parser: '@babel/eslint-parser',
plugins: ['react'],
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},
parserOptions: {
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
presets: [require.resolve('babel-preset-react-app/prod')],
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'react/jsx-uses-vars': 'warn',
'react/jsx-uses-react': 'warn',
},
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/eslint-config-react-app/jest.js | packages/eslint-config-react-app/jest.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
// Fix eslint shareable config (https://github.com/eslint/eslint/issues/3458)
require('@rushstack/eslint-patch/modern-module-resolution');
// We use eslint-loader so even warnings are very visible.
// This is why we prefer to use "WARNING" level for potential errors,
// and we try not to use "ERROR" level at all.
module.exports = {
plugins: ['jest', 'testing-library'],
overrides: [
{
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
env: {
'jest/globals': true,
},
// A subset of the recommended rules:
rules: {
// https://github.com/jest-community/eslint-plugin-jest
'jest/no-conditional-expect': 'error',
'jest/no-identical-title': 'error',
'jest/no-interpolation-in-snapshots': 'error',
'jest/no-jasmine-globals': 'error',
'jest/no-jest-import': 'error',
'jest/no-mocks-import': 'error',
'jest/valid-describe-callback': 'error',
'jest/valid-expect': 'error',
'jest/valid-expect-in-promise': 'error',
'jest/valid-title': 'warn',
// https://github.com/testing-library/eslint-plugin-testing-library
'testing-library/await-async-query': 'error',
'testing-library/await-async-utils': 'error',
'testing-library/no-await-sync-query': 'error',
'testing-library/no-container': 'error',
'testing-library/no-debugging-utils': 'error',
'testing-library/no-dom-import': ['error', 'react'],
'testing-library/no-node-access': 'error',
'testing-library/no-promise-in-fire-event': 'error',
'testing-library/no-render-in-setup': 'error',
'testing-library/no-unnecessary-act': 'error',
'testing-library/no-wait-for-empty-callback': 'error',
'testing-library/no-wait-for-multiple-assertions': 'error',
'testing-library/no-wait-for-side-effects': 'error',
'testing-library/no-wait-for-snapshot': 'error',
'testing-library/prefer-find-by': 'error',
'testing-library/prefer-presence-queries': 'error',
'testing-library/prefer-query-by-disappearance': 'error',
'testing-library/prefer-screen-queries': 'error',
'testing-library/render-result-naming-convention': 'error',
},
},
],
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/eslint-config-react-app/index.js | packages/eslint-config-react-app/index.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
// Inspired by https://github.com/airbnb/javascript but less opinionated.
// We use eslint-loader so even warnings are very visible.
// This is why we prefer to use "WARNING" level for potential errors,
// and we try not to use "ERROR" level at all.
// In the future, we might create a separate list of rules for production.
// It would probably be more strict.
// The ESLint browser environment defines all browser globals as valid,
// even though most people don't know some of them exist (e.g. `name` or `status`).
// This is dangerous as it hides accidentally undefined variables.
// We blacklist the globals that we deem potentially confusing.
// To use them, explicitly reference them, e.g. `window.name` or `window.status`.
const restrictedGlobals = require('confusing-browser-globals');
module.exports = {
extends: [require.resolve('./base')],
plugins: ['import', 'flowtype', 'jsx-a11y', 'react-hooks'],
overrides: [
{
files: ['**/*.ts?(x)'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
// typescript-eslint specific options
warnOnUnsupportedTypeScriptVersion: true,
},
plugins: ['@typescript-eslint'],
// If adding a typescript-eslint version of an existing ESLint rule,
// make sure to disable the ESLint rule here.
rules: {
// TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)
'default-case': 'off',
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
'no-dupe-class-members': 'off',
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
'no-undef': 'off',
// Add TypeScript specific rules (and turn off ESLint equivalents)
'@typescript-eslint/consistent-type-assertions': 'warn',
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 'warn',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'warn',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'warn',
{
functions: false,
classes: false,
variables: false,
typedefs: false,
},
],
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'none',
ignoreRestSiblings: true,
},
],
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'warn',
},
},
],
// NOTE: When adding rules here, you need to make sure they are compatible with
// `typescript-eslint`, as some rules such as `no-array-constructor` aren't compatible.
rules: {
// http://eslint.org/docs/rules/
'array-callback-return': 'warn',
'default-case': ['warn', { commentPattern: '^no default$' }],
'dot-location': ['warn', 'property'],
eqeqeq: ['warn', 'smart'],
'new-parens': 'warn',
'no-array-constructor': 'warn',
'no-caller': 'warn',
'no-cond-assign': ['warn', 'except-parens'],
'no-const-assign': 'warn',
'no-control-regex': 'warn',
'no-delete-var': 'warn',
'no-dupe-args': 'warn',
'no-dupe-class-members': 'warn',
'no-dupe-keys': 'warn',
'no-duplicate-case': 'warn',
'no-empty-character-class': 'warn',
'no-empty-pattern': 'warn',
'no-eval': 'warn',
'no-ex-assign': 'warn',
'no-extend-native': 'warn',
'no-extra-bind': 'warn',
'no-extra-label': 'warn',
'no-fallthrough': 'warn',
'no-func-assign': 'warn',
'no-implied-eval': 'warn',
'no-invalid-regexp': 'warn',
'no-iterator': 'warn',
'no-label-var': 'warn',
'no-labels': ['warn', { allowLoop: true, allowSwitch: false }],
'no-lone-blocks': 'warn',
'no-loop-func': 'warn',
'no-mixed-operators': [
'warn',
{
groups: [
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: false,
},
],
'no-multi-str': 'warn',
'no-global-assign': 'warn',
'no-unsafe-negation': 'warn',
'no-new-func': 'warn',
'no-new-object': 'warn',
'no-new-symbol': 'warn',
'no-new-wrappers': 'warn',
'no-obj-calls': 'warn',
'no-octal': 'warn',
'no-octal-escape': 'warn',
'no-redeclare': 'warn',
'no-regex-spaces': 'warn',
'no-restricted-syntax': ['warn', 'WithStatement'],
'no-script-url': 'warn',
'no-self-assign': 'warn',
'no-self-compare': 'warn',
'no-sequences': 'warn',
'no-shadow-restricted-names': 'warn',
'no-sparse-arrays': 'warn',
'no-template-curly-in-string': 'warn',
'no-this-before-super': 'warn',
'no-throw-literal': 'warn',
'no-undef': 'error',
'no-restricted-globals': ['error'].concat(restrictedGlobals),
'no-unreachable': 'warn',
'no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
'no-unused-labels': 'warn',
'no-unused-vars': [
'warn',
{
args: 'none',
ignoreRestSiblings: true,
},
],
'no-use-before-define': [
'warn',
{
functions: false,
classes: false,
variables: false,
},
],
'no-useless-computed-key': 'warn',
'no-useless-concat': 'warn',
'no-useless-constructor': 'warn',
'no-useless-escape': 'warn',
'no-useless-rename': [
'warn',
{
ignoreDestructuring: false,
ignoreImport: false,
ignoreExport: false,
},
],
'no-with': 'warn',
'no-whitespace-before-property': 'warn',
'react-hooks/exhaustive-deps': 'warn',
'require-yield': 'warn',
'rest-spread-spacing': ['warn', 'never'],
strict: ['warn', 'never'],
'unicode-bom': ['warn', 'never'],
'use-isnan': 'warn',
'valid-typeof': 'warn',
'no-restricted-properties': [
'error',
{
object: 'require',
property: 'ensure',
message:
'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
},
{
object: 'System',
property: 'import',
message:
'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
},
],
'getter-return': 'warn',
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
'import/first': 'error',
'import/no-amd': 'error',
'import/no-anonymous-default-export': 'warn',
'import/no-webpack-loader-syntax': 'error',
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
'react/jsx-no-comment-textnodes': 'warn',
'react/jsx-no-duplicate-props': 'warn',
'react/jsx-no-target-blank': 'warn',
'react/jsx-no-undef': 'error',
'react/jsx-pascal-case': [
'warn',
{
allowAllCaps: true,
ignore: [],
},
],
'react/no-danger-with-children': 'warn',
// Disabled because of undesirable warnings
// See https://github.com/facebook/create-react-app/issues/5204 for
// blockers until its re-enabled
// 'react/no-deprecated': 'warn',
'react/no-direct-mutation-state': 'warn',
'react/no-is-mounted': 'warn',
'react/no-typos': 'error',
'react/require-render-return': 'error',
'react/style-prop-object': 'warn',
// https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/anchor-has-content': 'warn',
'jsx-a11y/anchor-is-valid': [
'warn',
{
aspects: ['noHref', 'invalidHref'],
},
],
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }],
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/heading-has-content': 'warn',
'jsx-a11y/iframe-has-title': 'warn',
'jsx-a11y/img-redundant-alt': 'warn',
'jsx-a11y/no-access-key': 'warn',
'jsx-a11y/no-distracting-elements': 'warn',
'jsx-a11y/no-redundant-roles': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
'jsx-a11y/scope': 'warn',
// https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
'react-hooks/rules-of-hooks': 'error',
// https://github.com/gajus/eslint-plugin-flowtype
'flowtype/define-flow-type': 'warn',
'flowtype/require-valid-file-annotation': 'warn',
'flowtype/use-flow-type': 'warn',
},
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template/src/App.test.js | packages/cra-template/template/src/App.test.js | import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template/src/reportWebVitals.js | packages/cra-template/template/src/reportWebVitals.js | const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template/src/index.js | packages/cra-template/template/src/index.js | import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template/src/App.js | packages/cra-template/template/src/App.js | import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/cra-template/template/src/setupTests.js | packages/cra-template/template/src/setupTests.js | // jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/confusing-browser-globals/index.js | packages/confusing-browser-globals/index.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
module.exports = [
'addEventListener',
'blur',
'close',
'closed',
'confirm',
'defaultStatus',
'defaultstatus',
'event',
'external',
'find',
'focus',
'frameElement',
'frames',
'history',
'innerHeight',
'innerWidth',
'length',
'location',
'locationbar',
'menubar',
'moveBy',
'moveTo',
'name',
'onblur',
'onerror',
'onfocus',
'onload',
'onresize',
'onunload',
'open',
'opener',
'opera',
'outerHeight',
'outerWidth',
'pageXOffset',
'pageYOffset',
'parent',
'print',
'removeEventListener',
'resizeBy',
'resizeTo',
'screen',
'screenLeft',
'screenTop',
'screenX',
'screenY',
'scroll',
'scrollbars',
'scrollBy',
'scrollTo',
'scrollX',
'scrollY',
'self',
'status',
'statusbar',
'stop',
'toolbar',
'top',
];
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/confusing-browser-globals/test.js | packages/confusing-browser-globals/test.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-env jest */
'use strict';
let globals = require('./index');
it('should return an Array of globals', () => {
expect(Array.isArray(globals)).toBe(true);
});
it('should contain "event" variable', () => {
expect(globals).toContain('event');
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/webpack.config.iframe.js | packages/react-error-overlay/webpack.config.iframe.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: './src/iframeScript.js',
output: {
path: path.join(__dirname, './lib'),
filename: 'iframe-bundle.js',
},
module: {
rules: [
{
oneOf: [
// Source
{
test: /\.js$/,
include: [path.resolve(__dirname, './src')],
use: {
loader: 'babel-loader',
},
},
// Dependencies
{
test: /\.js$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
configFile: false,
compact: false,
presets: [
['babel-preset-react-app/dependencies', { helpers: true }],
],
},
},
},
],
},
],
},
optimization: {
minimizer: [
// This code is embedded as a string, so it would never be optimized
// elsewhere.
new TerserPlugin({
terserOptions: {
compress: {
warnings: false,
comparisons: false,
},
output: {
comments: false,
ascii_only: false,
},
},
}),
],
},
plugins: [
new webpack.DefinePlugin({
// We set process.env.NODE_ENV to 'production' so that React is built
// in production mode.
'process.env': { NODE_ENV: '"production"' },
// This prevents our bundled React from accidentally hijacking devtools.
__REACT_DEVTOOLS_GLOBAL_HOOK__: '({})',
}),
],
performance: false,
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/build.js | packages/react-error-overlay/build.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const webpack = require('webpack');
const chalk = require('chalk');
const webpackConfig = require('./webpack.config.js');
const iframeWebpackConfig = require('./webpack.config.iframe.js');
const rimraf = require('rimraf');
const chokidar = require('chokidar');
const args = process.argv.slice(2);
const watchMode = args[0] === '--watch' || args[0] === '-w';
const isCI =
process.env.CI &&
(typeof process.env.CI !== 'string' ||
process.env.CI.toLowerCase() !== 'false');
function build(config, name, callback) {
console.log(chalk.cyan('Compiling ' + name));
webpack(config).run((error, stats) => {
if (error) {
console.log(chalk.red('Failed to compile.'));
console.log(error.message || error);
console.log();
}
if (stats.compilation.errors.length) {
console.log(chalk.red('Failed to compile.'));
console.log(stats.toString({ all: false, errors: true }));
}
if (stats.compilation.warnings.length) {
console.log(chalk.yellow('Compiled with warnings.'));
console.log(stats.toString({ all: false, warnings: true }));
}
// Fail the build if running in a CI server
if (
error ||
stats.compilation.errors.length ||
stats.compilation.warnings.length
) {
isCI && process.exit(1);
return;
}
console.log(
stats.toString({ colors: true, modules: false, version: false })
);
console.log();
callback(stats);
});
}
function runBuildSteps() {
build(iframeWebpackConfig, 'iframeScript.js', () => {
build(webpackConfig, 'index.js', () => {
console.log(chalk.bold.green('Compiled successfully!\n\n'));
});
});
}
function setupWatch() {
const watcher = chokidar.watch('./src', {
ignoreInitial: true,
});
watcher.on('change', runBuildSteps);
watcher.on('add', runBuildSteps);
watcher.on('ready', () => {
runBuildSteps();
});
process.on('SIGINT', function () {
watcher.close();
process.exit(0);
});
watcher.on('error', error => {
console.error('Watcher failure', error);
process.exit(1);
});
}
// Clean up lib folder
rimraf('lib/', () => {
console.log('Cleaned up the lib folder.\n');
watchMode ? setupWatch() : runBuildSteps();
});
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/webpack.config.js | packages/react-error-overlay/webpack.config.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const path = require('path');
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: './src/index.js',
output: {
path: path.join(__dirname, './lib'),
filename: 'index.js',
library: 'ReactErrorOverlay',
libraryTarget: 'umd',
},
module: {
rules: [
{
test: /iframe-bundle\.js$/,
use: 'raw-loader',
},
{
test: /\.js$/,
include: path.resolve(__dirname, './src'),
use: 'babel-loader',
},
],
},
resolve: {
alias: {
iframeScript$: path.resolve(__dirname, './lib/iframe-bundle.js'),
},
fallback: {
fs: false,
path: false,
},
},
optimization: {
nodeEnv: false,
},
performance: {
hints: false,
},
};
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/flow/env.js | packages/react-error-overlay/flow/env.js | declare module 'anser' {
declare module.exports: any;
}
declare module '@babel/code-frame' {
declare module.exports: any;
}
declare module 'html-entities' {
declare module.exports: any;
}
declare module 'settle-promise' {
declare module.exports: any;
}
declare module 'source-map' {
declare module.exports: any;
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/src/iframeScript.js | packages/react-error-overlay/src/iframeScript.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import 'react-app-polyfill/ie9';
import React, { createContext } from 'react';
import ReactDOM from 'react-dom';
import CompileErrorContainer from './containers/CompileErrorContainer';
import RuntimeErrorContainer from './containers/RuntimeErrorContainer';
import { overlayStyle } from './styles';
import { applyStyles, getTheme } from './utils/dom/css';
let iframeRoot = null;
const theme = getTheme();
export const ThemeContext = createContext();
function render({
currentBuildError,
currentRuntimeErrorRecords,
dismissRuntimeErrors,
editorHandler,
}) {
if (currentBuildError) {
return (
<ThemeContext.Provider value={theme}>
<CompileErrorContainer
error={currentBuildError}
editorHandler={editorHandler}
/>
</ThemeContext.Provider>
);
}
if (currentRuntimeErrorRecords.length > 0) {
return (
<ThemeContext.Provider value={theme}>
<RuntimeErrorContainer
errorRecords={currentRuntimeErrorRecords}
close={dismissRuntimeErrors}
editorHandler={editorHandler}
/>
</ThemeContext.Provider>
);
}
return null;
}
window.updateContent = function updateContent(errorOverlayProps) {
let renderedElement = render(errorOverlayProps);
if (renderedElement === null) {
ReactDOM.unmountComponentAtNode(iframeRoot);
return false;
}
// Update the overlay
ReactDOM.render(renderedElement, iframeRoot);
return true;
};
document.body.style.margin = '0';
// Keep popup within body boundaries for iOS Safari
document.body.style['max-width'] = '100vw';
iframeRoot = document.createElement('div');
applyStyles(iframeRoot, overlayStyle(theme));
document.body.appendChild(iframeRoot);
window.parent.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady();
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/src/index.js | packages/react-error-overlay/src/index.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {
listenToRuntimeErrors,
crashWithFrames,
} from './listenToRuntimeErrors';
import { iframeStyle } from './styles';
import { applyStyles } from './utils/dom/css';
// Importing iframe-bundle generated in the pre build step as
// a text using webpack raw-loader. See webpack.config.js file.
// $FlowFixMe
import iframeScript from 'iframeScript';
import type { ErrorRecord } from './listenToRuntimeErrors';
import type { ErrorLocation } from './utils/parseCompileError';
type RuntimeReportingOptions = {|
onError: () => void,
filename?: string,
|};
type EditorHandler = (errorLoc: ErrorLocation) => void;
let iframe: null | HTMLIFrameElement = null;
let isLoadingIframe: boolean = false;
var isIframeReady: boolean = false;
let editorHandler: null | EditorHandler = null;
let currentBuildError: null | string = null;
let currentRuntimeErrorRecords: Array<ErrorRecord> = [];
let currentRuntimeErrorOptions: null | RuntimeReportingOptions = null;
let stopListeningToRuntimeErrors: null | (() => void) = null;
export function setEditorHandler(handler: EditorHandler | null) {
editorHandler = handler;
if (iframe) {
update();
}
}
export function reportBuildError(error: string) {
currentBuildError = error;
update();
}
export function reportRuntimeError(
error: Error,
options: RuntimeReportingOptions = {}
) {
currentRuntimeErrorOptions = options;
crashWithFrames(handleRuntimeError(options))(error);
}
export function dismissBuildError() {
currentBuildError = null;
update();
}
export function startReportingRuntimeErrors(options: RuntimeReportingOptions) {
if (stopListeningToRuntimeErrors !== null) {
throw new Error('Already listening');
}
if (options.launchEditorEndpoint) {
console.warn(
'Warning: `startReportingRuntimeErrors` doesn’t accept ' +
'`launchEditorEndpoint` argument anymore. Use `listenToOpenInEditor` ' +
'instead with your own implementation to open errors in editor '
);
}
currentRuntimeErrorOptions = options;
stopListeningToRuntimeErrors = listenToRuntimeErrors(
handleRuntimeError(options),
options.filename
);
}
const handleRuntimeError =
(options: RuntimeReportingOptions) => (errorRecord: ErrorRecord) => {
try {
if (typeof options.onError === 'function') {
options.onError.call(null);
}
} finally {
if (
currentRuntimeErrorRecords.some(
({ error }) => error === errorRecord.error
)
) {
// Deduplicate identical errors.
// This fixes https://github.com/facebook/create-react-app/issues/3011.
// eslint-disable-next-line no-unsafe-finally
return;
}
currentRuntimeErrorRecords = currentRuntimeErrorRecords.concat([
errorRecord,
]);
update();
}
};
export function dismissRuntimeErrors() {
currentRuntimeErrorRecords = [];
update();
}
export function stopReportingRuntimeErrors() {
if (stopListeningToRuntimeErrors === null) {
throw new Error('Not currently listening');
}
currentRuntimeErrorOptions = null;
try {
stopListeningToRuntimeErrors();
} finally {
stopListeningToRuntimeErrors = null;
}
}
function update() {
// Loading iframe can be either sync or async depending on the browser.
if (isLoadingIframe) {
// Iframe is loading.
// First render will happen soon--don't need to do anything.
return;
}
if (isIframeReady) {
// Iframe is ready.
// Just update it.
updateIframeContent();
return;
}
// We need to schedule the first render.
isLoadingIframe = true;
const loadingIframe = window.document.createElement('iframe');
applyStyles(loadingIframe, iframeStyle);
loadingIframe.onload = function () {
const iframeDocument = loadingIframe.contentDocument;
if (iframeDocument != null && iframeDocument.body != null) {
iframe = loadingIframe;
const script =
loadingIframe.contentWindow.document.createElement('script');
script.type = 'text/javascript';
script.innerHTML = iframeScript;
iframeDocument.body.appendChild(script);
}
};
const appDocument = window.document;
appDocument.body.appendChild(loadingIframe);
}
function updateIframeContent() {
if (!currentRuntimeErrorOptions) {
throw new Error('Expected options to be injected.');
}
if (!iframe) {
throw new Error('Iframe has not been created yet.');
}
const isRendered = iframe.contentWindow.updateContent({
currentBuildError,
currentRuntimeErrorRecords,
dismissRuntimeErrors,
editorHandler,
});
if (!isRendered) {
window.document.body.removeChild(iframe);
iframe = null;
isIframeReady = false;
}
}
window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__ =
window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__ || {};
window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady =
function iframeReady() {
isIframeReady = true;
isLoadingIframe = false;
updateIframeContent();
};
if (process.env.NODE_ENV === 'production') {
console.warn(
'react-error-overlay is not meant for use in production. You should ' +
'ensure it is not included in your build to reduce bundle size.'
);
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/src/styles.js | packages/react-error-overlay/src/styles.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* @flow */
export type Theme = {|
// Colors for components styles
background: string, // Page background
color: string, // Base text
headerColor: string, // Header text
primaryPreBackground: string, // <pre/> Error background
primaryPreColor: string, // <pre/> Error text
secondaryPreBackground: string, // <pre/> Warning background
secondaryPreColor: string, // <pre/> Warning text
footer: string, // Footer text
anchorColor: string, // Link color
toggleBackground: string, // Toggle stack background
toggleColor: string, // Toggle stack text
closeColor: string, // Close button color
navBackground: string, // Navigation arrow background
navArrow: string, // Navigation arrow color
// ANSI colors
// base00: string; // Default Background
base01: string, // Lighter Background (Used for status bars)
// base02: string, // Selection Background
base03: string, // Comments, Invisibles, Line Highlighting
// base04: string, // Dark Foreground (Used for status bars)
base05: string, // Default Foreground, Caret, Delimiters, Operators
// base06: string, // Light Foreground (Not often used)
// base07: string, // Light Background (Not often used)
base08: string, // Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
// base09: string, // Integers, Boolean, Constants, XML Attributes, Markup Link Url
// base0A: string, // Classes, Markup Bold, Search Text Background
base0B: string, // Strings, Inherited Class, Markup Code, Diff Inserted
base0C: string, // Support, Regular Expressions, Escape Characters, Markup Quotes
// base0D: string, // Functions, Methods, Attribute IDs, Headings
base0E: string, // Keywords, Storage, Selector, Markup Italic, Diff Changed
// base0F: string, // Deprecated, Opening/Closing Embedded Language Tags e.g. <?php ?>
|};
const lightTheme: Theme = {
// Colors for components styles
background: 'white',
color: 'black',
headerColor: '#ce1126',
primaryPreBackground: 'rgba(206, 17, 38, 0.05)',
primaryPreColor: 'inherit',
secondaryPreBackground: 'rgba(251, 245, 180, 0.3)',
secondaryPreColor: 'inherit',
footer: '#878e91',
anchorColor: '#878e91',
toggleBackground: 'transparent',
toggleColor: '#878e91',
closeColor: '#293238',
navBackground: 'rgba(206, 17, 38, 0.05)',
navArrow: '#ce1126',
// Light color scheme inspired by https://chriskempson.github.io/base16/css/base16-github.css
// base00: '#ffffff',
base01: '#f5f5f5',
// base02: '#c8c8fa',
base03: '#6e6e6e',
// base04: '#e8e8e8',
base05: '#333333',
// base06: '#ffffff',
// base07: '#ffffff',
base08: '#881280',
// base09: '#0086b3',
// base0A: '#795da3',
base0B: '#1155cc',
base0C: '#994500',
// base0D: '#795da3',
base0E: '#c80000',
// base0F: '#333333',
};
const darkTheme: Theme = {
// Colors for components styles
background: '#353535',
color: 'white',
headerColor: '#e83b46',
primaryPreBackground: 'rgba(206, 17, 38, 0.1)',
primaryPreColor: '#fccfcf',
secondaryPreBackground: 'rgba(251, 245, 180, 0.1)',
secondaryPreColor: '#fbf5b4',
footer: '#878e91',
anchorColor: '#878e91',
toggleBackground: 'transparent',
toggleColor: '#878e91',
closeColor: '#ffffff',
navBackground: 'rgba(206, 17, 38, 0.2)',
navArrow: '#ce1126',
// Dark color scheme inspired by https://github.com/atom/base16-tomorrow-dark-theme/blob/master/styles/colors.less
// base00: '#1d1f21',
base01: '#282a2e',
// base02: '#373b41',
base03: '#969896',
// base04: '#b4b7b4',
base05: '#c5c8c6',
// base06: '#e0e0e0',
// base07: '#ffffff',
base08: '#cc6666',
// base09: '#de935f',
// base0A: '#f0c674',
base0B: '#b5bd68',
base0C: '#8abeb7',
// base0D: '#81a2be',
base0E: '#b294bb',
// base0F: '#a3685a',
};
const iframeStyle = {
position: 'fixed',
top: '0',
left: '0',
width: '100%',
height: '100%',
border: 'none',
'z-index': 2147483647,
};
const overlayStyle = (theme: Theme) => ({
width: '100%',
height: '100%',
'box-sizing': 'border-box',
'text-align': 'center',
'background-color': theme.background,
});
export { iframeStyle, overlayStyle, lightTheme, darkTheme };
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/src/listenToRuntimeErrors.js | packages/react-error-overlay/src/listenToRuntimeErrors.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {
register as registerError,
unregister as unregisterError,
} from './effects/unhandledError';
import {
register as registerPromise,
unregister as unregisterPromise,
} from './effects/unhandledRejection';
import {
register as registerStackTraceLimit,
unregister as unregisterStackTraceLimit,
} from './effects/stackTraceLimit';
import {
permanentRegister as permanentRegisterConsole,
registerReactStack,
unregisterReactStack,
} from './effects/proxyConsole';
import { massage as massageWarning } from './utils/warnings';
import getStackFrames from './utils/getStackFrames';
import type { StackFrame } from './utils/stack-frame';
const CONTEXT_SIZE: number = 3;
export type ErrorRecord = {|
error: Error,
unhandledRejection: boolean,
contextSize: number,
stackFrames: StackFrame[],
|};
export const crashWithFrames =
(crash: ErrorRecord => void) =>
(error: Error, unhandledRejection = false) => {
getStackFrames(error, unhandledRejection, CONTEXT_SIZE)
.then(stackFrames => {
if (stackFrames == null) {
return;
}
crash({
error,
unhandledRejection,
contextSize: CONTEXT_SIZE,
stackFrames,
});
})
.catch(e => {
console.log('Could not get the stack frames of error:', e);
});
};
export function listenToRuntimeErrors(
crash: ErrorRecord => void,
filename: string = '/static/js/bundle.js'
) {
const crashWithFramesRunTime = crashWithFrames(crash);
registerError(window, error => crashWithFramesRunTime(error, false));
registerPromise(window, error => crashWithFramesRunTime(error, true));
registerStackTraceLimit();
registerReactStack();
permanentRegisterConsole('error', (warning, stack) => {
const data = massageWarning(warning, stack);
crashWithFramesRunTime(
// $FlowFixMe
{
message: data.message,
stack: data.stack,
__unmap_source: filename,
},
false
);
});
return function stopListening() {
unregisterStackTraceLimit();
unregisterPromise(window);
unregisterError(window);
unregisterReactStack();
};
}
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
facebook/create-react-app | https://github.com/facebook/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-error-overlay/src/components/CodeBlock.js | packages/react-error-overlay/src/components/CodeBlock.js | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* @flow */
import React, { useContext } from 'react';
import { ThemeContext } from '../iframeScript';
const _preStyle = {
position: 'relative',
display: 'block',
padding: '0.5em',
marginTop: '0.5em',
marginBottom: '0.5em',
overflowX: 'auto',
whiteSpace: 'pre-wrap',
borderRadius: '0.25rem',
};
const codeStyle = {
fontFamily: 'Consolas, Menlo, monospace',
};
type CodeBlockPropsType = {|
main: boolean,
codeHTML: string,
|};
function CodeBlock({ main, codeHTML }: CodeBlockPropsType) {
const theme = useContext(ThemeContext);
const primaryPreStyle = {
..._preStyle,
backgroundColor: theme.primaryPreBackground,
color: theme.primaryPreColor,
};
const secondaryPreStyle = {
..._preStyle,
backgroundColor: theme.secondaryPreBackground,
color: theme.secondaryPreColor,
};
const preStyle = main ? primaryPreStyle : secondaryPreStyle;
const codeBlock = { __html: codeHTML };
return (
<pre style={preStyle}>
<code style={codeStyle} dangerouslySetInnerHTML={codeBlock} />
</pre>
);
}
export default CodeBlock;
| javascript | MIT | 6254386531d263688ccfa542d0e628fbc0de0b28 | 2026-01-04T14:56:49.538607Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.