ezuikit-js 0.6.1-beta.4 → 0.6.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 (159) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +45 -5
  3. package/demos/base-demo/base.html +117 -0
  4. package/demos/base-demo/ezuikit.js +8567 -6436
  5. package/demos/base-demo/ezuikit_static/v6/v1/css/theme.css +121 -0
  6. package/demos/base-demo/ezuikit_static/v6/v1/js/jsPluginV1-1.0.0.min.js +2 -2
  7. package/demos/base-demo/ezuikit_static/v6/v1/js/playctrl/AudioRenderer.js +5 -5
  8. package/demos/base-demo/ezuikit_static/v6/v1/js/playctrl/DecodeWorker.js +130 -223
  9. package/demos/base-demo/ezuikit_static/v6/v1/js/playctrl/Decoder.js +1 -1
  10. package/demos/base-demo/ezuikit_static/v6/v1/js/playctrl/JSPlaySDKInterface.js +201 -667
  11. package/demos/base-demo/ezuikit_static/v6/v1/js/playctrl/SuperRender_10.js +9 -8
  12. package/demos/base-demo/ezuikit_static/v6/v1/speed/speed.css +144 -0
  13. package/demos/base-demo/ezuikit_static/v6/v2/css/theme.css +121 -0
  14. package/demos/base-demo/ezuikit_static/v6/v2/js/jsPluginV2-2.0.1.min.js +147 -65
  15. package/demos/base-demo/ezuikit_static/v6/v2/speed/speed.css +144 -0
  16. package/demos/base-demo/hls.html +24 -0
  17. package/demos/base-demo/index.html +11 -16
  18. package/demos/base-demo/localDecoder.html +118 -0
  19. package/demos/base-demo/mobileLive.html +117 -0
  20. package/demos/base-demo/mobileRec.html +116 -0
  21. package/demos/base-demo/multi.html +129 -0
  22. package/demos/base-demo/pcLive.html +117 -0
  23. package/demos/base-demo/pcRec.html +116 -0
  24. package/demos/base-demo/template.html +124 -0
  25. package/demos/base-demo/themeData.html +232 -0
  26. package/demos/nginx-demo/contrib/README +21 -21
  27. package/demos/nginx-demo/contrib/unicode2nginx/koi-utf +131 -131
  28. package/demos/nginx-demo/contrib/unicode2nginx/unicode-to-nginx.pl +48 -48
  29. package/demos/nginx-demo/contrib/unicode2nginx/win-utf +130 -130
  30. package/demos/nginx-demo/contrib/vim/ftdetect/nginx.vim +4 -4
  31. package/demos/nginx-demo/contrib/vim/ftplugin/nginx.vim +1 -1
  32. package/demos/nginx-demo/contrib/vim/indent/nginx.vim +11 -11
  33. package/demos/nginx-demo/contrib/vim/syntax/nginx.vim +2268 -2268
  34. package/demos/nginx-demo/docs/CHANGES +8115 -8115
  35. package/demos/nginx-demo/docs/CHANGES.ru +8252 -8252
  36. package/demos/nginx-demo/docs/LICENSE +26 -26
  37. package/demos/nginx-demo/docs/OpenSSL.LICENSE +127 -127
  38. package/demos/nginx-demo/docs/PCRE.LICENCE +93 -93
  39. package/demos/nginx-demo/docs/README +3 -3
  40. package/demos/nginx-demo/docs/zlib.LICENSE +20 -20
  41. package/demos/nginx-demo/html/50x.html +21 -21
  42. package/demos/nginx-demo/html/ezuikit5/ezuikit.js +8893 -6480
  43. package/demos/nginx-demo/html/ezuikit5/index.html +10 -3
  44. package/demos/nginx-demo/html/index.html +16 -16
  45. package/demos/react-demo/package-lock.json +13953 -0
  46. package/demos/react-demo/package.json +36 -141
  47. package/demos/react-demo/src/App.js +72 -12
  48. package/demos/vue-demo/README.md +24 -0
  49. package/demos/vue-demo/babel.config.js +5 -0
  50. package/demos/vue-demo/package-lock.json +11638 -0
  51. package/demos/vue-demo/package.json +43 -0
  52. package/demos/vue-demo/public/favicon.ico +0 -0
  53. package/demos/vue-demo/public/index.html +17 -0
  54. package/demos/vue-demo/src/App.vue +27 -0
  55. package/demos/vue-demo/src/assets/logo.png +0 -0
  56. package/demos/vue-demo/src/components/EZUIKitJs.vue +115 -0
  57. package/demos/vue-demo/src/main.js +8 -0
  58. package/ezuikit.js +8567 -6436
  59. package/package.json +1 -1
  60. package/demos/base-demo/ezuikit_static/v6/v1/Decoder.js +0 -9195
  61. package/demos/base-demo/ezuikit_static/v6/v1/Decoder.wasm +0 -0
  62. package/demos/base-demo/ezuikit_static/v6/v1/ezuikit.js +0 -2334
  63. package/demos/base-demo/ezuikit_static/v6/v1/js/jsPlugin-4.0.0.min.js +0 -26
  64. package/demos/base-demo/ezuikit_static/v6/v1/js/jsPlugin-4.0.1.min.js +0 -26
  65. package/demos/base-demo/ezuikit_static/v6/v1/js/jsPlugin-4.0.2.min.js +0 -26
  66. package/demos/base-demo/ezuikit_static/v6/v1/jsPlugin-2.0.0.min.js +0 -5219
  67. package/demos/base-demo/ezuikit_static/v6/v2/Decoder.js +0 -9195
  68. package/demos/base-demo/ezuikit_static/v6/v2/Decoder.wasm +0 -0
  69. package/demos/base-demo/ezuikit_static/v6/v2/js/AudioRenderer.js +0 -225
  70. package/demos/base-demo/ezuikit_static/v6/v2/js/SuperRender_10.js +0 -395
  71. package/demos/base-demo/ezuikit_static/v6/v2/js/SystemTransform.js +0 -22
  72. package/demos/base-demo/ezuikit_static/v6/v2/js/SystemTransform.js.mem +0 -0
  73. package/demos/base-demo/ezuikit_static/v6/v2/js/jsPlugin-4.0.0.min.js +0 -26
  74. package/demos/base-demo/ezuikit_static/v6/v2/js/jsPlugin-4.0.1.min.js +0 -26
  75. package/demos/base-demo/ezuikit_static/v6/v2/js/jsPlugin-4.0.2.min.js +0 -26
  76. package/demos/base-demo/ezuikit_static/v6/v2/js/playctrl/AudioRenderer.js +0 -225
  77. package/demos/base-demo/ezuikit_static/v6/v2/js/playctrl/DecodeWorker.js +0 -711
  78. package/demos/base-demo/ezuikit_static/v6/v2/js/playctrl/Decoder.js +0 -1
  79. package/demos/base-demo/ezuikit_static/v6/v2/js/playctrl/JSPlaySDKInterface.js +0 -2518
  80. package/demos/base-demo/ezuikit_static/v6/v2/js/playctrl/SuperRender_10.js +0 -395
  81. package/demos/base-demo/ezuikit_static/v6/v2/js/playctrl/SuperRender_20.js +0 -1
  82. package/demos/base-demo/ezuikit_static/v6/v2/js/transform/SystemTransform.js +0 -22
  83. package/demos/base-demo/ezuikit_static/v6/v2/js/transform/SystemTransform.js.mem +0 -0
  84. package/demos/base-demo/ezuikit_static/v6/v2/js/transform/systemTransform-worker.min.js +0 -1
  85. package/demos/base-demo/ezuikit_static/v6/v2/js/tts-v4.js +0 -343
  86. package/demos/base-demo/ezuikit_static/v6/v2/jsPlugin-2.0.1.min.js +0 -5319
  87. package/demos/base-demo/ezuikit_static/v6/v2/jsPluginV2-2.0.1.min.js +0 -5294
  88. package/demos/base-demo/server.js +0 -67
  89. package/demos/react-demo/config/env.js +0 -101
  90. package/demos/react-demo/config/getHttpsConfig.js +0 -66
  91. package/demos/react-demo/config/jest/cssTransform.js +0 -14
  92. package/demos/react-demo/config/jest/fileTransform.js +0 -40
  93. package/demos/react-demo/config/modules.js +0 -141
  94. package/demos/react-demo/config/paths.js +0 -72
  95. package/demos/react-demo/config/pnpTs.js +0 -35
  96. package/demos/react-demo/config/webpack.config.js +0 -669
  97. package/demos/react-demo/config/webpackDevServer.config.js +0 -134
  98. package/demos/react-demo/scripts/build.js +0 -211
  99. package/demos/react-demo/scripts/start.js +0 -166
  100. package/demos/react-demo/scripts/test.js +0 -53
  101. package/ezuikit_static/v6/v1/Decoder.js +0 -9195
  102. package/ezuikit_static/v6/v1/Decoder.wasm +0 -0
  103. package/ezuikit_static/v6/v1/ezuikit.js +0 -2334
  104. package/ezuikit_static/v6/v1/js/AudioRenderer.js +0 -225
  105. package/ezuikit_static/v6/v1/js/SuperRender_10.js +0 -395
  106. package/ezuikit_static/v6/v1/js/SystemTransform.js +0 -22
  107. package/ezuikit_static/v6/v1/js/SystemTransform.js.mem +0 -0
  108. package/ezuikit_static/v6/v1/js/jsPlugin-4.0.0.min.js +0 -26
  109. package/ezuikit_static/v6/v1/js/jsPlugin-4.0.1.min.js +0 -26
  110. package/ezuikit_static/v6/v1/js/jsPlugin-4.0.2.min.js +0 -26
  111. package/ezuikit_static/v6/v1/js/jsPluginV1-1.0.0.min.js +0 -26
  112. package/ezuikit_static/v6/v1/js/playctrl/AudioRenderer.js +0 -225
  113. package/ezuikit_static/v6/v1/js/playctrl/DecodeWorker.js +0 -711
  114. package/ezuikit_static/v6/v1/js/playctrl/Decoder.js +0 -1
  115. package/ezuikit_static/v6/v1/js/playctrl/JSPlaySDKInterface.js +0 -2518
  116. package/ezuikit_static/v6/v1/js/playctrl/SuperRender_10.js +0 -395
  117. package/ezuikit_static/v6/v1/js/playctrl/SuperRender_20.js +0 -1
  118. package/ezuikit_static/v6/v1/js/transform/SystemTransform.js +0 -22
  119. package/ezuikit_static/v6/v1/js/transform/SystemTransform.js.mem +0 -0
  120. package/ezuikit_static/v6/v1/js/transform/systemTransform-worker.min.js +0 -1
  121. package/ezuikit_static/v6/v1/js/tts-v4.js +0 -346
  122. package/ezuikit_static/v6/v1/jsPlugin-2.0.0.min.js +0 -5219
  123. package/ezuikit_static/v6/v1/rec/datepicker.js +0 -1522
  124. package/ezuikit_static/v6/v1/rec/datepicker.min.css +0 -27
  125. package/ezuikit_static/v6/v1/rec/datepicker.zh-CN.js +0 -19
  126. package/ezuikit_static/v6/v1/rec/jquery.min.js +0 -2
  127. package/ezuikit_static/v6/v1/talk/adapeter.js +0 -5497
  128. package/ezuikit_static/v6/v1/talk/janus.js +0 -3507
  129. package/ezuikit_static/v6/v1/talk/tts-v4.js +0 -346
  130. package/ezuikit_static/v6/v2/Decoder.js +0 -9195
  131. package/ezuikit_static/v6/v2/Decoder.wasm +0 -0
  132. package/ezuikit_static/v6/v2/js/AudioRenderer.js +0 -225
  133. package/ezuikit_static/v6/v2/js/Decoder.js +0 -9195
  134. package/ezuikit_static/v6/v2/js/Decoder.wasm +0 -0
  135. package/ezuikit_static/v6/v2/js/SuperRender_10.js +0 -395
  136. package/ezuikit_static/v6/v2/js/SystemTransform.js +0 -22
  137. package/ezuikit_static/v6/v2/js/SystemTransform.js.mem +0 -0
  138. package/ezuikit_static/v6/v2/js/jsPlugin-4.0.0.min.js +0 -26
  139. package/ezuikit_static/v6/v2/js/jsPlugin-4.0.1.min.js +0 -26
  140. package/ezuikit_static/v6/v2/js/jsPlugin-4.0.2.min.js +0 -26
  141. package/ezuikit_static/v6/v2/js/jsPluginV2-2.0.1.min.js +0 -5325
  142. package/ezuikit_static/v6/v2/js/playctrl/AudioRenderer.js +0 -225
  143. package/ezuikit_static/v6/v2/js/playctrl/DecodeWorker.js +0 -711
  144. package/ezuikit_static/v6/v2/js/playctrl/Decoder.js +0 -1
  145. package/ezuikit_static/v6/v2/js/playctrl/JSPlaySDKInterface.js +0 -2518
  146. package/ezuikit_static/v6/v2/js/playctrl/SuperRender_10.js +0 -395
  147. package/ezuikit_static/v6/v2/js/playctrl/SuperRender_20.js +0 -1
  148. package/ezuikit_static/v6/v2/js/transform/SystemTransform.js +0 -22
  149. package/ezuikit_static/v6/v2/js/transform/SystemTransform.js.mem +0 -0
  150. package/ezuikit_static/v6/v2/js/transform/systemTransform-worker.min.js +0 -1
  151. package/ezuikit_static/v6/v2/js/tts-v4.js +0 -343
  152. package/ezuikit_static/v6/v2/jsPlugin-2.0.1.min.js +0 -5319
  153. package/ezuikit_static/v6/v2/rec/datepicker.js +0 -1522
  154. package/ezuikit_static/v6/v2/rec/datepicker.min.css +0 -27
  155. package/ezuikit_static/v6/v2/rec/datepicker.zh-CN.js +0 -19
  156. package/ezuikit_static/v6/v2/rec/jquery.min.js +0 -2
  157. package/ezuikit_static/v6/v2/talk/adapeter.js +0 -5497
  158. package/ezuikit_static/v6/v2/talk/janus.js +0 -3507
  159. package/ezuikit_static/v6/v2/talk/tts-v4.js +0 -343
@@ -1,134 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
5
- const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
6
- const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
7
- const ignoredFiles = require('react-dev-utils/ignoredFiles');
8
- const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
9
- const paths = require('./paths');
10
- const getHttpsConfig = require('./getHttpsConfig');
11
-
12
- const host = process.env.HOST || '0.0.0.0';
13
- const sockHost = process.env.WDS_SOCKET_HOST;
14
- const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node'
15
- const sockPort = process.env.WDS_SOCKET_PORT;
16
-
17
- module.exports = function(proxy, allowedHost) {
18
- return {
19
- // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
20
- // websites from potentially accessing local content through DNS rebinding:
21
- // https://github.com/webpack/webpack-dev-server/issues/887
22
- // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
23
- // However, it made several existing use cases such as development in cloud
24
- // environment or subdomains in development significantly more complicated:
25
- // https://github.com/facebook/create-react-app/issues/2271
26
- // https://github.com/facebook/create-react-app/issues/2233
27
- // While we're investigating better solutions, for now we will take a
28
- // compromise. Since our WDS configuration only serves files in the `public`
29
- // folder we won't consider accessing them a vulnerability. However, if you
30
- // use the `proxy` feature, it gets more dangerous because it can expose
31
- // remote code execution vulnerabilities in backends like Django and Rails.
32
- // So we will disable the host check normally, but enable it if you have
33
- // specified the `proxy` setting. Finally, we let you override it if you
34
- // really know what you're doing with a special environment variable.
35
- disableHostCheck:
36
- !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
37
- // Enable gzip compression of generated files.
38
- compress: true,
39
- // Silence WebpackDevServer's own logs since they're generally not useful.
40
- // It will still show compile warnings and errors with this setting.
41
- clientLogLevel: 'none',
42
- // By default WebpackDevServer serves physical files from current directory
43
- // in addition to all the virtual build products that it serves from memory.
44
- // This is confusing because those files won’t automatically be available in
45
- // production build folder unless we copy them. However, copying the whole
46
- // project directory is dangerous because we may expose sensitive files.
47
- // Instead, we establish a convention that only files in `public` directory
48
- // get served. Our build script will copy `public` into the `build` folder.
49
- // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
50
- // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
51
- // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
52
- // Note that we only recommend to use `public` folder as an escape hatch
53
- // for files like `favicon.ico`, `manifest.json`, and libraries that are
54
- // for some reason broken when imported through webpack. If you just want to
55
- // use an image, put it in `src` and `import` it from JavaScript instead.
56
- contentBase: paths.appPublic,
57
- contentBasePublicPath: paths.publicUrlOrPath,
58
- // By default files from `contentBase` will not trigger a page reload.
59
- watchContentBase: true,
60
- // Enable hot reloading server. It will provide WDS_SOCKET_PATH endpoint
61
- // for the WebpackDevServer client so it can learn when the files were
62
- // updated. The WebpackDevServer client is included as an entry point
63
- // in the webpack development configuration. Note that only changes
64
- // to CSS are currently hot reloaded. JS changes will refresh the browser.
65
- hot: true,
66
- // Use 'ws' instead of 'sockjs-node' on server since we're using native
67
- // websockets in `webpackHotDevClient`.
68
- transportMode: 'ws',
69
- // Prevent a WS client from getting injected as we're already including
70
- // `webpackHotDevClient`.
71
- injectClient: false,
72
- // Enable custom sockjs pathname for websocket connection to hot reloading server.
73
- // Enable custom sockjs hostname, pathname and port for websocket connection
74
- // to hot reloading server.
75
- sockHost,
76
- sockPath,
77
- sockPort,
78
- // It is important to tell WebpackDevServer to use the same "publicPath" path as
79
- // we specified in the webpack config. When homepage is '.', default to serving
80
- // from the root.
81
- // remove last slash so user can land on `/test` instead of `/test/`
82
- publicPath: paths.publicUrlOrPath.slice(0, -1),
83
- // WebpackDevServer is noisy by default so we emit custom message instead
84
- // by listening to the compiler events with `compiler.hooks[...].tap` calls above.
85
- quiet: true,
86
- // Reportedly, this avoids CPU overload on some systems.
87
- // https://github.com/facebook/create-react-app/issues/293
88
- // src/node_modules is not ignored to support absolute imports
89
- // https://github.com/facebook/create-react-app/issues/1065
90
- watchOptions: {
91
- ignored: ignoredFiles(paths.appSrc),
92
- },
93
- https: getHttpsConfig(),
94
- host,
95
- overlay: false,
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
- public: allowedHost,
103
- // `proxy` is run between `before` and `after` `webpack-dev-server` hooks
104
- proxy,
105
- headers: {
106
- 'Cross-Origin-Embedder-Policy':'require-corp',
107
- 'Cross-Origin-Opener-Policy':'same-origin'
108
- },
109
- before(app, server) {
110
- // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware`
111
- // middlewares before `redirectServedPath` otherwise will not have any effect
112
- // This lets us fetch source contents from webpack for the error overlay
113
- app.use(evalSourceMapMiddleware(server));
114
- // This lets us open files from the runtime error overlay.
115
- app.use(errorOverlayMiddleware());
116
-
117
- if (fs.existsSync(paths.proxySetup)) {
118
- // This registers user provided middleware for proxy reasons
119
- require(paths.proxySetup)(app);
120
- }
121
- },
122
- after(app) {
123
- // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
124
- app.use(redirectServedPath(paths.publicUrlOrPath));
125
-
126
- // This service worker file is effectively a 'no-op' that will reset any
127
- // previous service worker registered for the same host:port combination.
128
- // We do this in development to avoid hitting the production cache if
129
- // it used the same host and port.
130
- // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
131
- app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
132
- },
133
- };
134
- };
@@ -1,211 +0,0 @@
1
- 'use strict';
2
-
3
- // Do this as the first thing so that any code reading it knows the right env.
4
- process.env.BABEL_ENV = 'production';
5
- process.env.NODE_ENV = 'production';
6
-
7
- // Makes the script crash on unhandled rejections instead of silently
8
- // ignoring them. In the future, promise rejections that are not handled will
9
- // terminate the Node.js process with a non-zero exit code.
10
- process.on('unhandledRejection', err => {
11
- throw err;
12
- });
13
-
14
- // Ensure environment variables are read.
15
- require('../config/env');
16
-
17
-
18
- const path = require('path');
19
- const chalk = require('react-dev-utils/chalk');
20
- const fs = require('fs-extra');
21
- const webpack = require('webpack');
22
- const configFactory = require('../config/webpack.config');
23
- const paths = require('../config/paths');
24
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
25
- const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
26
- const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
27
- const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
28
- const printBuildError = require('react-dev-utils/printBuildError');
29
-
30
- const measureFileSizesBeforeBuild =
31
- FileSizeReporter.measureFileSizesBeforeBuild;
32
- const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
33
- const useYarn = fs.existsSync(paths.yarnLockFile);
34
-
35
- // These sizes are pretty large. We'll warn for bundles exceeding them.
36
- const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
37
- const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
38
-
39
- const isInteractive = process.stdout.isTTY;
40
-
41
- // Warn and crash if required files are missing
42
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
43
- process.exit(1);
44
- }
45
-
46
- // Generate configuration
47
- const config = configFactory('production');
48
-
49
- // We require that you explicitly set browsers and do not fall back to
50
- // browserslist defaults.
51
- const { checkBrowsers } = require('react-dev-utils/browsersHelper');
52
- checkBrowsers(paths.appPath, isInteractive)
53
- .then(() => {
54
- // First, read the current file sizes in build directory.
55
- // This lets us display how much they changed later.
56
- return measureFileSizesBeforeBuild(paths.appBuild);
57
- })
58
- .then(previousFileSizes => {
59
- // Remove all content but keep the directory so that
60
- // if you're in it, you don't end up in Trash
61
- fs.emptyDirSync(paths.appBuild);
62
- // Merge with the public folder
63
- copyPublicFolder();
64
- // Start the webpack build
65
- return build(previousFileSizes);
66
- })
67
- .then(
68
- ({ stats, previousFileSizes, warnings }) => {
69
- if (warnings.length) {
70
- console.log(chalk.yellow('Compiled with warnings.\n'));
71
- console.log(warnings.join('\n\n'));
72
- console.log(
73
- '\nSearch for the ' +
74
- chalk.underline(chalk.yellow('keywords')) +
75
- ' to learn more about each warning.'
76
- );
77
- console.log(
78
- 'To ignore, add ' +
79
- chalk.cyan('// eslint-disable-next-line') +
80
- ' to the line before.\n'
81
- );
82
- } else {
83
- console.log(chalk.green('Compiled successfully.\n'));
84
- }
85
-
86
- console.log('File sizes after gzip:\n');
87
- printFileSizesAfterBuild(
88
- stats,
89
- previousFileSizes,
90
- paths.appBuild,
91
- WARN_AFTER_BUNDLE_GZIP_SIZE,
92
- WARN_AFTER_CHUNK_GZIP_SIZE
93
- );
94
- console.log();
95
-
96
- const appPackage = require(paths.appPackageJson);
97
- const publicUrl = paths.publicUrlOrPath;
98
- const publicPath = config.output.publicPath;
99
- const buildFolder = path.relative(process.cwd(), paths.appBuild);
100
- printHostingInstructions(
101
- appPackage,
102
- publicUrl,
103
- publicPath,
104
- buildFolder,
105
- useYarn
106
- );
107
- },
108
- err => {
109
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
110
- if (tscCompileOnError) {
111
- console.log(
112
- chalk.yellow(
113
- 'Compiled with the following type errors (you may want to check these before deploying your app):\n'
114
- )
115
- );
116
- printBuildError(err);
117
- } else {
118
- console.log(chalk.red('Failed to compile.\n'));
119
- printBuildError(err);
120
- process.exit(1);
121
- }
122
- }
123
- )
124
- .catch(err => {
125
- if (err && err.message) {
126
- console.log(err.message);
127
- }
128
- process.exit(1);
129
- });
130
-
131
- // Create the production build and print the deployment instructions.
132
- function build(previousFileSizes) {
133
- // We used to support resolving modules according to `NODE_PATH`.
134
- // This now has been deprecated in favor of jsconfig/tsconfig.json
135
- // This lets you use absolute paths in imports inside large monorepos:
136
- if (process.env.NODE_PATH) {
137
- console.log(
138
- chalk.yellow(
139
- 'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
140
- )
141
- );
142
- console.log();
143
- }
144
-
145
- console.log('Creating an optimized production build...');
146
-
147
- const compiler = webpack(config);
148
- return new Promise((resolve, reject) => {
149
- compiler.run((err, stats) => {
150
- let messages;
151
- if (err) {
152
- if (!err.message) {
153
- return reject(err);
154
- }
155
-
156
- let errMessage = err.message;
157
-
158
- // Add additional information for postcss errors
159
- if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
160
- errMessage +=
161
- '\nCompileError: Begins at CSS selector ' +
162
- err['postcssNode'].selector;
163
- }
164
-
165
- messages = formatWebpackMessages({
166
- errors: [errMessage],
167
- warnings: [],
168
- });
169
- } else {
170
- messages = formatWebpackMessages(
171
- stats.toJson({ all: false, warnings: true, errors: true })
172
- );
173
- }
174
- if (messages.errors.length) {
175
- // Only keep the first error. Others are often indicative
176
- // of the same problem, but confuse the reader with noise.
177
- if (messages.errors.length > 1) {
178
- messages.errors.length = 1;
179
- }
180
- return reject(new Error(messages.errors.join('\n\n')));
181
- }
182
- if (
183
- process.env.CI &&
184
- (typeof process.env.CI !== 'string' ||
185
- process.env.CI.toLowerCase() !== 'false') &&
186
- messages.warnings.length
187
- ) {
188
- console.log(
189
- chalk.yellow(
190
- '\nTreating warnings as errors because process.env.CI = true.\n' +
191
- 'Most CI servers set it automatically.\n'
192
- )
193
- );
194
- return reject(new Error(messages.warnings.join('\n\n')));
195
- }
196
-
197
- return resolve({
198
- stats,
199
- previousFileSizes,
200
- warnings: messages.warnings,
201
- });
202
- });
203
- });
204
- }
205
-
206
- function copyPublicFolder() {
207
- fs.copySync(paths.appPublic, paths.appBuild, {
208
- dereference: true,
209
- filter: file => file !== paths.appHtml,
210
- });
211
- }
@@ -1,166 +0,0 @@
1
- 'use strict';
2
-
3
- // Do this as the first thing so that any code reading it knows the right env.
4
- process.env.BABEL_ENV = 'development';
5
- process.env.NODE_ENV = 'development';
6
-
7
- // Makes the script crash on unhandled rejections instead of silently
8
- // ignoring them. In the future, promise rejections that are not handled will
9
- // terminate the Node.js process with a non-zero exit code.
10
- process.on('unhandledRejection', err => {
11
- throw err;
12
- });
13
-
14
- // Ensure environment variables are read.
15
- require('../config/env');
16
-
17
-
18
- const fs = require('fs');
19
- const chalk = require('react-dev-utils/chalk');
20
- const webpack = require('webpack');
21
- const WebpackDevServer = require('webpack-dev-server');
22
- const clearConsole = require('react-dev-utils/clearConsole');
23
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
24
- const {
25
- choosePort,
26
- createCompiler,
27
- prepareProxy,
28
- prepareUrls,
29
- } = require('react-dev-utils/WebpackDevServerUtils');
30
- const openBrowser = require('react-dev-utils/openBrowser');
31
- const paths = require('../config/paths');
32
- const configFactory = require('../config/webpack.config');
33
- const createDevServerConfig = require('../config/webpackDevServer.config');
34
-
35
- const useYarn = fs.existsSync(paths.yarnLockFile);
36
- const isInteractive = process.stdout.isTTY;
37
-
38
- // Warn and crash if required files are missing
39
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
40
- process.exit(1);
41
- }
42
-
43
- // Tools like Cloud9 rely on this.
44
- const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
45
- const HOST = process.env.HOST || '0.0.0.0';
46
-
47
- if (process.env.HOST) {
48
- console.log(
49
- chalk.cyan(
50
- `Attempting to bind to HOST environment variable: ${chalk.yellow(
51
- chalk.bold(process.env.HOST)
52
- )}`
53
- )
54
- );
55
- console.log(
56
- `If this was unintentional, check that you haven't mistakenly set it in your shell.`
57
- );
58
- console.log(
59
- `Learn more here: ${chalk.yellow('https://bit.ly/CRA-advanced-config')}`
60
- );
61
- console.log();
62
- }
63
-
64
- // We require that you explicitly set browsers and do not fall back to
65
- // browserslist defaults.
66
- const { checkBrowsers } = require('react-dev-utils/browsersHelper');
67
- checkBrowsers(paths.appPath, isInteractive)
68
- .then(() => {
69
- // We attempt to use the default port but if it is busy, we offer the user to
70
- // run on a different port. `choosePort()` Promise resolves to the next free port.
71
- return choosePort(HOST, DEFAULT_PORT);
72
- })
73
- .then(port => {
74
- if (port == null) {
75
- // We have not found a port.
76
- return;
77
- }
78
-
79
- const config = configFactory('development');
80
- const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
81
- const appName = require(paths.appPackageJson).name;
82
- const useTypeScript = fs.existsSync(paths.appTsConfig);
83
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
84
- const urls = prepareUrls(
85
- protocol,
86
- HOST,
87
- port,
88
- paths.publicUrlOrPath.slice(0, -1)
89
- );
90
- const devSocket = {
91
- warnings: warnings =>
92
- devServer.sockWrite(devServer.sockets, 'warnings', warnings),
93
- errors: errors =>
94
- devServer.sockWrite(devServer.sockets, 'errors', errors),
95
- };
96
- // Create a webpack compiler that is configured with custom messages.
97
- const compiler = createCompiler({
98
- appName,
99
- config,
100
- devSocket,
101
- urls,
102
- useYarn,
103
- useTypeScript,
104
- tscCompileOnError,
105
- webpack,
106
- });
107
- // Load proxy config
108
- const proxySetting = require(paths.appPackageJson).proxy;
109
- const proxyConfig = prepareProxy(
110
- proxySetting,
111
- paths.appPublic,
112
- paths.publicUrlOrPath
113
- );
114
- // Serve webpack assets generated by the compiler over a web server.
115
- const serverConfig = createDevServerConfig(
116
- proxyConfig,
117
- urls.lanUrlForConfig
118
- );
119
- const devServer = new WebpackDevServer(compiler, serverConfig);
120
- // Launch WebpackDevServer.
121
- devServer.listen(port, HOST, err => {
122
- if (err) {
123
- return console.log(err);
124
- }
125
- if (isInteractive) {
126
- clearConsole();
127
- }
128
-
129
- // We used to support resolving modules according to `NODE_PATH`.
130
- // This now has been deprecated in favor of jsconfig/tsconfig.json
131
- // This lets you use absolute paths in imports inside large monorepos:
132
- if (process.env.NODE_PATH) {
133
- console.log(
134
- chalk.yellow(
135
- 'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
136
- )
137
- );
138
- console.log();
139
- }
140
-
141
- console.log(chalk.cyan('Starting the development server...\n'));
142
- openBrowser(urls.localUrlForBrowser);
143
- });
144
-
145
- ['SIGINT', 'SIGTERM'].forEach(function(sig) {
146
- process.on(sig, function() {
147
- devServer.close();
148
- process.exit();
149
- });
150
- });
151
-
152
- if (isInteractive || process.env.CI !== 'true') {
153
- // Gracefully exit when stdin ends
154
- process.stdin.on('end', function() {
155
- devServer.close();
156
- process.exit();
157
- });
158
- process.stdin.resume();
159
- }
160
- })
161
- .catch(err => {
162
- if (err && err.message) {
163
- console.log(err.message);
164
- }
165
- process.exit(1);
166
- });
@@ -1,53 +0,0 @@
1
- 'use strict';
2
-
3
- // Do this as the first thing so that any code reading it knows the right env.
4
- process.env.BABEL_ENV = 'test';
5
- process.env.NODE_ENV = 'test';
6
- process.env.PUBLIC_URL = '';
7
-
8
- // Makes the script crash on unhandled rejections instead of silently
9
- // ignoring them. In the future, promise rejections that are not handled will
10
- // terminate the Node.js process with a non-zero exit code.
11
- process.on('unhandledRejection', err => {
12
- throw err;
13
- });
14
-
15
- // Ensure environment variables are read.
16
- require('../config/env');
17
-
18
-
19
- const jest = require('jest');
20
- const execSync = require('child_process').execSync;
21
- let argv = process.argv.slice(2);
22
-
23
- function isInGitRepository() {
24
- try {
25
- execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
26
- return true;
27
- } catch (e) {
28
- return false;
29
- }
30
- }
31
-
32
- function isInMercurialRepository() {
33
- try {
34
- execSync('hg --cwd . root', { stdio: 'ignore' });
35
- return true;
36
- } catch (e) {
37
- return false;
38
- }
39
- }
40
-
41
- // Watch unless on CI or explicitly running all tests
42
- if (
43
- !process.env.CI &&
44
- argv.indexOf('--watchAll') === -1 &&
45
- argv.indexOf('--watchAll=false') === -1
46
- ) {
47
- // https://github.com/facebook/create-react-app/issues/5210
48
- const hasSourceControl = isInGitRepository() || isInMercurialRepository();
49
- argv.push(hasSourceControl ? '--watch' : '--watchAll');
50
- }
51
-
52
-
53
- jest.run(argv);