├── test ├── fixtures │ ├── boostrap-sass │ │ ├── .disable-pnp │ │ ├── src │ │ │ ├── index.sass │ │ │ └── index.js │ │ ├── package.json │ │ └── index.test.js │ ├── webpack-message-formatting │ │ ├── .disable-pnp │ │ ├── src │ │ │ ├── Export5.js │ │ │ ├── AppCss.css │ │ │ ├── AppSass.scss │ │ │ ├── ExportNoDefault.js │ │ │ ├── FooExport.js │ │ │ ├── index.js │ │ │ ├── AppLintWarning.js │ │ │ ├── AppCss.js │ │ │ ├── AppSass.js │ │ │ ├── AppBabel.js │ │ │ ├── AppLintError.js │ │ │ ├── AppIncorrectCase.js │ │ │ ├── AppNoDefault.js │ │ │ ├── AppUnknownFile.js │ │ │ ├── AppOutOfScopeImport.js │ │ │ ├── AppMissingPackage.js │ │ │ ├── AppUnknownExport.js │ │ │ └── AppAliasUnknownExport.js │ │ └── package.json │ ├── issue-5176-flow-class-properties │ │ ├── package.json │ │ ├── src │ │ │ ├── App.test.js │ │ │ └── App.js │ │ └── index.test.js │ ├── relative-paths │ │ ├── src │ │ │ ├── index.js │ │ │ └── index.css │ │ ├── package.json │ │ └── index.test.js │ ├── mjs-support │ │ ├── src │ │ │ ├── index.js │ │ │ └── App.js │ │ ├── __snapshots__ │ │ │ └── index.test.js.snap │ │ ├── package.json │ │ └── index.test.js │ ├── __shared__ │ │ ├── template │ │ │ └── public │ │ │ │ └── index.html │ │ └── test-setup.js │ └── builds-with-multiple-runtimes │ │ ├── package.json │ │ ├── index.test.js │ │ └── src │ │ └── index.js ├── jest.config.js └── README.md ├── packages ├── react-scripts │ ├── .npmignore │ ├── fixtures │ │ └── kitchensink │ │ │ ├── src │ │ │ ├── features │ │ │ │ ├── webpack │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── aFileWithExt.unknown │ │ │ │ │ │ ├── aFileWithoutExt │ │ │ │ │ │ ├── abstract.json │ │ │ │ │ │ ├── svg.css │ │ │ │ │ │ ├── sass-styles.sass │ │ │ │ │ │ ├── sass-styles.module.sass │ │ │ │ │ │ ├── style.module.css │ │ │ │ │ │ ├── index.module.css │ │ │ │ │ │ ├── index.module.sass │ │ │ │ │ │ ├── index.module.scss │ │ │ │ │ │ ├── scss-styles.module.scss │ │ │ │ │ │ ├── tiniest-cat.jpg │ │ │ │ │ │ ├── style.css │ │ │ │ │ │ └── scss-styles.scss │ │ │ │ │ ├── SvgInCss.js │ │ │ │ │ ├── SvgInCss.test.js │ │ │ │ │ ├── CssInclusion.js │ │ │ │ │ ├── SassInclusion.js │ │ │ │ │ ├── ScssInclusion.js │ │ │ │ │ ├── SvgComponent.js │ │ │ │ │ ├── SvgInclusion.js │ │ │ │ │ ├── JsonInclusion.js │ │ │ │ │ ├── ImageInclusion.js │ │ │ │ │ ├── CssInclusion.test.js │ │ │ │ │ ├── SvgInclusion.test.js │ │ │ │ │ ├── JsonInclusion.test.js │ │ │ │ │ ├── SassInclusion.test.js │ │ │ │ │ ├── ScssInclusion.test.js │ │ │ │ │ ├── ImageInclusion.test.js │ │ │ │ │ ├── NoExtInclusion.test.js │ │ │ │ │ ├── LinkedModules.js │ │ │ │ │ ├── CssModulesInclusion.test.js │ │ │ │ │ ├── NoExtInclusion.js │ │ │ │ │ ├── UnknownExtInclusion.test.js │ │ │ │ │ ├── SassModulesInclusion.test.js │ │ │ │ │ ├── ScssModulesInclusion.test.js │ │ │ │ │ ├── SvgComponent.test.js │ │ │ │ │ ├── UnknownExtInclusion.js │ │ │ │ │ ├── CssModulesInclusion.js │ │ │ │ │ ├── SassModulesInclusion.js │ │ │ │ │ ├── ScssModulesInclusion.js │ │ │ │ │ └── LinkedModules.test.js │ │ │ │ ├── env │ │ │ │ │ ├── PublicUrl.js │ │ │ │ │ ├── ShellEnvVariables.js │ │ │ │ │ ├── PublicUrl.test.js │ │ │ │ │ ├── FileEnvVariables.test.js │ │ │ │ │ ├── ShellEnvVariables.test.js │ │ │ │ │ ├── ExpandEnvVariables.test.js │ │ │ │ │ ├── NodePath.test.js │ │ │ │ │ ├── ExpandEnvVariables.js │ │ │ │ │ ├── FileEnvVariables.js │ │ │ │ │ └── NodePath.js │ │ │ │ └── syntax │ │ │ │ │ ├── Generators.test.js │ │ │ │ │ ├── AsyncAwait.test.js │ │ │ │ │ ├── ArraySpread.test.js │ │ │ │ │ ├── ObjectSpread.test.js │ │ │ │ │ ├── RestAndDefault.test.js │ │ │ │ │ ├── RestParameters.test.js │ │ │ │ │ ├── ClassProperties.test.js │ │ │ │ │ ├── DefaultParameters.test.js │ │ │ │ │ ├── Promises.test.js │ │ │ │ │ ├── ArrayDestructuring.test.js │ │ │ │ │ ├── ComputedProperties.test.js │ │ │ │ │ ├── CustomInterpolation.test.js │ │ │ │ │ ├── ObjectDestructuring.test.js │ │ │ │ │ ├── DestructuringAndAwait.test.js │ │ │ │ │ ├── TemplateInterpolation.test.js │ │ │ │ │ ├── ClassProperties.js │ │ │ │ │ ├── ArrayDestructuring.js │ │ │ │ │ ├── ArraySpread.js │ │ │ │ │ ├── Promises.js │ │ │ │ │ ├── Generators.js │ │ │ │ │ ├── DefaultParameters.js │ │ │ │ │ ├── TemplateInterpolation.js │ │ │ │ │ ├── RestAndDefault.js │ │ │ │ │ ├── RestParameters.js │ │ │ │ │ ├── DestructuringAndAwait.js │ │ │ │ │ ├── ComputedProperties.js │ │ │ │ │ ├── ObjectSpread.js │ │ │ │ │ ├── ObjectDestructuring.js │ │ │ │ │ ├── AsyncAwait.js │ │ │ │ │ └── CustomInterpolation.js │ │ │ ├── subfolder │ │ │ │ └── lol.js │ │ │ ├── absoluteLoad.js │ │ │ └── index.js │ │ │ ├── .env.production │ │ │ ├── .env.development │ │ │ ├── .env.local │ │ │ ├── .flowconfig │ │ │ ├── public │ │ │ ├── favicon.ico │ │ │ └── index.html │ │ │ ├── jest.transform.js │ │ │ ├── jest.integration.config.js │ │ │ ├── .template.dependencies.json │ │ │ ├── gitignore │ │ │ └── .env │ ├── template │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── manifest.json │ │ │ └── index.html │ │ ├── src │ │ │ ├── App.test.js │ │ │ ├── index.css │ │ │ ├── index.js │ │ │ ├── App.css │ │ │ └── App.js │ │ └── gitignore │ ├── README.md │ ├── config │ │ └── jest │ │ │ ├── babelTransform.js │ │ │ ├── cssTransform.js │ │ │ └── fileTransform.js │ └── LICENSE ├── react-error-overlay │ ├── .gitignore │ ├── .gitattributes │ ├── .babelrc │ ├── .npmignore │ ├── fixtures │ │ ├── inline.es6.mjs │ │ ├── inline.mjs │ │ └── junk-inline.mjs │ ├── .eslintrc │ ├── .flowconfig │ ├── src │ │ ├── __tests__ │ │ │ ├── setupJest.js │ │ │ ├── __snapshots__ │ │ │ │ ├── script-lines.js.snap │ │ │ │ ├── stack-frame.js.snap │ │ │ │ └── lines-around.js.snap │ │ │ ├── script-lines.js │ │ │ ├── parser │ │ │ │ ├── react.js │ │ │ │ ├── safari.js │ │ │ │ ├── chrome.js │ │ │ │ ├── generic.js │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── safari.js.snap │ │ │ │ │ ├── react.js.snap │ │ │ │ │ └── chrome.js.snap │ │ │ │ └── firefox.js │ │ │ ├── lines-around.js │ │ │ ├── extract-source-map.js │ │ │ └── stack-frame.js │ │ ├── utils │ │ │ ├── isInternalFile.js │ │ │ ├── isBultinErrorName.js │ │ │ ├── getLinesAround.js │ │ │ ├── dom │ │ │ │ ├── absolutifyCaret.js │ │ │ │ └── css.js │ │ │ ├── getStackFrames.js │ │ │ ├── getPrettyURL.js │ │ │ ├── warnings.js │ │ │ └── parseCompileError.js │ │ ├── components │ │ │ ├── Footer.js │ │ │ ├── Header.js │ │ │ ├── CloseButton.js │ │ │ ├── CodeBlock.js │ │ │ └── NavigationBar.js │ │ ├── styles.js │ │ ├── effects │ │ │ ├── stackTraceLimit.js │ │ │ ├── unhandledError.js │ │ │ └── unhandledRejection.js │ │ ├── containers │ │ │ └── CompileErrorContainer.js │ │ └── iframeScript.js │ ├── flow │ │ └── env.js │ ├── README.md │ ├── LICENSE │ └── webpack.config.js ├── react-dev-utils │ ├── __tests__ │ │ ├── .eslintrc │ │ └── ignoredFiles.test.js │ ├── inquirer.js │ ├── crossSpawn.js │ ├── launchEditorEndpoint.js │ ├── clearConsole.js │ ├── ignoredFiles.js │ ├── getCacheIdentifier.js │ ├── errorOverlayMiddleware.js │ ├── checkRequiredFiles.js │ ├── LICENSE │ ├── WatchMissingNodeModulesPlugin.js │ ├── getCSSModuleLocalIdent.js │ ├── printBuildError.js │ ├── noopServiceWorkerMiddleware.js │ ├── InterpolateHtmlPlugin.js │ └── evalSourceMapMiddleware.js ├── babel-preset-react-app │ ├── test.js │ ├── dev.js │ ├── prod.js │ ├── index.js │ ├── LICENSE │ ├── webpack-overrides.js │ └── package.json ├── create-react-app │ ├── README.md │ ├── package.json │ └── LICENSE ├── babel-plugin-named-asset-import │ ├── package.json │ └── LICENSE ├── react-app-polyfill │ ├── jsdom.js │ ├── package.json │ ├── ie11.js │ ├── LICENSE │ ├── ie9.js │ └── README.md ├── confusing-browser-globals │ ├── package.json │ ├── test.js │ ├── LICENSE │ ├── index.js │ └── README.md └── eslint-config-react-app │ ├── package.json │ └── LICENSE ├── .prettierrc ├── .eslintignore ├── docusaurus ├── website │ ├── static │ │ ├── img │ │ │ ├── logo-og.png │ │ │ ├── oss_logo.png │ │ │ └── favicon │ │ │ │ └── favicon.ico │ │ └── css │ │ │ └── custom.css │ ├── sidebars.json │ ├── package.json │ └── i18n │ │ └── en.json └── docs │ ├── user-guide.md │ └── README.md ├── appveyor.cleanup-cache.txt ├── .gitignore ├── .github └── PULL_REQUEST_TEMPLATE.md ├── CODE_OF_CONDUCT.md ├── .eslintrc ├── lerna.json ├── .travis.yml ├── tasks ├── screencast.sh ├── publish.sh ├── screencast-start.js ├── verdaccio.yaml ├── compile-lockfile.js └── e2e-old-node.sh ├── LICENSE ├── appveyor.yml └── package.json /test/fixtures/boostrap-sass/.disable-pnp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/react-scripts/.npmignore: -------------------------------------------------------------------------------- 1 | /fixtures 2 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/.disable-pnp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/react-error-overlay/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | coverage/ 3 | -------------------------------------------------------------------------------- /packages/react-error-overlay/.gitattributes: -------------------------------------------------------------------------------- 1 | *.js text eol=lf 2 | -------------------------------------------------------------------------------- /test/fixtures/issue-5176-flow-class-properties/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/fixtures/relative-paths/src/index.js: -------------------------------------------------------------------------------- 1 | import './index.css'; 2 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/Export5.js: -------------------------------------------------------------------------------- 1 | export default 5; 2 | -------------------------------------------------------------------------------- /packages/react-error-overlay/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-app"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/react-error-overlay/.npmignore: -------------------------------------------------------------------------------- 1 | __tests__ 2 | *.test.js 3 | *.spec.js 4 | -------------------------------------------------------------------------------- /test/fixtures/boostrap-sass/src/index.sass: -------------------------------------------------------------------------------- 1 | @import "~bootstrap/scss/bootstrap.scss"; 2 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppCss.css: -------------------------------------------------------------------------------- 1 | .App { 2 | color: red; 3 | }} 4 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppSass.scss: -------------------------------------------------------------------------------- 1 | .App { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/ExportNoDefault.js: -------------------------------------------------------------------------------- 1 | export const six = 6; 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "singleQuote": true, 4 | "semi": true 5 | } 6 | -------------------------------------------------------------------------------- /packages/react-dev-utils/__tests__/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/relative-paths/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": {}, 3 | "homepage": "." 4 | } 5 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/aFileWithExt.unknown: -------------------------------------------------------------------------------- 1 | Whoooo, spooky! 2 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/FooExport.js: -------------------------------------------------------------------------------- 1 | export function foo() { 2 | console.log('bar'); 3 | } 4 | -------------------------------------------------------------------------------- /packages/react-error-overlay/fixtures/inline.es6.mjs: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.log('bar') 3 | } 4 | 5 | export { foo } 6 | -------------------------------------------------------------------------------- /packages/react-error-overlay/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "react-app", 3 | "rules": { 4 | "curly": "warn" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/aFileWithoutExt: -------------------------------------------------------------------------------- 1 | This is just a file without an extension 2 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/.env.production: -------------------------------------------------------------------------------- 1 | REACT_APP_X = x-from-production-env 2 | REACT_APP_PRODUCTION = production 3 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/abstract.json: -------------------------------------------------------------------------------- 1 | { 2 | "abstract": "This is an abstract." 3 | } 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | build 3 | my-app* 4 | packages/react-scripts/template 5 | packages/react-scripts/fixtures 6 | fixtures/ 7 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/.env.development: -------------------------------------------------------------------------------- 1 | REACT_APP_X = x-from-development-env 2 | REACT_APP_DEVELOPMENT = development 3 | -------------------------------------------------------------------------------- /docusaurus/website/static/img/logo-og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minesaner/create-react-app/HEAD/docusaurus/website/static/img/logo-og.png -------------------------------------------------------------------------------- /docusaurus/website/static/img/oss_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minesaner/create-react-app/HEAD/docusaurus/website/static/img/oss_logo.png -------------------------------------------------------------------------------- /docusaurus/website/sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "Getting Started": ["getting-started"], 4 | "User Guide": ["user-guide"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /appveyor.cleanup-cache.txt: -------------------------------------------------------------------------------- 1 | Edit this file to trigger a cache rebuild. 2 | http://help.appveyor.com/discussions/questions/1310-delete-cache 3 | 4 | ---- 5 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/svg.css: -------------------------------------------------------------------------------- 1 | #feature-svg-in-css { 2 | background-image: url("./logo.svg"); 3 | } 4 | -------------------------------------------------------------------------------- /docusaurus/website/static/img/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minesaner/create-react-app/HEAD/docusaurus/website/static/img/favicon/favicon.ico -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/.env.local: -------------------------------------------------------------------------------- 1 | REACT_APP_X = x-from-original-local-env 2 | REACT_APP_ORIGINAL_2 = override-from-original-local-env-2 3 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | /node_modules/fbjs/.* 3 | 4 | [include] 5 | 6 | [libs] 7 | 8 | [options] 9 | -------------------------------------------------------------------------------- /packages/react-scripts/template/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minesaner/create-react-app/HEAD/packages/react-scripts/template/public/favicon.ico -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/sass-styles.sass: -------------------------------------------------------------------------------- 1 | #feature-sass-inclusion 2 | background: ghostwhite 3 | color: crimson 4 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/sass-styles.module.sass: -------------------------------------------------------------------------------- 1 | .sassModulesInclusion 2 | background: darkblue 3 | color: lightblue 4 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/style.module.css: -------------------------------------------------------------------------------- 1 | .cssModulesInclusion { 2 | background: darkblue; 3 | color: lightblue; 4 | } 5 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/index.module.css: -------------------------------------------------------------------------------- 1 | .cssModulesIndexInclusion { 2 | background: darkblue; 3 | color: lightblue; 4 | } 5 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/index.module.sass: -------------------------------------------------------------------------------- 1 | .sassModulesIndexInclusion 2 | background: darkblue 3 | color: lightblue 4 | 5 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/index.module.scss: -------------------------------------------------------------------------------- 1 | .scssModulesIndexInclusion { 2 | background: darkblue; 3 | color: lightblue; 4 | } 5 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/scss-styles.module.scss: -------------------------------------------------------------------------------- 1 | .scssModulesInclusion { 2 | background: darkblue; 3 | color: lightblue; 4 | } 5 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minesaner/create-react-app/HEAD/packages/react-scripts/fixtures/kitchensink/public/favicon.ico -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/jest.transform.js: -------------------------------------------------------------------------------- 1 | const babelOptions = { presets: ['react-app'] }; 2 | 3 | module.exports = require('babel-jest').createTransformer(babelOptions); 4 | -------------------------------------------------------------------------------- /test/fixtures/boostrap-sass/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "bootstrap": "4.x", 4 | "node-sass": "4.x", 5 | "react": "latest", 6 | "react-dom": "latest" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SvgInCss.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './assets/svg.css'; 3 | 4 | export default () =>
; 5 | -------------------------------------------------------------------------------- /test/fixtures/boostrap-sass/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.sass'; 4 | 5 | ReactDOM.render(
, document.getElementById('root')); 6 | -------------------------------------------------------------------------------- /test/fixtures/mjs-support/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | ReactDOM.render(, document.getElementById('root')); 6 | -------------------------------------------------------------------------------- /test/jest.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | testEnvironment: 'node', 5 | testMatch: ['/**/*.test.js'], 6 | testPathIgnorePatterns: ['/src/', 'node_modules'], 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/issue-5176-flow-class-properties/src/App.test.js: -------------------------------------------------------------------------------- 1 | import App from './App'; 2 | 3 | it('creates instance without', () => { 4 | const app = new App(); 5 | expect(app.foo()).toBe('bar'); 6 | }); 7 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "react": "latest", 4 | "react-dom": "latest" 5 | }, 6 | "browserslist": [ 7 | ">0.2%" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | ReactDOM.render(, document.getElementById('root')); 6 | -------------------------------------------------------------------------------- /test/fixtures/relative-paths/src/index.css: -------------------------------------------------------------------------------- 1 | .RootSvg:before { 2 | display: block; 3 | content: ' '; 4 | background-image: url(./logo.svg); 5 | background-size: 28px 28px; 6 | height: 28px; 7 | width: 28px; 8 | } 9 | -------------------------------------------------------------------------------- /test/fixtures/__shared__/template/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | React App 5 | 6 | 7 |
8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/jest.integration.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: 'node', 3 | testMatch: ['**/integration/*.test.js'], 4 | transform: { '^.+\\.js$': './jest.transform.js' }, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/tiniest-cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minesaner/create-react-app/HEAD/packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/tiniest-cat.jpg -------------------------------------------------------------------------------- /test/fixtures/builds-with-multiple-runtimes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "dva": "2.4.0", 4 | "history": "4.7.2", 5 | "ky": "0.3.0", 6 | "react": "latest", 7 | "react-dom": "latest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/mjs-support/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`can use mjs library in development 1`] = `"Pikachu"`; 4 | 5 | exports[`can use mjs library in production 1`] = `"Pikachu"`; 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vscode/ 3 | node_modules/ 4 | build 5 | .DS_Store 6 | *.tgz 7 | my-app* 8 | template/src/__tests__/__snapshots__/ 9 | lerna-debug.log 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | /.changelog 14 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /test/fixtures/issue-5176-flow-class-properties/src/App.js: -------------------------------------------------------------------------------- 1 | class App { 2 | constructor() { 3 | this.foo = this.foo.bind(this); 4 | } 5 | foo: void => void; 6 | foo() { 7 | return 'bar'; 8 | } 9 | } 10 | 11 | export default App; 12 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppLintWarning.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | function foo() {} 4 | 5 | class App extends Component { 6 | render() { 7 | return
; 8 | } 9 | } 10 | 11 | export default App; 12 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated. 4 | -------------------------------------------------------------------------------- /docusaurus/docs/user-guide.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: user-guide 3 | title: User guide 4 | sidebar_label: User guide 5 | --- 6 | 7 | The user guide can be found on [GitHub](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md) for now. 8 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppCss.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import './AppCss.css'; 3 | 4 | class App extends Component { 5 | render() { 6 | return
; 7 | } 8 | } 9 | 10 | export default App; 11 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppSass.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import './AppSass.scss'; 3 | 4 | class App extends Component { 5 | render() { 6 | return
; 7 | } 8 | } 9 | 10 | export default App; 11 | -------------------------------------------------------------------------------- /docusaurus/docs/README.md: -------------------------------------------------------------------------------- 1 | # Nothing to see here right now 2 | 3 | Please refer to the [Readme](https://github.com/facebook/create-react-app/blob/master/README.md) or the [User Guide](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md). 4 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppBabel.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | class App extends Component { 4 | render() { 5 | return ( 6 |
7 | 8 |
9 | ); 10 | } 11 | } 12 | 13 | export default App; 14 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppLintError.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | function foo() { 4 | const a = b; 5 | } 6 | 7 | class App extends Component { 8 | render() { 9 | return
; 10 | } 11 | } 12 | 13 | export default App; 14 | -------------------------------------------------------------------------------- /packages/react-error-overlay/.flowconfig: -------------------------------------------------------------------------------- 1 | [include] 2 | /src/**/*.js 3 | 4 | [ignore] 5 | .*/node_modules/.* 6 | .*/.git/.* 7 | .*/__test__/.* 8 | .*/fixtures/.* 9 | 10 | [libs] 11 | flow/ 12 | 13 | [options] 14 | module.file_ext=.js 15 | sharedmemory.hash_table_pow=19 16 | -------------------------------------------------------------------------------- /test/fixtures/mjs-support/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "apollo-boost": "0.1.16", 4 | "graphql": "14.0.2", 5 | "react-apollo": "2.2.1", 6 | "apollo-client": "2.4.2", 7 | "react": "latest", 8 | "react-dom": "latest", 9 | "serve": "10.0.2" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppIncorrectCase.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import five from './export5'; 3 | 4 | class App extends Component { 5 | render() { 6 | return
{five}
; 7 | } 8 | } 9 | 10 | export default App; 11 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/.template.dependencies.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "bootstrap": "4.1.1", 4 | "jest": "23.6.0", 5 | "node-sass": "4.8.3", 6 | "normalize.css": "7.0.0", 7 | "prop-types": "15.5.6", 8 | "test-integrity": "1.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | build 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | npm-debug.log 16 | -------------------------------------------------------------------------------- /test/fixtures/issue-5176-flow-class-properties/index.test.js: -------------------------------------------------------------------------------- 1 | const testSetup = require('../__shared__/test-setup'); 2 | 3 | test('passes tests', async () => { 4 | const { fulfilled } = await testSetup.scripts.test({ 5 | jestEnvironment: 'node', 6 | }); 7 | expect(fulfilled).toBe(true); 8 | }); 9 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/setupJest.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | global.fetch = require('jest-fetch-mock'); 9 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppNoDefault.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import myImport from './ExportNoDefault'; 3 | 4 | class App extends Component { 5 | render() { 6 | return
{myImport}
; 7 | } 8 | } 9 | 10 | export default App; 11 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppUnknownFile.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import DefaultExport from './ThisFileSouldNotExist'; 3 | 4 | class App extends Component { 5 | render() { 6 | return
; 7 | } 8 | } 9 | 10 | export default App; 11 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppOutOfScopeImport.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import myImport from '../OutOfScopeImport'; 3 | 4 | class App extends Component { 5 | render() { 6 | return
{myImport}
; 7 | } 8 | } 9 | 10 | export default App; 11 | -------------------------------------------------------------------------------- /packages/react-scripts/template/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppMissingPackage.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { bar } from 'unknown-package'; 3 | 4 | class App extends Component { 5 | componentDidMount() { 6 | bar(); 7 | } 8 | render() { 9 | return
; 10 | } 11 | } 12 | 13 | export default App; 14 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppUnknownExport.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { bar } from './AppUnknownExport'; 3 | 4 | class App extends Component { 5 | componentDidMount() { 6 | bar(); 7 | } 8 | render() { 9 | return
; 10 | } 11 | } 12 | 13 | export default App; 14 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/subfolder/lol.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | module.exports = function() { 9 | return `haha`; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Ensure CSS inclusion doesn't regress 3 | * https://github.com/facebook/create-react-app/issues/2677 4 | */ 5 | @import '~normalize.css/normalize.css'; 6 | 7 | #feature-css-inclusion { 8 | background: palevioletred; 9 | color: papayawhip; 10 | } 11 | -------------------------------------------------------------------------------- /test/fixtures/webpack-message-formatting/src/AppAliasUnknownExport.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { bar as bar2 } from './AppUnknownExport'; 3 | 4 | class App extends Component { 5 | componentDidMount() { 6 | bar2(); 7 | } 8 | render() { 9 | return
; 10 | } 11 | } 12 | 13 | export default App; 14 | -------------------------------------------------------------------------------- /packages/react-dev-utils/inquirer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var inquirer = require('inquirer'); 11 | 12 | module.exports = inquirer; 13 | -------------------------------------------------------------------------------- /packages/react-dev-utils/crossSpawn.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var crossSpawn = require('cross-spawn'); 11 | 12 | module.exports = crossSpawn; 13 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/.env: -------------------------------------------------------------------------------- 1 | REACT_APP_X = x-from-original-env 2 | REACT_APP_ORIGINAL_1 = from-original-env-1 3 | REACT_APP_ORIGINAL_2 = from-original-env-2 4 | REACT_APP_BASIC = basic 5 | REACT_APP_BASIC_EXPAND = ${REACT_APP_BASIC} 6 | REACT_APP_BASIC_EXPAND_SIMPLE = $REACT_APP_BASIC 7 | REACT_APP_EXPAND_EXISTING = $REACT_APP_SHELL_ENV_MESSAGE 8 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "browser": true, 5 | "commonjs": true, 6 | "node": true, 7 | "es6": true 8 | }, 9 | "parserOptions": { 10 | "ecmaVersion": 2018 11 | }, 12 | "rules": { 13 | "no-console": "off", 14 | "strict": ["error", "global"], 15 | "curly": "warn" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SvgInCss.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import SvgInCss from './SvgInCss'; 4 | 5 | describe('svg in css', () => { 6 | it('renders without crashing', () => { 7 | const div = document.createElement('div'); 8 | ReactDOM.render(, div); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /docusaurus/website/static/css/custom.css: -------------------------------------------------------------------------------- 1 | /* your custom css */ 2 | 3 | @media only screen and (min-device-width: 360px) and (max-device-width: 736px) { 4 | } 5 | 6 | @media only screen and (min-width: 1024px) { 7 | } 8 | 9 | @media only screen and (max-width: 1023px) { 10 | } 11 | 12 | @media only screen and (min-width: 1400px) { 13 | } 14 | 15 | @media only screen and (min-width: 1500px) { 16 | } -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | React App 8 | 9 | 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/react-dev-utils/launchEditorEndpoint.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | // TODO: we might want to make this injectable to support DEV-time non-root URLs. 10 | module.exports = '/__open-stack-frame-in-editor'; 11 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/absoluteLoad.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | export default () => [ 9 | { id: 1, name: '1' }, 10 | { id: 2, name: '2' }, 11 | { id: 3, name: '3' }, 12 | { id: 4, name: '4' }, 13 | ]; 14 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/PublicUrl.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | 10 | export default () => ( 11 | {process.env.PUBLIC_URL}. 12 | ); 13 | -------------------------------------------------------------------------------- /packages/react-scripts/template/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /packages/react-scripts/template/gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import App from './App'; 11 | 12 | ReactDOM.render(, document.getElementById('root')); 13 | -------------------------------------------------------------------------------- /packages/babel-preset-react-app/test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | const create = require('./create'); 10 | 11 | module.exports = function(api, opts) { 12 | return create(api, Object.assign({ helpers: false }, opts), 'test'); 13 | }; 14 | -------------------------------------------------------------------------------- /test/fixtures/builds-with-multiple-runtimes/index.test.js: -------------------------------------------------------------------------------- 1 | const testSetup = require('../__shared__/test-setup'); 2 | 3 | test('builds in development', async () => { 4 | const { fulfilled } = await testSetup.scripts.start({ smoke: true }); 5 | expect(fulfilled).toBe(true); 6 | }); 7 | test('builds in production', async () => { 8 | const { fulfilled } = await testSetup.scripts.build(); 9 | expect(fulfilled).toBe(true); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import './assets/style.css'; 10 | 11 | export default () =>

We love useless text.

; 12 | -------------------------------------------------------------------------------- /packages/babel-preset-react-app/dev.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | const create = require('./create'); 10 | 11 | module.exports = function(api, opts) { 12 | return create(api, Object.assign({ helpers: false }, opts), 'development'); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/babel-preset-react-app/prod.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | const create = require('./create'); 10 | 11 | module.exports = function(api, opts) { 12 | return create(api, Object.assign({ helpers: false }, opts), 'production'); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/react-error-overlay/flow/env.js: -------------------------------------------------------------------------------- 1 | declare module 'anser' { 2 | declare module.exports: any; 3 | } 4 | 5 | declare module 'babel-code-frame' { 6 | declare module.exports: any; 7 | } 8 | 9 | declare module 'html-entities' { 10 | declare module.exports: any; 11 | } 12 | 13 | declare module 'settle-promise' { 14 | declare module.exports: any; 15 | } 16 | 17 | declare module 'source-map' { 18 | declare module.exports: any; 19 | } 20 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/__snapshots__/script-lines.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`script line shape 1`] = ` 4 | ScriptLine { 5 | "content": "foobar", 6 | "highlight": true, 7 | "lineNumber": 5, 8 | } 9 | `; 10 | 11 | exports[`script line to provide default highlight 1`] = ` 12 | ScriptLine { 13 | "content": "foobar", 14 | "highlight": false, 15 | "lineNumber": 5, 16 | } 17 | `; 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SassInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import './assets/sass-styles.sass'; 10 | 11 | export default () =>

We love useless text.

; 12 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/ScssInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import './assets/scss-styles.scss'; 10 | 11 | export default () =>

We love useless text.

; 12 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SvgComponent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import { ReactComponent as Logo } from './assets/logo.svg'; 10 | 11 | export default () => ; 12 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SvgInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import logo from './assets/logo.svg'; 10 | 11 | export default () => logo; 12 | -------------------------------------------------------------------------------- /docusaurus/website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "examples": "docusaurus-examples", 4 | "start": "docusaurus-start", 5 | "build": "docusaurus-build", 6 | "publish-gh-pages": "docusaurus-publish", 7 | "write-translations": "docusaurus-write-translations", 8 | "version": "docusaurus-version", 9 | "rename-version": "docusaurus-rename-version" 10 | }, 11 | "devDependencies": { 12 | "docusaurus": "^1.4.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/JsonInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import { abstract } from './assets/abstract.json'; 10 | 11 | export default () => {abstract}; 12 | -------------------------------------------------------------------------------- /packages/react-dev-utils/clearConsole.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | function clearConsole() { 11 | process.stdout.write( 12 | process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H' 13 | ); 14 | } 15 | 16 | module.exports = clearConsole; 17 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/ShellEnvVariables.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | 10 | export default () => ( 11 | 12 | {process.env.REACT_APP_SHELL_ENV_MESSAGE}. 13 | 14 | ); 15 | -------------------------------------------------------------------------------- /packages/react-scripts/template/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | } 10 | 11 | code { 12 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 13 | monospace; 14 | } 15 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/scss-styles.scss: -------------------------------------------------------------------------------- 1 | @import "~bootstrap/scss/functions"; 2 | @import "~bootstrap/scss/variables"; 3 | @import "~bootstrap/scss/mixins"; 4 | 5 | @import "~bootstrap/scss/reboot"; 6 | @import "~bootstrap/scss/type"; 7 | @import "~bootstrap/scss/images"; 8 | @import "~bootstrap/scss/code"; 9 | @import "~bootstrap/scss/grid"; 10 | 11 | #feature-scss-inclusion { 12 | background: ghostwhite; 13 | color: crimson; 14 | } 15 | -------------------------------------------------------------------------------- /test/fixtures/builds-with-multiple-runtimes/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import dva from 'dva'; 3 | import createHistory from 'history/createHashHistory'; 4 | import ky from 'ky'; 5 | 6 | const app = dva({ history: createHistory() }); 7 | app.router(() => { 8 | ky.get('https://canihazip.com/s') 9 | .then(r => r.text()) 10 | .then(console.log, console.error) 11 | .then(() => console.log('ok')); 12 | return
Test
; 13 | }); 14 | app.start('#root'); 15 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/ImageInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import tiniestCat from './assets/tiniest-cat.jpg'; 10 | 11 | export default () => ( 12 | tiniest cat 13 | ); 14 | -------------------------------------------------------------------------------- /packages/create-react-app/README.md: -------------------------------------------------------------------------------- 1 | # create-react-app 2 | 3 | This package includes the global command for [Create React App](https://github.com/facebook/create-react-app).
4 | Please refer to its documentation: 5 | 6 | - [Getting Started](https://github.com/facebook/create-react-app/blob/master/README.md#getting-started) – How to create a new app. 7 | - [User Guide](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md) – How to develop apps bootstrapped with Create React App. 8 | -------------------------------------------------------------------------------- /packages/react-scripts/README.md: -------------------------------------------------------------------------------- 1 | # react-scripts 2 | 3 | This package includes scripts and configuration used by [Create React App](https://github.com/facebook/create-react-app).
4 | Please refer to its documentation: 5 | 6 | - [Getting Started](https://github.com/facebook/create-react-app/blob/master/README.md#getting-started) – How to create a new app. 7 | - [User Guide](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md) – How to develop apps bootstrapped with Create React App. 8 | -------------------------------------------------------------------------------- /packages/react-scripts/config/jest/babelTransform.js: -------------------------------------------------------------------------------- 1 | // @remove-file-on-eject 2 | /** 3 | * Copyright (c) 2014-present, Facebook, Inc. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 'use strict'; 9 | 10 | const babelJest = require('babel-jest'); 11 | 12 | module.exports = babelJest.createTransformer({ 13 | presets: [require.resolve('babel-preset-react-app')], 14 | babelrc: false, 15 | configFile: false, 16 | }); 17 | -------------------------------------------------------------------------------- /packages/react-scripts/template/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: http://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /packages/babel-plugin-named-asset-import/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-named-asset-import", 3 | "version": "0.2.2", 4 | "description": "Babel plugin for named asset imports in Create React App", 5 | "repository": "facebookincubator/create-react-app", 6 | "license": "MIT", 7 | "bugs": { 8 | "url": "https://github.com/facebookincubator/create-react-app/issues" 9 | }, 10 | "main": "index.js", 11 | "files": [ 12 | "index.js" 13 | ], 14 | "peerDependencies": { 15 | "@babel/core": "^7.1.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/react-app-polyfill/jsdom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | // Make sure we're in a Browser-like environment before importing polyfills 10 | // This prevents `fetch()` from being imported in a Node test environment 11 | if (typeof window !== 'undefined') { 12 | // fetch() polyfill for making API calls. 13 | require('whatwg-fetch'); 14 | } 15 | -------------------------------------------------------------------------------- /packages/confusing-browser-globals/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "confusing-browser-globals", 3 | "version": "1.0.4", 4 | "description": "A list of browser globals that are often used by mistake instead of local variables", 5 | "license": "MIT", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "jest" 9 | }, 10 | "repository": "facebook/create-react-app", 11 | "keywords": [ 12 | "eslint", 13 | "globals" 14 | ], 15 | "files": [ 16 | "index.js" 17 | ], 18 | "devDependencies": { 19 | "jest": "23.6.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/confusing-browser-globals/test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* eslint-env jest */ 9 | 10 | 'use strict'; 11 | 12 | let globals = require('./index'); 13 | 14 | it('should return an Array of globals', () => { 15 | expect(Array.isArray(globals)).toBe(true); 16 | }); 17 | 18 | it('should contain "event" variable', () => { 19 | expect(globals).toContain('event'); 20 | }); 21 | -------------------------------------------------------------------------------- /test/fixtures/boostrap-sass/index.test.js: -------------------------------------------------------------------------------- 1 | const testSetup = require('../__shared__/test-setup'); 2 | 3 | if (testSetup.isLocal) { 4 | // TODO: make this work locally 5 | test('skipped locally', () => {}); 6 | } else { 7 | test('builds in development', async () => { 8 | const { fulfilled } = await testSetup.scripts.start({ smoke: true }); 9 | expect(fulfilled).toBe(true); 10 | }); 11 | 12 | test('builds in production', async () => { 13 | const { fulfilled } = await testSetup.scripts.build(); 14 | expect(fulfilled).toBe(true); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/script-lines.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { ScriptLine } from '../utils/stack-frame'; 9 | 10 | test('script line shape', () => { 11 | expect(new ScriptLine(5, 'foobar', true)).toMatchSnapshot(); 12 | }); 13 | 14 | test('script line to provide default highlight', () => { 15 | expect(new ScriptLine(5, 'foobar')).toMatchSnapshot(); 16 | }); 17 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.6.0", 3 | "npmClient": "yarn", 4 | "useWorkspaces": true, 5 | "version": "independent", 6 | "changelog": { 7 | "repo": "facebook/create-react-app", 8 | "labels": { 9 | "tag: new feature": ":rocket: New Feature", 10 | "tag: breaking change": ":boom: Breaking Change", 11 | "tag: bug fix": ":bug: Bug Fix", 12 | "tag: enhancement": ":nail_care: Enhancement", 13 | "tag: documentation": ":memo: Documentation", 14 | "tag: internal": ":house: Internal" 15 | }, 16 | "cacheDir": ".changelog" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/react-dev-utils/ignoredFiles.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | const path = require('path'); 11 | const escape = require('escape-string-regexp'); 12 | 13 | module.exports = function ignoredFiles(appSrc) { 14 | return new RegExp( 15 | `^(?!${escape( 16 | path.normalize(appSrc + '/').replace(/[\\]+/g, '/') 17 | )}).+/node_modules/`, 18 | 'g' 19 | ); 20 | }; 21 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/PublicUrl.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import PublicUrl from './PublicUrl'; 11 | 12 | describe('PUBLIC_URL', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-error-overlay/fixtures/inline.mjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | function foo() { 7 | console.log('bar'); 8 | } 9 | 10 | exports.foo = foo; 11 | 12 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxTQUFTLEdBQVQsR0FBZTtBQUNiLFVBQVEsR0FBUixDQUFZLEtBQVo7QUFDRDs7UUFFUSxHLEdBQUEsRyIsImZpbGUiOiJzdGRvdXQiLCJzb3VyY2VzQ29udGVudCI6WyJmdW5jdGlvbiBmb28oKSB7XG4gIGNvbnNvbGUubG9nKCdiYXInKVxufVxuXG5leHBvcnQgeyBmb28gfVxuIl19 13 | -------------------------------------------------------------------------------- /packages/react-error-overlay/fixtures/junk-inline.mjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | function foo() { 7 | console.log('bar'); 8 | } 9 | 10 | exports.foo = foo; 11 | 12 | //# sourceMappingURL=data:application/json;charset=utf-8;base64vlq,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxTQUFTLEdBQVQsR0FBZTtBQUNiLFVBQVEsR0FBUixDQUFZLEtBQVo7QUFDRDs7UUFFUSxHLEdBQUEsRyIsImZpbGUiOiJzdGRvdXQiLCJzb3VyY2VzQ29udGVudCI6WyJmdW5jdGlvbiBmb28oKSB7XG4gIGNvbnNvbGUubG9nKCdiYXInKVxufVxuXG5leHBvcnQgeyBmb28gfVxuIl19 13 | -------------------------------------------------------------------------------- /packages/react-error-overlay/README.md: -------------------------------------------------------------------------------- 1 | # `react-error-overlay` 2 | 3 | `react-error-overlay` is an overlay which displays when there is a runtime error. 4 | 5 | ## Development 6 | 7 | When developing within this package, make sure you run `npm start` (or `yarn start`) so that the files are compiled as you work. 8 | This is ran in watch mode by default. 9 | 10 | If you would like to build this for production, run `npm run build:prod` (or `yarn build:prod`).
11 | If you would like to build this one-off for development, you can run `NODE_ENV=development npm run build` (or `NODE_ENV=development yarn build`). 12 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import CssInclusion from './CssInclusion'; 11 | 12 | describe('css inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SvgInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import SvgInclusion from './SvgInclusion'; 11 | 12 | describe('svg inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/JsonInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import JsonInclusion from './JsonInclusion'; 11 | 12 | describe('JSON inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SassInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import SassInclusion from './SassInclusion'; 11 | 12 | describe('sass inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/ScssInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ScssInclusion from './ScssInclusion'; 11 | 12 | describe('scss inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/ImageInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ImageInclusion from './ImageInclusion'; 11 | 12 | describe('image inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/NoExtInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import NoExtInclusion from './NoExtInclusion'; 11 | 12 | describe('no ext inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/FileEnvVariables.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import FileEnvVariables from './FileEnvVariables'; 11 | 12 | describe('.env variables', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/ShellEnvVariables.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ShellEnvVariables from './ShellEnvVariables'; 11 | 12 | describe('shell env variables', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/LinkedModules.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import './assets/style.css'; 10 | import { test, version } from 'test-integrity'; 11 | 12 | export default () => { 13 | const v = version(); 14 | if (!test() || v !== '2.0.0') { 15 | throw new Error('Functionality test did not pass.'); 16 | } 17 | return

{v}

; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/ExpandEnvVariables.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ExpandEnvVariables from './ExpandEnvVariables'; 11 | 12 | describe('expand .env variables', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssModulesInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import CssModulesInclusion from './CssModulesInclusion'; 11 | 12 | describe('css modules inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/NoExtInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import aFileWithoutExt from './assets/aFileWithoutExt'; 10 | 11 | const text = aFileWithoutExt.includes('base64') 12 | ? atob(aFileWithoutExt.split('base64,')[1]).trim() 13 | : aFileWithoutExt; 14 | 15 | export default () => ( 16 | 17 | aFileWithoutExt 18 | 19 | ); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/UnknownExtInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import UnknownExtInclusion from './UnknownExtInclusion'; 11 | 12 | describe('unknown ext inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/template/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 40vmin; 8 | } 9 | 10 | .App-header { 11 | background-color: #282c34; 12 | min-height: 100vh; 13 | display: flex; 14 | flex-direction: column; 15 | align-items: center; 16 | justify-content: center; 17 | font-size: calc(10px + 2vmin); 18 | color: white; 19 | } 20 | 21 | .App-link { 22 | color: #61dafb; 23 | } 24 | 25 | @keyframes App-logo-spin { 26 | from { 27 | transform: rotate(0deg); 28 | } 29 | to { 30 | transform: rotate(360deg); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SassModulesInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import SassModulesInclusion from './SassModulesInclusion'; 11 | 12 | describe('sass modules inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/ScssModulesInclusion.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ScssModulesInclusion from './ScssModulesInclusion'; 11 | 12 | describe('scss modules inclusion', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/parser/react.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { parse } from '../../utils/parser'; 9 | 10 | test('15.y.z', () => { 11 | expect( 12 | parse( 13 | `Warning: Each child in array should have a unique "key" prop. Check render method of \`FileA\`. 14 | in div (at FileA.js:9) 15 | in FileA (at App.js:9) 16 | in div (at App.js:8) 17 | in App (at index.js:7)` 18 | ) 19 | ).toMatchSnapshot(); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/NodePath.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import NodePath from './NodePath'; 11 | 12 | describe('NODE_PATH', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SvgComponent.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import SvgComponent from './SvgComponent'; 11 | 12 | describe('svg component', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | ReactDOM.render(, div); 16 | expect(div.textContent).toBe('logo.svg'); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/Generators.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import Generators from './Generators'; 11 | 12 | describe('generators', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/AsyncAwait.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import AsyncAwait from './AsyncAwait'; 11 | 12 | describe('async/await', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/config/jest/cssTransform.js: -------------------------------------------------------------------------------- 1 | // @remove-on-eject-begin 2 | /** 3 | * Copyright (c) 2014-present, Facebook, Inc. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | // @remove-on-eject-end 9 | 'use strict'; 10 | 11 | // This is a custom Jest transformer turning style imports into empty objects. 12 | // http://facebook.github.io/jest/docs/en/webpack.html 13 | 14 | module.exports = { 15 | process() { 16 | return 'module.exports = {};'; 17 | }, 18 | getCacheKey() { 19 | // The output is always the same. 20 | return 'cssTransform'; 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ArraySpread.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ArraySpread from './ArraySpread'; 11 | 12 | describe('array spread', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/UnknownExtInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import aFileWithExtUnknown from './assets/aFileWithExt.unknown'; 10 | 11 | const text = aFileWithExtUnknown.includes('base64') 12 | ? atob(aFileWithExtUnknown.split('base64,')[1]).trim() 13 | : aFileWithExtUnknown; 14 | 15 | export default () => ( 16 | 17 | aFileWithExtUnknown 18 | 19 | ); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectSpread.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ObjectSpread from './ObjectSpread'; 11 | 12 | describe('object spread', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-app-polyfill/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-app-polyfill", 3 | "version": "0.1.3", 4 | "description": "Polyfills for various browsers including commonly used language features", 5 | "repository": "facebook/create-react-app", 6 | "license": "MIT", 7 | "bugs": { 8 | "url": "https://github.com/facebook/create-react-app/issues" 9 | }, 10 | "engines": { 11 | "node": ">=6" 12 | }, 13 | "files": [ 14 | "ie9.js", 15 | "ie11.js", 16 | "jsdom.js" 17 | ], 18 | "dependencies": { 19 | "core-js": "2.5.7", 20 | "object-assign": "4.1.1", 21 | "promise": "8.0.2", 22 | "raf": "3.4.0", 23 | "whatwg-fetch": "3.0.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/lines-around.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { getLinesAround } from '../utils/getLinesAround'; 9 | 10 | const arr = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight']; 11 | 12 | test('should return lines around from a string', () => { 13 | expect(getLinesAround(4, 2, arr)).toMatchSnapshot(); 14 | }); 15 | 16 | test('should return lines around from an array', () => { 17 | expect(getLinesAround(4, 2, arr.join('\n'))).toMatchSnapshot(); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestAndDefault.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import RestAndDefault from './RestAndDefault'; 11 | 12 | describe('rest + default', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssModulesInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import styles from './assets/style.module.css'; 10 | import indexStyles from './assets/index.module.css'; 11 | 12 | export default () => ( 13 |
14 |

CSS Modules are working!

15 |

16 | CSS Modules with index are working! 17 |

18 |
19 | ); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestParameters.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import RestParameters from './RestParameters'; 11 | 12 | describe('rest parameters', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/utils/isInternalFile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | function isInternalFile(sourceFileName: ?string, fileName: ?string) { 10 | return ( 11 | sourceFileName == null || 12 | sourceFileName === '' || 13 | sourceFileName.indexOf('/~/') !== -1 || 14 | sourceFileName.indexOf('/node_modules/') !== -1 || 15 | sourceFileName.trim().indexOf(' ') !== -1 || 16 | fileName == null || 17 | fileName === '' 18 | ); 19 | } 20 | 21 | export { isInternalFile }; 22 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ClassProperties.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ClassProperties from './ClassProperties'; 11 | 12 | describe('class properties', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /test/fixtures/__shared__/test-setup.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const fs = require('fs-extra'); 3 | const TestSetup = require('./util/setup'); 4 | 5 | const fixturePath = path.dirname(module.parent.filename); 6 | const fixtureName = path.basename(fixturePath); 7 | const disablePnp = fs.existsSync(path.resolve(fixturePath, '.disable-pnp')); 8 | const testSetup = new TestSetup(fixtureName, fixturePath, { 9 | pnp: !disablePnp, 10 | }); 11 | 12 | beforeAll(async () => { 13 | await testSetup.setup(); 14 | }, 1000 * 60 * 5); 15 | afterAll(async () => { 16 | await testSetup.teardown(); 17 | }); 18 | 19 | beforeEach(() => jest.setTimeout(1000 * 60 * 5)); 20 | 21 | module.exports = testSetup; 22 | -------------------------------------------------------------------------------- /packages/react-dev-utils/getCacheIdentifier.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function getCacheIdentifier(environment, packages) { 11 | let cacheIdentifier = environment == null ? '' : environment.toString(); 12 | for (const packageName of packages) { 13 | cacheIdentifier += `:${packageName}@`; 14 | try { 15 | cacheIdentifier += require(`${packageName}/package.json`).version; 16 | } catch (_) { 17 | // ignored 18 | } 19 | } 20 | return cacheIdentifier; 21 | }; 22 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/DefaultParameters.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import DefaultParameters from './DefaultParameters'; 11 | 12 | describe('default parameters', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/Promises.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | 11 | describe('promises', () => { 12 | it('renders without crashing', () => { 13 | const div = document.createElement('div'); 14 | return import('./Promises').then(({ default: Promises }) => { 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/SassModulesInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import styles from './assets/sass-styles.module.sass'; 10 | import indexStyles from './assets/index.module.sass'; 11 | 12 | export default () => ( 13 |
14 |

SASS Modules are working!

15 |

16 | SASS Modules with index are working! 17 |

18 |
19 | ); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/ScssModulesInclusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import styles from './assets/scss-styles.module.scss'; 10 | import indexStyles from './assets/index.module.scss'; 11 | 12 | export default () => ( 13 |
14 |

SCSS Modules are working!

15 |

16 | SCSS Modules with index are working! 17 |

18 |
19 | ); 20 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/utils/isBultinErrorName.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | function isBultinErrorName(errorName: ?string) { 10 | switch (errorName) { 11 | case 'EvalError': 12 | case 'InternalError': 13 | case 'RangeError': 14 | case 'ReferenceError': 15 | case 'SyntaxError': 16 | case 'TypeError': 17 | case 'URIError': 18 | return true; 19 | default: 20 | return false; 21 | } 22 | } 23 | 24 | export { isBultinErrorName }; 25 | export default isBultinErrorName; 26 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ArrayDestructuring.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ArrayDestructuring from './ArrayDestructuring'; 11 | 12 | describe('array destructuring', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ComputedProperties.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ComputedProperties from './ComputedProperties'; 11 | 12 | describe('computed properties', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/parser/safari.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { parse } from '../../utils/parser'; 9 | 10 | test('stack with eval', () => { 11 | expect( 12 | parse( 13 | `e@file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:25:18 14 | eval code 15 | eval@[native code] 16 | a@file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:8:10 17 | global code@file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:32:8` 18 | ) 19 | ).toMatchSnapshot(); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/CustomInterpolation.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import CustomInterpolation from './CustomInterpolation'; 11 | 12 | describe('custom interpolation', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectDestructuring.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import ObjectDestructuring from './ObjectDestructuring'; 11 | 12 | describe('object destructuring', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/DestructuringAndAwait.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import DestructuringAndAwait from './DestructuringAndAwait'; 11 | 12 | describe('destructuring and await', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/TemplateInterpolation.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import TemplateInterpolation from './TemplateInterpolation'; 11 | 12 | describe('template interpolation', () => { 13 | it('renders without crashing', () => { 14 | const div = document.createElement('div'); 15 | return new Promise(resolve => { 16 | ReactDOM.render(, div); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/eslint-config-react-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-config-react-app", 3 | "version": "3.0.4", 4 | "description": "ESLint configuration used by Create React App", 5 | "repository": "facebook/create-react-app", 6 | "license": "MIT", 7 | "bugs": { 8 | "url": "https://github.com/facebook/create-react-app/issues" 9 | }, 10 | "files": [ 11 | "index.js" 12 | ], 13 | "peerDependencies": { 14 | "babel-eslint": "9.x", 15 | "eslint": "5.x", 16 | "eslint-plugin-flowtype": "2.x", 17 | "eslint-plugin-import": "2.x", 18 | "eslint-plugin-jsx-a11y": "6.x", 19 | "eslint-plugin-react": "7.x" 20 | }, 21 | "dependencies": { 22 | "confusing-browser-globals": "^1.0.4" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/ExpandEnvVariables.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | 10 | export default () => ( 11 | 12 | {process.env.REACT_APP_BASIC} 13 | {process.env.REACT_APP_BASIC_EXPAND} 14 | 15 | {process.env.REACT_APP_BASIC_EXPAND_SIMPLE} 16 | 17 | 18 | {process.env.REACT_APP_EXPAND_EXISTING} 19 | 20 | 21 | ); 22 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/webpack/LinkedModules.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import ReactDOM from 'react-dom'; 10 | import { test, version } from 'test-integrity'; 11 | import LinkedModules from './LinkedModules'; 12 | 13 | describe('linked modules', () => { 14 | it('has integrity', () => { 15 | expect(test()); 16 | expect(version() === '2.0.0'); 17 | }); 18 | 19 | it('renders without crashing', () => { 20 | const div = document.createElement('div'); 21 | ReactDOM.render(, div); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/react-scripts/template/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import logo from './logo.svg'; 3 | import './App.css'; 4 | 5 | class App extends Component { 6 | render() { 7 | return ( 8 |
9 |
10 | logo 11 |

12 | Edit src/App.js and save to reload. 13 |

14 | 20 | Learn React 21 | 22 |
23 |
24 | ); 25 | } 26 | } 27 | 28 | export default App; 29 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/components/Footer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | import React from 'react'; 10 | import { darkGray } from '../styles'; 11 | 12 | const footerStyle = { 13 | fontFamily: 'sans-serif', 14 | color: darkGray, 15 | marginTop: '0.5rem', 16 | flex: '0 0 auto', 17 | }; 18 | 19 | type FooterPropsType = {| 20 | line1: string, 21 | line2?: string, 22 | |}; 23 | 24 | function Footer(props: FooterPropsType) { 25 | return ( 26 |
27 | {props.line1} 28 |
29 | {props.line2} 30 |
31 | ); 32 | } 33 | 34 | export default Footer; 35 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/FileEnvVariables.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | 10 | export default () => ( 11 | 12 | 13 | {process.env.REACT_APP_ORIGINAL_1} 14 | 15 | 16 | {process.env.REACT_APP_ORIGINAL_2} 17 | 18 | 19 | {process.env.REACT_APP_DEVELOPMENT} 20 | {process.env.REACT_APP_PRODUCTION} 21 | 22 | {process.env.REACT_APP_X} 23 | 24 | ); 25 | -------------------------------------------------------------------------------- /packages/babel-preset-react-app/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | const create = require('./create'); 10 | 11 | module.exports = function(api, opts) { 12 | // This is similar to how `env` works in Babel: 13 | // https://babeljs.io/docs/usage/babelrc/#env-option 14 | // We are not using `env` because it’s ignored in versions > babel-core@6.10.4: 15 | // https://github.com/babel/babel/issues/4539 16 | // https://github.com/facebook/create-react-app/issues/720 17 | // It’s also nice that we can enforce `NODE_ENV` being specified. 18 | const env = process.env.BABEL_ENV || process.env.NODE_ENV; 19 | return create(api, opts, env); 20 | }; 21 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/parser/chrome.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { parse } from '../../utils/parser'; 9 | 10 | test('stack with eval', () => { 11 | expect( 12 | parse( 13 | `TypeError: window[f] is not a function 14 | at e (file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:25:18) 15 | at eval (eval at c (file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:12:9), :1:1) 16 | at a (file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:8:9) 17 | at file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:32:7` 18 | ) 19 | ).toMatchSnapshot(); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/react-dev-utils/errorOverlayMiddleware.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | const launchEditor = require('./launchEditor'); 10 | const launchEditorEndpoint = require('./launchEditorEndpoint'); 11 | 12 | module.exports = function createLaunchEditorMiddleware() { 13 | return function launchEditorMiddleware(req, res, next) { 14 | if (req.url.startsWith(launchEditorEndpoint)) { 15 | const lineNumber = parseInt(req.query.lineNumber, 10) || 1; 16 | const colNumber = parseInt(req.query.colNumber, 10) || 1; 17 | launchEditor(req.query.fileName, lineNumber, colNumber); 18 | res.end(); 19 | } else { 20 | next(); 21 | } 22 | }; 23 | }; 24 | -------------------------------------------------------------------------------- /test/fixtures/relative-paths/index.test.js: -------------------------------------------------------------------------------- 1 | const testSetup = require('../__shared__/test-setup'); 2 | 3 | const fs = require('fs-extra'); 4 | const globby = require('globby'); 5 | const path = require('path'); 6 | 7 | test('contains a relative path in production build', async () => { 8 | await testSetup.scripts.build(); 9 | 10 | const buildDir = path.join(testSetup.testDirectory, 'build'); 11 | const cssFile = path.join( 12 | buildDir, 13 | globby.sync('**/*.css', { cwd: buildDir }).pop() 14 | ); 15 | const svgFile = path.join( 16 | buildDir, 17 | globby.sync('**/*.svg', { cwd: buildDir }).pop() 18 | ); 19 | const desiredPath = /url\((.+?)\)/ 20 | .exec(fs.readFileSync(cssFile, 'utf8')) 21 | .pop(); 22 | expect(path.resolve(path.join(path.dirname(cssFile), desiredPath))).toBe( 23 | path.resolve(svgFile) 24 | ); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/parser/generic.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { parse } from '../../utils/parser'; 9 | 10 | test('throws on null', () => { 11 | expect.assertions(2); 12 | try { 13 | parse(null); 14 | } catch (e) { 15 | expect(e instanceof Error).toBe(true); 16 | expect(e.message).toBe('You cannot pass a null object.'); 17 | } 18 | }); 19 | 20 | test('throws on unparsable', () => { 21 | expect.assertions(2); 22 | try { 23 | parse({}); 24 | } catch (e) { 25 | expect(e instanceof Error).toBe(true); 26 | expect(e.message).toBe( 27 | 'The error you provided does not contain a stack trace.' 28 | ); 29 | } 30 | }); 31 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/__snapshots__/stack-frame.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`proper empty shape 1`] = ` 4 | StackFrame { 5 | "_originalColumnNumber": null, 6 | "_originalFileName": null, 7 | "_originalFunctionName": null, 8 | "_originalLineNumber": null, 9 | "_originalScriptCode": null, 10 | "_scriptCode": null, 11 | "columnNumber": null, 12 | "fileName": null, 13 | "functionName": null, 14 | "lineNumber": null, 15 | } 16 | `; 17 | 18 | exports[`proper full shape 1`] = ` 19 | StackFrame { 20 | "_originalColumnNumber": 13, 21 | "_originalFileName": "test.js", 22 | "_originalFunctionName": "apple", 23 | "_originalLineNumber": 37, 24 | "_originalScriptCode": null, 25 | "_scriptCode": null, 26 | "columnNumber": 37, 27 | "fileName": "b.js", 28 | "functionName": "a", 29 | "lineNumber": 13, 30 | } 31 | `; 32 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/components/Header.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | import React from 'react'; 10 | import { red } from '../styles'; 11 | 12 | const headerStyle = { 13 | fontSize: '2em', 14 | fontFamily: 'sans-serif', 15 | color: red, 16 | whiteSpace: 'pre-wrap', 17 | // Top bottom margin spaces header 18 | // Right margin revents overlap with close button 19 | margin: '0 2rem 0.75rem 0', 20 | flex: '0 0 auto', 21 | maxHeight: '50%', 22 | overflow: 'auto', 23 | }; 24 | 25 | type HeaderPropType = {| 26 | headerText: string, 27 | |}; 28 | 29 | function Header(props: HeaderPropType) { 30 | return
{props.headerText}
; 31 | } 32 | 33 | export default Header; 34 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/components/CloseButton.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | import React from 'react'; 10 | import { black } from '../styles'; 11 | 12 | const closeButtonStyle = { 13 | color: black, 14 | lineHeight: '1rem', 15 | fontSize: '1.5rem', 16 | padding: '1rem', 17 | cursor: 'pointer', 18 | position: 'absolute', 19 | right: 0, 20 | top: 0, 21 | }; 22 | 23 | type CloseCallback = () => void; 24 | function CloseButton({ close }: {| close: CloseCallback |}) { 25 | return ( 26 | 31 | × 32 | 33 | ); 34 | } 35 | 36 | export default CloseButton; 37 | -------------------------------------------------------------------------------- /packages/create-react-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-react-app", 3 | "version": "2.0.4", 4 | "keywords": [ 5 | "react" 6 | ], 7 | "description": "Create React apps with no build configuration.", 8 | "repository": "facebook/create-react-app", 9 | "license": "MIT", 10 | "engines": { 11 | "node": ">=4" 12 | }, 13 | "bugs": { 14 | "url": "https://github.com/facebook/create-react-app/issues" 15 | }, 16 | "files": [ 17 | "index.js", 18 | "createReactApp.js", 19 | "yarn.lock.cached" 20 | ], 21 | "bin": { 22 | "create-react-app": "./index.js" 23 | }, 24 | "dependencies": { 25 | "chalk": "1.1.3", 26 | "commander": "2.18.0", 27 | "cross-spawn": "4.0.2", 28 | "envinfo": "5.10.0", 29 | "fs-extra": "5.0.0", 30 | "hyperquest": "2.1.3", 31 | "semver": "5.5.1", 32 | "tar-pack": "3.4.1", 33 | "tmp": "0.0.33", 34 | "validate-npm-package-name": "3.0.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ClassProperties.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | export default class extends Component { 12 | static propTypes = { 13 | onReady: PropTypes.func.isRequired, 14 | }; 15 | 16 | users = [ 17 | { id: 1, name: '1' }, 18 | { id: 2, name: '2' }, 19 | { id: 3, name: '3' }, 20 | { id: 4, name: '4' }, 21 | ]; 22 | 23 | componentDidMount() { 24 | this.props.onReady(); 25 | } 26 | 27 | render() { 28 | return ( 29 |
30 | {this.users.map(user => ( 31 |
{user.name}
32 | ))} 33 |
34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/extract-source-map.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { extractSourceMapUrl } from '../utils/getSourceMap'; 9 | 10 | test('extracts last source map directive', async () => { 11 | const res = await extractSourceMapUrl( 12 | `test.js`, 13 | `//# sourceMappingURL=test.js.map\nconsole.log('a')\n//# sourceMappingURL=bundle.js.map` 14 | ); 15 | expect(res).toBe('bundle.js.map'); 16 | }); 17 | 18 | test('errors when no source map', async () => { 19 | expect.assertions(1); 20 | 21 | const testFileName = 'test.js'; 22 | try { 23 | await extractSourceMapUrl( 24 | testFileName, 25 | `console.log('hi')\n\nconsole.log('bye')` 26 | ); 27 | } catch (e) { 28 | expect(e).toBe(`Cannot find a source map directive for ${testFileName}.`); 29 | } 30 | }); 31 | -------------------------------------------------------------------------------- /packages/react-dev-utils/checkRequiredFiles.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var fs = require('fs'); 11 | var path = require('path'); 12 | var chalk = require('chalk'); 13 | 14 | function checkRequiredFiles(files) { 15 | var currentFilePath; 16 | try { 17 | files.forEach(filePath => { 18 | currentFilePath = filePath; 19 | fs.accessSync(filePath, fs.F_OK); 20 | }); 21 | return true; 22 | } catch (err) { 23 | var dirName = path.dirname(currentFilePath); 24 | var fileName = path.basename(currentFilePath); 25 | console.log(chalk.red('Could not find a required file.')); 26 | console.log(chalk.red(' Name: ') + chalk.cyan(fileName)); 27 | console.log(chalk.red(' Searched in: ') + chalk.cyan(dirName)); 28 | return false; 29 | } 30 | } 31 | 32 | module.exports = checkRequiredFiles; 33 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/stack-frame.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { StackFrame } from '../utils/stack-frame'; 9 | 10 | test('proper empty shape', () => { 11 | const empty = new StackFrame(); 12 | expect(empty).toMatchSnapshot(); 13 | 14 | expect(empty.getFunctionName()).toBe('(anonymous function)'); 15 | expect(empty.getSource()).toBe(''); 16 | expect(empty.toString()).toBe('(anonymous function)'); 17 | }); 18 | 19 | test('proper full shape', () => { 20 | const empty = new StackFrame( 21 | 'a', 22 | 'b.js', 23 | 13, 24 | 37, 25 | undefined, 26 | 'apple', 27 | 'test.js', 28 | 37, 29 | 13 30 | ); 31 | expect(empty).toMatchSnapshot(); 32 | 33 | expect(empty.getFunctionName()).toBe('a'); 34 | expect(empty.getSource()).toBe('b.js:13:37'); 35 | expect(empty.toString()).toBe('a (b.js:13:37)'); 36 | }); 37 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/env/NodePath.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | import load from 'absoluteLoad'; 11 | 12 | export default class extends Component { 13 | static propTypes = { 14 | onReady: PropTypes.func.isRequired, 15 | }; 16 | 17 | constructor(props) { 18 | super(props); 19 | this.state = { users: [] }; 20 | } 21 | 22 | async componentDidMount() { 23 | const users = load(); 24 | this.setState({ users }); 25 | } 26 | 27 | componentDidUpdate() { 28 | this.props.onReady(); 29 | } 30 | 31 | render() { 32 | return ( 33 |
34 | {this.state.users.map(user => ( 35 |
{user.name}
36 | ))} 37 |
38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dist: trusty 3 | language: node_js 4 | node_js: 5 | - 8 6 | - 10 7 | cache: 8 | yarn: true 9 | directories: 10 | - .npm 11 | before_install: 12 | - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --nightly 13 | - export PATH="$HOME/.yarn/bin:$PATH" 14 | install: true 15 | script: 16 | - 'if [ $TEST_SUITE = "simple" ]; then tasks/e2e-simple.sh; fi' 17 | - 'if [ $TEST_SUITE = "installs" ]; then tasks/e2e-installs.sh; fi' 18 | - 'if [ $TEST_SUITE = "kitchensink" ]; then tasks/e2e-kitchensink.sh; fi' 19 | - 'if [ $TEST_SUITE = "kitchensink-eject" ]; then tasks/e2e-kitchensink-eject.sh; fi' 20 | - 'if [ $TEST_SUITE = "old-node" ]; then tasks/e2e-old-node.sh; fi' 21 | - 'if [ $TEST_SUITE = "behavior" ]; then tasks/e2e-behavior.sh; fi' 22 | env: 23 | matrix: 24 | - TEST_SUITE=simple 25 | - TEST_SUITE=installs 26 | - TEST_SUITE=kitchensink 27 | - TEST_SUITE=kitchensink-eject 28 | - TEST_SUITE=behavior 29 | matrix: 30 | include: 31 | - os: osx 32 | node_js: 8 33 | env: TEST_SUITE=behavior 34 | - node_js: 6 35 | env: TEST_SUITE=old-node 36 | -------------------------------------------------------------------------------- /packages/react-app-polyfill/ie11.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | if (typeof Promise === 'undefined') { 10 | // Rejection tracking prevents a common issue where React gets into an 11 | // inconsistent state due to an error, but it gets swallowed by a Promise, 12 | // and the user has no idea what causes React's erratic future behavior. 13 | require('promise/lib/rejection-tracking').enable(); 14 | window.Promise = require('promise/lib/es6-extensions.js'); 15 | } 16 | 17 | // fetch() polyfill for making API calls. 18 | require('whatwg-fetch'); 19 | 20 | // Object.assign() is commonly used with React. 21 | // It will use the native implementation if it's present and isn't buggy. 22 | Object.assign = require('object-assign'); 23 | 24 | // Support for...of (a commonly used syntax feature that requires Symbols) 25 | require('core-js/es6/symbol'); 26 | // Support iterable spread (...Set, ...Map) 27 | require('core-js/fn/array/from'); 28 | -------------------------------------------------------------------------------- /tasks/screencast.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # Copyright (c) 2015-present, Facebook, Inc. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | # ****************************************************************************** 8 | # This is an end-to-end test intended to be run via screencast.js 9 | # Dependencies: asciinema, pv, core-utils 10 | # ****************************************************************************** 11 | set -e 12 | 13 | printf '\e[32m%s\e[m' "λ " 14 | echo "npx create-react-app my-app" | pv -qL $[10+(-2 + RANDOM%5)] 15 | npx create-react-app my-app 16 | 17 | printf '\e[32m%s\e[m' "λ " 18 | sleep 1 19 | echo "cd my-app" | pv -qL $[10+(-2 + RANDOM%5)] 20 | cd my-app 21 | 22 | printf '\e[32m%s\e[m' "λ " 23 | sleep 1 24 | echo "npm start" | pv -qL $[10+(-2 + RANDOM%5)] 25 | 26 | BROWSER="none" node "$(dirname $0)/screencast-start.js" \ 27 | --command "npm start" \ 28 | --pattern="Compiled successfully*" \ 29 | --pattern-count 2 \ 30 | --error-pattern="*already running on port" \ 31 | --timeout 10 32 | 33 | echo "" -------------------------------------------------------------------------------- /packages/react-error-overlay/src/utils/getLinesAround.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | import { ScriptLine } from './stack-frame'; 10 | 11 | /** 12 | * 13 | * @param {number} line The line number to provide context around. 14 | * @param {number} count The number of lines you'd like for context. 15 | * @param {string[] | string} lines The source code. 16 | */ 17 | function getLinesAround( 18 | line: number, 19 | count: number, 20 | lines: string[] | string 21 | ): ScriptLine[] { 22 | if (typeof lines === 'string') { 23 | lines = lines.split('\n'); 24 | } 25 | const result = []; 26 | for ( 27 | let index = Math.max(0, line - 1 - count); 28 | index <= Math.min(lines.length - 1, line - 1 + count); 29 | ++index 30 | ) { 31 | result.push(new ScriptLine(index + 1, lines[index], index === line - 1)); 32 | } 33 | return result; 34 | } 35 | 36 | export { getLinesAround }; 37 | export default getLinesAround; 38 | -------------------------------------------------------------------------------- /docusaurus/website/i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "This file is auto-generated by write-translations.js", 3 | "localized-strings": { 4 | "next": "Next", 5 | "previous": "Previous", 6 | "tagline": "Create React apps with no build configuration.", 7 | "docs": { 8 | "getting-started": { 9 | "title": "Getting started", 10 | "sidebar_label": "Getting started" 11 | }, 12 | "README": { 13 | "title": "README" 14 | }, 15 | "user-guide": { 16 | "title": "User guide", 17 | "sidebar_label": "User guide" 18 | } 19 | }, 20 | "links": { 21 | "Getting started": "Getting started", 22 | "Help": "Help" 23 | }, 24 | "categories": { 25 | "Getting Started": "Getting Started", 26 | "User Guide": "User Guide" 27 | } 28 | }, 29 | "pages-strings": { 30 | "Help Translate|recruit community translators for your project": "Help Translate", 31 | "Edit this Doc|recruitment message asking to edit the doc source": "Edit", 32 | "Translate this Doc|recruitment message asking to translate the docs": "Translate" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ArrayDestructuring.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load() { 12 | return [[1, '1'], [2, '2'], [3, '3'], [4, '4']]; 13 | } 14 | 15 | export default class extends Component { 16 | static propTypes = { 17 | onReady: PropTypes.func.isRequired, 18 | }; 19 | 20 | constructor(props) { 21 | super(props); 22 | this.state = { users: [] }; 23 | } 24 | 25 | async componentDidMount() { 26 | const users = load(); 27 | this.setState({ users }); 28 | } 29 | 30 | componentDidUpdate() { 31 | this.props.onReady(); 32 | } 33 | 34 | render() { 35 | return ( 36 |
37 | {this.state.users.map(user => { 38 | const [id, name] = user; 39 | return
{name}
; 40 | })} 41 |
42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /packages/react-dev-utils/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/react-scripts/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/create-react-app/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/react-app-polyfill/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/react-error-overlay/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/babel-preset-react-app/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/confusing-browser-globals/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/eslint-config-react-app/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/react-scripts/config/jest/fileTransform.js: -------------------------------------------------------------------------------- 1 | // @remove-on-eject-begin 2 | /** 3 | * Copyright (c) 2014-present, Facebook, Inc. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | // @remove-on-eject-end 9 | 'use strict'; 10 | 11 | const path = require('path'); 12 | 13 | // This is a custom Jest transformer turning file imports into filenames. 14 | // http://facebook.github.io/jest/docs/en/webpack.html 15 | 16 | module.exports = { 17 | process(src, filename) { 18 | const assetFilename = JSON.stringify(path.basename(filename)); 19 | 20 | if (filename.match(/\.svg$/)) { 21 | return `module.exports = { 22 | __esModule: true, 23 | default: ${assetFilename}, 24 | ReactComponent: (props) => ({ 25 | $$typeof: Symbol.for('react.element'), 26 | type: 'svg', 27 | ref: null, 28 | key: null, 29 | props: Object.assign({}, props, { 30 | children: ${assetFilename} 31 | }) 32 | }), 33 | };`; 34 | } 35 | 36 | return `module.exports = ${assetFilename};`; 37 | }, 38 | }; 39 | -------------------------------------------------------------------------------- /packages/babel-plugin-named-asset-import/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-present, Facebook, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/utils/dom/absolutifyCaret.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | function removeNextBr(parent, component: ?Element) { 10 | while (component != null && component.tagName.toLowerCase() !== 'br') { 11 | component = component.nextElementSibling; 12 | } 13 | if (component != null) { 14 | parent.removeChild(component); 15 | } 16 | } 17 | 18 | function absolutifyCaret(component: Node) { 19 | const ccn = component.childNodes; 20 | for (let index = 0; index < ccn.length; ++index) { 21 | const c = ccn[index]; 22 | // $FlowFixMe 23 | if (c.tagName.toLowerCase() !== 'span') { 24 | continue; 25 | } 26 | const _text = c.innerText; 27 | if (_text == null) { 28 | continue; 29 | } 30 | const text = _text.replace(/\s/g, ''); 31 | if (text !== '|^') { 32 | continue; 33 | } 34 | // $FlowFixMe 35 | c.style.position = 'absolute'; 36 | // $FlowFixMe 37 | removeNextBr(component, c); 38 | } 39 | } 40 | 41 | export { absolutifyCaret }; 42 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ArraySpread.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load(users) { 12 | return [ 13 | { id: 1, name: '1' }, 14 | { id: 2, name: '2' }, 15 | { id: 3, name: '3' }, 16 | ...users, 17 | ]; 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | async componentDidMount() { 31 | const users = load([{ id: 42, name: '42' }]); 32 | this.setState({ users }); 33 | } 34 | 35 | componentDidUpdate() { 36 | this.props.onReady(); 37 | } 38 | 39 | render() { 40 | return ( 41 |
42 | {this.state.users.map(user => ( 43 |
{user.name}
44 | ))} 45 |
46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/Promises.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load() { 12 | return Promise.resolve([ 13 | { id: 1, name: '1' }, 14 | { id: 2, name: '2' }, 15 | { id: 3, name: '3' }, 16 | { id: 4, name: '4' }, 17 | ]); 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | componentDidMount() { 31 | load().then(users => { 32 | this.setState({ users }); 33 | }); 34 | } 35 | 36 | componentDidUpdate() { 37 | this.props.onReady(); 38 | } 39 | 40 | render() { 41 | return ( 42 |
43 | {this.state.users.map(user => ( 44 |
{user.name}
45 | ))} 46 |
47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /packages/react-error-overlay/webpack.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | const path = require('path'); 10 | 11 | module.exports = { 12 | mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', 13 | entry: './src/index.js', 14 | output: { 15 | path: path.join(__dirname, './lib'), 16 | filename: 'index.js', 17 | library: 'ReactErrorOverlay', 18 | libraryTarget: 'umd', 19 | }, 20 | module: { 21 | rules: [ 22 | { 23 | test: /iframe-bundle\.js$/, 24 | use: 'raw-loader', 25 | }, 26 | { 27 | test: /\.js$/, 28 | include: path.resolve(__dirname, './src'), 29 | use: 'babel-loader', 30 | }, 31 | ], 32 | }, 33 | resolve: { 34 | alias: { 35 | iframeScript$: path.resolve(__dirname, './lib/iframe-bundle.js'), 36 | }, 37 | }, 38 | optimization: { 39 | nodeEnv: false, 40 | }, 41 | node: { 42 | fs: 'empty', 43 | process: false, 44 | }, 45 | performance: { 46 | hints: false, 47 | }, 48 | }; 49 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/Generators.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function* load(limit) { 12 | let i = 1; 13 | while (i <= limit) { 14 | yield { id: i, name: i }; 15 | i++; 16 | } 17 | } 18 | 19 | export default class extends Component { 20 | static propTypes = { 21 | onReady: PropTypes.func.isRequired, 22 | }; 23 | 24 | constructor(props) { 25 | super(props); 26 | this.state = { users: [] }; 27 | } 28 | 29 | componentDidMount() { 30 | const users = []; 31 | for (let user of load(4)) { 32 | users.push(user); 33 | } 34 | this.setState({ users }); 35 | } 36 | 37 | componentDidUpdate() { 38 | this.props.onReady(); 39 | } 40 | 41 | render() { 42 | return ( 43 |
44 | {this.state.users.map(user => ( 45 |
{user.name}
46 | ))} 47 |
48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/DefaultParameters.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load(id = 0) { 12 | return [ 13 | { id: id + 1, name: '1' }, 14 | { id: id + 2, name: '2' }, 15 | { id: id + 3, name: '3' }, 16 | { id: id + 4, name: '4' }, 17 | ]; 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | async componentDidMount() { 31 | const users = load(); 32 | this.setState({ users }); 33 | } 34 | 35 | componentDidUpdate() { 36 | this.props.onReady(); 37 | } 38 | 39 | render() { 40 | return ( 41 |
42 | {this.state.users.map(user => ( 43 |
{user.name}
44 | ))} 45 |
46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/TemplateInterpolation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load(name) { 12 | return [ 13 | { id: 1, name: `${name}1` }, 14 | { id: 2, name: `${name}2` }, 15 | { id: 3, name: `${name}3` }, 16 | { id: 4, name: `${name}4` }, 17 | ]; 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | async componentDidMount() { 31 | const users = load('user_'); 32 | this.setState({ users }); 33 | } 34 | 35 | componentDidUpdate() { 36 | this.props.onReady(); 37 | } 38 | 39 | render() { 40 | return ( 41 |
42 | {this.state.users.map(user => ( 43 |
{user.name}
44 | ))} 45 |
46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestAndDefault.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load({ id, ...rest } = { id: 0, user: { id: 42, name: '42' } }) { 12 | return [ 13 | { id: id + 1, name: '1' }, 14 | { id: id + 2, name: '2' }, 15 | { id: id + 3, name: '3' }, 16 | rest.user, 17 | ]; 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | async componentDidMount() { 31 | const users = load(); 32 | this.setState({ users }); 33 | } 34 | 35 | componentDidUpdate() { 36 | this.props.onReady(); 37 | } 38 | 39 | render() { 40 | return ( 41 |
42 | {this.state.users.map(user => ( 43 |
{user.name}
44 | ))} 45 |
46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestParameters.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load({ id = 0, ...rest }) { 12 | return [ 13 | { id: id + 1, name: '1' }, 14 | { id: id + 2, name: '2' }, 15 | { id: id + 3, name: '3' }, 16 | rest.user, 17 | ]; 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | async componentDidMount() { 31 | const users = load({ id: 0, user: { id: 42, name: '42' } }); 32 | this.setState({ users }); 33 | } 34 | 35 | componentDidUpdate() { 36 | this.props.onReady(); 37 | } 38 | 39 | render() { 40 | return ( 41 |
42 | {this.state.users.map(user => ( 43 |
{user.name}
44 | ))} 45 |
46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/react-dev-utils/WatchMissingNodeModulesPlugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | // This Webpack plugin ensures `npm install ` forces a project rebuild. 9 | // We’re not sure why this isn't Webpack's default behavior. 10 | // See https://github.com/facebook/create-react-app/issues/186. 11 | 12 | 'use strict'; 13 | 14 | class WatchMissingNodeModulesPlugin { 15 | constructor(nodeModulesPath) { 16 | this.nodeModulesPath = nodeModulesPath; 17 | } 18 | 19 | apply(compiler) { 20 | compiler.hooks.emit.tap('WatchMissingNodeModulesPlugin', compilation => { 21 | var missingDeps = Array.from(compilation.missingDependencies); 22 | var nodeModulesPath = this.nodeModulesPath; 23 | 24 | // If any missing files are expected to appear in node_modules... 25 | if (missingDeps.some(file => file.includes(nodeModulesPath))) { 26 | // ...tell webpack to watch node_modules recursively until they appear. 27 | compilation.contextDependencies.add(nodeModulesPath); 28 | } 29 | }); 30 | } 31 | } 32 | 33 | module.exports = WatchMissingNodeModulesPlugin; 34 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/styles.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | const black = '#293238', 10 | darkGray = '#878e91', 11 | red = '#ce1126', 12 | redTransparent = 'rgba(206, 17, 38, 0.05)', 13 | lightRed = '#fccfcf', 14 | yellow = '#fbf5b4', 15 | yellowTransparent = 'rgba(251, 245, 180, 0.3)', 16 | white = '#ffffff'; 17 | 18 | const iframeStyle = { 19 | position: 'fixed', 20 | top: '0', 21 | left: '0', 22 | width: '100%', 23 | height: '100%', 24 | border: 'none', 25 | 'z-index': 2147483647, 26 | }; 27 | 28 | const overlayStyle = { 29 | width: '100%', 30 | height: '100%', 31 | 'box-sizing': 'border-box', 32 | 'text-align': 'center', 33 | 'background-color': white, 34 | }; 35 | 36 | const primaryErrorStyle = { 37 | 'background-color': lightRed, 38 | }; 39 | 40 | const secondaryErrorStyle = { 41 | 'background-color': yellow, 42 | }; 43 | 44 | export { 45 | iframeStyle, 46 | overlayStyle, 47 | primaryErrorStyle, 48 | secondaryErrorStyle, 49 | black, 50 | darkGray, 51 | red, 52 | redTransparent, 53 | yellowTransparent, 54 | }; 55 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/DestructuringAndAwait.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | async function load() { 12 | return { 13 | users: [ 14 | { id: 1, name: '1' }, 15 | { id: 2, name: '2' }, 16 | { id: 3, name: '3' }, 17 | { id: 4, name: '4' }, 18 | ], 19 | }; 20 | } 21 | 22 | export default class extends Component { 23 | static propTypes = { 24 | onReady: PropTypes.func.isRequired, 25 | }; 26 | 27 | constructor(props) { 28 | super(props); 29 | this.state = { users: [] }; 30 | } 31 | 32 | async componentDidMount() { 33 | const { users } = await load(); 34 | this.setState({ users }); 35 | } 36 | 37 | componentDidUpdate() { 38 | this.props.onReady(); 39 | } 40 | 41 | render() { 42 | return ( 43 |
44 | {this.state.users.map(user => ( 45 |
{user.name}
46 | ))} 47 |
48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ComputedProperties.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load(prefix) { 12 | return [ 13 | { id: 1, [`${prefix} name`]: '1' }, 14 | { id: 2, [`${prefix} name`]: '2' }, 15 | { id: 3, [`${prefix} name`]: '3' }, 16 | { id: 4, [`${prefix} name`]: '4' }, 17 | ]; 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | async componentDidMount() { 31 | const users = load('user_'); 32 | this.setState({ users }); 33 | } 34 | 35 | componentDidUpdate() { 36 | this.props.onReady(); 37 | } 38 | 39 | render() { 40 | return ( 41 |
42 | {this.state.users.map(user => ( 43 |
{user.user_name}
44 | ))} 45 |
46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/babel-preset-react-app/webpack-overrides.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | const crypto = require('crypto'); 10 | 11 | const macroCheck = new RegExp('[./]macro'); 12 | 13 | module.exports = function() { 14 | return { 15 | // This function transforms the Babel configuration on a per-file basis 16 | config(config, { source }) { 17 | // Babel Macros are notoriously hard to cache, so they shouldn't be 18 | // https://github.com/babel/babel/issues/8497 19 | // We naively detect macros using their package suffix and add a random token 20 | // to the caller, a valid option accepted by Babel, to compose a one-time 21 | // cacheIdentifier for the file. We cannot tune the loader options on a per 22 | // file basis. 23 | if (macroCheck.test(source)) { 24 | return Object.assign({}, config.options, { 25 | caller: Object.assign({}, config.options.caller, { 26 | craInvalidationToken: crypto.randomBytes(32).toString('hex'), 27 | }), 28 | }); 29 | } 30 | return config.options; 31 | }, 32 | }; 33 | }; 34 | -------------------------------------------------------------------------------- /packages/react-app-polyfill/ie9.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | if (typeof Promise === 'undefined') { 10 | // Rejection tracking prevents a common issue where React gets into an 11 | // inconsistent state due to an error, but it gets swallowed by a Promise, 12 | // and the user has no idea what causes React's erratic future behavior. 13 | require('promise/lib/rejection-tracking').enable(); 14 | window.Promise = require('promise/lib/es6-extensions.js'); 15 | } 16 | 17 | // fetch() polyfill for making API calls. 18 | require('whatwg-fetch'); 19 | 20 | // Object.assign() is commonly used with React. 21 | // It will use the native implementation if it's present and isn't buggy. 22 | Object.assign = require('object-assign'); 23 | 24 | // Support for...of (a commonly used syntax feature that requires Symbols) 25 | require('core-js/es6/symbol'); 26 | // Support iterable spread (...Set, ...Map) 27 | require('core-js/fn/array/from'); 28 | 29 | // React 16+ relies on Map, Set, and requestAnimationFrame 30 | require('core-js/es6/map'); 31 | require('core-js/es6/set'); 32 | require('raf').polyfill(window); 33 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectSpread.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load(baseUser) { 12 | return [ 13 | { id: 1, name: '1', ...baseUser }, 14 | { id: 2, name: '2', ...baseUser }, 15 | { id: 3, name: '3', ...baseUser }, 16 | { id: 4, name: '4', ...baseUser }, 17 | ]; 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | async componentDidMount() { 31 | const users = load({ age: 42 }); 32 | this.setState({ users }); 33 | } 34 | 35 | componentDidUpdate() { 36 | this.props.onReady(); 37 | } 38 | 39 | render() { 40 | return ( 41 |
42 | {this.state.users.map(user => ( 43 |
44 | {user.name}: {user.age} 45 |
46 | ))} 47 |
48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tasks/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2015-present, Facebook, Inc. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | # ****************************************************************************** 8 | # This releases an update to the `react-scripts` package. 9 | # Don't use `npm publish` for it. 10 | # Read the release instructions: 11 | # https://github.com/facebook/create-react-app/blob/master/CONTRIBUTING.md#cutting-a-release 12 | # ****************************************************************************** 13 | 14 | # Start in tasks/ even if run from root directory 15 | cd "$(dirname "$0")" 16 | 17 | # Exit the script on any command with non 0 return code 18 | # We assume that all the commands in the pipeline set their return code 19 | # properly and that we do not need to validate that the output is correct 20 | set -e 21 | 22 | # Echo every command being executed 23 | set -x 24 | 25 | # Go to root 26 | cd .. 27 | root_path=$PWD 28 | 29 | if [ -n "$(git status --porcelain)" ]; then 30 | echo "Your git status is not clean. Aborting."; 31 | exit 1; 32 | fi 33 | 34 | # Compile 35 | cd packages/react-error-overlay/ 36 | npm run build:prod 37 | cd ../.. 38 | # Go! 39 | ./node_modules/.bin/lerna publish --independent "$@" 40 | -------------------------------------------------------------------------------- /packages/react-dev-utils/getCSSModuleLocalIdent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | const loaderUtils = require('loader-utils'); 11 | 12 | module.exports = function getLocalIdent( 13 | context, 14 | localIdentName, 15 | localName, 16 | options 17 | ) { 18 | // Use the filename or folder name, based on some uses the index.js / index.module.(css|scss|sass) project style 19 | const fileNameOrFolder = context.resourcePath.match( 20 | /index\.module\.(css|scss|sass)$/ 21 | ) 22 | ? '[folder]' 23 | : '[name]'; 24 | // Create a hash based on a the file location and class name. Will be unique across a project, and close to globally unique. 25 | const hash = loaderUtils.getHashDigest( 26 | context.resourcePath + localName, 27 | 'md5', 28 | 'base64', 29 | 5 30 | ); 31 | // Use loaderUtils to find the file or folder name 32 | const className = loaderUtils.interpolateName( 33 | context, 34 | fileNameOrFolder + '_' + localName + '__' + hash, 35 | options 36 | ); 37 | // remove the .module that appears in every classname when based on the file. 38 | return className.replace('.module_', '_'); 39 | }; 40 | -------------------------------------------------------------------------------- /packages/confusing-browser-globals/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = [ 11 | 'addEventListener', 12 | 'blur', 13 | 'close', 14 | 'closed', 15 | 'confirm', 16 | 'defaultStatus', 17 | 'defaultstatus', 18 | 'event', 19 | 'external', 20 | 'find', 21 | 'focus', 22 | 'frameElement', 23 | 'frames', 24 | 'history', 25 | 'innerHeight', 26 | 'innerWidth', 27 | 'length', 28 | 'location', 29 | 'locationbar', 30 | 'menubar', 31 | 'moveBy', 32 | 'moveTo', 33 | 'name', 34 | 'onblur', 35 | 'onerror', 36 | 'onfocus', 37 | 'onload', 38 | 'onresize', 39 | 'onunload', 40 | 'open', 41 | 'opener', 42 | 'opera', 43 | 'outerHeight', 44 | 'outerWidth', 45 | 'pageXOffset', 46 | 'pageYOffset', 47 | 'parent', 48 | 'print', 49 | 'removeEventListener', 50 | 'resizeBy', 51 | 'resizeTo', 52 | 'screen', 53 | 'screenLeft', 54 | 'screenTop', 55 | 'screenX', 56 | 'screenY', 57 | 'scroll', 58 | 'scrollbars', 59 | 'scrollBy', 60 | 'scrollTo', 61 | 'scrollX', 62 | 'scrollY', 63 | 'self', 64 | 'status', 65 | 'statusbar', 66 | 'stop', 67 | 'toolbar', 68 | 'top', 69 | ]; 70 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/effects/stackTraceLimit.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | let stackTraceRegistered: boolean = false; 10 | // Default: https://docs.microsoft.com/en-us/scripting/javascript/reference/stacktracelimit-property-error-javascript 11 | let restoreStackTraceValue: number = 10; 12 | 13 | const MAX_STACK_LENGTH: number = 50; 14 | 15 | function registerStackTraceLimit(limit: number = MAX_STACK_LENGTH) { 16 | if (stackTraceRegistered) { 17 | return; 18 | } 19 | try { 20 | restoreStackTraceValue = Error.stackTraceLimit; 21 | Error.stackTraceLimit = limit; 22 | stackTraceRegistered = true; 23 | } catch (e) { 24 | // Not all browsers support this so we don't care if it errors 25 | } 26 | } 27 | 28 | function unregisterStackTraceLimit() { 29 | if (!stackTraceRegistered) { 30 | return; 31 | } 32 | try { 33 | Error.stackTraceLimit = restoreStackTraceValue; 34 | stackTraceRegistered = false; 35 | } catch (e) { 36 | // Not all browsers support this so we don't care if it errors 37 | } 38 | } 39 | 40 | export { 41 | registerStackTraceLimit as register, 42 | unregisterStackTraceLimit as unregister, 43 | }; 44 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectDestructuring.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | function load() { 12 | return [ 13 | { id: 1, name: '1' }, 14 | { id: 2, name: '2' }, 15 | { id: 3, name: '3' }, 16 | { id: 4, name: '4' }, 17 | ]; 18 | } 19 | 20 | export default class extends Component { 21 | static propTypes = { 22 | onReady: PropTypes.func.isRequired, 23 | }; 24 | 25 | constructor(props) { 26 | super(props); 27 | this.state = { users: [] }; 28 | } 29 | 30 | async componentDidMount() { 31 | const users = load(); 32 | this.setState({ users }); 33 | } 34 | 35 | componentDidUpdate() { 36 | this.props.onReady(); 37 | } 38 | 39 | render() { 40 | return ( 41 |
42 | {this.state.users.map(user => { 43 | const { id, ...rest } = user; 44 | // eslint-disable-next-line no-unused-vars 45 | const [{ name, ...innerRest }] = [{ ...rest }]; 46 | return
{name}
; 47 | })} 48 |
49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/components/CodeBlock.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | import React from 'react'; 10 | import { redTransparent, yellowTransparent } from '../styles'; 11 | 12 | const _preStyle = { 13 | position: 'relative', 14 | display: 'block', 15 | padding: '0.5em', 16 | marginTop: '0.5em', 17 | marginBottom: '0.5em', 18 | overflowX: 'auto', 19 | whiteSpace: 'pre-wrap', 20 | borderRadius: '0.25rem', 21 | }; 22 | 23 | const primaryPreStyle = { 24 | ..._preStyle, 25 | backgroundColor: redTransparent, 26 | }; 27 | 28 | const secondaryPreStyle = { 29 | ..._preStyle, 30 | backgroundColor: yellowTransparent, 31 | }; 32 | 33 | const codeStyle = { 34 | fontFamily: 'Consolas, Menlo, monospace', 35 | }; 36 | 37 | type CodeBlockPropsType = {| 38 | main: boolean, 39 | codeHTML: string, 40 | |}; 41 | 42 | function CodeBlock(props: CodeBlockPropsType) { 43 | const preStyle = props.main ? primaryPreStyle : secondaryPreStyle; 44 | const codeBlock = { __html: props.codeHTML }; 45 | 46 | return ( 47 |
48 |       
49 |     
50 | ); 51 | } 52 | 53 | export default CodeBlock; 54 | -------------------------------------------------------------------------------- /packages/confusing-browser-globals/README.md: -------------------------------------------------------------------------------- 1 | # confusing-browser-globals 2 | 3 | A curated list of browser globals that commonly cause confusion and are not recommended to use without an explicit `window.` qualifier. 4 | 5 | ## Motivation 6 | 7 | Some global variables in browser are likely to be used by people without the intent of using them as globals, such as `status`, `name`, `event`, etc. 8 | 9 | For example: 10 | 11 | ```js 12 | handleClick() { // missing `event` argument 13 | this.setState({ 14 | text: event.target.value // uses the `event` global: oops! 15 | }); 16 | } 17 | ``` 18 | 19 | This package exports a list of globals that are often used by mistake. You can feed this list to a static analysis tool like ESLint to prevent their usage without an explicit `window.` qualifier. 20 | 21 | ## Installation 22 | 23 | ``` 24 | npm install --save confusing-browser-globals 25 | ``` 26 | 27 | ## Usage 28 | 29 | If you use Create React App, you don't need to configure anything, as this rule is already included in the default `eslint-config-react-app` preset. 30 | 31 | If you maintain your own ESLint configuration, you can do this: 32 | 33 | ```js 34 | var restrictedGlobals = require('confusing-browser-globals'); 35 | 36 | module.exports = { 37 | rules: { 38 | 'no-restricted-globals': ['error'].concat(restrictedGlobals), 39 | }, 40 | }; 41 | ``` 42 | 43 | ## License 44 | 45 | MIT 46 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/__snapshots__/lines-around.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should return lines around from a string 1`] = ` 4 | Array [ 5 | ScriptLine { 6 | "content": "two", 7 | "highlight": false, 8 | "lineNumber": 2, 9 | }, 10 | ScriptLine { 11 | "content": "three", 12 | "highlight": false, 13 | "lineNumber": 3, 14 | }, 15 | ScriptLine { 16 | "content": "four", 17 | "highlight": true, 18 | "lineNumber": 4, 19 | }, 20 | ScriptLine { 21 | "content": "five", 22 | "highlight": false, 23 | "lineNumber": 5, 24 | }, 25 | ScriptLine { 26 | "content": "six", 27 | "highlight": false, 28 | "lineNumber": 6, 29 | }, 30 | ] 31 | `; 32 | 33 | exports[`should return lines around from an array 1`] = ` 34 | Array [ 35 | ScriptLine { 36 | "content": "two", 37 | "highlight": false, 38 | "lineNumber": 2, 39 | }, 40 | ScriptLine { 41 | "content": "three", 42 | "highlight": false, 43 | "lineNumber": 3, 44 | }, 45 | ScriptLine { 46 | "content": "four", 47 | "highlight": true, 48 | "lineNumber": 4, 49 | }, 50 | ScriptLine { 51 | "content": "five", 52 | "highlight": false, 53 | "lineNumber": 5, 54 | }, 55 | ScriptLine { 56 | "content": "six", 57 | "highlight": false, 58 | "lineNumber": 6, 59 | }, 60 | ] 61 | `; 62 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/effects/unhandledError.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | let boundErrorHandler = null; 10 | 11 | type ErrorCallback = (error: Error) => void; 12 | 13 | function errorHandler(callback: ErrorCallback, e: Event): void { 14 | if (!e.error) { 15 | return; 16 | } 17 | // $FlowFixMe 18 | const { error } = e; 19 | if (error instanceof Error) { 20 | callback(error); 21 | } else { 22 | // A non-error was thrown, we don't have a trace. :( 23 | // Look in your browser's devtools for more information 24 | callback(new Error(error)); 25 | } 26 | } 27 | 28 | function registerUnhandledError(target: EventTarget, callback: ErrorCallback) { 29 | if (boundErrorHandler !== null) { 30 | return; 31 | } 32 | boundErrorHandler = errorHandler.bind(undefined, callback); 33 | target.addEventListener('error', boundErrorHandler); 34 | } 35 | 36 | function unregisterUnhandledError(target: EventTarget) { 37 | if (boundErrorHandler === null) { 38 | return; 39 | } 40 | target.removeEventListener('error', boundErrorHandler); 41 | boundErrorHandler = null; 42 | } 43 | 44 | export { 45 | registerUnhandledError as register, 46 | unregisterUnhandledError as unregister, 47 | }; 48 | -------------------------------------------------------------------------------- /packages/babel-preset-react-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-preset-react-app", 3 | "version": "5.0.4", 4 | "description": "Babel preset used by Create React App", 5 | "repository": "facebook/create-react-app", 6 | "license": "MIT", 7 | "bugs": { 8 | "url": "https://github.com/facebook/create-react-app/issues" 9 | }, 10 | "files": [ 11 | "create.js", 12 | "dependencies.js", 13 | "dev.js", 14 | "index.js", 15 | "webpack-overrides.js", 16 | "prod.js", 17 | "test.js" 18 | ], 19 | "dependencies": { 20 | "@babel/core": "7.1.0", 21 | "@babel/plugin-proposal-class-properties": "7.1.0", 22 | "@babel/plugin-proposal-object-rest-spread": "7.0.0", 23 | "@babel/plugin-syntax-dynamic-import": "7.0.0", 24 | "@babel/plugin-transform-classes": "7.1.0", 25 | "@babel/plugin-transform-destructuring": "7.0.0", 26 | "@babel/plugin-transform-flow-strip-types": "7.0.0", 27 | "@babel/plugin-transform-react-constant-elements": "7.0.0", 28 | "@babel/plugin-transform-react-display-name": "7.0.0", 29 | "@babel/plugin-transform-runtime": "7.1.0", 30 | "@babel/preset-env": "7.1.0", 31 | "@babel/preset-react": "7.0.0", 32 | "@babel/runtime": "7.0.0", 33 | "babel-loader": "8.0.4", 34 | "babel-plugin-dynamic-import-node": "2.2.0", 35 | "babel-plugin-macros": "2.4.2", 36 | "babel-plugin-transform-react-remove-prop-types": "0.4.18" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/utils/dom/css.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | let injectedCount = 0; 10 | const injectedCache = {}; 11 | 12 | function getHead(document: Document) { 13 | return document.head || document.getElementsByTagName('head')[0]; 14 | } 15 | 16 | function injectCss(document: Document, css: string): number { 17 | const head = getHead(document); 18 | const style = document.createElement('style'); 19 | style.type = 'text/css'; 20 | style.appendChild(document.createTextNode(css)); 21 | head.appendChild(style); 22 | 23 | injectedCache[++injectedCount] = style; 24 | return injectedCount; 25 | } 26 | 27 | function removeCss(document: Document, ref: number) { 28 | if (injectedCache[ref] == null) { 29 | return; 30 | } 31 | const head = getHead(document); 32 | head.removeChild(injectedCache[ref]); 33 | delete injectedCache[ref]; 34 | } 35 | 36 | function applyStyles(element: HTMLElement, styles: Object) { 37 | element.setAttribute('style', ''); 38 | for (const key in styles) { 39 | if (!styles.hasOwnProperty(key)) { 40 | continue; 41 | } 42 | // $FlowFixMe 43 | element.style[key] = styles[key]; 44 | } 45 | } 46 | 47 | export { getHead, injectCss, removeCss, applyStyles }; 48 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/parser/__snapshots__/safari.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`stack with eval 1`] = ` 4 | Array [ 5 | StackFrame { 6 | "_originalColumnNumber": null, 7 | "_originalFileName": null, 8 | "_originalFunctionName": null, 9 | "_originalLineNumber": null, 10 | "_originalScriptCode": null, 11 | "_scriptCode": null, 12 | "columnNumber": 18, 13 | "fileName": "file:///Users/joe/Documents/Development/OSS/stack-frame/index.html", 14 | "functionName": "e", 15 | "lineNumber": 25, 16 | }, 17 | StackFrame { 18 | "_originalColumnNumber": null, 19 | "_originalFileName": null, 20 | "_originalFunctionName": null, 21 | "_originalLineNumber": null, 22 | "_originalScriptCode": null, 23 | "_scriptCode": null, 24 | "columnNumber": 10, 25 | "fileName": "file:///Users/joe/Documents/Development/OSS/stack-frame/index.html", 26 | "functionName": "a", 27 | "lineNumber": 8, 28 | }, 29 | StackFrame { 30 | "_originalColumnNumber": null, 31 | "_originalFileName": null, 32 | "_originalFunctionName": null, 33 | "_originalLineNumber": null, 34 | "_originalScriptCode": null, 35 | "_scriptCode": null, 36 | "columnNumber": 8, 37 | "fileName": "file:///Users/joe/Documents/Development/OSS/stack-frame/index.html", 38 | "functionName": "global code", 39 | "lineNumber": 32, 40 | }, 41 | ] 42 | `; 43 | -------------------------------------------------------------------------------- /packages/react-dev-utils/printBuildError.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | const chalk = require('chalk'); 11 | 12 | module.exports = function printBuildError(err) { 13 | const message = err != null && err.message; 14 | const stack = err != null && err.stack; 15 | 16 | // Add more helpful message for Terser error 17 | if ( 18 | stack && 19 | typeof message === 'string' && 20 | message.indexOf('from Terser') !== -1 21 | ) { 22 | try { 23 | const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack); 24 | if (!matched) { 25 | throw new Error('Using errors for control flow is bad.'); 26 | } 27 | const problemPath = matched[2]; 28 | const line = matched[3]; 29 | const column = matched[4]; 30 | console.log( 31 | 'Failed to minify the code from this file: \n\n', 32 | chalk.yellow( 33 | `\t${problemPath}:${line}${column !== '0' ? ':' + column : ''}` 34 | ), 35 | '\n' 36 | ); 37 | } catch (ignored) { 38 | console.log('Failed to minify the bundle.', err); 39 | } 40 | console.log('Read more here: http://bit.ly/CRA-build-minify'); 41 | } else { 42 | console.log((message || err) + '\n'); 43 | } 44 | console.log(); 45 | }; 46 | -------------------------------------------------------------------------------- /packages/react-app-polyfill/README.md: -------------------------------------------------------------------------------- 1 | # react-app-polyfill 2 | 3 | This package includes polyfills for various browsers. 4 | It includes minimum requirements and commonly used language features used by [Create React App](https://github.com/facebook/create-react-app) projects. 5 | 6 | ### Features 7 | 8 | Each polyfill ensures the following language features are present: 9 | 10 | 1. `Promise` (for `async` / `await` support) 11 | 1. `window.fetch` (a Promise-based way to make web requests in the browser) 12 | 1. `Object.assign` (a helper required for Object Spread, i.e. `{ ...a, ...b }`) 13 | 1. `Symbol` (a built-in object used by `for...of` syntax and friends) 14 | 1. `Array.from` (a built-in static method used by array spread, i.e. `[...arr]`) 15 | 16 | ### Usage 17 | 18 | First, install the package using Yarn or npm: 19 | 20 | ```bash 21 | npm install react-app-polyfill 22 | ``` 23 | 24 | or 25 | 26 | ```bash 27 | yarn add react-app-polyfill 28 | ``` 29 | 30 | Now, you can import the entry point for the minimal version you intend to support. For example, if you import the IE9 entry point, this will include IE10 and IE11 support. 31 | 32 | #### Internet Explorer 9 33 | 34 | ```js 35 | // This must be the first line in src/index.js 36 | import 'react-app-polyfill/ie9'; 37 | 38 | // ... 39 | ``` 40 | 41 | #### Internet Explorer 11 42 | 43 | ```js 44 | // This must be the first line in src/index.js 45 | import 'react-app-polyfill/ie11'; 46 | 47 | // ... 48 | ``` 49 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/AsyncAwait.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | async function load() { 12 | return [ 13 | { id: 1, name: '1' }, 14 | { id: 2, name: '2' }, 15 | { id: 3, name: '3' }, 16 | { id: 4, name: '4' }, 17 | ]; 18 | } 19 | 20 | /* eslint-disable */ 21 | // Regression test for https://github.com/facebook/create-react-app/issues/3055 22 | const x = async ( 23 | /* prettier-ignore */ 24 | y: void 25 | ) => { 26 | const z = await y; 27 | }; 28 | /* eslint-enable */ 29 | 30 | export default class extends Component { 31 | static propTypes = { 32 | onReady: PropTypes.func.isRequired, 33 | }; 34 | 35 | constructor(props) { 36 | super(props); 37 | this.state = { users: [] }; 38 | } 39 | 40 | async componentDidMount() { 41 | const users = await load(); 42 | this.setState({ users }); 43 | } 44 | 45 | componentDidUpdate() { 46 | this.props.onReady(); 47 | } 48 | 49 | render() { 50 | return ( 51 |
52 | {this.state.users.map(user => ( 53 |
{user.name}
54 | ))} 55 |
56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tasks/screencast-start.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Copyright (c) 2015-present, Facebook, Inc. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | */ 9 | 10 | 'use strict'; 11 | 12 | const execa = require('execa'); 13 | const meow = require('meow'); 14 | const multimatch = require('multimatch'); 15 | 16 | main(meow()); 17 | 18 | function main(cli) { 19 | let count = 0; 20 | 21 | const start = Date.now(); 22 | const duration = parseInt(cli.flags.timeout, 10) * 1000; 23 | const cp = execa.shell(cli.flags.command); 24 | 25 | const target = parseInt(cli.flags.patternCount || '1', 10); 26 | 27 | cp.stdout.on('data', data => { 28 | process.stdout.write(data); 29 | const matches = multimatch([String(data)], cli.flags.pattern); 30 | const errMatches = multimatch([String(data)], cli.flags.errorPattern); 31 | 32 | if (matches.length > 0) { 33 | count++; 34 | } 35 | 36 | if (errMatches.length > 0) { 37 | process.exit(1); 38 | } 39 | 40 | if (count >= target) { 41 | setTimeout(() => { 42 | process.exit(0); 43 | }, duration); 44 | } 45 | }); 46 | 47 | cp.on('exit', e => { 48 | const elapsed = Date.now() - start; 49 | 50 | if (elapsed >= duration) { 51 | return; 52 | } 53 | 54 | setTimeout(() => { 55 | process.exit(e.code); 56 | }, duration - elapsed); 57 | }); 58 | } 59 | -------------------------------------------------------------------------------- /packages/react-dev-utils/noopServiceWorkerMiddleware.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | module.exports = function createNoopServiceWorkerMiddleware() { 11 | return function noopServiceWorkerMiddleware(req, res, next) { 12 | if (req.url === '/service-worker.js') { 13 | res.setHeader('Content-Type', 'text/javascript'); 14 | res.send( 15 | `// This service worker file is effectively a 'no-op' that will reset any 16 | // previous service worker registered for the same host:port combination. 17 | // In the production build, this file is replaced with an actual service worker 18 | // file that will precache your site's local assets. 19 | // See https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432 20 | 21 | self.addEventListener('install', () => self.skipWaiting()); 22 | 23 | self.addEventListener('activate', () => { 24 | self.clients.matchAll({ type: 'window' }).then(windowClients => { 25 | for (let windowClient of windowClients) { 26 | // Force open pages to refresh, so that they have a chance to load the 27 | // fresh navigation response from the local dev server. 28 | windowClient.navigate(windowClient.url); 29 | } 30 | }); 31 | }); 32 | ` 33 | ); 34 | } else { 35 | next(); 36 | } 37 | }; 38 | }; 39 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2017 2 | 3 | environment: 4 | APPVEYOR_SAVE_CACHE_ON_ERROR: true 5 | APPVEYOR_BUILD_WORKER_CLOUD: 'GCE' 6 | matrix: 7 | - nodejs_version: 10 8 | test_suite: 'simple' 9 | - nodejs_version: 10 10 | test_suite: 'installs' 11 | - nodejs_version: 10 12 | test_suite: 'kitchensink' 13 | - nodejs_version: 10 14 | test_suite: 'kitchensink-eject' 15 | - nodejs_version: 8 16 | test_suite: 'simple' 17 | - nodejs_version: 8 18 | test_suite: 'installs' 19 | - nodejs_version: 8 20 | test_suite: 'kitchensink' 21 | - nodejs_version: 8 22 | test_suite: 'kitchensink-eject' 23 | cache: 24 | - '%APPDATA%\npm-cache -> appveyor.cleanup-cache.txt' 25 | - '%LOCALAPPDATA%\Yarn\Cache -> appveyor.cleanup-cache.txt' 26 | 27 | clone_depth: 50 28 | 29 | matrix: 30 | fast_finish: true 31 | allow_failures: 32 | - test_suite: 'installs' 33 | 34 | platform: 35 | - x64 36 | 37 | install: 38 | - ps: Install-Product node $env:nodejs_version $env:platform 39 | - ps: | 40 | (New-Object Net.WebClient).DownloadFile("https://nightly.yarnpkg.com/latest.msi", "$env:temp\yarn.msi") 41 | cmd /c start /wait msiexec.exe /i $env:temp\yarn.msi /quiet /qn /norestart 42 | 43 | build: off 44 | 45 | skip_commits: 46 | files: 47 | - '**/*.md' 48 | 49 | test_script: 50 | - node --version 51 | - npm --version 52 | - yarn --version 53 | - yarn cache dir 54 | - bash tasks/e2e-%test_suite%.sh 55 | -------------------------------------------------------------------------------- /tasks/verdaccio.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # This is based on verdaccio's default config file. It allows all users 3 | # to do anything, so don't use it on production systems. 4 | # 5 | # Look here for more config file examples: 6 | # https://github.com/verdaccio/verdaccio/tree/master/conf 7 | # 8 | 9 | # path to a directory with all packages 10 | storage: ./storage 11 | 12 | auth: 13 | htpasswd: 14 | file: ./htpasswd 15 | # Maximum amount of users allowed to register, defaults to "+inf". 16 | # You can set this to -1 to disable registration. 17 | #max_users: 1000 18 | 19 | # a list of other known repositories we can talk to 20 | uplinks: 21 | npmjs: 22 | url: https://registry.npmjs.org/ 23 | 24 | packages: 25 | '@*/*': 26 | # scoped packages 27 | access: $all 28 | publish: $all 29 | proxy: npmjs 30 | 31 | '**': 32 | # allow all users (including non-authenticated users) to read and 33 | # publish all packages 34 | # 35 | # you can specify usernames/groupnames (depending on your auth plugin) 36 | # and three keywords: "$all", "$anonymous", "$authenticated" 37 | access: $all 38 | 39 | # allow all known users to publish packages 40 | # (anyone can register by default, remember?) 41 | publish: $all 42 | 43 | # if package is not available locally, proxy requests to 'npmjs' registry 44 | proxy: npmjs 45 | 46 | # log settings 47 | logs: 48 | - {type: stdout, format: pretty, level: http} 49 | #- {type: file, path: verdaccio.log, level: info} 50 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/utils/getStackFrames.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | import type { StackFrame } from './stack-frame'; 10 | import { parse } from './parser'; 11 | import { map } from './mapper'; 12 | import { unmap } from './unmapper'; 13 | 14 | function getStackFrames( 15 | error: Error, 16 | unhandledRejection: boolean = false, 17 | contextSize: number = 3 18 | ): Promise { 19 | const parsedFrames = parse(error); 20 | let enhancedFramesPromise; 21 | if (error.__unmap_source) { 22 | enhancedFramesPromise = unmap( 23 | // $FlowFixMe 24 | error.__unmap_source, 25 | parsedFrames, 26 | contextSize 27 | ); 28 | } else { 29 | enhancedFramesPromise = map(parsedFrames, contextSize); 30 | } 31 | return enhancedFramesPromise.then(enhancedFrames => { 32 | if ( 33 | enhancedFrames 34 | .map(f => f._originalFileName) 35 | .filter(f => f != null && f.indexOf('node_modules') === -1).length === 0 36 | ) { 37 | return null; 38 | } 39 | return enhancedFrames.filter( 40 | ({ functionName }) => 41 | functionName == null || 42 | functionName.indexOf('__stack_frame_overlay_proxy_console__') === -1 43 | ); 44 | }); 45 | } 46 | 47 | export default getStackFrames; 48 | export { getStackFrames }; 49 | -------------------------------------------------------------------------------- /test/fixtures/mjs-support/index.test.js: -------------------------------------------------------------------------------- 1 | const testSetup = require('../__shared__/test-setup'); 2 | 3 | const puppeteer = require('puppeteer'); 4 | 5 | test('can use mjs library in development', async () => { 6 | const { port, done } = await testSetup.scripts.start(); 7 | 8 | const browser = await puppeteer.launch({ headless: true }); 9 | try { 10 | const page = await browser.newPage(); 11 | await page.goto(`http://localhost:${port}/`); 12 | await page.waitForSelector('.Pokemon-Name-Data', { timeout: 0 }); 13 | const output = await page.evaluate(() => { 14 | return Array.from( 15 | document.getElementsByClassName('Pokemon-Name-Data') 16 | ).pop().innerHTML; 17 | }); 18 | expect(output).toMatchSnapshot(); 19 | } finally { 20 | browser.close(); 21 | done(); 22 | } 23 | }); 24 | test('can use mjs library in production', async () => { 25 | await testSetup.scripts.build(); 26 | const { port, done } = await testSetup.scripts.serve(); 27 | 28 | const browser = await puppeteer.launch({ headless: true }); 29 | try { 30 | const page = await browser.newPage(); 31 | await page.goto(`http://localhost:${port}/`); 32 | await page.waitForSelector('.Pokemon-Name-Data', { timeout: 0 }); 33 | const output = await page.evaluate(() => { 34 | return Array.from( 35 | document.getElementsByClassName('Pokemon-Name-Data') 36 | ).pop().innerHTML; 37 | }); 38 | expect(output).toMatchSnapshot(); 39 | } finally { 40 | browser.close(); 41 | done(); 42 | } 43 | }); 44 | -------------------------------------------------------------------------------- /tasks/compile-lockfile.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /** 3 | * Copyright (c) 2015-present, Facebook, Inc. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | const cprocess = require('child_process'); 12 | const fse = require('fs-extra'); 13 | const os = require('os'); 14 | const path = require('path'); 15 | 16 | const temp = path.join(os.tmpdir(), `cra-compile-lockfile`); 17 | 18 | try { 19 | // Ensures that we start from a clean state 20 | fse.removeSync(temp); 21 | fse.mkdirSync(temp); 22 | 23 | // Create an empty package.json that we'll populate 24 | fse.writeFileSync(path.join(temp, 'package.json'), '{}'); 25 | 26 | // Extract the dependencies from react-scripts (which is a workspace) 27 | const dependencies = require('react-scripts/package.json').dependencies; 28 | const descriptors = Object.keys(dependencies).map( 29 | dep => `${dep}@${dependencies[dep]}` 30 | ); 31 | 32 | // Run "yarn add" with all the dependencies of react-scripts 33 | cprocess.execFileSync('yarn', ['add', ...descriptors], { cwd: temp }); 34 | 35 | // Store the generated lockfile in create-react-app 36 | // We can't store it inside react-scripts, because we need it even before react-scripts is installed 37 | fse.copySync( 38 | path.join(temp, 'yarn.lock'), 39 | path.join( 40 | __dirname, 41 | '..', 42 | 'packages', 43 | 'create-react-app', 44 | 'yarn.lock.cached' 45 | ) 46 | ); 47 | } finally { 48 | fse.removeSync(temp); 49 | } 50 | -------------------------------------------------------------------------------- /test/fixtures/mjs-support/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import ApolloClient, { gql } from 'apollo-boost'; 3 | import { ApolloProvider, Query } from 'react-apollo'; 4 | 5 | const GET_PIKA = gql` 6 | { 7 | pokemon(name: "Pikachu") { 8 | name 9 | } 10 | } 11 | `; 12 | 13 | const client = new ApolloClient({ 14 | uri: 'https://graphql-pokemon.now.sh/graphql', 15 | }); 16 | 17 | class Pokemon extends Component { 18 | render() { 19 | const { name } = this.props.pokemon; 20 | return ( 21 |

22 | Pokemon name: {name} 23 |

24 | ); 25 | } 26 | } 27 | 28 | class Data extends Component { 29 | state = {}; 30 | componentDidCatch() { 31 | this.setState({ hasError: true }); 32 | } 33 | render() { 34 | const { hasError } = this.state; 35 | return hasError ? ( 36 |
Error :(
37 | ) : ( 38 | 39 | {({ loading, error, data }) => { 40 | if (loading) { 41 | return
Loading...
; 42 | } 43 | if (error) { 44 | return
Error :(
; 45 | } 46 | return ; 47 | }} 48 |
49 | ); 50 | } 51 | } 52 | 53 | class App extends Component { 54 | render() { 55 | return ( 56 | 57 | 58 | 59 | ); 60 | } 61 | } 62 | 63 | export default App; 64 | -------------------------------------------------------------------------------- /packages/react-scripts/fixtures/kitchensink/src/features/syntax/CustomInterpolation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { Component } from 'react'; 9 | import PropTypes from 'prop-types'; 10 | 11 | const styled = ([style]) => 12 | style 13 | .trim() 14 | .split(/\s*;\s*/) 15 | .map(rule => rule.split(/\s*:\s*/)) 16 | .reduce((rules, rule) => ({ ...rules, [rule[0]]: rule[1] }), {}); 17 | 18 | function load() { 19 | return [ 20 | { id: 1, name: '1' }, 21 | { id: 2, name: '2' }, 22 | { id: 3, name: '3' }, 23 | { id: 4, name: '4' }, 24 | ]; 25 | } 26 | 27 | export default class extends Component { 28 | static propTypes = { 29 | onReady: PropTypes.func.isRequired, 30 | }; 31 | 32 | constructor(props) { 33 | super(props); 34 | this.state = { users: [] }; 35 | } 36 | 37 | async componentDidMount() { 38 | const users = load(); 39 | this.setState({ users }); 40 | } 41 | 42 | componentDidUpdate() { 43 | this.props.onReady(); 44 | } 45 | 46 | render() { 47 | const veryInlineStyle = styled` 48 | background: palevioletred; 49 | color: papayawhip; 50 | `; 51 | 52 | return ( 53 |
54 | {this.state.users.map(user => ( 55 |
56 | {user.name} 57 |
58 | ))} 59 |
60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/effects/unhandledRejection.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | let boundRejectionHandler = null; 10 | 11 | type ErrorCallback = (error: Error) => void; 12 | 13 | function rejectionHandler( 14 | callback: ErrorCallback, 15 | e: PromiseRejectionEvent 16 | ): void { 17 | if (e == null || e.reason == null) { 18 | return callback(new Error('Unknown')); 19 | } 20 | let { reason } = e; 21 | if (reason instanceof Error) { 22 | return callback(reason); 23 | } 24 | // A non-error was rejected, we don't have a trace :( 25 | // Look in your browser's devtools for more information 26 | return callback(new Error(reason)); 27 | } 28 | 29 | function registerUnhandledRejection( 30 | target: EventTarget, 31 | callback: ErrorCallback 32 | ) { 33 | if (boundRejectionHandler !== null) { 34 | return; 35 | } 36 | boundRejectionHandler = rejectionHandler.bind(undefined, callback); 37 | // $FlowFixMe 38 | target.addEventListener('unhandledrejection', boundRejectionHandler); 39 | } 40 | 41 | function unregisterUnhandledRejection(target: EventTarget) { 42 | if (boundRejectionHandler === null) { 43 | return; 44 | } 45 | // $FlowFixMe 46 | target.removeEventListener('unhandledrejection', boundRejectionHandler); 47 | boundRejectionHandler = null; 48 | } 49 | 50 | export { 51 | registerUnhandledRejection as register, 52 | unregisterUnhandledRejection as unregister, 53 | }; 54 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/parser/__snapshots__/react.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`15.y.z 1`] = ` 4 | Array [ 5 | StackFrame { 6 | "_originalColumnNumber": null, 7 | "_originalFileName": null, 8 | "_originalFunctionName": null, 9 | "_originalLineNumber": null, 10 | "_originalScriptCode": null, 11 | "_scriptCode": null, 12 | "columnNumber": null, 13 | "fileName": "FileA.js", 14 | "functionName": "div", 15 | "lineNumber": 9, 16 | }, 17 | StackFrame { 18 | "_originalColumnNumber": null, 19 | "_originalFileName": null, 20 | "_originalFunctionName": null, 21 | "_originalLineNumber": null, 22 | "_originalScriptCode": null, 23 | "_scriptCode": null, 24 | "columnNumber": null, 25 | "fileName": "App.js", 26 | "functionName": "FileA", 27 | "lineNumber": 9, 28 | }, 29 | StackFrame { 30 | "_originalColumnNumber": null, 31 | "_originalFileName": null, 32 | "_originalFunctionName": null, 33 | "_originalLineNumber": null, 34 | "_originalScriptCode": null, 35 | "_scriptCode": null, 36 | "columnNumber": null, 37 | "fileName": "App.js", 38 | "functionName": "div", 39 | "lineNumber": 8, 40 | }, 41 | StackFrame { 42 | "_originalColumnNumber": null, 43 | "_originalFileName": null, 44 | "_originalFunctionName": null, 45 | "_originalLineNumber": null, 46 | "_originalScriptCode": null, 47 | "_scriptCode": null, 48 | "columnNumber": null, 49 | "fileName": "index.js", 50 | "functionName": "App", 51 | "lineNumber": 7, 52 | }, 53 | ] 54 | `; 55 | -------------------------------------------------------------------------------- /packages/react-dev-utils/InterpolateHtmlPlugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | // This Webpack plugin lets us interpolate custom variables into `index.html`. 9 | // Usage: `new InterpolateHtmlPlugin(HtmlWebpackPlugin, { 'MY_VARIABLE': 42 })` 10 | // Then, you can use %MY_VARIABLE% in your `index.html`. 11 | 12 | // It works in tandem with HtmlWebpackPlugin. 13 | // Learn more about creating plugins like this: 14 | // https://github.com/ampedandwired/html-webpack-plugin#events 15 | 16 | 'use strict'; 17 | const escapeStringRegexp = require('escape-string-regexp'); 18 | 19 | class InterpolateHtmlPlugin { 20 | constructor(htmlWebpackPlugin, replacements) { 21 | this.htmlWebpackPlugin = htmlWebpackPlugin; 22 | this.replacements = replacements; 23 | } 24 | 25 | apply(compiler) { 26 | compiler.hooks.compilation.tap('InterpolateHtmlPlugin', compilation => { 27 | this.htmlWebpackPlugin 28 | .getHooks(compilation) 29 | .beforeEmit.tap('InterpolateHtmlPlugin', data => { 30 | // Run HTML through a series of user-specified string replacements. 31 | Object.keys(this.replacements).forEach(key => { 32 | const value = this.replacements[key]; 33 | data.html = data.html.replace( 34 | new RegExp('%' + escapeStringRegexp(key) + '%', 'g'), 35 | value 36 | ); 37 | }); 38 | }); 39 | }); 40 | } 41 | } 42 | 43 | module.exports = InterpolateHtmlPlugin; 44 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/utils/getPrettyURL.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | function getPrettyURL( 10 | sourceFileName: ?string, 11 | sourceLineNumber: ?number, 12 | sourceColumnNumber: ?number, 13 | fileName: ?string, 14 | lineNumber: ?number, 15 | columnNumber: ?number, 16 | compiled: boolean 17 | ): string { 18 | let prettyURL; 19 | if (!compiled && sourceFileName && typeof sourceLineNumber === 'number') { 20 | // Remove everything up to the first /src/ or /node_modules/ 21 | const trimMatch = /^[/|\\].*?[/|\\]((src|node_modules)[/|\\].*)/.exec( 22 | sourceFileName 23 | ); 24 | if (trimMatch && trimMatch[1]) { 25 | prettyURL = trimMatch[1]; 26 | } else { 27 | prettyURL = sourceFileName; 28 | } 29 | prettyURL += ':' + sourceLineNumber; 30 | // Note: we intentionally skip 0's because they're produced by cheap Webpack maps 31 | if (sourceColumnNumber) { 32 | prettyURL += ':' + sourceColumnNumber; 33 | } 34 | } else if (fileName && typeof lineNumber === 'number') { 35 | prettyURL = fileName + ':' + lineNumber; 36 | // Note: we intentionally skip 0's because they're produced by cheap Webpack maps 37 | if (columnNumber) { 38 | prettyURL += ':' + columnNumber; 39 | } 40 | } else { 41 | prettyURL = 'unknown'; 42 | } 43 | return prettyURL.replace('webpack://', '.'); 44 | } 45 | 46 | export { getPrettyURL }; 47 | export default getPrettyURL; 48 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/utils/warnings.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | import type { ReactFrame } from '../effects/proxyConsole'; 10 | 11 | function stripInlineStacktrace(message: string): string { 12 | return message 13 | .split('\n') 14 | .filter(line => !line.match(/^\s*in/)) 15 | .join('\n'); // " in Foo" 16 | } 17 | 18 | function massage( 19 | warning: string, 20 | frames: ReactFrame[] 21 | ): { message: string, stack: string } { 22 | let message = stripInlineStacktrace(warning); 23 | 24 | // Reassemble the stack with full filenames provided by React 25 | let stack = ''; 26 | let lastFilename; 27 | let lastLineNumber; 28 | for (let index = 0; index < frames.length; ++index) { 29 | const { fileName, lineNumber } = frames[index]; 30 | if (fileName == null || lineNumber == null) { 31 | continue; 32 | } 33 | 34 | // TODO: instead, collapse them in the UI 35 | if ( 36 | fileName === lastFilename && 37 | typeof lineNumber === 'number' && 38 | typeof lastLineNumber === 'number' && 39 | Math.abs(lineNumber - lastLineNumber) < 3 40 | ) { 41 | continue; 42 | } 43 | lastFilename = fileName; 44 | lastLineNumber = lineNumber; 45 | 46 | let { name } = frames[index]; 47 | name = name || '(anonymous function)'; 48 | stack += `in ${name} (at ${fileName}:${lineNumber})\n`; 49 | } 50 | 51 | return { message, stack }; 52 | } 53 | 54 | export { massage }; 55 | -------------------------------------------------------------------------------- /packages/react-dev-utils/evalSourceMapMiddleware.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 'use strict'; 8 | 9 | function base64SourceMap(source) { 10 | const base64 = Buffer.from(JSON.stringify(source.map()), 'utf8').toString( 11 | 'base64' 12 | ); 13 | return `data:application/json;charset=utf-8;base64,${base64}`; 14 | } 15 | 16 | function getSourceById(server, id) { 17 | const module = server._stats.compilation.modules.find(m => m.id == id); 18 | return module.originalSource(); 19 | } 20 | 21 | /* 22 | * Middleware responsible for retrieving a generated source 23 | * Receives a webpack internal url: "webpack-internal:///" 24 | * Returns a generated source: "" 25 | * 26 | * Based on EvalSourceMapDevToolModuleTemplatePlugin.js 27 | */ 28 | module.exports = function createEvalSourceMapMiddleware(server) { 29 | return function handleWebpackInternalMiddleware(req, res, next) { 30 | if (req.url.startsWith('/__get-internal-source')) { 31 | const fileName = req.query.fileName; 32 | const id = fileName.match(/webpack-internal:\/\/\/(.+)/)[1]; 33 | if (!id || !server._stats) { 34 | next(); 35 | } 36 | 37 | const source = getSourceById(server, id); 38 | const sourceMapURL = `//# sourceMappingURL=${base64SourceMap(source)}`; 39 | const sourceURL = `//# sourceURL=webpack-internal:///${module.id}`; 40 | res.end(`${source.source()}\n${sourceMapURL}\n${sourceURL}`); 41 | } else { 42 | next(); 43 | } 44 | }; 45 | }; 46 | -------------------------------------------------------------------------------- /packages/react-scripts/template/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 22 | React App 23 | 24 | 25 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/__tests__/parser/firefox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import { parse } from '../../utils/parser'; 9 | 10 | test('eval 1', () => { 11 | expect( 12 | parse( 13 | `test1@file:///C:/example.html line 7 > eval line 1 > eval:1:1 14 | test2@file:///C:/example.html line 7 > eval:1:1 15 | test3@file:///C:/example.html:7:6`.split('\n') 16 | ) 17 | ).toMatchSnapshot(); 18 | }); 19 | 20 | test('eval 2', () => { 21 | expect( 22 | parse({ 23 | stack: `anonymous@file:///C:/example.html line 7 > Function:1:1 24 | @file:///C:/example.html:7:6`, 25 | }) 26 | ).toMatchSnapshot(); 27 | }); 28 | 29 | test('stack with eval', () => { 30 | expect( 31 | parse( 32 | `e@file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:25:9 33 | @file:///Users/joe/Documents/Development/OSS/stack-frame/index.html line 17 > eval:1:1 34 | a@file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:8:9 35 | @file:///Users/joe/Documents/Development/OSS/stack-frame/index.html:32:7` 36 | ) 37 | ).toMatchSnapshot(); 38 | }); 39 | 40 | test('v14 to v29', () => { 41 | expect( 42 | parse( 43 | `trace@file:///C:/example.html:9 44 | b@file:///C:/example.html:16 45 | a@file:///C:/example.html:19 46 | @file:///C:/example.html:21` 47 | ) 48 | ).toMatchSnapshot(); 49 | }); 50 | 51 | test('v30+', () => { 52 | expect( 53 | parse( 54 | `trace@file:///C:/example.html:9:17 55 | b@file:///C:/example.html:16:13 56 | a@file:///C:/example.html:19:13 57 | @file:///C:/example.html:21:9` 58 | ) 59 | ).toMatchSnapshot(); 60 | }); 61 | -------------------------------------------------------------------------------- /packages/react-error-overlay/src/containers/CompileErrorContainer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* @flow */ 9 | import React, { PureComponent } from 'react'; 10 | import ErrorOverlay from '../components/ErrorOverlay'; 11 | import Footer from '../components/Footer'; 12 | import Header from '../components/Header'; 13 | import CodeBlock from '../components/CodeBlock'; 14 | import generateAnsiHTML from '../utils/generateAnsiHTML'; 15 | import parseCompileError from '../utils/parseCompileError'; 16 | import type { ErrorLocation } from '../utils/parseCompileError'; 17 | 18 | const codeAnchorStyle = { 19 | cursor: 'pointer', 20 | }; 21 | 22 | type Props = {| 23 | error: string, 24 | editorHandler: (errorLoc: ErrorLocation) => void, 25 | |}; 26 | 27 | class CompileErrorContainer extends PureComponent { 28 | render() { 29 | const { error, editorHandler } = this.props; 30 | const errLoc: ?ErrorLocation = parseCompileError(error); 31 | const canOpenInEditor = errLoc !== null && editorHandler !== null; 32 | return ( 33 | 34 |
35 |
editorHandler(errLoc) : null 38 | } 39 | style={canOpenInEditor ? codeAnchorStyle : null} 40 | > 41 | 42 |
43 |