becomap 1.5.69 → 1.5.71

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.
@@ -1,87 +1,91 @@
1
- const path = require('path');
2
- const HtmlWebpackPlugin = require('html-webpack-plugin');
3
- const WebpackObfuscator = require('webpack-obfuscator');
4
- const TerserPlugin = require('terser-webpack-plugin');
5
- const Dotenv = require('dotenv-webpack');
6
-
7
- const envFile = `.env`;
8
-
9
- module.exports = {
10
- mode: 'production',
11
- entry: './src/index.ts',
12
- output: {
13
- filename: 'becomap.[contenthash].js',
14
- chunkFilename: 'becomap.[name].[contenthash].js',
15
- path: path.resolve(__dirname, 'esm-build'),
16
- library: 'becomap',
17
- libraryTarget: 'umd',
18
- umdNamedDefine: true,
19
- globalObject: 'this',
20
- },
21
- resolve: {
22
- extensions: ['.ts', '.js'],
23
- },
24
- module: {
25
- rules: [
26
- {
27
- test: /\.ts$/,
28
- use: 'ts-loader',
29
- exclude: /node_modules/,
30
- },
31
- {
32
- test: /\.css$/,
33
- use: ['style-loader', 'css-loader'],
34
- },
35
- {
36
- test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
37
- type: 'asset',
38
- },
39
- ],
40
- },
41
- optimization: {
42
- minimize: true,
43
- minimizer: [
44
- new TerserPlugin({
45
- terserOptions: {
46
- compress: {
47
- drop_console: false,
48
- },
49
- },
50
- }),
51
- ],
52
- splitChunks : {
53
- chunks: 'all',
54
- minSize: 30000,
55
- maxSize: 204800,
56
- cacheGroups: {
57
- vendors: {
58
- test: /[\\/]node_modules[\\/]/,
59
- name: 'vendors',
60
- enforce: true,
61
- priority: -10,
62
- },
63
- default: {
64
- minChunks: 2,
65
- priority: -20,
66
- reuseExistingChunk: true,
67
- },
68
- }
69
- },
70
- runtimeChunk: 'single'
71
- },
72
- externalsType: 'window',
73
- externals: {
74
- 'maplibre-gl': 'maplibregl',
75
- '@turf/turf': 'turf'
76
- },
77
- plugins: [
78
- new Dotenv({
79
- path: envFile,
80
- }),
81
- new HtmlWebpackPlugin({
82
- template: './public/index1.html',
83
- filename: 'index.html',
84
- inject: 'body',
85
- }),
86
- ],
87
- };
1
+ const path = require('path');
2
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
3
+ const WebpackObfuscator = require('webpack-obfuscator');
4
+ const TerserPlugin = require('terser-webpack-plugin');
5
+ const Dotenv = require('dotenv-webpack');
6
+
7
+ const envFile = `.env`;
8
+
9
+ module.exports = {
10
+ mode: 'production',
11
+ entry: './src/index.ts',
12
+ output: {
13
+ filename: 'becomap.[contenthash].js',
14
+ chunkFilename: 'becomap.[name].[contenthash].js',
15
+ path: path.resolve(__dirname, 'esm-build'),
16
+ library: 'becomap',
17
+ libraryTarget: 'umd',
18
+ umdNamedDefine: true,
19
+ globalObject: 'this',
20
+ },
21
+ resolve: {
22
+ extensions: ['.ts', '.js'],
23
+ },
24
+ module: {
25
+ rules: [
26
+ {
27
+ test: /\.ts$/,
28
+ use: 'ts-loader',
29
+ exclude: /node_modules/,
30
+ },
31
+ {
32
+ test: /\.css$/,
33
+ use: ['style-loader', 'css-loader'],
34
+ },
35
+ {
36
+ test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
37
+ type: 'asset',
38
+ },
39
+ ],
40
+ },
41
+ optimization: {
42
+ minimize: true,
43
+ minimizer: [
44
+ new TerserPlugin({
45
+ terserOptions: {
46
+ compress: {
47
+ drop_console: false,
48
+ },
49
+ },
50
+ }),
51
+ ],
52
+ splitChunks : {
53
+ chunks: 'all',
54
+ minSize: 30000,
55
+ maxSize: 204800,
56
+ cacheGroups: {
57
+ vendors: {
58
+ test: /[\\/]node_modules[\\/]/,
59
+ name: 'vendors',
60
+ enforce: true,
61
+ priority: -10,
62
+ },
63
+ default: {
64
+ minChunks: 2,
65
+ priority: -20,
66
+ reuseExistingChunk: true,
67
+ },
68
+ }
69
+ },
70
+ runtimeChunk: 'single'
71
+ },
72
+ externalsType: 'window',
73
+ externals: {
74
+ 'maplibre-gl': 'maplibregl',
75
+ '@turf/turf': 'turf'
76
+ },
77
+ plugins: [
78
+ new Dotenv({
79
+ path: envFile,
80
+ }),
81
+ new HtmlWebpackPlugin({
82
+ template: './public/index.html',
83
+ filename: 'index.html',
84
+ inject: 'body',
85
+ }),
86
+ new WebpackObfuscator(
87
+ { stringArray: false },
88
+ ['node_modules/**/*']
89
+ ),
90
+ ],
91
+ };
@@ -1,52 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta http-equiv="Content-Security-Policy" content="default-src * data: blob: filesystem: about: ws: wss: 'unsafe-inline' 'unsafe-eval';">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <style>
8
- body, html { margin:0; padding:0; height:100%; }
9
- #app {
10
- width: 100%;
11
- height: 100%;
12
- }
13
- </style>
14
- </head>
15
- <body>
16
- <div id="app"></div>
17
- <!-- external libs from CDN as globals -->
18
- <script src="https://unpkg.com/maplibre-gl@4.4.1/dist/maplibre-gl.js"></script>
19
- <script src="https://unpkg.com/@turf/turf@7.1.0/turf.min.js"></script>
20
-
21
- <!-- HtmlWebpackPlugin will inject your UMD bundle(s) here -->
22
-
23
- <script>
24
- document.addEventListener('DOMContentLoaded', function() {
25
- if (
26
- window.becomap &&
27
- typeof window.becomap.getSite === 'function' &&
28
- typeof window.becomap.getMapView === 'function'
29
- ) {
30
- window.becomap.getSite(
31
- { clientId:'c079dfa3a77dad13351cfacd95841c2c2780fe08', clientSecret:'f62a59675b2a47ddb75f1f994d88e653', siteIdentifier:'67dcf5dd2f21c64e3225254f' }
32
- )
33
- .then(site => {
34
- return window.becomap.getMapView(
35
- document.getElementById('app'),
36
- site,
37
- { zoom: 18.2 }
38
- );
39
- })
40
- .then(() => {
41
- console.log('Map rendered successfully');
42
- })
43
- .catch(error => {
44
- console.error('Error initializing map:', error);
45
- });
46
- } else {
47
- console.error('becomap library did not load correctly.');
48
- }
49
- });
50
- </script>
51
- </body>
52
- </html>