@panoramax/web-viewer 4.4.0-develop-746bcb00 → 4.4.0-develop-d8b38e70

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 (341) hide show
  1. package/{src → build}/components/core/Basic.js +22 -16
  2. package/{src → build}/components/core/CoverageMap.js +19 -14
  3. package/{src → build}/components/core/Editor.js +16 -16
  4. package/{src → build}/components/core/PhotoViewer.js +30 -29
  5. package/{src → build}/components/core/Viewer.js +21 -20
  6. package/build/components/core/index.js +10 -0
  7. package/build/components/index.js +11 -0
  8. package/build/components/index_photoviewer.js +6 -0
  9. package/{src → build}/components/layout/BottomDrawer.js +4 -4
  10. package/{src → build}/components/layout/CorneredGrid.js +1 -1
  11. package/{src → build}/components/layout/Mini.js +5 -4
  12. package/{src → build}/components/layout/Tabs.js +1 -1
  13. package/build/components/layout/index.js +9 -0
  14. package/{src → build}/components/menus/LocationPrecisionDoc.js +4 -6
  15. package/{src → build}/components/menus/MapBackground.js +4 -6
  16. package/{src → build}/components/menus/MapFilters.js +16 -21
  17. package/{src → build}/components/menus/MapLayers.js +20 -24
  18. package/{src → build}/components/menus/MapLegend.js +3 -4
  19. package/{src → build}/components/menus/MiniPictureLegend.js +3 -4
  20. package/{src → build}/components/menus/PictureLegend.js +10 -15
  21. package/{src → build}/components/menus/PictureMetadata.js +12 -19
  22. package/{src → build}/components/menus/PlayerOptions.js +5 -7
  23. package/{src → build}/components/menus/QualityScoreDoc.js +3 -4
  24. package/{src → build}/components/menus/ReportForm.js +8 -9
  25. package/{src → build}/components/menus/SemanticsDoc.js +3 -4
  26. package/{src → build}/components/menus/SemanticsDownload.js +3 -3
  27. package/{src → build}/components/menus/SemanticsFilters.js +7 -8
  28. package/{src → build}/components/menus/SemanticsList.js +11 -18
  29. package/{src → build}/components/menus/SemanticsMetadata.js +8 -11
  30. package/{src → build}/components/menus/Share.js +6 -7
  31. package/build/components/menus/index.js +22 -0
  32. package/build/components/menus/index_photoviewer.js +11 -0
  33. package/{src → build}/components/styles.js +0 -2
  34. package/{src → build}/components/ui/AnnotationsSwitch.js +6 -8
  35. package/{src → build}/components/ui/Button.js +1 -1
  36. package/{src → build}/components/ui/ButtonGroup.js +2 -1
  37. package/{src → build}/components/ui/CopyButton.js +4 -6
  38. package/{src → build}/components/ui/Grade.js +5 -5
  39. package/{src → build}/components/ui/GradeFilter.js +3 -3
  40. package/{src → build}/components/ui/IconSwitch.js +1 -1
  41. package/{src → build}/components/ui/LinkButton.js +1 -1
  42. package/{src → build}/components/ui/ListGroup.js +3 -3
  43. package/{src → build}/components/ui/ListItem.js +1 -1
  44. package/{src → build}/components/ui/Loader.js +8 -7
  45. package/{src → build}/components/ui/Map.js +38 -26
  46. package/{src → build}/components/ui/MapMore.js +7 -7
  47. package/{src → build}/components/ui/Photo.js +29 -27
  48. package/{src → build}/components/ui/Popup.js +4 -4
  49. package/{src → build}/components/ui/QualityScore.js +4 -4
  50. package/{src → build}/components/ui/SearchBar.js +6 -7
  51. package/{src → build}/components/ui/SemanticsEditor.js +14 -15
  52. package/{src → build}/components/ui/SemanticsTable.js +4 -5
  53. package/{src → build}/components/ui/Switch.js +1 -1
  54. package/{src → build}/components/ui/TogglableGroup.js +4 -4
  55. package/build/components/ui/index.js +29 -0
  56. package/build/components/ui/index_photoviewer.js +21 -0
  57. package/{src → build}/components/ui/widgets/CopyCoordinates.js +5 -5
  58. package/{src → build}/components/ui/widgets/GeoSearch.js +10 -10
  59. package/{src → build}/components/ui/widgets/Legend.js +9 -8
  60. package/{src → build}/components/ui/widgets/LevelSelect.js +9 -7
  61. package/{src → build}/components/ui/widgets/MapFiltersButton.js +5 -5
  62. package/{src → build}/components/ui/widgets/MapLayersButton.js +5 -5
  63. package/{src → build}/components/ui/widgets/OSMEditors.js +8 -8
  64. package/{src → build}/components/ui/widgets/PictureLegendActions.js +4 -4
  65. package/{src → build}/components/ui/widgets/Player.js +6 -7
  66. package/{src → build}/components/ui/widgets/SemanticsFiltersButton.js +6 -7
  67. package/{src → build}/components/ui/widgets/Zoom.js +6 -6
  68. package/build/components/ui/widgets/index.js +16 -0
  69. package/build/components/ui/widgets/index_photoviewer.js +7 -0
  70. package/build/editor.html +94 -10
  71. package/{src → build}/img/arrow_triangle.svg +0 -1
  72. package/{src → build}/img/arrow_turn.svg +0 -1
  73. package/build/index.html +111 -1
  74. package/build/index.js +6 -95
  75. package/build/index_photoviewer.js +4 -0
  76. package/build/map.html +97 -1
  77. package/build/package.json +141 -0
  78. package/build/photo.html +85 -1
  79. package/build/servers.js +3 -4
  80. package/{src → build}/translations/pt.json +7 -2
  81. package/{src → build}/utils/API.js +33 -33
  82. package/{src → build}/utils/InitParameters.js +11 -9
  83. package/{src → build}/utils/MapStyleComposer.js +39 -37
  84. package/{src → build}/utils/PhotoAdapter.js +1 -0
  85. package/{src → build}/utils/PresetsManager.js +4 -4
  86. package/{src → build}/utils/SemanticsMapProtocol.js +3 -4
  87. package/{src → build}/utils/URLHandler.js +16 -14
  88. package/{src → build}/utils/geocoder.js +5 -5
  89. package/{src → build}/utils/i18n.js +21 -20
  90. package/build/utils/index.js +17 -0
  91. package/build/utils/index_photoviewer.js +14 -0
  92. package/{src → build}/utils/indoor.js +9 -5
  93. package/{src → build}/utils/map.js +15 -11
  94. package/{src → build}/utils/picture.js +22 -17
  95. package/{src → build}/utils/semantics.js +9 -5
  96. package/{src → build}/utils/utils.js +8 -4
  97. package/{src → build}/utils/widgets.js +2 -2
  98. package/build/viewer.html +120 -35
  99. package/build/viewer_indoor.html +90 -8
  100. package/build/widgets.html +410 -1
  101. package/package.json +81 -204
  102. package/.dockerignore +0 -7
  103. package/.gitlab-ci.yml +0 -78
  104. package/CHANGELOG.md +0 -853
  105. package/CODE_OF_CONDUCT.md +0 -134
  106. package/Dockerfile +0 -14
  107. package/build/index.css +0 -36
  108. package/build/index.css.map +0 -1
  109. package/build/index.js.map +0 -1
  110. package/build/photoviewer.css +0 -36
  111. package/build/photoviewer.css.map +0 -1
  112. package/build/photoviewer.js +0 -86
  113. package/build/photoviewer.js.map +0 -1
  114. package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff +0 -0
  115. package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff2 +0 -0
  116. package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff +0 -0
  117. package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff2 +0 -0
  118. package/config/env.js +0 -104
  119. package/config/getHttpsConfig.js +0 -69
  120. package/config/getPackageJson.js +0 -25
  121. package/config/jest/babelTransform.js +0 -29
  122. package/config/jest/cssTransform.js +0 -14
  123. package/config/jest/fileTransform.js +0 -40
  124. package/config/jest/mocks.js +0 -230
  125. package/config/modules.js +0 -134
  126. package/config/paths.js +0 -76
  127. package/config/pnpTs.js +0 -35
  128. package/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
  129. package/config/webpack.config.js +0 -825
  130. package/config/webpackDevServer.config.js +0 -131
  131. package/docs/03_URL_settings.md +0 -218
  132. package/docs/05_Compatibility.md +0 -83
  133. package/docs/09_Develop.md +0 -141
  134. package/docs/90_Releases.md +0 -27
  135. package/docs/images/class_diagram.drawio +0 -144
  136. package/docs/images/class_diagram.jpg +0 -0
  137. package/docs/images/comparative_3drender.jpg +0 -0
  138. package/docs/images/indoor_level.png +0 -0
  139. package/docs/images/screenshot.jpg +0 -0
  140. package/docs/index.md +0 -159
  141. package/docs/reference/components/core/Basic.md +0 -211
  142. package/docs/reference/components/core/CoverageMap.md +0 -220
  143. package/docs/reference/components/core/Editor.md +0 -252
  144. package/docs/reference/components/core/PhotoViewer.md +0 -320
  145. package/docs/reference/components/core/Viewer.md +0 -398
  146. package/docs/reference/components/layout/BottomDrawer.md +0 -35
  147. package/docs/reference/components/layout/CorneredGrid.md +0 -29
  148. package/docs/reference/components/layout/Mini.md +0 -45
  149. package/docs/reference/components/layout/Tabs.md +0 -46
  150. package/docs/reference/components/menus/LocationPrecisionDoc.md +0 -15
  151. package/docs/reference/components/menus/MapBackground.md +0 -32
  152. package/docs/reference/components/menus/MapFilters.md +0 -37
  153. package/docs/reference/components/menus/MapLayers.md +0 -15
  154. package/docs/reference/components/menus/MapLegend.md +0 -32
  155. package/docs/reference/components/menus/MiniPictureLegend.md +0 -15
  156. package/docs/reference/components/menus/PictureLegend.md +0 -45
  157. package/docs/reference/components/menus/PictureMetadata.md +0 -32
  158. package/docs/reference/components/menus/PlayerOptions.md +0 -15
  159. package/docs/reference/components/menus/QualityScoreDoc.md +0 -15
  160. package/docs/reference/components/menus/ReportForm.md +0 -15
  161. package/docs/reference/components/menus/SemanticsDoc.md +0 -15
  162. package/docs/reference/components/menus/SemanticsDownload.md +0 -15
  163. package/docs/reference/components/menus/SemanticsFilters.md +0 -33
  164. package/docs/reference/components/menus/SemanticsList.md +0 -97
  165. package/docs/reference/components/menus/SemanticsMetadata.md +0 -15
  166. package/docs/reference/components/menus/ShareMenu.md +0 -32
  167. package/docs/reference/components/ui/AnnotationsSwitch.md +0 -32
  168. package/docs/reference/components/ui/Button.md +0 -40
  169. package/docs/reference/components/ui/ButtonGroup.md +0 -36
  170. package/docs/reference/components/ui/CopyButton.md +0 -41
  171. package/docs/reference/components/ui/Grade.md +0 -32
  172. package/docs/reference/components/ui/GradeFilter.md +0 -42
  173. package/docs/reference/components/ui/IconSwitch.md +0 -53
  174. package/docs/reference/components/ui/LinkButton.md +0 -45
  175. package/docs/reference/components/ui/ListGroup.md +0 -22
  176. package/docs/reference/components/ui/ListItem.md +0 -39
  177. package/docs/reference/components/ui/Loader.md +0 -56
  178. package/docs/reference/components/ui/Map.md +0 -150
  179. package/docs/reference/components/ui/MapMore.md +0 -150
  180. package/docs/reference/components/ui/Photo.md +0 -495
  181. package/docs/reference/components/ui/Popup.md +0 -56
  182. package/docs/reference/components/ui/ProgressBar.md +0 -32
  183. package/docs/reference/components/ui/QualityScore.md +0 -45
  184. package/docs/reference/components/ui/SearchBar.md +0 -63
  185. package/docs/reference/components/ui/SemanticsEditor.md +0 -113
  186. package/docs/reference/components/ui/SemanticsTable.md +0 -32
  187. package/docs/reference/components/ui/Switch.md +0 -49
  188. package/docs/reference/components/ui/TogglableGroup.md +0 -39
  189. package/docs/reference/components/ui/widgets/CopyCoordinates.md +0 -32
  190. package/docs/reference/components/ui/widgets/GeoSearch.md +0 -36
  191. package/docs/reference/components/ui/widgets/Legend.md +0 -58
  192. package/docs/reference/components/ui/widgets/LevelSelect.md +0 -16
  193. package/docs/reference/components/ui/widgets/MapFiltersButton.md +0 -37
  194. package/docs/reference/components/ui/widgets/MapLayersButton.md +0 -15
  195. package/docs/reference/components/ui/widgets/OSMEditors.md +0 -15
  196. package/docs/reference/components/ui/widgets/PictureLegendActions.md +0 -32
  197. package/docs/reference/components/ui/widgets/Player.md +0 -34
  198. package/docs/reference/components/ui/widgets/SemanticsFiltersButton.md +0 -15
  199. package/docs/reference/components/ui/widgets/Zoom.md +0 -15
  200. package/docs/reference/utils/API.md +0 -389
  201. package/docs/reference/utils/InitParameters.md +0 -68
  202. package/docs/reference/utils/MapStyleComposer.md +0 -408
  203. package/docs/reference/utils/PanoraMapProtocol.md +0 -28
  204. package/docs/reference/utils/PresetsManager.md +0 -43
  205. package/docs/reference/utils/SemanticsMapProtocol.md +0 -43
  206. package/docs/reference/utils/URLHandler.md +0 -114
  207. package/docs/reference.md +0 -99
  208. package/docs/shortcuts.md +0 -11
  209. package/docs/tutorials/aerial_imagery.md +0 -21
  210. package/docs/tutorials/authentication.md +0 -10
  211. package/docs/tutorials/custom_widgets.md +0 -59
  212. package/docs/tutorials/indoor_maps.md +0 -50
  213. package/docs/tutorials/map_style.md +0 -83
  214. package/docs/tutorials/migrate_v4.md +0 -153
  215. package/docs/tutorials/migrate_v5.md +0 -103
  216. package/docs/tutorials/semantics_overlays.md +0 -74
  217. package/docs/tutorials/synced_coverage.md +0 -43
  218. package/mkdocs.yml +0 -131
  219. package/public/editor.html +0 -53
  220. package/public/index.html +0 -70
  221. package/public/map.html +0 -55
  222. package/public/photo.html +0 -43
  223. package/public/servers.js +0 -15
  224. package/public/viewer.html +0 -79
  225. package/public/viewer_indoor.html +0 -48
  226. package/public/widgets.html +0 -366
  227. package/scripts/build.js +0 -217
  228. package/scripts/doc.js +0 -79
  229. package/scripts/start.js +0 -172
  230. package/scripts/test.js +0 -52
  231. package/src/components/core/index.js +0 -12
  232. package/src/components/index.js +0 -13
  233. package/src/components/index_photoviewer.js +0 -8
  234. package/src/components/layout/index.js +0 -9
  235. package/src/components/menus/index.js +0 -22
  236. package/src/components/menus/index_photoviewer.js +0 -13
  237. package/src/components/ui/index.js +0 -29
  238. package/src/components/ui/index_photoviewer.js +0 -23
  239. package/src/components/ui/widgets/index.js +0 -16
  240. package/src/components/ui/widgets/index_photoviewer.js +0 -9
  241. package/src/index.js +0 -8
  242. package/src/index_photoviewer.js +0 -6
  243. package/src/utils/index.js +0 -17
  244. package/src/utils/index_photoviewer.js +0 -16
  245. package/tests/components/core/Basic.test.js +0 -168
  246. package/tests/components/core/BasicMock.js +0 -25
  247. package/tests/components/core/CoverageMap.test.js +0 -20
  248. package/tests/components/core/Editor.test.js +0 -20
  249. package/tests/components/core/PhotoViewer.test.js +0 -57
  250. package/tests/components/core/Viewer.test.js +0 -85
  251. package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +0 -96
  252. package/tests/components/core/__snapshots__/Viewer.test.js.snap +0 -188
  253. package/tests/components/ui/CopyButton.test.js +0 -52
  254. package/tests/components/ui/Loader.test.js +0 -55
  255. package/tests/components/ui/Map.test.js +0 -145
  256. package/tests/components/ui/Photo.test.js +0 -437
  257. package/tests/components/ui/Popup.test.js +0 -26
  258. package/tests/components/ui/QualityScore.test.js +0 -18
  259. package/tests/components/ui/SearchBar.test.js +0 -110
  260. package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +0 -33
  261. package/tests/components/ui/__snapshots__/Loader.test.js.snap +0 -56
  262. package/tests/components/ui/__snapshots__/Map.test.js.snap +0 -16
  263. package/tests/components/ui/__snapshots__/Photo.test.js.snap +0 -263
  264. package/tests/components/ui/__snapshots__/Popup.test.js.snap +0 -29
  265. package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +0 -11
  266. package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +0 -65
  267. package/tests/data/Map_geocoder_ban.json +0 -36
  268. package/tests/data/Map_geocoder_nominatim.json +0 -41
  269. package/tests/data/Viewer_pictures_1.json +0 -148
  270. package/tests/setupTests.js +0 -5
  271. package/tests/utils/API.test.js +0 -752
  272. package/tests/utils/InitParameters.test.js +0 -599
  273. package/tests/utils/MapStyleComposer.test.js +0 -697
  274. package/tests/utils/PresetsManager.test.js +0 -123
  275. package/tests/utils/URLHandler.test.js +0 -587
  276. package/tests/utils/__snapshots__/API.test.js.snap +0 -40
  277. package/tests/utils/__snapshots__/MapStyleComposer.test.js.snap +0 -767
  278. package/tests/utils/__snapshots__/URLHandler.test.js.snap +0 -21
  279. package/tests/utils/__snapshots__/geocoder.test.js.snap +0 -37
  280. package/tests/utils/__snapshots__/map.test.js.snap +0 -1249
  281. package/tests/utils/__snapshots__/picture.test.js.snap +0 -327
  282. package/tests/utils/__snapshots__/widgets.test.js.snap +0 -19
  283. package/tests/utils/geocoder.test.js +0 -37
  284. package/tests/utils/i18n.test.js +0 -111
  285. package/tests/utils/map.test.js +0 -200
  286. package/tests/utils/picture.test.js +0 -745
  287. package/tests/utils/semantics.test.js +0 -174
  288. package/tests/utils/utils.test.js +0 -358
  289. package/tests/utils/widgets.test.js +0 -31
  290. /package/{src → build}/components/core/Basic.css +0 -0
  291. /package/{src → build}/components/core/CoverageMap.css +0 -0
  292. /package/{src → build}/components/core/Editor.css +0 -0
  293. /package/{src → build}/components/core/PhotoViewer.css +0 -0
  294. /package/{src → build}/components/core/Viewer.css +0 -0
  295. /package/{src → build}/components/ui/ButtonGroup.css +0 -0
  296. /package/{src → build}/components/ui/Map.css +0 -0
  297. /package/{src → build}/components/ui/Photo.css +0 -0
  298. /package/{src → build}/components/ui/ProgressBar.js +0 -0
  299. /package/{src → build}/components/ui/widgets/GeoSearch.css +0 -0
  300. /package/{src → build}/components/ui/widgets/LevelSelect.css +0 -0
  301. /package/{src → build}/components/ui/widgets/Player.css +0 -0
  302. /package/{public → build}/favicon.ico +0 -0
  303. /package/{src → build}/img/arrow_360.svg +0 -0
  304. /package/{src → build}/img/arrow_flat.svg +0 -0
  305. /package/{src → build}/img/bg_aerial.jpg +0 -0
  306. /package/{src → build}/img/bg_streets.jpg +0 -0
  307. /package/{src → build}/img/loader_base.jpg +0 -0
  308. /package/{src → build}/img/logo_dead.svg +0 -0
  309. /package/{src → build}/img/marker.svg +0 -0
  310. /package/{src → build}/img/marker_blue.svg +0 -0
  311. /package/{src → build}/img/osm.svg +0 -0
  312. /package/{src → build}/img/panoramax.svg +0 -0
  313. /package/{src → build}/img/switch_big.svg +0 -0
  314. /package/{src → build}/img/switch_mini.svg +0 -0
  315. /package/{src → build}/img/wd.svg +0 -0
  316. /package/{src → build}/translations/ar.json +0 -0
  317. /package/{src → build}/translations/be.json +0 -0
  318. /package/{src → build}/translations/br.json +0 -0
  319. /package/{src → build}/translations/cy.json +0 -0
  320. /package/{src → build}/translations/da.json +0 -0
  321. /package/{src → build}/translations/de.json +0 -0
  322. /package/{src → build}/translations/en.json +0 -0
  323. /package/{src → build}/translations/eo.json +0 -0
  324. /package/{src → build}/translations/es.json +0 -0
  325. /package/{src → build}/translations/fi.json +0 -0
  326. /package/{src → build}/translations/fr.json +0 -0
  327. /package/{src → build}/translations/hu.json +0 -0
  328. /package/{src → build}/translations/it.json +0 -0
  329. /package/{src → build}/translations/ja.json +0 -0
  330. /package/{src → build}/translations/ko.json +0 -0
  331. /package/{src → build}/translations/nl.json +0 -0
  332. /package/{src → build}/translations/nn.json +0 -0
  333. /package/{src → build}/translations/pl.json +0 -0
  334. /package/{src → build}/translations/pt_BR.json +0 -0
  335. /package/{src → build}/translations/sv.json +0 -0
  336. /package/{src → build}/translations/ti.json +0 -0
  337. /package/{src → build}/translations/tr.json +0 -0
  338. /package/{src → build}/translations/uk.json +0 -0
  339. /package/{src → build}/translations/zh_Hant.json +0 -0
  340. /package/{src → build}/utils/PanoraMapProtocol.js +0 -0
  341. /package/{src → build}/utils/services.js +0 -0
package/config/env.js DELETED
@@ -1,104 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const paths = require('./paths');
6
-
7
- // Make sure that including paths.js after env.js will read .env variables.
8
- delete require.cache[require.resolve('./paths')];
9
-
10
- const NODE_ENV = process.env.NODE_ENV;
11
- if (!NODE_ENV) {
12
- throw new Error(
13
- 'The NODE_ENV environment variable is required but was not specified.'
14
- );
15
- }
16
-
17
- // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
18
- const dotenvFiles = [
19
- `${paths.dotenv}.${NODE_ENV}.local`,
20
- // Don't include `.env.local` for `test` environment
21
- // since normally you expect tests to produce the same
22
- // results for everyone
23
- NODE_ENV !== 'test' && `${paths.dotenv}.local`,
24
- `${paths.dotenv}.${NODE_ENV}`,
25
- paths.dotenv,
26
- ].filter(Boolean);
27
-
28
- // Load environment variables from .env* files. Suppress warnings using silent
29
- // if this file is missing. dotenv will never modify any environment variables
30
- // that have already been set. Variable expansion is supported in .env files.
31
- // https://github.com/motdotla/dotenv
32
- // https://github.com/motdotla/dotenv-expand
33
- dotenvFiles.forEach(dotenvFile => {
34
- if (fs.existsSync(dotenvFile)) {
35
- require('dotenv-expand')(
36
- require('dotenv').config({
37
- path: dotenvFile,
38
- })
39
- );
40
- }
41
- });
42
-
43
- // We support resolving modules according to `NODE_PATH`.
44
- // This lets you use absolute paths in imports inside large monorepos:
45
- // https://github.com/facebook/create-react-app/issues/253.
46
- // It works similar to `NODE_PATH` in Node itself:
47
- // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
48
- // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
49
- // Otherwise, we risk importing Node.js core modules into an app instead of webpack shims.
50
- // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
51
- // We also resolve them to make sure all tools using them work consistently.
52
- const appDirectory = fs.realpathSync(process.cwd());
53
- process.env.NODE_PATH = (process.env.NODE_PATH || '')
54
- .split(path.delimiter)
55
- .filter(folder => folder && !path.isAbsolute(folder))
56
- .map(folder => path.resolve(appDirectory, folder))
57
- .join(path.delimiter);
58
-
59
- // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
60
- // injected into the application via DefinePlugin in webpack configuration.
61
- const REACT_APP = /^REACT_APP_/i;
62
-
63
- function getClientEnvironment(publicUrl) {
64
- const raw = Object.keys(process.env)
65
- .filter(key => REACT_APP.test(key))
66
- .reduce(
67
- (env, key) => {
68
- env[key] = process.env[key];
69
- return env;
70
- },
71
- {
72
- // Useful for determining whether we’re running in production mode.
73
- // Most importantly, it switches React into the correct mode.
74
- NODE_ENV: process.env.NODE_ENV || 'development',
75
- // Useful for resolving the correct path to static assets in `public`.
76
- // For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
77
- // This should only be used as an escape hatch. Normally you would put
78
- // images into the `src` and `import` them in code to get their paths.
79
- PUBLIC_URL: publicUrl,
80
- // We support configuring the sockjs pathname during development.
81
- // These settings let a developer run multiple simultaneous projects.
82
- // They are used as the connection `hostname`, `pathname` and `port`
83
- // in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
84
- // and `sockPort` options in webpack-dev-server.
85
- WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
86
- WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
87
- WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
88
- // Whether or not react-refresh is enabled.
89
- // It is defined here so it is available in the webpackHotDevClient.
90
- FAST_REFRESH: process.env.FAST_REFRESH !== 'false',
91
- }
92
- );
93
- // Stringify all values so we can feed into webpack DefinePlugin
94
- const stringified = {
95
- 'process.env': Object.keys(raw).reduce((env, key) => {
96
- env[key] = JSON.stringify(raw[key]);
97
- return env;
98
- }, {}),
99
- };
100
-
101
- return { raw, stringified };
102
- }
103
-
104
- module.exports = getClientEnvironment;
@@ -1,69 +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 {
62
- type: "https",
63
- options: config
64
- };
65
- }
66
- return {type: "http"};
67
- }
68
-
69
- module.exports = getHttpsConfig;
@@ -1,25 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- /**
5
- * A module to get package informations from package.json
6
- * @module getPackageJson
7
- * @param {...string} keys from package.json if no arguments passed it returns package.json content as object
8
- * @returns {object} with given keys or content of package.json as object
9
- */
10
-
11
- /**
12
- * Returns package info
13
- */
14
- const getPackageJson = function(...args) {
15
- const packageJSON = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')));
16
- if (!args.length) {
17
- return packageJSON;
18
- }
19
- return args.reduce((out, key) => {
20
- out[key] = packageJSON[key];
21
- return out;
22
- }, {});
23
- };
24
-
25
- module.exports = getPackageJson;
@@ -1,29 +0,0 @@
1
- 'use strict';
2
-
3
- const babelJest = require('babel-jest').default;
4
-
5
- const hasJsxRuntime = (() => {
6
- if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
7
- return false;
8
- }
9
-
10
- try {
11
- require.resolve('react/jsx-runtime');
12
- return true;
13
- } catch (e) {
14
- return false;
15
- }
16
- })();
17
-
18
- module.exports = babelJest.createTransformer({
19
- presets: [
20
- [
21
- require.resolve('babel-preset-react-app'),
22
- {
23
- runtime: hasJsxRuntime ? 'automatic' : 'classic',
24
- },
25
- ],
26
- ],
27
- babelrc: false,
28
- configFile: false,
29
- });
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- // This is a custom Jest transformer turning style imports into empty objects.
4
- // http://facebook.github.io/jest/docs/en/webpack.html
5
-
6
- module.exports = {
7
- process() {
8
- return 'module.exports = {};';
9
- },
10
- getCacheKey() {
11
- // The output is always the same.
12
- return 'cssTransform';
13
- },
14
- };
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const camelcase = require('camelcase');
5
-
6
- // This is a custom Jest transformer turning file imports into filenames.
7
- // http://facebook.github.io/jest/docs/en/webpack.html
8
-
9
- module.exports = {
10
- process(src, filename) {
11
- const assetFilename = JSON.stringify(path.basename(filename));
12
-
13
- if (filename.match(/\.svg$/)) {
14
- // Based on how SVGR generates a component name:
15
- // https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
16
- const pascalCaseFilename = camelcase(path.parse(filename).name, {
17
- pascalCase: true,
18
- });
19
- const componentName = `Svg${pascalCaseFilename}`;
20
- return `const React = require('react');
21
- module.exports = {
22
- __esModule: true,
23
- default: ${assetFilename},
24
- ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
25
- return {
26
- $$typeof: Symbol.for('react.element'),
27
- type: 'svg',
28
- ref: ref,
29
- key: null,
30
- props: Object.assign({}, props, {
31
- children: ${assetFilename}
32
- })
33
- };
34
- }),
35
- };`;
36
- }
37
-
38
- return `module.exports = ${assetFilename};`;
39
- },
40
- };
@@ -1,230 +0,0 @@
1
- /*
2
- * Common Jest mocks for complex libraries
3
- */
4
-
5
- jest.mock("lit", () => {
6
- class MockLitElement {
7
- static properties = {};
8
- static styles = [];
9
-
10
- constructor() {
11
- this.shadowRoot = {
12
- innerHTML: "",
13
- appendChild: jest.fn(),
14
- };
15
- this.requestUpdate = jest.fn();
16
- this.updateComplete = Promise.resolve();
17
- this.style = {};
18
- this._handlers = {};
19
- this._handlesOnce = {};
20
- this.renderRoot = {
21
- querySelectorAll: jest.fn(),
22
- };
23
- }
24
-
25
- connectedCallback() {}
26
- disconnectedCallback() {}
27
- attributeChangedCallback() {}
28
- adoptedCallback() {}
29
- firstUpdated() {}
30
- updated() {}
31
- render() {
32
- return "";
33
- }
34
- getAttribute() {}
35
- addEventListener(type, handler, options) {
36
- if(options?.once) {
37
- if(!this._handlersOnce) { this._handlersOnce = {}; }
38
- if(!this._handlersOnce?.[type]) { this._handlersOnce[type] = []; }
39
- this._handlersOnce[type].push(handler);
40
- }
41
- else {
42
- if(!this._handlers[type]) { this._handlers[type] = []; }
43
- this._handlers[type].push(handler);
44
- }
45
- }
46
- dispatchEvent(event, opts) {
47
- this._handlers[event.type]?.forEach(f => f(opts));
48
- this._handlersOnce?.[event.type]?.forEach(f => f(opts));
49
- if(this._handlersOnce?.[event.type]) {
50
- this._handlersOnce[event.type] = [];
51
- }
52
- }
53
- }
54
-
55
- return {
56
- LitElement: MockLitElement,
57
- css: jest.fn((styles) => styles),
58
- html: jest.fn((strings, ...values) => strings.reduce((acc, str, i) => acc + str + (values[i] || ""), "")),
59
- nothing: Symbol("lit-nothing"),
60
- unsafeCSS: jest.fn((styles) => styles),
61
- };
62
- });
63
-
64
-
65
- jest.mock("lit/directives/class-map.js", () => ({
66
- classMap: jest.fn(),
67
- }));
68
-
69
-
70
- jest.mock("lit/directives/map.js", () => ({
71
- map: jest.fn(),
72
- }));
73
-
74
-
75
- jest.mock("maplibre-gl", () => ({
76
- addProtocol: jest.fn(),
77
- AttributionControl: jest.fn(),
78
- NavigationControl: jest.fn(),
79
- GeolocateControl: class {
80
- onAdd() {;}
81
- },
82
- Marker: class {
83
- setDraggable() {;}
84
- },
85
- Popup: function() {
86
- return {
87
- on: jest.fn(),
88
- };
89
- },
90
- Map: class {
91
- constructor(opts) {
92
- this._mapOpts = opts;
93
- this._handlers = {};
94
- this._handlersOnce = {};
95
- }
96
- getContainer() {
97
- return this._mapOpts.container;
98
- }
99
- addControl() {;}
100
- addSource() {;}
101
- addLayer() {;}
102
- getLayer(l) { return {id: l}; }
103
- setLayoutProperty() {;}
104
- setPaintProperty() {;}
105
- loaded() { return true; }
106
- getStyle() {
107
- return {
108
- layers: [],
109
- sources: {},
110
- metadata: {},
111
- };
112
- }
113
- resize() {;}
114
- on(type, handler) {
115
- if(!this._handlers[type]) { this._handlers[type] = []; }
116
- this._handlers[type].push(handler);
117
- }
118
- once(type, handler) {
119
- if(!this._handlersOnce[type]) { this._handlersOnce[type] = []; }
120
- this._handlersOnce[type].push(handler);
121
- }
122
- fire(type, opts) {
123
- this._handlers[type]?.forEach(f => f(opts));
124
- this._handlersOnce?.[type]?.forEach(f => f(opts));
125
- if(this._handlersOnce?.[type]) {
126
- this._handlersOnce[type] = [];
127
- }
128
- }
129
- },
130
- LngLat: function() {
131
- return { lng: -1.7, lat: 47.8 };
132
- },
133
- LngLatBounds: function() {
134
- return { sw: { lng: -1.7, lat: 47.8 }, ne: { lng: -1.7, lat: 47.8 } };
135
- },
136
- }));
137
-
138
-
139
- jest.mock("@photo-sphere-viewer/core", () => ({
140
- Viewer: class {
141
- constructor(opts) {
142
- this._psvOpts = opts;
143
- this.loader = {
144
- canvas: { setAttribute: jest.fn() },
145
- __updateContent: jest.fn(),
146
- show: jest.fn(),
147
- };
148
- this.renderer = {
149
- renderer: {
150
- toneMapping: null,
151
- toneMappingExposure: null,
152
- }
153
- };
154
- this.receivedEvents = [];
155
- this.container = {
156
- classList: {
157
- add: jest.fn(),
158
- remove: jest.fn(),
159
- },
160
- querySelector: jest.fn(),
161
- };
162
- }
163
- addEventListener(t, h) {
164
- this.receivedEvents.push([t, h]);
165
- if(t == "ready") { h(); }
166
- }
167
- dispatchEvent(e) {
168
- this.receivedEvents
169
- .filter(([t,h]) => e.type === t)
170
- .forEach(([t,h]) => h(e?.detail));
171
- }
172
- getPlugin() {
173
- return {
174
- addEventListener: jest.fn(),
175
- datasource: {
176
- nodeResolver: jest.fn(),
177
- },
178
- arrowsRenderer: {
179
- clear: jest.fn(),
180
- },
181
- state: {
182
- currentNode: null,
183
- datasource: { nodes: {} },
184
- },
185
- config: {
186
- transitionOptions: jest.fn(),
187
- },
188
- getCurrentNode: jest.fn(),
189
- __onEnterObject: jest.fn(),
190
- __onLeaveObject: jest.fn(),
191
- };
192
- }
193
- },
194
- SYSTEM: {},
195
- DEFAULTS: {},
196
- }));
197
-
198
-
199
- jest.mock("@photo-sphere-viewer/equirectangular-tiles-adapter", () => ({
200
- EquirectangularTilesAdapter: jest.fn(),
201
- }));
202
-
203
-
204
- jest.mock("@photo-sphere-viewer/virtual-tour-plugin", () => ({
205
- VirtualTourPlugin: jest.fn(),
206
- }));
207
-
208
-
209
- jest.mock("@photo-sphere-viewer/markers-plugin", () => ({
210
- MarkersPlugin: jest.fn(),
211
- }));
212
-
213
-
214
- jest.mock("query-selector-shadow-dom", () => ({
215
- querySelectorDeep: jest.fn(),
216
- }));
217
-
218
-
219
- jest.mock("@maplibre/vt-pbf", () => ({
220
- fromGeojsonVt: jest.fn(),
221
- }));
222
-
223
- jest.mock("pbf", () => ({}));
224
-
225
- jest.mock("@mapbox/vector-tile", () => ({
226
- VectorTile: jest.fn(),
227
- }));
228
-
229
- global.TextDecoder = require("util").TextDecoder;
230
- global.TextEncoder = require("util").TextEncoder;
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();