@mapcomponents/react-maplibre 0.1.62 → 0.1.63
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.
- package/.babelrc +21 -2
- package/.eslintrc.js +8 -1
- package/.storybook/main.js +0 -1
- package/.storybook/preview.js +0 -2
- package/CHANGELOG.md +18 -0
- package/coverage/clover.xml +232 -44
- package/coverage/coverage-final.json +11 -3
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +70 -25
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +148 -0
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +22 -7
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +73 -40
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +15 -15
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +9 -3
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +59 -29
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +652 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +649 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +131 -0
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +214 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +121 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +412 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +463 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +161 -0
- package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +898 -0
- package/coverage/lcov-report/src/components/MlSketchTool/index.html +116 -0
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
- package/coverage/lcov-report/src/contexts/index.html +1 -1
- package/coverage/lcov-report/src/hooks/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
- package/coverage/lcov-report/src/hooks/useMap.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useSource.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useWms.js.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +1 -1
- package/coverage/lcov.info +514 -89
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/component-index.html +12 -0
- package/cypress/support/component.ts +46 -0
- package/cypress.config.ts +101 -0
- package/dist/components/MapLibreMap/MapLibreMap.d.ts +1 -1
- package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +3 -3
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.cy.d.ts +1 -0
- package/dist/components/MlCreatePdfForm/lib/PdfPreview.d.ts +1 -1
- package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +10 -4
- package/dist/components/MlFeatureEditor/lib/double_click_zoom.d.ts +0 -2
- package/dist/components/MlFeatureEditor/lib/theme.d.ts +1 -1
- package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +1 -1
- package/dist/components/MlGPXViewer/util/MlGPXViewerInstructions.d.ts +1 -0
- package/dist/components/MlGPXViewer/util/SampleLayer.d.ts +0 -0
- package/dist/components/MlGPXViewer/util/demoViewer.d.ts +5 -0
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +4 -4
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +103 -11
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.d.ts +2 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.d.ts +2 -0
- package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +9 -0
- package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +5 -0
- package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +11 -0
- package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +9 -0
- package/dist/components/MlSketchTool/MlSketchTool.d.ts +29 -0
- package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +10 -0
- package/dist/contexts/SimpleDataProvider.d.ts +1 -1
- package/dist/custom.d.d.ts +1 -1
- package/dist/hooks/useLayer.d.ts +1 -1
- package/dist/hooks/useMap.d.ts +1 -1
- package/dist/hooks/useMapState.d.ts +3 -3
- package/dist/hooks/useSource.d.ts +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +2736 -3557
- package/dist/index.esm.js.map +1 -1
- package/dist/ui_components/LoadingOverlayContext.d.ts +1 -1
- package/dist/ui_components/Sidebar.d.ts +9 -1
- package/dist/ui_components/TopToolbar.d.ts +6 -1
- package/package.json +21 -15
- package/public/assets/sample1.gpx +3003 -0
- package/public/assets/sample2.gpx +1264 -0
- package/public/assets/sample3.gpx +912 -0
- package/public/index.html +0 -4
- package/public/thumbnails/MlSketchTool.png +0 -0
- package/public/thumbnails/useCameraFollowPath.png +0 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx +21 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.stories.tsx +1 -3
- package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +1 -1
- package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +1 -1
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +39 -28
- package/src/components/MlGPXViewer/MlGPXViewer.stories.js +75 -15
- package/src/components/MlGPXViewer/MlGPXViewer.tsx +3 -1
- package/src/components/MlGPXViewer/util/MlGPXViewerInstructions.js +145 -0
- package/src/components/MlGPXViewer/util/SampleLayer.js +2 -0
- package/src/components/MlGPXViewer/util/demoViewer.js +254 -0
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +102 -0
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +33 -23
- package/src/components/MlGeoJsonLayer/assets/sample_1.json +138 -24
- package/src/components/MlGeoJsonLayer/assets/sample_2.json +140 -20
- package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js +189 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js +188 -0
- package/src/components/MlSketchTool/LayerList/ColorPicker.tsx +43 -0
- package/src/components/MlSketchTool/LayerList/LayerList.tsx +12 -0
- package/src/components/MlSketchTool/LayerList/LayerListItem.tsx +109 -0
- package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +126 -0
- package/src/components/MlSketchTool/MlSketchTool.doc.de.md +3 -0
- package/src/components/MlSketchTool/MlSketchTool.meta.json +15 -0
- package/src/components/MlSketchTool/MlSketchTool.stories.js +26 -0
- package/src/components/MlSketchTool/MlSketchTool.tsx +271 -0
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +2 -2
- package/src/ui_components/Sidebar.tsx +80 -0
- package/src/ui_components/TopToolbar.tsx +24 -0
- package/tsconfig.json +39 -58
- package/config/getHttpsConfig.js +0 -66
- package/config/modules.js +0 -134
- package/config/pnpTs.js +0 -35
- package/config/webpack.config.js +0 -757
- package/config/webpackDevServer.config.js +0 -130
- package/scripts/start.js +0 -166
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +0 -66
- package/src/ui_components/Sidebar.js +0 -100
- package/src/ui_components/TopToolbar.js +0 -29
package/config/getHttpsConfig.js
DELETED
|
@@ -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;
|
package/config/modules.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const paths = require('./paths');
|
|
6
|
-
const chalk = require('react-dev-utils/chalk');
|
|
7
|
-
const resolve = require('resolve');
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Get additional module paths based on the baseUrl of a compilerOptions object.
|
|
11
|
-
*
|
|
12
|
-
* @param {Object} options
|
|
13
|
-
*/
|
|
14
|
-
function getAdditionalModulePaths(options = {}) {
|
|
15
|
-
const baseUrl = options.baseUrl;
|
|
16
|
-
|
|
17
|
-
if (!baseUrl) {
|
|
18
|
-
return '';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
22
|
-
|
|
23
|
-
// We don't need to do anything if `baseUrl` is set to `node_modules`. This is
|
|
24
|
-
// the default behavior.
|
|
25
|
-
if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Allow the user set the `baseUrl` to `appSrc`.
|
|
30
|
-
if (path.relative(paths.appSrc, baseUrlResolved) === '') {
|
|
31
|
-
return [paths.appSrc];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// If the path is equal to the root directory we ignore it here.
|
|
35
|
-
// We don't want to allow importing from the root directly as source files are
|
|
36
|
-
// not transpiled outside of `src`. We do allow importing them with the
|
|
37
|
-
// absolute path (e.g. `src/Components/Button.js`) but we set that up with
|
|
38
|
-
// an alias.
|
|
39
|
-
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Otherwise, throw an error.
|
|
44
|
-
throw new Error(
|
|
45
|
-
chalk.red.bold(
|
|
46
|
-
"Your project's `baseUrl` can only be set to `src` or `node_modules`." +
|
|
47
|
-
' Create React App does not support other values at this time.'
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Get webpack aliases based on the baseUrl of a compilerOptions object.
|
|
54
|
-
*
|
|
55
|
-
* @param {*} options
|
|
56
|
-
*/
|
|
57
|
-
function getWebpackAliases(options = {}) {
|
|
58
|
-
const baseUrl = options.baseUrl;
|
|
59
|
-
|
|
60
|
-
if (!baseUrl) {
|
|
61
|
-
return {};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
65
|
-
|
|
66
|
-
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
67
|
-
return {
|
|
68
|
-
src: paths.appSrc,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Get jest aliases based on the baseUrl of a compilerOptions object.
|
|
75
|
-
*
|
|
76
|
-
* @param {*} options
|
|
77
|
-
*/
|
|
78
|
-
function getJestAliases(options = {}) {
|
|
79
|
-
const baseUrl = options.baseUrl;
|
|
80
|
-
|
|
81
|
-
if (!baseUrl) {
|
|
82
|
-
return {};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
86
|
-
|
|
87
|
-
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
88
|
-
return {
|
|
89
|
-
'^src/(.*)$': '<rootDir>/src/$1',
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function getModules() {
|
|
95
|
-
// Check if TypeScript is setup
|
|
96
|
-
const hasTsConfig = fs.existsSync(paths.appTsConfig);
|
|
97
|
-
const hasJsConfig = fs.existsSync(paths.appJsConfig);
|
|
98
|
-
|
|
99
|
-
if (hasTsConfig && hasJsConfig) {
|
|
100
|
-
throw new Error(
|
|
101
|
-
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
let config;
|
|
106
|
-
|
|
107
|
-
// If there's a tsconfig.json we assume it's a
|
|
108
|
-
// TypeScript project and set up the config
|
|
109
|
-
// based on tsconfig.json
|
|
110
|
-
if (hasTsConfig) {
|
|
111
|
-
const ts = require(resolve.sync('typescript', {
|
|
112
|
-
basedir: paths.appNodeModules,
|
|
113
|
-
}));
|
|
114
|
-
config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
|
|
115
|
-
// Otherwise we'll check if there is jsconfig.json
|
|
116
|
-
// for non TS projects.
|
|
117
|
-
} else if (hasJsConfig) {
|
|
118
|
-
config = require(paths.appJsConfig);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
config = config || {};
|
|
122
|
-
const options = config.compilerOptions || {};
|
|
123
|
-
|
|
124
|
-
const additionalModulePaths = getAdditionalModulePaths(options);
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
additionalModulePaths: additionalModulePaths,
|
|
128
|
-
webpackAliases: getWebpackAliases(options),
|
|
129
|
-
jestAliases: getJestAliases(options),
|
|
130
|
-
hasTsConfig,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
module.exports = getModules();
|
package/config/pnpTs.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { resolveModuleName } = require('ts-pnp');
|
|
4
|
-
|
|
5
|
-
exports.resolveModuleName = (
|
|
6
|
-
typescript,
|
|
7
|
-
moduleName,
|
|
8
|
-
containingFile,
|
|
9
|
-
compilerOptions,
|
|
10
|
-
resolutionHost
|
|
11
|
-
) => {
|
|
12
|
-
return resolveModuleName(
|
|
13
|
-
moduleName,
|
|
14
|
-
containingFile,
|
|
15
|
-
compilerOptions,
|
|
16
|
-
resolutionHost,
|
|
17
|
-
typescript.resolveModuleName
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
exports.resolveTypeReferenceDirective = (
|
|
22
|
-
typescript,
|
|
23
|
-
moduleName,
|
|
24
|
-
containingFile,
|
|
25
|
-
compilerOptions,
|
|
26
|
-
resolutionHost
|
|
27
|
-
) => {
|
|
28
|
-
return resolveModuleName(
|
|
29
|
-
moduleName,
|
|
30
|
-
containingFile,
|
|
31
|
-
compilerOptions,
|
|
32
|
-
resolutionHost,
|
|
33
|
-
typescript.resolveTypeReferenceDirective
|
|
34
|
-
);
|
|
35
|
-
};
|