@authing/react-ui-components 2.4.59 → 3.0.0-rc.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 (144) hide show
  1. package/lib/index.d.ts +1758 -203
  2. package/lib/index.min.css +2 -1
  3. package/lib/index.min.js +1 -1
  4. package/lib/index.min.js.LICENSE.txt +34 -0
  5. package/lib/static/media/loading.4a67a5f3.svg +29 -0
  6. package/package.json +41 -14
  7. package/.eslintignore +0 -6
  8. package/.eslintrc.js +0 -7
  9. package/.prettierrc +0 -5
  10. package/.vscode/settings.json +0 -31
  11. package/config/antdReplacer.js +0 -51
  12. package/config/env.js +0 -106
  13. package/config/getHttpsConfig.js +0 -66
  14. package/config/jest/cssTransform.js +0 -14
  15. package/config/jest/fileTransform.js +0 -40
  16. package/config/modules.js +0 -134
  17. package/config/paths.js +0 -71
  18. package/config/pnpTs.js +0 -35
  19. package/config/webpack.config.js +0 -857
  20. package/config/webpackDevServer.config.js +0 -130
  21. package/public/favicon.ico +0 -0
  22. package/public/index.html +0 -43
  23. package/public/logo192.png +0 -0
  24. package/public/logo512.png +0 -0
  25. package/public/manifest.json +0 -25
  26. package/public/robots.txt +0 -3
  27. package/scripts/build.js +0 -212
  28. package/scripts/lib.js +0 -200
  29. package/scripts/start.js +0 -166
  30. package/scripts/test.js +0 -53
  31. package/src/common/AuthingDropdown/index.tsx +0 -52
  32. package/src/common/AuthingDropdown/style.less +0 -43
  33. package/src/common/AuthingTabs/index.tsx +0 -98
  34. package/src/common/AuthingTabs/style.less +0 -135
  35. package/src/common/CopyAbleText/index.tsx +0 -54
  36. package/src/common/CopyAbleText/style.less +0 -13
  37. package/src/common/VerifyCodeInput/index.tsx +0 -76
  38. package/src/common/VerifyCodeInput/style.less +0 -24
  39. package/src/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  40. package/src/components/AuthingGuard/AppMFALayout/style.less +0 -12
  41. package/src/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  42. package/src/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  43. package/src/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  44. package/src/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  45. package/src/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  46. package/src/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  47. package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -86
  48. package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  49. package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  50. package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  51. package/src/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  52. package/src/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  53. package/src/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -162
  54. package/src/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  55. package/src/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  56. package/src/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  57. package/src/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  58. package/src/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  59. package/src/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  60. package/src/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  61. package/src/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  62. package/src/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  63. package/src/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  64. package/src/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  65. package/src/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  66. package/src/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -61
  67. package/src/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  68. package/src/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  69. package/src/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  70. package/src/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  71. package/src/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  72. package/src/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  73. package/src/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  74. package/src/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  75. package/src/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  76. package/src/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  77. package/src/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  78. package/src/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  79. package/src/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  80. package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  81. package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  82. package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  83. package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  84. package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  85. package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  86. package/src/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  87. package/src/components/AuthingGuard/Forms/index.ts +0 -13
  88. package/src/components/AuthingGuard/GuardLayout/index.tsx +0 -488
  89. package/src/components/AuthingGuard/GuardLayout/style.less +0 -111
  90. package/src/components/AuthingGuard/Header/index.tsx +0 -28
  91. package/src/components/AuthingGuard/Header/style.less +0 -64
  92. package/src/components/AuthingGuard/IconFont/iconfont.js +0 -74
  93. package/src/components/AuthingGuard/IconFont/index.tsx +0 -19
  94. package/src/components/AuthingGuard/IconFont/style.less +0 -6
  95. package/src/components/AuthingGuard/IconFont/svg.js +0 -2
  96. package/src/components/AuthingGuard/LoginLayout/index.tsx +0 -205
  97. package/src/components/AuthingGuard/LoginLayout/style.less +0 -0
  98. package/src/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  99. package/src/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  100. package/src/components/AuthingGuard/MfaLayout/style.less +0 -3
  101. package/src/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  102. package/src/components/AuthingGuard/RegisterLayout/style.less +0 -0
  103. package/src/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  104. package/src/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  105. package/src/components/AuthingGuard/api/appConfig.ts +0 -154
  106. package/src/components/AuthingGuard/api/http.ts +0 -88
  107. package/src/components/AuthingGuard/api/index.ts +0 -3
  108. package/src/components/AuthingGuard/api/sso.ts +0 -29
  109. package/src/components/AuthingGuard/api/userPoolConfig.ts +0 -112
  110. package/src/components/AuthingGuard/constants.ts +0 -107
  111. package/src/components/AuthingGuard/hooks/index.tsx +0 -70
  112. package/src/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  113. package/src/components/AuthingGuard/index.tsx +0 -134
  114. package/src/components/AuthingGuard/locales/en/common.json +0 -185
  115. package/src/components/AuthingGuard/locales/en/index.ts +0 -6
  116. package/src/components/AuthingGuard/locales/en/login.json +0 -94
  117. package/src/components/AuthingGuard/locales/en/map.json +0 -4
  118. package/src/components/AuthingGuard/locales/en/user.json +0 -81
  119. package/src/components/AuthingGuard/locales/index.ts +0 -45
  120. package/src/components/AuthingGuard/locales/zh/common.json +0 -185
  121. package/src/components/AuthingGuard/locales/zh/index.ts +0 -6
  122. package/src/components/AuthingGuard/locales/zh/login.json +0 -94
  123. package/src/components/AuthingGuard/locales/zh/map.json +0 -4
  124. package/src/components/AuthingGuard/locales/zh/user.json +0 -81
  125. package/src/components/AuthingGuard/style.less +0 -104
  126. package/src/components/AuthingGuard/types/Forms.ts +0 -95
  127. package/src/components/AuthingGuard/types/GuardConfig.ts +0 -424
  128. package/src/components/AuthingGuard/types/GuardState.ts +0 -7
  129. package/src/components/AuthingGuard/types/Locales.ts +0 -12
  130. package/src/components/AuthingGuard/types/index.ts +0 -4
  131. package/src/components/index.ts +0 -7
  132. package/src/context/base.tsx +0 -28
  133. package/src/context/global/context.tsx +0 -39
  134. package/src/context/global/reducer.tsx +0 -56
  135. package/src/index.tsx +0 -142
  136. package/src/logo.svg +0 -7
  137. package/src/react-app-env.d.ts +0 -71
  138. package/src/reportWebVitals.ts +0 -15
  139. package/src/setupTests.ts +0 -5
  140. package/src/utils/clipboard.ts +0 -27
  141. package/src/utils/index.ts +0 -180
  142. package/src/utils/popupCenter.ts +0 -48
  143. package/tsconfig.json +0 -24
  144. package/yarn-error.log +0 -20371
@@ -4,6 +4,38 @@
4
4
  http://jedwatson.github.io/classnames
5
5
  */
6
6
 
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+
22
+ /**
23
+ * @license
24
+ * Copyright 2020 Google LLC. All Rights Reserved.
25
+ * Licensed under the Apache License, Version 2.0 (the "License");
26
+ * you may not use this file except in compliance with the License.
27
+ * You may obtain a copy of the License at
28
+ *
29
+ * http://www.apache.org/licenses/LICENSE-2.0
30
+ *
31
+ * Unless required by applicable law or agreed to in writing, software
32
+ * distributed under the License is distributed on an "AS IS" BASIS,
33
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ * See the License for the specific language governing permissions and
35
+ * limitations under the License.
36
+ * =============================================================================
37
+ */
38
+
7
39
  /**
8
40
  * @license
9
41
  * Lodash <https://lodash.com/>
@@ -35,3 +67,5 @@
35
67
  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
36
68
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
69
  */
70
+
71
+ //! moment.js
@@ -0,0 +1,29 @@
1
+ <svg width="100%" height="100%"
2
+ viewBox="0 0 150 150" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <style>
4
+ #path-f {
5
+ fill: none;
6
+ stroke: #eaebee;
7
+ stroke-width: 10;
8
+ stroke-dasharray: 100 220;
9
+ animation: dash 40s infinite linear forwards;
10
+ }
11
+ #path-b {
12
+ fill: none;
13
+ stroke: #0080ff;
14
+ stroke-width: 8;
15
+ stroke-linecap: round;
16
+ stroke-linejoin: round;
17
+ }
18
+ @keyframes dash {
19
+ to {
20
+ stroke-dashoffset: 12000;
21
+ }
22
+ }
23
+ </style>
24
+ <title>Loading</title>
25
+ <g id="单独" transform="translate(25.000000, 16.000000)" fill-rule="nonzero" stroke-width="2" >
26
+ <path d="M50,0 L0,30 C0,31 0,32 0,33 C0,69 20,100 50,116 C79,100 100,69 100,33 C100,32 99,31 99,30 L50,0 Z" id="path-b"/>
27
+ <path d="M50,0 L0,30 C0,31 0,32 0,33 C0,69 20,100 50,116 C79,100 100,69 100,33 C100,32 99,31 99,30 L50,0 Z" id="path-f"/>
28
+ </g>
29
+ </svg>
package/package.json CHANGED
@@ -1,23 +1,42 @@
1
1
  {
2
2
  "name": "@authing/react-ui-components",
3
- "version": "2.4.59",
3
+ "version": "3.0.0-rc.2",
4
4
  "private": false,
5
5
  "main": "lib/index.min.js",
6
6
  "typings": "lib/index.d.ts",
7
+ "types": "react-app-env.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "lib"
11
+ ],
7
12
  "dependencies": {
8
13
  "antd": "^4.8.0",
9
- "authing-js-sdk": "4.23.1",
10
- "qs": "^6.9.4"
14
+ "authing-js-sdk": "4.22.26-alpha.18",
15
+ "face-api.js": "^0.22.2",
16
+ "fastclick": "^1.0.6",
17
+ "global": "^4.4.0",
18
+ "qs": "^6.9.4",
19
+ "react-use": "^17.3.1"
11
20
  },
12
21
  "peerDependencies": {
13
22
  "react": "16.14.0",
14
23
  "react-dom": "16.14.0"
15
24
  },
16
25
  "scripts": {
17
- "start": "PORT=3006 node scripts/start.js",
18
- "build": "node scripts/build.js",
19
- "build:lib": "node scripts/lib.js",
20
- "test": "node scripts/test.js"
26
+ "build": "node ./scripts/build.js",
27
+ "build:lib": "node ./scripts/lib.js",
28
+ "clear": "clear:lib && clear:dist",
29
+ "clear:dist": "rm -rf dist",
30
+ "clear:lib": "rm -rf lib",
31
+ "log-tag": "node ./scripts/tag.js",
32
+ "pretty-quick": "pretty-quick",
33
+ "prestart": "npm run log-tag && npm run version",
34
+ "prebuild:lib": "npm run log-tag && npm run version",
35
+ "prepare": "cd ../.. && husky install packages/react-components/.husky",
36
+ "pub": "npm run build:lib && node ./scripts/publish.js",
37
+ "start": "PORT=3006 node ./scripts/start.js",
38
+ "vite": "vite",
39
+ "version": "node ./scripts/generate-version"
21
40
  },
22
41
  "publishConfig": {
23
42
  "access": "public",
@@ -43,21 +62,21 @@
43
62
  },
44
63
  "jest": {
45
64
  "roots": [
46
- "<rootDir>/src"
65
+ "<rootDir>/components"
47
66
  ],
48
67
  "collectCoverageFrom": [
49
- "src/**/*.{js,jsx,ts,tsx}",
50
- "!src/**/*.d.ts"
68
+ "components/**/*.{js,jsx,ts,tsx}",
69
+ "!components/**/*.d.ts"
51
70
  ],
52
71
  "setupFiles": [
53
72
  "react-app-polyfill/jsdom"
54
73
  ],
55
74
  "setupFilesAfterEnv": [
56
- "<rootDir>/src/setupTests.ts"
75
+ "<rootDir>/components/setupTests.ts"
57
76
  ],
58
77
  "testMatch": [
59
- "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
60
- "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
78
+ "<rootDir>/components/**/__tests__/**/*.{js,jsx,ts,tsx}",
79
+ "<rootDir>/components/**/*.{spec,test}.{js,jsx,ts,tsx}"
61
80
  ],
62
81
  "testEnvironment": "jsdom",
63
82
  "testRunner": "/Users/lixpng/workspace/authing/ui-components/packages/react-components/node_modules/jest-circus/runner.js",
@@ -107,6 +126,7 @@
107
126
  "@testing-library/react": "^11.1.0",
108
127
  "@testing-library/user-event": "^12.1.10",
109
128
  "@types/jest": "^26.0.15",
129
+ "@types/lodash": "^4.14.175",
110
130
  "@types/node": "^12.0.0",
111
131
  "@types/qs": "^6.9.5",
112
132
  "@types/react": "^16.9.53",
@@ -114,6 +134,7 @@
114
134
  "@types/shortid": "^0.0.29",
115
135
  "@typescript-eslint/eslint-plugin": "^4.5.0",
116
136
  "@typescript-eslint/parser": "^4.5.0",
137
+ "@vitejs/plugin-react": "1.1.0",
117
138
  "babel-eslint": "^10.1.0",
118
139
  "babel-jest": "^26.6.0",
119
140
  "babel-loader": "8.1.0",
@@ -123,6 +144,8 @@
123
144
  "bfj": "^7.0.2",
124
145
  "camelcase": "^6.1.0",
125
146
  "case-sensitive-paths-webpack-plugin": "2.3.0",
147
+ "chalk": "^4.1.2",
148
+ "cross-env": "^7.0.3",
126
149
  "css-loader": "4.3.0",
127
150
  "dotenv": "8.2.0",
128
151
  "dotenv-expand": "5.1.0",
@@ -141,6 +164,7 @@
141
164
  "file-loader": "6.1.1",
142
165
  "fs-extra": "^9.0.1",
143
166
  "html-webpack-plugin": "4.5.0",
167
+ "husky": "^7.0.4",
144
168
  "i18next": "^20.1.0",
145
169
  "i18next-browser-languagedetector": "^6.1.0",
146
170
  "identity-obj-proxy": "3.0.0",
@@ -161,6 +185,7 @@
161
185
  "postcss-rename-selector": "^0.1.1",
162
186
  "postcss-safe-parser": "5.0.2",
163
187
  "prettier": "^2.1.2",
188
+ "pretty-quick": "^3.0.0",
164
189
  "query-string": "^7.0.0",
165
190
  "react": "16.14.0",
166
191
  "react-app-polyfill": "^2.0.0",
@@ -172,12 +197,14 @@
172
197
  "resolve-url-loader": "^3.1.2",
173
198
  "sass-loader": "8.0.2",
174
199
  "semver": "7.3.2",
200
+ "shelljs": "^0.8.4",
175
201
  "shortid": "^2.2.16",
176
202
  "style-loader": "1.3.0",
177
203
  "terser-webpack-plugin": "4.2.3",
178
204
  "ts-pnp": "1.2.0",
179
205
  "typescript": "^4.0.3",
180
206
  "url-loader": "4.1.1",
207
+ "vite": "^2.6.14",
181
208
  "web-vitals": "^0.2.4",
182
209
  "webpack": "4.44.2",
183
210
  "webpack-bundle-analyzer": "^4.1.0",
@@ -185,5 +212,5 @@
185
212
  "webpack-manifest-plugin": "2.2.0",
186
213
  "workbox-webpack-plugin": "5.1.4"
187
214
  },
188
- "gitHead": "6a20b0d25cc459993f2884dad32e56ea23d17b59"
215
+ "gitHead": "38168128397d6ea8bfa26f395532a493596a535d"
189
216
  }
package/.eslintignore DELETED
@@ -1,6 +0,0 @@
1
- # /node_modules/* and /bower_components/* ignored by default
2
-
3
- # Ignore built files except build/index.js
4
- build/*
5
- lib/*
6
- iconfont.js
package/.eslintrc.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: ['react-app'],
3
- plugins: ['prettier'],
4
- rules: {
5
- 'prettier/prettier': 'error',
6
- },
7
- }
package/.prettierrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "semi": false,
4
- "trailingComma": "es5"
5
- }
@@ -1,31 +0,0 @@
1
- {
2
- "eslint.validate": [
3
- "javascript",
4
- "javascriptreact",
5
- "typescript",
6
- "typescriptreact"
7
- ],
8
- "files.associations": {
9
- "*.mw.json": "jsonc",
10
- "*.icon": "xml"
11
- },
12
- "cssModules.camelCase": true,
13
- "editor.snippetSuggestions": "top",
14
- "emmet.showSuggestionsAsSnippets": true,
15
- "editor.formatOnSave": true,
16
- "editor.defaultFormatter": "esbenp.prettier-vscode",
17
- "typescript.tsdk": "node_modules/typescript/lib",
18
- "editor.codeActionsOnSave": {
19
- "source.fixAll": true
20
- },
21
- "prettier.printWidth": 120,
22
- "prettier.singleQuote": false,
23
- "prettier.semi": true,
24
- "i18n-ally.localesPaths": "src/components/AuthingGuard/locales",
25
- "i18n-ally.displayLanguage": "zh",
26
- "i18n-ally.keystyle": "nested",
27
- "i18n-ally.annotations": true,
28
- "i18n-ally.extract.targetPickingStrategy": "file-previous",
29
- "i18n-ally.namespace": true,
30
- "i18n-ally.sourceLanguage": "zh"
31
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * 全面提高 antd 样式优先级
3
- * https://juejin.cn/post/6844904116288749581#heading-8
4
- * https://github.com/fi3ework/postcss-rename-selector/blob/master/src/presets/antd.ts
5
- * */
6
-
7
- const parser = require('postcss-selector-parser')
8
-
9
- function antdScopeReplacerFn(node) {
10
- if (node.type !== 'selector') return
11
-
12
- const firstAntClassNodeIndex = node.nodes.findIndex((n) => {
13
- return n.type === 'class' && n.value.startsWith('authing-')
14
- })
15
- if (firstAntClassNodeIndex < 0) return
16
-
17
- const firstAntClassNode = node.nodes[firstAntClassNodeIndex]
18
- const prevNode = node.nodes[firstAntClassNodeIndex - 1]
19
-
20
- // preserve line break
21
- const spaces = {
22
- before: firstAntClassNode.rawSpaceBefore,
23
- after: firstAntClassNode.rawSpaceAfter,
24
- }
25
-
26
- firstAntClassNode.setPropertyWithoutEscape('rawSpaceBefore', '')
27
- const toInsert = []
28
-
29
- if (firstAntClassNodeIndex === 0 || prevNode.type === 'combinator') {
30
- const universal = parser.universal({
31
- value: '*',
32
- })
33
- toInsert.push(universal)
34
- }
35
-
36
- const attr = parser.attribute({
37
- attribute: 'class',
38
- operator: '*=',
39
- value: `"authing-"`,
40
- raws: {},
41
- })
42
-
43
- toInsert.push(attr)
44
- toInsert[0].spaces = spaces
45
-
46
- firstAntClassNode.parent.nodes.splice(firstAntClassNodeIndex, 0, ...toInsert)
47
- }
48
-
49
- module.exports = {
50
- antdScopeReplacerFn,
51
- }
package/config/env.js DELETED
@@ -1,106 +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
- // react-refresh is not 100% stable at this time,
90
- // which is why it's disabled by default.
91
- // It is defined here so it is available in the webpackHotDevClient.
92
- FAST_REFRESH: process.env.FAST_REFRESH !== 'false',
93
- }
94
- );
95
- // Stringify all values so we can feed into webpack DefinePlugin
96
- const stringified = {
97
- 'process.env': Object.keys(raw).reduce((env, key) => {
98
- env[key] = JSON.stringify(raw[key]);
99
- return env;
100
- }, {}),
101
- };
102
-
103
- return { raw, stringified };
104
- }
105
-
106
- 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,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();