@lunit/oui 1.0.0-alpha.1 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/types/components/BaseTextField/BaseTextField.styled.d.ts +1 -1
  3. package/dist/types/components/Button/styleds/ContainedButton.styled.d.ts +1 -1
  4. package/dist/types/components/Button/styleds/GhostButton.styled.d.ts +1 -1
  5. package/dist/types/components/Button/styleds/OutlinedButton.styled.d.ts +1 -1
  6. package/dist/types/components/Chip/Chip.styled.d.ts +1 -1
  7. package/dist/types/components/Dialog/Dialog.styled.d.ts +1 -1
  8. package/dist/types/components/Divider/Divider.styled.d.ts +1 -1
  9. package/dist/types/components/Dropdown/DropdownItem.styled.d.ts +1 -1
  10. package/dist/types/components/Dropdown/DropdownSubtitle.styled.d.ts +1 -1
  11. package/dist/types/components/List/List.styled.d.ts +2 -2
  12. package/dist/types/components/List/ListItem.styled.d.ts +4 -4
  13. package/dist/types/components/List/ListItemCaption.styled.d.ts +1 -1
  14. package/dist/types/components/LoadingIndicator/LoadingIndicator.styled.d.ts +2 -2
  15. package/dist/types/components/Menu/Menu.styled.d.ts +1 -1
  16. package/dist/types/components/Menu/MenuItem.styled.d.ts +1 -1
  17. package/dist/types/components/ProductLabel/ProductLabel.styled.d.ts +2 -2
  18. package/dist/types/components/Stepper/Stepper.styled.d.ts +1 -1
  19. package/dist/types/components/TabbedPanel/TabbedPanel.styled.d.ts +2 -2
  20. package/dist/types/components/UploadManager/UploadManager.styled.d.ts +3 -3
  21. package/package.json +2 -2
  22. package/.github/PULL_REQUEST_TEMPLATE.md +0 -35
  23. package/.husky/commit-msg +0 -4
  24. package/.husky/pre-commit +0 -5
  25. package/config/alias.js +0 -5
  26. package/config/cjs.config.js +0 -25
  27. package/config/env.js +0 -104
  28. package/config/getHttpsConfig.js +0 -66
  29. package/config/jest/babelTransform.js +0 -29
  30. package/config/jest/cssTransform.js +0 -14
  31. package/config/jest/fileTransform.js +0 -40
  32. package/config/modules.js +0 -134
  33. package/config/paths.js +0 -77
  34. package/config/webpack.config.js +0 -39
  35. package/config/webpackDevServer.config.js +0 -127
  36. package/dist/cjs/components/Alert/index.js +0 -2
  37. package/dist/cjs/components/Alert/index.js.map +0 -1
  38. package/dist/cjs/components/Button/index.js +0 -2
  39. package/dist/cjs/components/Button/index.js.map +0 -1
  40. package/dist/cjs/components/Card/index.js +0 -2
  41. package/dist/cjs/components/Card/index.js.map +0 -1
  42. package/dist/cjs/components/Checkbox/index.js +0 -2
  43. package/dist/cjs/components/Checkbox/index.js.map +0 -1
  44. package/dist/cjs/components/Chip/index.js +0 -2
  45. package/dist/cjs/components/Chip/index.js.map +0 -1
  46. package/dist/cjs/components/DataTable/index.js +0 -2
  47. package/dist/cjs/components/DataTable/index.js.map +0 -1
  48. package/dist/cjs/components/DatePicker/index.js +0 -2
  49. package/dist/cjs/components/DatePicker/index.js.map +0 -1
  50. package/dist/cjs/components/Dialog/index.js +0 -2
  51. package/dist/cjs/components/Dialog/index.js.map +0 -1
  52. package/dist/cjs/components/Divider/index.js +0 -2
  53. package/dist/cjs/components/Divider/index.js.map +0 -1
  54. package/dist/cjs/components/Dropdown/index.js +0 -2
  55. package/dist/cjs/components/Dropdown/index.js.map +0 -1
  56. package/dist/cjs/components/FileDnDZone/index.js +0 -2
  57. package/dist/cjs/components/FileDnDZone/index.js.map +0 -1
  58. package/dist/cjs/components/Icons/index.js +0 -2
  59. package/dist/cjs/components/Icons/index.js.map +0 -1
  60. package/dist/cjs/components/List/index.js +0 -2
  61. package/dist/cjs/components/List/index.js.map +0 -1
  62. package/dist/cjs/components/LoadingIndicator/index.js +0 -2
  63. package/dist/cjs/components/LoadingIndicator/index.js.map +0 -1
  64. package/dist/cjs/components/Menu/index.js +0 -2
  65. package/dist/cjs/components/Menu/index.js.map +0 -1
  66. package/dist/cjs/components/ProductLabel/index.js +0 -2
  67. package/dist/cjs/components/ProductLabel/index.js.map +0 -1
  68. package/dist/cjs/components/Progress/index.js +0 -2
  69. package/dist/cjs/components/Progress/index.js.map +0 -1
  70. package/dist/cjs/components/Radio/index.js +0 -2
  71. package/dist/cjs/components/Radio/index.js.map +0 -1
  72. package/dist/cjs/components/Stepper/index.js +0 -2
  73. package/dist/cjs/components/Stepper/index.js.map +0 -1
  74. package/dist/cjs/components/TabbedPanel/index.js +0 -2
  75. package/dist/cjs/components/TabbedPanel/index.js.map +0 -1
  76. package/dist/cjs/components/TextField/index.js +0 -2
  77. package/dist/cjs/components/TextField/index.js.map +0 -1
  78. package/dist/cjs/components/Tooltip/index.js +0 -2
  79. package/dist/cjs/components/Tooltip/index.js.map +0 -1
  80. package/dist/cjs/components/UploadManager/index.js +0 -2
  81. package/dist/cjs/components/UploadManager/index.js.map +0 -1
  82. package/dist/cjs/index.js +0 -2
  83. package/dist/cjs/index.js.map +0 -1
  84. package/public/favicon.ico +0 -0
  85. package/public/index.html +0 -43
  86. package/public/logo192.png +0 -0
  87. package/public/logo512.png +0 -0
  88. package/public/manifest.json +0 -25
  89. package/public/robots.txt +0 -3
package/config/env.js DELETED
@@ -1,104 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const paths = require('./paths');
6
-
7
- // Make sure that including paths.js after env.js will read .env variables.
8
- delete require.cache[require.resolve('./paths')];
9
-
10
- const NODE_ENV = process.env.NODE_ENV;
11
- if (!NODE_ENV) {
12
- throw new Error(
13
- 'The NODE_ENV environment variable is required but was not specified.'
14
- );
15
- }
16
-
17
- // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
18
- const dotenvFiles = [
19
- `${paths.dotenv}.${NODE_ENV}.local`,
20
- // Don't include `.env.local` for `test` environment
21
- // since normally you expect tests to produce the same
22
- // results for everyone
23
- NODE_ENV !== 'test' && `${paths.dotenv}.local`,
24
- `${paths.dotenv}.${NODE_ENV}`,
25
- paths.dotenv,
26
- ].filter(Boolean);
27
-
28
- // Load environment variables from .env* files. Suppress warnings using silent
29
- // if this file is missing. dotenv will never modify any environment variables
30
- // that have already been set. Variable expansion is supported in .env files.
31
- // https://github.com/motdotla/dotenv
32
- // https://github.com/motdotla/dotenv-expand
33
- dotenvFiles.forEach(dotenvFile => {
34
- if (fs.existsSync(dotenvFile)) {
35
- require('dotenv-expand')(
36
- require('dotenv').config({
37
- path: dotenvFile,
38
- })
39
- );
40
- }
41
- });
42
-
43
- // We support resolving modules according to `NODE_PATH`.
44
- // This lets you use absolute paths in imports inside large monorepos:
45
- // https://github.com/facebook/create-react-app/issues/253.
46
- // It works similar to `NODE_PATH` in Node itself:
47
- // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
48
- // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
49
- // Otherwise, we risk importing Node.js core modules into an app instead of webpack shims.
50
- // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
51
- // We also resolve them to make sure all tools using them work consistently.
52
- const appDirectory = fs.realpathSync(process.cwd());
53
- process.env.NODE_PATH = (process.env.NODE_PATH || '')
54
- .split(path.delimiter)
55
- .filter(folder => folder && !path.isAbsolute(folder))
56
- .map(folder => path.resolve(appDirectory, folder))
57
- .join(path.delimiter);
58
-
59
- // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
60
- // injected into the application via DefinePlugin in webpack configuration.
61
- const REACT_APP = /^REACT_APP_/i;
62
-
63
- function getClientEnvironment(publicUrl) {
64
- const raw = Object.keys(process.env)
65
- .filter(key => REACT_APP.test(key))
66
- .reduce(
67
- (env, key) => {
68
- env[key] = process.env[key];
69
- return env;
70
- },
71
- {
72
- // Useful for determining whether we’re running in production mode.
73
- // Most importantly, it switches React into the correct mode.
74
- NODE_ENV: process.env.NODE_ENV || 'development',
75
- // Useful for resolving the correct path to static assets in `public`.
76
- // For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
77
- // This should only be used as an escape hatch. Normally you would put
78
- // images into the `src` and `import` them in code to get their paths.
79
- PUBLIC_URL: publicUrl,
80
- // We support configuring the sockjs pathname during development.
81
- // These settings let a developer run multiple simultaneous projects.
82
- // They are used as the connection `hostname`, `pathname` and `port`
83
- // in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
84
- // and `sockPort` options in webpack-dev-server.
85
- WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
86
- WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
87
- WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
88
- // Whether or not react-refresh is enabled.
89
- // It is defined here so it is available in the webpackHotDevClient.
90
- FAST_REFRESH: process.env.FAST_REFRESH !== 'false',
91
- }
92
- );
93
- // Stringify all values so we can feed into webpack DefinePlugin
94
- const stringified = {
95
- 'process.env': Object.keys(raw).reduce((env, key) => {
96
- env[key] = JSON.stringify(raw[key]);
97
- return env;
98
- }, {}),
99
- };
100
-
101
- return { raw, stringified };
102
- }
103
-
104
- module.exports = getClientEnvironment;
@@ -1,66 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const crypto = require('crypto');
6
- const chalk = require('react-dev-utils/chalk');
7
- const paths = require('./paths');
8
-
9
- // Ensure the certificate and key provided are valid and if not
10
- // throw an easy to debug error
11
- function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
12
- let encrypted;
13
- try {
14
- // publicEncrypt will throw an error with an invalid cert
15
- encrypted = crypto.publicEncrypt(cert, Buffer.from('test'));
16
- } catch (err) {
17
- throw new Error(
18
- `The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`
19
- );
20
- }
21
-
22
- try {
23
- // privateDecrypt will throw an error with an invalid key
24
- crypto.privateDecrypt(key, encrypted);
25
- } catch (err) {
26
- throw new Error(
27
- `The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${
28
- err.message
29
- }`
30
- );
31
- }
32
- }
33
-
34
- // Read file and throw an error if it doesn't exist
35
- function readEnvFile(file, type) {
36
- if (!fs.existsSync(file)) {
37
- throw new Error(
38
- `You specified ${chalk.cyan(
39
- type
40
- )} in your env, but the file "${chalk.yellow(file)}" can't be found.`
41
- );
42
- }
43
- return fs.readFileSync(file);
44
- }
45
-
46
- // Get the https config
47
- // Return cert files if provided in env, otherwise just true or false
48
- function getHttpsConfig() {
49
- const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
50
- const isHttps = HTTPS === 'true';
51
-
52
- if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
53
- const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
54
- const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
55
- const config = {
56
- cert: readEnvFile(crtFile, 'SSL_CRT_FILE'),
57
- key: readEnvFile(keyFile, 'SSL_KEY_FILE'),
58
- };
59
-
60
- validateKeyAndCerts({ ...config, keyFile, crtFile });
61
- return config;
62
- }
63
- return isHttps;
64
- }
65
-
66
- module.exports = getHttpsConfig;
@@ -1,29 +0,0 @@
1
- 'use strict';
2
-
3
- const babelJest = require('babel-jest').default;
4
-
5
- const hasJsxRuntime = (() => {
6
- if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
7
- return false;
8
- }
9
-
10
- try {
11
- require.resolve('react/jsx-runtime');
12
- return true;
13
- } catch (e) {
14
- return false;
15
- }
16
- })();
17
-
18
- module.exports = babelJest.createTransformer({
19
- presets: [
20
- [
21
- require.resolve('babel-preset-react-app'),
22
- {
23
- runtime: hasJsxRuntime ? 'automatic' : 'classic',
24
- },
25
- ],
26
- ],
27
- babelrc: false,
28
- configFile: false,
29
- });
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- // This is a custom Jest transformer turning style imports into empty objects.
4
- // http://facebook.github.io/jest/docs/en/webpack.html
5
-
6
- module.exports = {
7
- process() {
8
- return 'module.exports = {};';
9
- },
10
- getCacheKey() {
11
- // The output is always the same.
12
- return 'cssTransform';
13
- },
14
- };
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const camelcase = require('camelcase');
5
-
6
- // This is a custom Jest transformer turning file imports into filenames.
7
- // http://facebook.github.io/jest/docs/en/webpack.html
8
-
9
- module.exports = {
10
- process(src, filename) {
11
- const assetFilename = JSON.stringify(path.basename(filename));
12
-
13
- if (filename.match(/\.svg$/)) {
14
- // Based on how SVGR generates a component name:
15
- // https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
16
- const pascalCaseFilename = camelcase(path.parse(filename).name, {
17
- pascalCase: true,
18
- });
19
- const componentName = `Svg${pascalCaseFilename}`;
20
- return `const React = require('react');
21
- module.exports = {
22
- __esModule: true,
23
- default: ${assetFilename},
24
- ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
25
- return {
26
- $$typeof: Symbol.for('react.element'),
27
- type: 'svg',
28
- ref: ref,
29
- key: null,
30
- props: Object.assign({}, props, {
31
- children: ${assetFilename}
32
- })
33
- };
34
- }),
35
- };`;
36
- }
37
-
38
- return `module.exports = ${assetFilename};`;
39
- },
40
- };
package/config/modules.js DELETED
@@ -1,134 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const paths = require('./paths');
6
- const chalk = require('react-dev-utils/chalk');
7
- const resolve = require('resolve');
8
-
9
- /**
10
- * Get additional module paths based on the baseUrl of a compilerOptions object.
11
- *
12
- * @param {Object} options
13
- */
14
- function getAdditionalModulePaths(options = {}) {
15
- const baseUrl = options.baseUrl;
16
-
17
- if (!baseUrl) {
18
- return '';
19
- }
20
-
21
- const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
22
-
23
- // We don't need to do anything if `baseUrl` is set to `node_modules`. This is
24
- // the default behavior.
25
- if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
26
- return null;
27
- }
28
-
29
- // Allow the user set the `baseUrl` to `appSrc`.
30
- if (path.relative(paths.appSrc, baseUrlResolved) === '') {
31
- return [paths.appSrc];
32
- }
33
-
34
- // If the path is equal to the root directory we ignore it here.
35
- // We don't want to allow importing from the root directly as source files are
36
- // not transpiled outside of `src`. We do allow importing them with the
37
- // absolute path (e.g. `src/Components/Button.js`) but we set that up with
38
- // an alias.
39
- if (path.relative(paths.appPath, baseUrlResolved) === '') {
40
- return null;
41
- }
42
-
43
- // Otherwise, throw an error.
44
- throw new Error(
45
- chalk.red.bold(
46
- "Your project's `baseUrl` can only be set to `src` or `node_modules`." +
47
- ' Create React App does not support other values at this time.'
48
- )
49
- );
50
- }
51
-
52
- /**
53
- * Get webpack aliases based on the baseUrl of a compilerOptions object.
54
- *
55
- * @param {*} options
56
- */
57
- function getWebpackAliases(options = {}) {
58
- const baseUrl = options.baseUrl;
59
-
60
- if (!baseUrl) {
61
- return {};
62
- }
63
-
64
- const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
65
-
66
- if (path.relative(paths.appPath, baseUrlResolved) === '') {
67
- return {
68
- src: paths.appSrc,
69
- };
70
- }
71
- }
72
-
73
- /**
74
- * Get jest aliases based on the baseUrl of a compilerOptions object.
75
- *
76
- * @param {*} options
77
- */
78
- function getJestAliases(options = {}) {
79
- const baseUrl = options.baseUrl;
80
-
81
- if (!baseUrl) {
82
- return {};
83
- }
84
-
85
- const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
86
-
87
- if (path.relative(paths.appPath, baseUrlResolved) === '') {
88
- return {
89
- '^src/(.*)$': '<rootDir>/src/$1',
90
- };
91
- }
92
- }
93
-
94
- function getModules() {
95
- // Check if TypeScript is setup
96
- const hasTsConfig = fs.existsSync(paths.appTsConfig);
97
- const hasJsConfig = fs.existsSync(paths.appJsConfig);
98
-
99
- if (hasTsConfig && hasJsConfig) {
100
- throw new Error(
101
- 'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
102
- );
103
- }
104
-
105
- let config;
106
-
107
- // If there's a tsconfig.json we assume it's a
108
- // TypeScript project and set up the config
109
- // based on tsconfig.json
110
- if (hasTsConfig) {
111
- const ts = require(resolve.sync('typescript', {
112
- basedir: paths.appNodeModules,
113
- }));
114
- config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
115
- // Otherwise we'll check if there is jsconfig.json
116
- // for non TS projects.
117
- } else if (hasJsConfig) {
118
- config = require(paths.appJsConfig);
119
- }
120
-
121
- config = config || {};
122
- const options = config.compilerOptions || {};
123
-
124
- const additionalModulePaths = getAdditionalModulePaths(options);
125
-
126
- return {
127
- additionalModulePaths: additionalModulePaths,
128
- webpackAliases: getWebpackAliases(options),
129
- jestAliases: getJestAliases(options),
130
- hasTsConfig,
131
- };
132
- }
133
-
134
- module.exports = getModules();
package/config/paths.js DELETED
@@ -1,77 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const fs = require('fs');
5
- const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
6
-
7
- // Make sure any symlinks in the project folder are resolved:
8
- // https://github.com/facebook/create-react-app/issues/637
9
- const appDirectory = fs.realpathSync(process.cwd());
10
- const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
11
-
12
- // We use `PUBLIC_URL` environment variable or "homepage" field to infer
13
- // "public path" at which the app is served.
14
- // webpack needs to know it to put the right <script> hrefs into HTML even in
15
- // single-page apps that may serve index.html for nested URLs like /todos/42.
16
- // We can't use a relative path in HTML because we don't want to load something
17
- // like /todos/42/static/js/bundle.7289d.js. We have to know the root.
18
- const publicUrlOrPath = getPublicUrlOrPath(
19
- process.env.NODE_ENV === 'development',
20
- require(resolveApp('package.json')).homepage,
21
- process.env.PUBLIC_URL
22
- );
23
-
24
- const buildPath = process.env.BUILD_PATH || 'build';
25
-
26
- const moduleFileExtensions = [
27
- 'web.mjs',
28
- 'mjs',
29
- 'web.js',
30
- 'js',
31
- 'web.ts',
32
- 'ts',
33
- 'web.tsx',
34
- 'tsx',
35
- 'json',
36
- 'web.jsx',
37
- 'jsx',
38
- ];
39
-
40
- // Resolve file paths in the same order as webpack
41
- const resolveModule = (resolveFn, filePath) => {
42
- const extension = moduleFileExtensions.find(extension =>
43
- fs.existsSync(resolveFn(`${filePath}.${extension}`))
44
- );
45
-
46
- if (extension) {
47
- return resolveFn(`${filePath}.${extension}`);
48
- }
49
-
50
- return resolveFn(`${filePath}.js`);
51
- };
52
-
53
- // config after eject: we're in ./config/
54
- module.exports = {
55
- dotenv: resolveApp('.env'),
56
- appPath: resolveApp('.'),
57
- appBuild: resolveApp(buildPath),
58
- appPublic: resolveApp('public'),
59
- appHtml: resolveApp('public/index.html'),
60
- appIndexJs: resolveModule(resolveApp, 'src/index'),
61
- appPackageJson: resolveApp('package.json'),
62
- appSrc: resolveApp('src'),
63
- appTsConfig: resolveApp('tsconfig.json'),
64
- appJsConfig: resolveApp('jsconfig.json'),
65
- yarnLockFile: resolveApp('yarn.lock'),
66
- testsSetup: resolveModule(resolveApp, 'src/setupTests'),
67
- proxySetup: resolveApp('src/setupProxy.js'),
68
- appNodeModules: resolveApp('node_modules'),
69
- appWebpackCache: resolveApp('node_modules/.cache'),
70
- appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
71
- swSrc: resolveModule(resolveApp, 'src/service-worker'),
72
- publicUrlOrPath,
73
- };
74
-
75
-
76
-
77
- module.exports.moduleFileExtensions = moduleFileExtensions;
@@ -1,39 +0,0 @@
1
- const nodeExternals = require('webpack-node-externals');
2
- const alias = require('./alias');
3
-
4
- module.exports = {
5
- mode: 'production',
6
- // Enable sourcemaps for debugging webpack's output.
7
- devtool: 'source-map',
8
- resolve: {
9
- // Add '.ts' and '.tsx' as resolvable extensions.
10
- extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js', '.svg', 'json'],
11
- },
12
- module: {
13
- rules: [
14
- // All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
15
- {
16
- test: /\.tsx?$/,
17
- loader: 'ts-loader',
18
- exclude: /node_modules/,
19
- options: {
20
- configFile: 'tsconfig.build.json',
21
- },
22
- },
23
- {
24
- test: /\.svg$/,
25
- issuer: /\.[jt]sx?$/,
26
- use: ['@svgr/webpack'],
27
- },
28
- ],
29
- },
30
- // resolve: {
31
- // alias,
32
- // extensions: ['.tsx', '.ts'],
33
- // },
34
- externals: [
35
- nodeExternals({
36
- modulesFromFile: true,
37
- }),
38
- ],
39
- };
@@ -1,127 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
5
- const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
6
- const ignoredFiles = require('react-dev-utils/ignoredFiles');
7
- const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
8
- const paths = require('./paths');
9
- const getHttpsConfig = require('./getHttpsConfig');
10
-
11
- const host = process.env.HOST || '0.0.0.0';
12
- const sockHost = process.env.WDS_SOCKET_HOST;
13
- const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
14
- const sockPort = process.env.WDS_SOCKET_PORT;
15
-
16
- module.exports = function (proxy, allowedHost) {
17
- const disableFirewall =
18
- !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
19
- return {
20
- // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
21
- // websites from potentially accessing local content through DNS rebinding:
22
- // https://github.com/webpack/webpack-dev-server/issues/887
23
- // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
24
- // However, it made several existing use cases such as development in cloud
25
- // environment or subdomains in development significantly more complicated:
26
- // https://github.com/facebook/create-react-app/issues/2271
27
- // https://github.com/facebook/create-react-app/issues/2233
28
- // While we're investigating better solutions, for now we will take a
29
- // compromise. Since our WDS configuration only serves files in the `public`
30
- // folder we won't consider accessing them a vulnerability. However, if you
31
- // use the `proxy` feature, it gets more dangerous because it can expose
32
- // remote code execution vulnerabilities in backends like Django and Rails.
33
- // So we will disable the host check normally, but enable it if you have
34
- // specified the `proxy` setting. Finally, we let you override it if you
35
- // really know what you're doing with a special environment variable.
36
- // Note: ["localhost", ".localhost"] will support subdomains - but we might
37
- // want to allow setting the allowedHosts manually for more complex setups
38
- allowedHosts: disableFirewall ? 'all' : [allowedHost],
39
- headers: {
40
- 'Access-Control-Allow-Origin': '*',
41
- 'Access-Control-Allow-Methods': '*',
42
- 'Access-Control-Allow-Headers': '*',
43
- },
44
- // Enable gzip compression of generated files.
45
- compress: true,
46
- static: {
47
- // By default WebpackDevServer serves physical files from current directory
48
- // in addition to all the virtual build products that it serves from memory.
49
- // This is confusing because those files won’t automatically be available in
50
- // production build folder unless we copy them. However, copying the whole
51
- // project directory is dangerous because we may expose sensitive files.
52
- // Instead, we establish a convention that only files in `public` directory
53
- // get served. Our build script will copy `public` into the `build` folder.
54
- // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
55
- // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
56
- // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
57
- // Note that we only recommend to use `public` folder as an escape hatch
58
- // for files like `favicon.ico`, `manifest.json`, and libraries that are
59
- // for some reason broken when imported through webpack. If you just want to
60
- // use an image, put it in `src` and `import` it from JavaScript instead.
61
- directory: paths.appPublic,
62
- publicPath: [paths.publicUrlOrPath],
63
- // By default files from `contentBase` will not trigger a page reload.
64
- watch: {
65
- // Reportedly, this avoids CPU overload on some systems.
66
- // https://github.com/facebook/create-react-app/issues/293
67
- // src/node_modules is not ignored to support absolute imports
68
- // https://github.com/facebook/create-react-app/issues/1065
69
- ignored: ignoredFiles(paths.appSrc),
70
- },
71
- },
72
- client: {
73
- webSocketURL: {
74
- // Enable custom sockjs pathname for websocket connection to hot reloading server.
75
- // Enable custom sockjs hostname, pathname and port for websocket connection
76
- // to hot reloading server.
77
- hostname: sockHost,
78
- pathname: sockPath,
79
- port: sockPort,
80
- },
81
- overlay: {
82
- errors: true,
83
- warnings: false,
84
- },
85
- },
86
- devMiddleware: {
87
- // It is important to tell WebpackDevServer to use the same "publicPath" path as
88
- // we specified in the webpack config. When homepage is '.', default to serving
89
- // from the root.
90
- // remove last slash so user can land on `/test` instead of `/test/`
91
- publicPath: paths.publicUrlOrPath.slice(0, -1),
92
- },
93
-
94
- https: getHttpsConfig(),
95
- host,
96
- historyApiFallback: {
97
- // Paths with dots should still use the history fallback.
98
- // See https://github.com/facebook/create-react-app/issues/387.
99
- disableDotRule: true,
100
- index: paths.publicUrlOrPath,
101
- },
102
- // `proxy` is run between `before` and `after` `webpack-dev-server` hooks
103
- proxy,
104
- onBeforeSetupMiddleware(devServer) {
105
- // Keep `evalSourceMapMiddleware`
106
- // middlewares before `redirectServedPath` otherwise will not have any effect
107
- // This lets us fetch source contents from webpack for the error overlay
108
- devServer.app.use(evalSourceMapMiddleware(devServer));
109
-
110
- if (fs.existsSync(paths.proxySetup)) {
111
- // This registers user provided middleware for proxy reasons
112
- require(paths.proxySetup)(devServer.app);
113
- }
114
- },
115
- onAfterSetupMiddleware(devServer) {
116
- // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
117
- devServer.app.use(redirectServedPath(paths.publicUrlOrPath));
118
-
119
- // This service worker file is effectively a 'no-op' that will reset any
120
- // previous service worker registered for the same host:port combination.
121
- // We do this in development to avoid hitting the production cache if
122
- // it used the same host and port.
123
- // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
124
- devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
125
- },
126
- };
127
- };