@orangelogic/orange-dam-content-browser-sdk 2.1.52 → 2.1.54

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 (281) hide show
  1. package/.env +1 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc.json +82 -0
  4. package/.releaserc +17 -0
  5. package/.travis.yml +20 -0
  6. package/CBSDKdemo.html +315 -0
  7. package/GitVersion.yml +18 -0
  8. package/azure-pipeline.yaml +93 -0
  9. package/clientlib.config.js +36 -0
  10. package/config/env.js +105 -0
  11. package/config/getHttpsConfig.js +67 -0
  12. package/config/jest/babelTransform.js +30 -0
  13. package/config/jest/cssTransform.js +14 -0
  14. package/config/jest/fileTransform.js +41 -0
  15. package/config/modules.js +135 -0
  16. package/config/paths.js +79 -0
  17. package/config/webpack/persistentCache/createEnvironmentHash.js +10 -0
  18. package/config/webpack.config.js +762 -0
  19. package/config/webpackDevServer.config.js +128 -0
  20. package/config-overrides.js +8 -0
  21. package/gab_extension/GAB.html +85 -0
  22. package/gab_extension/GoogleChrome/manifest.json +28 -0
  23. package/gab_extension/GoogleChrome/src/assets/icon48.png +0 -0
  24. package/gab_extension/GoogleChrome/src/background/index.js +6 -0
  25. package/gab_extension/GoogleChrome/src/scripts/index.js +347 -0
  26. package/gab_extension/MozillaFirefox/manifest.json +20 -0
  27. package/gab_extension/MozillaFirefox/src/assets/icon.png +0 -0
  28. package/gab_extension/MozillaFirefox/src/background/index.js +5 -0
  29. package/gab_extension/MozillaFirefox/src/scripts/index.js +347 -0
  30. package/gab_extension/README.md +11 -0
  31. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.pbxproj +927 -0
  32. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  33. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  34. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcuserdata/oldevmac01.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  35. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/xcuserdata/oldevmac01.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  36. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  37. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AppIcon.appiconset/Contents.json +63 -0
  38. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/Contents.json +6 -0
  39. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/LargeIcon.imageset/Contents.json +20 -0
  40. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Base.lproj/Main.html +23 -0
  41. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Icon.png +0 -0
  42. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Script.js +24 -0
  43. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Style.css +61 -0
  44. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/ViewController.swift +81 -0
  45. package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (Extension)/SafariWebExtensionHandler.swift +26 -0
  46. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/AppDelegate.swift +24 -0
  47. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/LaunchScreen.storyboard +36 -0
  48. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/Main.storyboard +38 -0
  49. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Info.plist +27 -0
  50. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/SceneDelegate.swift +18 -0
  51. package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (Extension)/Info.plist +13 -0
  52. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/AppDelegate.swift +21 -0
  53. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Base.lproj/Main.storyboard +125 -0
  54. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Info.plist +8 -0
  55. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Orange DAM Asset Browser Extension.entitlements +12 -0
  56. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Info.plist +13 -0
  57. package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Orange DAM Asset Browser Extension.entitlements +10 -0
  58. package/package.json +8 -49
  59. package/public/index.html +92 -0
  60. package/scripts/build.js +218 -0
  61. package/scripts/start.js +154 -0
  62. package/scripts/test.js +53 -0
  63. package/src/App.tsx +98 -0
  64. package/src/AppContext.ts +18 -0
  65. package/src/GlobalConfigContext.ts +46 -0
  66. package/src/components/ArrayClamp/ArrayClamp.styled.ts +42 -0
  67. package/src/components/ArrayClamp/ArrayClamp.tsx +167 -0
  68. package/src/components/ArrayClamp/index.ts +1 -0
  69. package/src/components/Browser/Browser.styled.ts +82 -0
  70. package/src/components/Browser/Browser.tsx +284 -0
  71. package/src/components/Browser/BrowserItem.tsx +98 -0
  72. package/src/components/ControlBar/ControlBar.constants.tsx +66 -0
  73. package/src/components/ControlBar/ControlBar.styled.ts +82 -0
  74. package/src/components/ControlBar/ControlBar.tsx +528 -0
  75. package/src/components/ControlBar/Facet/Facet.tsx +113 -0
  76. package/src/components/ControlBar/Facet/index.ts +1 -0
  77. package/src/components/FormatDialog/CropPreviewer/CropPreviewer.tsx +224 -0
  78. package/{build/components/FormatDialog/CropPreviewer/index.d.ts → src/components/FormatDialog/CropPreviewer/index.ts} +1 -1
  79. package/src/components/FormatDialog/CustomRendition/CustomRendition.constants.ts +24 -0
  80. package/src/components/FormatDialog/CustomRendition/CustomRendition.styled.ts +57 -0
  81. package/src/components/FormatDialog/CustomRendition/CustomRendition.tsx +178 -0
  82. package/src/components/FormatDialog/CustomRendition/index.ts +1 -0
  83. package/src/components/FormatDialog/CustomRendition/transformations/Crop.tsx +249 -0
  84. package/src/components/FormatDialog/CustomRendition/transformations/Extension.tsx +54 -0
  85. package/src/components/FormatDialog/CustomRendition/transformations/Format.tsx +86 -0
  86. package/src/components/FormatDialog/CustomRendition/transformations/Resize.tsx +176 -0
  87. package/src/components/FormatDialog/CustomRendition/transformations/Rotate.tsx +101 -0
  88. package/{build/components/FormatDialog/CustomRendition/transformations/index.d.ts → src/components/FormatDialog/CustomRendition/transformations/index.ts} +1 -3
  89. package/src/components/FormatDialog/FormatDialog.styled.ts +137 -0
  90. package/src/components/FormatDialog/FormatDialog.tsx +1533 -0
  91. package/src/components/FormatDialog/Previewer/Previewer.styled.ts +31 -0
  92. package/src/components/FormatDialog/Previewer/Previewer.tsx +143 -0
  93. package/src/components/FormatDialog/Previewer/index.ts +1 -0
  94. package/src/components/FormatDialog/ProxyMenu/ProxyMenu.styled.ts +88 -0
  95. package/src/components/FormatDialog/ProxyMenu/ProxyMenu.tsx +74 -0
  96. package/src/components/FormatDialog/ProxyMenu/index.ts +1 -0
  97. package/src/components/FormatDialog/TrackingParameters/TrackingParameters.tsx +59 -0
  98. package/src/components/FormatDialog/TrackingParameters/index.ts +1 -0
  99. package/src/components/FormatDialog/index.ts +1 -0
  100. package/src/components/Header/Header.styled.ts +51 -0
  101. package/src/components/Header/Header.tsx +118 -0
  102. package/src/components/Loader/Loader.tsx +37 -0
  103. package/src/components/Loader/index.ts +1 -0
  104. package/src/components/NoResult/NoResult.tsx +37 -0
  105. package/src/components/NoResult/index.tsx +1 -0
  106. package/src/components/Result/AssetCard/AssetCard.styled.ts +120 -0
  107. package/src/components/Result/AssetCard/AssetCard.tsx +192 -0
  108. package/src/components/Result/AssetCard/AssetCardWrapper.styled.ts +35 -0
  109. package/src/components/Result/AssetCard/AssetCardWrapper.tsx +165 -0
  110. package/src/components/Result/AssetCard/index.ts +1 -0
  111. package/src/components/Result/AssetPreview/AssetPreview.styled.ts +108 -0
  112. package/src/components/Result/AssetPreview/AssetPreview.tsx +78 -0
  113. package/src/components/Result/AssetPreview/ImagePreview/ImagePreview.tsx +42 -0
  114. package/src/components/Result/AssetPreview/ImagePreview/index.ts +1 -0
  115. package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.ts +23 -0
  116. package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.tsx +28 -0
  117. package/src/components/Result/AssetPreview/OtherPreview/index.ts +1 -0
  118. package/src/components/Result/AssetPreview/VideoPreview/VideoPreview.tsx +132 -0
  119. package/src/components/Result/AssetPreview/VideoPreview/index.ts +1 -0
  120. package/src/components/Result/AssetPreview/index.ts +1 -0
  121. package/src/consts/asset.ts +16 -0
  122. package/src/consts/data.ts +17 -0
  123. package/src/index.tsx +305 -0
  124. package/src/page/Authenticate/Authenticate.tsx +232 -0
  125. package/src/page/Authenticate/ConnectingBackground.tsx +44 -0
  126. package/src/page/Authenticate/index.tsx +94 -0
  127. package/src/page/Home/Home.styled.ts +46 -0
  128. package/src/page/Home/Home.tsx +941 -0
  129. package/src/react-web-component.d.ts +4617 -0
  130. package/src/store/assets/assets.api.ts +167 -0
  131. package/src/store/assets/assets.service.ts +223 -0
  132. package/src/store/assets/assets.slice.ts +104 -0
  133. package/src/store/auth/auth.service.ts +71 -0
  134. package/src/store/auth/auth.slice.ts +295 -0
  135. package/src/store/index.ts +27 -0
  136. package/src/store/search/search.api.ts +319 -0
  137. package/src/store/search/search.slice.ts +28 -0
  138. package/src/store/user/user.api.ts +29 -0
  139. package/src/styles.css +42 -0
  140. package/src/types/assets.ts +71 -0
  141. package/src/types/auth.ts +42 -0
  142. package/src/types/common.ts +11 -0
  143. package/src/types/download.ts +8 -0
  144. package/src/types/navigation.ts +3 -0
  145. package/src/types/search.ts +116 -0
  146. package/{build/types/storage.d.ts → src/types/storage.ts} +1 -1
  147. package/src/types/user.ts +6 -0
  148. package/src/utils/api.ts +186 -0
  149. package/src/utils/array.ts +25 -0
  150. package/src/utils/constants.ts +12 -0
  151. package/src/utils/fetch.ts +116 -0
  152. package/src/utils/getRequestUrl.ts +15 -0
  153. package/src/utils/hooks.ts +36 -0
  154. package/src/utils/icon.ts +22 -0
  155. package/src/utils/image.ts +157 -0
  156. package/src/utils/number.ts +11 -0
  157. package/src/utils/rotate.ts +23 -0
  158. package/src/utils/storage.ts +184 -0
  159. package/src/utils/string.ts +24 -0
  160. package/src/view/AssetsPicker.tsx +24 -0
  161. package/src/web-component.d.ts +8151 -0
  162. package/tsconfig.eslint.json +10 -0
  163. package/tsconfig.json +37 -0
  164. package/build/ApiService.d.ts +0 -15
  165. package/build/App.d.ts +0 -62
  166. package/build/AppContext.d.ts +0 -18
  167. package/build/GlobalConfigContext.d.ts +0 -32
  168. package/build/OrangeDAMContentBrowserSDK.min.css +0 -2
  169. package/build/OrangeDAMContentBrowserSDK.min.css.map +0 -1
  170. package/build/OrangeDAMContentBrowserSDK.min.js +0 -11468
  171. package/build/OrangeDAMContentBrowserSDK.min.js.map +0 -1
  172. package/build/asset-manifest.json +0 -13
  173. package/build/components/ArrayClamp/ArrayClamp.d.ts +0 -10
  174. package/build/components/ArrayClamp/ArrayClamp.styled.d.ts +0 -1
  175. package/build/components/ArrayClamp/index.d.ts +0 -1
  176. package/build/components/Browser/Browser.constants.d.ts +0 -3
  177. package/build/components/Browser/Browser.d.ts +0 -21
  178. package/build/components/Browser/Browser.styled.d.ts +0 -2
  179. package/build/components/Browser/BrowserItem.d.ts +0 -13
  180. package/build/components/Browser/LoadMoreButton.d.ts +0 -9
  181. package/build/components/ControlBar/ControlBar.constants.d.ts +0 -10
  182. package/build/components/ControlBar/ControlBar.d.ts +0 -23
  183. package/build/components/ControlBar/ControlBar.styled.d.ts +0 -1
  184. package/build/components/ControlBar/Facet/Facet.d.ts +0 -14
  185. package/build/components/ControlBar/Facet/index.d.ts +0 -1
  186. package/build/components/FormatDialog/CropPreviewer/CropPreviewer.d.ts +0 -41
  187. package/build/components/FormatDialog/CustomRendition/CustomRendition.constants.d.ts +0 -5
  188. package/build/components/FormatDialog/CustomRendition/CustomRendition.d.ts +0 -56
  189. package/build/components/FormatDialog/CustomRendition/CustomRendition.styled.d.ts +0 -1
  190. package/build/components/FormatDialog/CustomRendition/index.d.ts +0 -1
  191. package/build/components/FormatDialog/CustomRendition/transformations/Crop.d.ts +0 -26
  192. package/build/components/FormatDialog/CustomRendition/transformations/Extension.d.ts +0 -11
  193. package/build/components/FormatDialog/CustomRendition/transformations/Format.d.ts +0 -10
  194. package/build/components/FormatDialog/CustomRendition/transformations/Metadata.d.ts +0 -7
  195. package/build/components/FormatDialog/CustomRendition/transformations/Quality.d.ts +0 -7
  196. package/build/components/FormatDialog/CustomRendition/transformations/Resize.d.ts +0 -18
  197. package/build/components/FormatDialog/CustomRendition/transformations/Rotate.d.ts +0 -8
  198. package/build/components/FormatDialog/FormatDialog.d.ts +0 -49
  199. package/build/components/FormatDialog/FormatDialog.styled.d.ts +0 -3
  200. package/build/components/FormatDialog/Previewer/Previewer.d.ts +0 -17
  201. package/build/components/FormatDialog/Previewer/Previewer.styled.d.ts +0 -1
  202. package/build/components/FormatDialog/Previewer/index.d.ts +0 -1
  203. package/build/components/FormatDialog/ProxyMenu/ProxyMenu.d.ts +0 -20
  204. package/build/components/FormatDialog/ProxyMenu/ProxyMenu.styled.d.ts +0 -2
  205. package/build/components/FormatDialog/ProxyMenu/index.d.ts +0 -1
  206. package/build/components/FormatDialog/TrackingParameters/TrackingParameters.d.ts +0 -13
  207. package/build/components/FormatDialog/TrackingParameters/index.d.ts +0 -1
  208. package/build/components/FormatDialog/VersionHistory/VersionHistory.d.ts +0 -6
  209. package/build/components/FormatDialog/VersionHistory/VersionHistory.styled.d.ts +0 -1
  210. package/build/components/FormatDialog/VersionHistory/index.d.ts +0 -1
  211. package/build/components/FormatDialog/index.d.ts +0 -1
  212. package/build/components/Header/Header.d.ts +0 -15
  213. package/build/components/Header/Header.styled.d.ts +0 -5
  214. package/build/components/Loader/Loader.d.ts +0 -7
  215. package/build/components/Loader/index.d.ts +0 -1
  216. package/build/components/NoResult/NoResult.d.ts +0 -7
  217. package/build/components/NoResult/index.d.ts +0 -1
  218. package/build/components/Result/AssetCard/AssetCard.d.ts +0 -15
  219. package/build/components/Result/AssetCard/AssetCard.styled.d.ts +0 -2
  220. package/build/components/Result/AssetCard/AssetCardWrapper.d.ts +0 -18
  221. package/build/components/Result/AssetCard/AssetCardWrapper.styled.d.ts +0 -1
  222. package/build/components/Result/AssetCard/index.d.ts +0 -1
  223. package/build/components/Result/AssetPreview/AssetPreview.d.ts +0 -11
  224. package/build/components/Result/AssetPreview/AssetPreview.styled.d.ts +0 -1
  225. package/build/components/Result/AssetPreview/ImagePreview/ImagePreview.d.ts +0 -11
  226. package/build/components/Result/AssetPreview/ImagePreview/index.d.ts +0 -1
  227. package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.d.ts +0 -9
  228. package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.d.ts +0 -1
  229. package/build/components/Result/AssetPreview/OtherPreview/index.d.ts +0 -1
  230. package/build/components/Result/AssetPreview/VideoPreview/VideoPreview.d.ts +0 -11
  231. package/build/components/Result/AssetPreview/VideoPreview/index.d.ts +0 -1
  232. package/build/components/Result/AssetPreview/index.d.ts +0 -1
  233. package/build/consts/asset.d.ts +0 -14
  234. package/build/consts/auth.d.ts +0 -4
  235. package/build/consts/data.d.ts +0 -21
  236. package/build/index.d.ts +0 -225
  237. package/build/index.html +0 -1
  238. package/build/page/Authenticate/Authenticate.d.ts +0 -2
  239. package/build/page/Authenticate/ConnectingBackground.d.ts +0 -8
  240. package/build/page/Authenticate/index.d.ts +0 -2
  241. package/build/page/Home/Home.d.ts +0 -6
  242. package/build/page/Home/Home.styled.d.ts +0 -2
  243. package/build/setupTests.d.ts +0 -1
  244. package/build/store/assets/assets.api.d.ts +0 -66
  245. package/build/store/assets/assets.service.d.ts +0 -23
  246. package/build/store/assets/assets.slice.d.ts +0 -65
  247. package/build/store/auth/auth.service.d.ts +0 -10
  248. package/build/store/auth/auth.slice.d.ts +0 -76
  249. package/build/store/index.d.ts +0 -368
  250. package/build/store/search/search.api.d.ts +0 -39
  251. package/build/store/search/search.slice.d.ts +0 -12
  252. package/build/store/user/user.api.d.ts +0 -5
  253. package/build/types/assets.d.ts +0 -68
  254. package/build/types/auth.d.ts +0 -35
  255. package/build/types/common.d.ts +0 -11
  256. package/build/types/download.d.ts +0 -8
  257. package/build/types/navigation.d.ts +0 -3
  258. package/build/types/search.d.ts +0 -148
  259. package/build/types/user.d.ts +0 -7
  260. package/build/utils/api.d.ts +0 -27
  261. package/build/utils/array.d.ts +0 -13
  262. package/build/utils/constants.d.ts +0 -11
  263. package/build/utils/function.d.ts +0 -1
  264. package/build/utils/getRequestUrl.d.ts +0 -1
  265. package/build/utils/hooks.d.ts +0 -1
  266. package/build/utils/icon.d.ts +0 -3
  267. package/build/utils/image.d.ts +0 -24
  268. package/build/utils/number.d.ts +0 -4
  269. package/build/utils/rotate.d.ts +0 -4
  270. package/build/utils/storage.d.ts +0 -23
  271. package/build/utils/string.d.ts +0 -12
  272. package/build/view/AssetsPicker.d.ts +0 -6
  273. /package/{build → public}/favicon.ico +0 -0
  274. /package/{build → public}/logo192.png +0 -0
  275. /package/{build → public}/logo512.png +0 -0
  276. /package/{build → public}/manifest.json +0 -0
  277. /package/{build → public}/robots.txt +0 -0
  278. /package/{build/components/Browser/index.d.ts → src/components/Browser/index.ts} +0 -0
  279. /package/{build/components/ControlBar/index.d.ts → src/components/ControlBar/index.ts} +0 -0
  280. /package/{build/components/Header/index.d.ts → src/components/Header/index.ts} +0 -0
  281. /package/{build/page/Home/index.d.ts → src/page/Home/index.ts} +0 -0
@@ -0,0 +1,762 @@
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const webpack = require('webpack');
7
+ const resolve = require('resolve');
8
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
9
+ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
10
+ // const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
11
+ const TerserPlugin = require('terser-webpack-plugin');
12
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
13
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
14
+ const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
15
+ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
16
+ const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
17
+ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
18
+ const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
19
+ const ESLintPlugin = require('eslint-webpack-plugin');
20
+ const paths = require('./paths');
21
+ const modules = require('./modules');
22
+ const getClientEnvironment = require('./env');
23
+ const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
24
+ const ForkTsCheckerWebpackPlugin =
25
+ process.env.TSC_COMPILE_ON_ERROR === 'true'
26
+ ? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
27
+ : require('react-dev-utils/ForkTsCheckerWebpackPlugin');
28
+ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
29
+
30
+ const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
31
+
32
+ // Source maps are resource heavy and can cause out of memory issue for large source files.
33
+ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
34
+
35
+ const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
36
+ const reactRefreshWebpackPluginRuntimeEntry = require.resolve(
37
+ '@pmmmwh/react-refresh-webpack-plugin',
38
+ );
39
+ const babelRuntimeEntry = require.resolve('babel-preset-react-app');
40
+ const babelRuntimeEntryHelpers = require.resolve(
41
+ '@babel/runtime/helpers/esm/assertThisInitialized',
42
+ { paths: [babelRuntimeEntry] },
43
+ );
44
+ const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
45
+ paths: [babelRuntimeEntry],
46
+ });
47
+
48
+ // Some apps do not need the benefits of saving a web request, so not inlining the chunk
49
+ // makes for a smoother build process.
50
+ // const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
51
+
52
+ const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true';
53
+ const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true';
54
+
55
+ const imageInlineSizeLimit = parseInt(
56
+ process.env.IMAGE_INLINE_SIZE_LIMIT || '10000',
57
+ );
58
+
59
+ // Check if TypeScript is setup
60
+ const useTypeScript = fs.existsSync(paths.appTsConfig);
61
+
62
+ // Check if Tailwind config exists
63
+ const useTailwind = fs.existsSync(
64
+ path.join(paths.appPath, 'tailwind.config.js'),
65
+ );
66
+
67
+ // Get the path to the uncompiled service worker (if it exists).
68
+ const swSrc = paths.swSrc;
69
+
70
+ // style files regexes
71
+ const cssRegex = /\.css$/;
72
+ const cssModuleRegex = /\.module\.css$/;
73
+ const sassRegex = /\.(scss|sass)$/;
74
+ const sassModuleRegex = /\.module\.(scss|sass)$/;
75
+
76
+ const hasJsxRuntime = (() => {
77
+ if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
78
+ return false;
79
+ }
80
+
81
+ try {
82
+ require.resolve('react/jsx-runtime');
83
+ return true;
84
+ } catch (e) {
85
+ return false;
86
+ }
87
+ })();
88
+
89
+ // This is the production and development configuration.
90
+ // It is focused on developer experience, fast rebuilds, and a minimal bundle.
91
+ module.exports = function (webpackEnv) {
92
+ const isEnvDevelopment = webpackEnv === 'development';
93
+ const isEnvProduction = webpackEnv === 'production';
94
+
95
+ // Variable used for enabling profiling in Production
96
+ // passed into alias object. Uses a flag if passed into the build command
97
+ const isEnvProductionProfile =
98
+ isEnvProduction && process.argv.includes('--profile');
99
+
100
+ // We will provide `paths.publicUrlOrPath` to our app
101
+ // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
102
+ // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
103
+ // Get environment variables to inject into our app.
104
+ const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
105
+
106
+ const shouldUseReactRefresh = env.raw.FAST_REFRESH;
107
+
108
+ // common function to get style loaders
109
+ const getStyleLoaders = (cssOptions, preProcessor) => {
110
+ const loaders = [
111
+ isEnvDevelopment && require.resolve('style-loader'),
112
+ isEnvProduction && {
113
+ loader: MiniCssExtractPlugin.loader,
114
+ // css is located in `static/css`, use '../../' to locate index.html folder
115
+ // in production `paths.publicUrlOrPath` can be a relative path
116
+ options: paths.publicUrlOrPath.startsWith('.')
117
+ ? { publicPath: '../../' }
118
+ : {},
119
+ },
120
+ {
121
+ loader: require.resolve('css-loader'),
122
+ options: cssOptions,
123
+ },
124
+ {
125
+ // Options for PostCSS as we reference these options twice
126
+ // Adds vendor prefixing based on your specified browser support in
127
+ // package.json
128
+ loader: require.resolve('postcss-loader'),
129
+ options: {
130
+ postcssOptions: {
131
+ // Necessary for external CSS imports to work
132
+ // https://github.com/facebook/create-react-app/issues/2677
133
+ ident: 'postcss',
134
+ config: false,
135
+ plugins: !useTailwind
136
+ ? [
137
+ 'postcss-flexbugs-fixes',
138
+ [
139
+ 'postcss-preset-env',
140
+ {
141
+ autoprefixer: {
142
+ flexbox: 'no-2009',
143
+ },
144
+ stage: 3,
145
+ },
146
+ ],
147
+ // Adds PostCSS Normalize as the reset css with default options,
148
+ // so that it honors browserslist config in package.json
149
+ // which in turn let's users customize the target behavior as per their needs.
150
+ 'postcss-normalize',
151
+ ]
152
+ : [
153
+ 'postcss-flexbugs-fixes',
154
+ [
155
+ 'postcss-preset-env',
156
+ {
157
+ autoprefixer: {
158
+ flexbox: 'no-2009',
159
+ },
160
+ stage: 3,
161
+ },
162
+ ],
163
+ ],
164
+ },
165
+ sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
166
+ },
167
+ },
168
+ ].filter(Boolean);
169
+ if (preProcessor) {
170
+ loaders.push(
171
+ {
172
+ loader: require.resolve('resolve-url-loader'),
173
+ options: {
174
+ sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
175
+ root: paths.appSrc,
176
+ },
177
+ },
178
+ {
179
+ loader: require.resolve(preProcessor),
180
+ options: {
181
+ sourceMap: true,
182
+ },
183
+ },
184
+ );
185
+ }
186
+ return loaders;
187
+ };
188
+
189
+ return {
190
+ target: ['browserslist'],
191
+ // Webpack noise constrained to errors and warnings
192
+ stats: 'errors-warnings',
193
+ mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
194
+ // Stop compilation early in production
195
+ bail: isEnvProduction,
196
+ devtool: isEnvProduction
197
+ ? shouldUseSourceMap
198
+ ? 'source-map'
199
+ : false
200
+ : isEnvDevelopment && 'cheap-module-source-map',
201
+ // These are the "entry points" to our application.
202
+ // This means they will be the "root" imports that are included in JS bundle.
203
+ entry: paths.appIndexJs,
204
+ output: {
205
+ // The build folder.
206
+ path: paths.appBuild,
207
+ // Add /* filename */ comments to generated require()s in the output.
208
+ pathinfo: isEnvDevelopment,
209
+ // There will be one main bundle, and one file per asynchronous chunk.
210
+ // In development, it does not produce real files.
211
+ filename: 'static/js/OrangeDAMContentBrowserSDK.min.js',
212
+ // There are also additional JS chunk files if you use code splitting.
213
+ // chunkFilename: isEnvProduction
214
+ // ? 'static/js/[name].[contenthash:8].chunk.js'
215
+ // : isEnvDevelopment && 'static/js/[name].chunk.js',
216
+ assetModuleFilename: 'static/media/[name].[hash][ext]',
217
+ // webpack uses `publicPath` to determine where the app is being served from.
218
+ // It requires a trailing slash, or the file assets will get an incorrect path.
219
+ // We inferred the "public path" (such as / or /my-project) from homepage.
220
+ publicPath: paths.publicUrlOrPath,
221
+ // Point sourcemap entries to original disk location (format as URL on Windows)
222
+ devtoolModuleFilenameTemplate: isEnvProduction
223
+ ? info =>
224
+ path
225
+ .relative(paths.appSrc, info.absoluteResourcePath)
226
+ .replace(/\\/g, '/')
227
+ : isEnvDevelopment &&
228
+ (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
229
+ },
230
+ cache: {
231
+ type: 'filesystem',
232
+ version: createEnvironmentHash(env.raw),
233
+ cacheDirectory: paths.appWebpackCache,
234
+ store: 'pack',
235
+ buildDependencies: {
236
+ defaultWebpack: ['webpack/lib/'],
237
+ config: [__filename],
238
+ tsconfig: [paths.appTsConfig, paths.appJsConfig].filter(f =>
239
+ fs.existsSync(f),
240
+ ),
241
+ },
242
+ },
243
+ infrastructureLogging: {
244
+ level: 'none',
245
+ },
246
+ optimization: {
247
+ minimize: isEnvProduction,
248
+ minimizer: [
249
+ // This is only used in production mode
250
+ new TerserPlugin({
251
+ // to not make bundle.js.LICENSE.txt file
252
+ extractComments: false,
253
+ terserOptions: {
254
+ parse: {
255
+ // We want terser to parse ecma 8 code. However, we don't want it
256
+ // to apply any minification steps that turns valid ecma 5 code
257
+ // into invalid ecma 5 code. This is why the 'compress' and 'output'
258
+ // sections only apply transformations that are ecma 5 safe
259
+ // https://github.com/facebook/create-react-app/pull/4234
260
+ ecma: 8,
261
+ },
262
+ compress: {
263
+ ecma: 5,
264
+ warnings: false,
265
+ // Disabled because of an issue with Uglify breaking seemingly valid code:
266
+ // https://github.com/facebook/create-react-app/issues/2376
267
+ // Pending further investigation:
268
+ // https://github.com/mishoo/UglifyJS2/issues/2011
269
+ comparisons: false,
270
+ // Disabled because of an issue with Terser breaking valid code:
271
+ // https://github.com/facebook/create-react-app/issues/5250
272
+ // Pending further investigation:
273
+ // https://github.com/terser-js/terser/issues/120
274
+ inline: 2,
275
+ },
276
+ mangle: {
277
+ safari10: true,
278
+ },
279
+ // Added for profiling in devtools
280
+ keep_classnames: isEnvProductionProfile,
281
+ keep_fnames: isEnvProductionProfile,
282
+ output: {
283
+ ecma: 5,
284
+ comments: /@license|@copyright/i,
285
+ // Turned on because emoji and regex is not minified properly using default
286
+ // https://github.com/facebook/create-react-app/issues/2488
287
+ ascii_only: true,
288
+ },
289
+ },
290
+ }),
291
+ new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
292
+ // This is only used in production mode
293
+ new CssMinimizerPlugin(),
294
+ ],
295
+ },
296
+ resolve: {
297
+ // This allows you to set a fallback for where webpack should look for modules.
298
+ // We placed these paths second because we want `node_modules` to "win"
299
+ // if there are any conflicts. This matches Node resolution mechanism.
300
+ // https://github.com/facebook/create-react-app/issues/253
301
+ modules: ['node_modules', paths.appNodeModules].concat(
302
+ modules.additionalModulePaths || [],
303
+ ),
304
+ // These are the reasonable defaults supported by the Node ecosystem.
305
+ // We also include JSX as a common component filename extension to support
306
+ // some tools, although we do not recommend using it, see:
307
+ // https://github.com/facebook/create-react-app/issues/290
308
+ // `web` extension prefixes have been added for better support
309
+ // for React Native Web.
310
+ extensions: paths.moduleFileExtensions
311
+ .map(ext => `.${ext}`)
312
+ .filter(ext => useTypeScript || !ext.includes('ts')),
313
+ alias: {
314
+ // Support React Native Web
315
+ // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
316
+ 'react-native': 'react-native-web',
317
+ // Allows for better profiling with ReactDevTools
318
+ ...(isEnvProductionProfile && {
319
+ 'react-dom$': 'react-dom/profiling',
320
+ 'scheduler/tracing': 'scheduler/tracing-profiling',
321
+ }),
322
+ ...(modules.webpackAliases || {}),
323
+ '@': paths.appSrc,
324
+ },
325
+ plugins: [
326
+ // Prevents users from importing files from outside of src/ (or node_modules/).
327
+ // This often causes confusion because we only process files within src/ with babel.
328
+ // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
329
+ // please link the files into your node_modules/ and let module-resolution kick in.
330
+ // Make sure your source files are compiled, as they will not be processed in any way.
331
+ new ModuleScopePlugin(paths.appSrc, [
332
+ paths.appPackageJson,
333
+ reactRefreshRuntimeEntry,
334
+ reactRefreshWebpackPluginRuntimeEntry,
335
+ babelRuntimeEntry,
336
+ babelRuntimeEntryHelpers,
337
+ babelRuntimeRegenerator,
338
+ ]),
339
+ ],
340
+ },
341
+ module: {
342
+ strictExportPresence: true,
343
+ rules: [
344
+ // Handle node_modules packages that contain sourcemaps
345
+ shouldUseSourceMap && {
346
+ enforce: 'pre',
347
+ exclude: /@babel(?:\/|\\{1,2})runtime/,
348
+ test: /\.(js|mjs|jsx|ts|tsx|css)$/,
349
+ loader: require.resolve('source-map-loader'),
350
+ },
351
+ {
352
+ // "oneOf" will traverse all following loaders until one will
353
+ // match the requirements. When no loader matches it will fall
354
+ // back to the "file" loader at the end of the loader list.
355
+ oneOf: [
356
+ // TODO: Merge this config once `image/avif` is in the mime-db
357
+ // https://github.com/jshttp/mime-db
358
+ {
359
+ test: [/\.avif$/],
360
+ type: 'asset',
361
+ mimetype: 'image/avif',
362
+ parser: {
363
+ dataUrlCondition: {
364
+ maxSize: imageInlineSizeLimit,
365
+ },
366
+ },
367
+ },
368
+ // "url" loader works like "file" loader except that it embeds assets
369
+ // smaller than specified limit in bytes as data URLs to avoid requests.
370
+ // A missing `test` is equivalent to a match.
371
+ {
372
+ test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
373
+ type: 'asset',
374
+ parser: {
375
+ dataUrlCondition: {
376
+ maxSize: imageInlineSizeLimit,
377
+ },
378
+ },
379
+ },
380
+ {
381
+ test: /\.svg$/,
382
+ use: [
383
+ {
384
+ loader: require.resolve('@svgr/webpack'),
385
+ options: {
386
+ prettier: false,
387
+ svgo: false,
388
+ svgoConfig: {
389
+ plugins: [{ removeViewBox: false }],
390
+ },
391
+ titleProp: true,
392
+ ref: true,
393
+ },
394
+ },
395
+ {
396
+ loader: require.resolve('file-loader'),
397
+ options: {
398
+ name: 'static/media/[name].[hash].[ext]',
399
+ },
400
+ },
401
+ ],
402
+ issuer: {
403
+ and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
404
+ },
405
+ },
406
+ // Process application JS with Babel.
407
+ // The preset includes JSX, Flow, TypeScript, and some ESnext features.
408
+ {
409
+ test: /\.(js|mjs|jsx|ts|tsx)$/,
410
+ include: paths.appSrc,
411
+ loader: require.resolve('babel-loader'),
412
+ options: {
413
+ customize: require.resolve(
414
+ 'babel-preset-react-app/webpack-overrides',
415
+ ),
416
+ presets: [
417
+ [
418
+ require.resolve('babel-preset-react-app'),
419
+ {
420
+ runtime: hasJsxRuntime ? 'automatic' : 'classic',
421
+ },
422
+ ],
423
+ ],
424
+
425
+ plugins: [
426
+ isEnvDevelopment &&
427
+ shouldUseReactRefresh &&
428
+ require.resolve('react-refresh/babel'),
429
+ ].filter(Boolean),
430
+ // This is a feature of `babel-loader` for webpack (not Babel itself).
431
+ // It enables caching results in ./node_modules/.cache/babel-loader/
432
+ // directory for faster rebuilds.
433
+ cacheDirectory: true,
434
+ // See #6846 for context on why cacheCompression is disabled
435
+ cacheCompression: false,
436
+ compact: isEnvProduction,
437
+ },
438
+ },
439
+ // Process any JS outside of the app with Babel.
440
+ // Unlike the application JS, we only compile the standard ES features.
441
+ {
442
+ test: /\.(js|mjs)$/,
443
+ exclude: /@babel(?:\/|\\{1,2})runtime/,
444
+ loader: require.resolve('babel-loader'),
445
+ options: {
446
+ babelrc: false,
447
+ configFile: false,
448
+ compact: false,
449
+ presets: [
450
+ [
451
+ require.resolve('babel-preset-react-app/dependencies'),
452
+ { helpers: true },
453
+ ],
454
+ ],
455
+ cacheDirectory: true,
456
+ // See #6846 for context on why cacheCompression is disabled
457
+ cacheCompression: false,
458
+
459
+ // Babel sourcemaps are needed for debugging into node_modules
460
+ // code. Without the options below, debuggers like VSCode
461
+ // show incorrect code and set breakpoints on the wrong lines.
462
+ sourceMaps: shouldUseSourceMap,
463
+ inputSourceMap: shouldUseSourceMap,
464
+ },
465
+ },
466
+ // "postcss" loader applies autoprefixer to our CSS.
467
+ // "css" loader resolves paths in CSS and adds assets as dependencies.
468
+ // "style" loader turns CSS into JS modules that inject <style> tags.
469
+ // In production, we use MiniCSSExtractPlugin to extract that CSS
470
+ // to a file, but in development "style" loader enables hot editing
471
+ // of CSS.
472
+ // By default we support CSS Modules with the extension .module.css
473
+ {
474
+ test: cssRegex,
475
+ exclude: cssModuleRegex,
476
+ use: getStyleLoaders({
477
+ importLoaders: 1,
478
+ sourceMap: isEnvProduction
479
+ ? shouldUseSourceMap
480
+ : isEnvDevelopment,
481
+ modules: {
482
+ mode: 'icss',
483
+ },
484
+ }),
485
+ // Don't consider CSS imports dead code even if the
486
+ // containing package claims to have no side effects.
487
+ // Remove this when webpack adds a warning or an error for this.
488
+ // See https://github.com/webpack/webpack/issues/6571
489
+ sideEffects: true,
490
+ },
491
+ // Adds support for CSS Modules (https://github.com/css-modules/css-modules)
492
+ // using the extension .module.css
493
+ {
494
+ test: cssModuleRegex,
495
+ use: getStyleLoaders({
496
+ importLoaders: 1,
497
+ sourceMap: isEnvProduction
498
+ ? shouldUseSourceMap
499
+ : isEnvDevelopment,
500
+ modules: {
501
+ mode: 'local',
502
+ getLocalIdent: getCSSModuleLocalIdent,
503
+ },
504
+ }),
505
+ },
506
+ // Opt-in support for SASS (using .scss or .sass extensions).
507
+ // By default we support SASS Modules with the
508
+ // extensions .module.scss or .module.sass
509
+ {
510
+ test: sassRegex,
511
+ exclude: sassModuleRegex,
512
+ use: getStyleLoaders(
513
+ {
514
+ importLoaders: 3,
515
+ sourceMap: isEnvProduction
516
+ ? shouldUseSourceMap
517
+ : isEnvDevelopment,
518
+ modules: {
519
+ mode: 'icss',
520
+ },
521
+ },
522
+ 'sass-loader',
523
+ ),
524
+ // Don't consider CSS imports dead code even if the
525
+ // containing package claims to have no side effects.
526
+ // Remove this when webpack adds a warning or an error for this.
527
+ // See https://github.com/webpack/webpack/issues/6571
528
+ sideEffects: true,
529
+ },
530
+ // Adds support for CSS Modules, but using SASS
531
+ // using the extension .module.scss or .module.sass
532
+ {
533
+ test: sassModuleRegex,
534
+ use: getStyleLoaders(
535
+ {
536
+ importLoaders: 3,
537
+ sourceMap: isEnvProduction
538
+ ? shouldUseSourceMap
539
+ : isEnvDevelopment,
540
+ modules: {
541
+ mode: 'local',
542
+ getLocalIdent: getCSSModuleLocalIdent,
543
+ },
544
+ },
545
+ 'sass-loader',
546
+ ),
547
+ },
548
+ // "file" loader makes sure those assets get served by WebpackDevServer.
549
+ // When you `import` an asset, you get its (virtual) filename.
550
+ // In production, they would get copied to the `build` folder.
551
+ // This loader doesn't use a "test" so it will catch all modules
552
+ // that fall through the other loaders.
553
+ {
554
+ // Exclude `js` files to keep "css" loader working as it injects
555
+ // its runtime that would otherwise be processed through "file" loader.
556
+ // Also exclude `html` and `json` extensions so they get processed
557
+ // by webpacks internal loaders.
558
+ exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
559
+ type: 'asset/resource',
560
+ },
561
+ // ** STOP ** Are you adding a new loader?
562
+ // Make sure to add the new loader(s) before the "file" loader.
563
+ ],
564
+ },
565
+ ].filter(Boolean),
566
+ },
567
+ plugins: [
568
+ // Copyright OL
569
+ new webpack.BannerPlugin(
570
+ '* @copyright \n' +
571
+ '* OrangeDAMContentBrowser – Copyright 2025 \n' +
572
+ '* OrangeLogic <orangelogic.com>'),
573
+ // Generates an `index.html` file with the <script> injected.
574
+ new HtmlWebpackPlugin(
575
+ Object.assign(
576
+ {},
577
+ {
578
+ inject: true,
579
+ template: paths.appHtml,
580
+ },
581
+ isEnvProduction
582
+ ? {
583
+ minify: {
584
+ removeComments: true,
585
+ collapseWhitespace: true,
586
+ removeRedundantAttributes: true,
587
+ useShortDoctype: true,
588
+ removeEmptyAttributes: true,
589
+ removeStyleLinkTypeAttributes: true,
590
+ keepClosingSlash: true,
591
+ minifyJS: true,
592
+ minifyCSS: true,
593
+ minifyURLs: true,
594
+ },
595
+ }
596
+ : undefined,
597
+ ),
598
+ ),
599
+ // Inlines the webpack runtime script. This script is too small to warrant
600
+ // a network request.
601
+ // https://github.com/facebook/create-react-app/issues/5358
602
+ // isEnvProduction &&
603
+ // shouldInlineRuntimeChunk &&
604
+ // new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
605
+ // Makes some environment variables available in index.html.
606
+ // The public URL is available as %PUBLIC_URL% in index.html, e.g.:
607
+ // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
608
+ // It will be an empty string unless you specify "homepage"
609
+ // in `package.json`, in which case it will be the pathname of that URL.
610
+ new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
611
+ // This gives some necessary context to module not found errors, such as
612
+ // the requesting resource.
613
+ new ModuleNotFoundPlugin(paths.appPath),
614
+ // Makes some environment variables available to the JS code, for example:
615
+ // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
616
+ // It is absolutely essential that NODE_ENV is set to production
617
+ // during a production build.
618
+ // Otherwise React will be compiled in the very slow development mode.
619
+ new webpack.DefinePlugin(env.stringified),
620
+ // Experimental hot reloading for React .
621
+ // https://github.com/facebook/react/tree/main/packages/react-refresh
622
+ isEnvDevelopment &&
623
+ shouldUseReactRefresh &&
624
+ new ReactRefreshWebpackPlugin({
625
+ overlay: false,
626
+ }),
627
+ // Watcher doesn't work well if you mistype casing in a path so we use
628
+ // a plugin that prints an error when you attempt to do this.
629
+ // See https://github.com/facebook/create-react-app/issues/240
630
+ isEnvDevelopment && new CaseSensitivePathsPlugin(),
631
+ isEnvProduction &&
632
+ new MiniCssExtractPlugin({
633
+ // Options similar to the same options in webpackOptions.output
634
+ // both options are optional
635
+ filename: 'static/css/OrangeDAMContentBrowserSDK.min.css',
636
+ // chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
637
+ }),
638
+ // Generate an asset manifest file with the following content:
639
+ // - "files" key: Mapping of all asset filenames to their corresponding
640
+ // output file so that tools can pick it up without having to parse
641
+ // `index.html`
642
+ // - "entrypoints" key: Array of files which are included in `index.html`,
643
+ // can be used to reconstruct the HTML if necessary
644
+ new WebpackManifestPlugin({
645
+ fileName: 'asset-manifest.json',
646
+ publicPath: paths.publicUrlOrPath,
647
+ generate: (seed, files, entrypoints) => {
648
+ const manifestFiles = files.reduce((manifest, file) => {
649
+ manifest[file.name] = file.path;
650
+ return manifest;
651
+ }, seed);
652
+ const entrypointFiles = entrypoints.main.filter(
653
+ fileName => !fileName.endsWith('.map'),
654
+ );
655
+
656
+ return {
657
+ files: manifestFiles,
658
+ entrypoints: entrypointFiles,
659
+ };
660
+ },
661
+ }),
662
+ // Moment.js is an extremely popular library that bundles large locale files
663
+ // by default due to how webpack interprets its code. This is a practical
664
+ // solution that requires the user to opt into importing specific locales.
665
+ // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
666
+ // You can remove this if you don't use Moment.js:
667
+ new webpack.IgnorePlugin({
668
+ resourceRegExp: /^\.\/locale$/,
669
+ contextRegExp: /moment$/,
670
+ }),
671
+ // Generate a service worker script that will precache, and keep up to date,
672
+ // the HTML & assets that are part of the webpack build.
673
+ isEnvProduction &&
674
+ fs.existsSync(swSrc) &&
675
+ new WorkboxWebpackPlugin.InjectManifest({
676
+ swSrc,
677
+ dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./,
678
+ exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/],
679
+ // Bump up the default maximum size (2mb) that's precached,
680
+ // to make lazy-loading failure scenarios less likely.
681
+ // See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270
682
+ maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
683
+ }),
684
+ // TypeScript type checking
685
+ useTypeScript &&
686
+ new ForkTsCheckerWebpackPlugin({
687
+ async: isEnvDevelopment,
688
+ typescript: {
689
+ typescriptPath: resolve.sync('typescript', {
690
+ basedir: paths.appNodeModules,
691
+ }),
692
+ configOverwrite: {
693
+ compilerOptions: {
694
+ sourceMap: isEnvProduction
695
+ ? shouldUseSourceMap
696
+ : isEnvDevelopment,
697
+ skipLibCheck: true,
698
+ inlineSourceMap: false,
699
+ declarationMap: false,
700
+ noEmit: true,
701
+ incremental: true,
702
+ tsBuildInfoFile: paths.appTsBuildInfoFile,
703
+ },
704
+ },
705
+ context: paths.appPath,
706
+ diagnosticOptions: {
707
+ syntactic: true,
708
+ },
709
+ mode: 'write-references',
710
+ // profile: true,
711
+ },
712
+ issue: {
713
+ // This one is specifically to match during CI tests,
714
+ // as micromatch doesn't match
715
+ // '../cra-template-typescript/template/src/App.tsx'
716
+ // otherwise.
717
+ include: [
718
+ { file: '../**/src/**/*.{ts,tsx}' },
719
+ { file: '**/src/**/*.{ts,tsx}' },
720
+ ],
721
+ exclude: [
722
+ { file: '**/src/**/__tests__/**' },
723
+ { file: '**/src/**/?(*.){spec|test}.*' },
724
+ { file: '**/src/setupProxy.*' },
725
+ { file: '**/src/setupTests.*' },
726
+ ],
727
+ },
728
+ logger: {
729
+ infrastructure: 'silent',
730
+ },
731
+ }),
732
+ !disableESLintPlugin &&
733
+ new ESLintPlugin({
734
+ // Plugin options
735
+ extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
736
+ formatter: require.resolve('react-dev-utils/eslintFormatter'),
737
+ eslintPath: require.resolve('eslint'),
738
+ failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
739
+ context: paths.appSrc,
740
+ cache: true,
741
+ cacheLocation: path.resolve(
742
+ paths.appNodeModules,
743
+ '.cache/.eslintcache',
744
+ ),
745
+ // ESLint class options
746
+ cwd: paths.appPath,
747
+ resolvePluginsRelativeTo: __dirname,
748
+ baseConfig: {
749
+ extends: [require.resolve('eslint-config-react-app/base')],
750
+ rules: {
751
+ ...(!hasJsxRuntime && {
752
+ 'react/react-in-jsx-scope': 'error',
753
+ }),
754
+ },
755
+ },
756
+ }),
757
+ ].filter(Boolean),
758
+ // Turn off performance processing because we utilize
759
+ // our own hints via the FileSizeReporter
760
+ performance: false,
761
+ };
762
+ };