hn-map 1.0.8 → 1.0.10

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/dist/index.js CHANGED
@@ -3589,7 +3589,7 @@
3589
3589
  key: "create",
3590
3590
  value: function () {
3591
3591
  var _create = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(id, option, mapType) {
3592
- var baseUrl, _t;
3592
+ var currentScriptUrl, _t;
3593
3593
  return _regenerator().w(function (_context) {
3594
3594
  while (1) switch (_context.n) {
3595
3595
  case 0:
@@ -3598,27 +3598,27 @@
3598
3598
  _context.n = _t === 'mars3d' ? 1 : _t === 'gaode' ? 9 : _t === 'siji' ? 13 : 14;
3599
3599
  break;
3600
3600
  case 1:
3601
- baseUrl = './lib/';
3601
+ currentScriptUrl = new URL((typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('index.js', document.baseURI).href))).origin;
3602
3602
  _context.n = 2;
3603
- return loadResource(baseUrl + 'Cesium/Widgets/widgets.css', 'css');
3603
+ return loadResource(currentScriptUrl + '/lib/Cesium/Widgets/widgets.css', 'css');
3604
3604
  case 2:
3605
3605
  _context.n = 3;
3606
- return loadResource(baseUrl + 'Cesium/Cesium.js', 'js');
3606
+ return loadResource(currentScriptUrl + '/lib/Cesium/Cesium.js', 'js');
3607
3607
  case 3:
3608
3608
  _context.n = 4;
3609
- return loadResource(baseUrl + 'turf/turf.min.js', 'js');
3609
+ return loadResource(currentScriptUrl + '/lib/turf/turf.min.js', 'js');
3610
3610
  case 4:
3611
3611
  _context.n = 5;
3612
- return loadResource(baseUrl + 'mars3d/mars3d.css', 'css');
3612
+ return loadResource(currentScriptUrl + '/lib/mars3d/mars3d.css', 'css');
3613
3613
  case 5:
3614
3614
  _context.n = 6;
3615
- return loadResource(baseUrl + 'mars3d/mars3d.js', 'js');
3615
+ return loadResource(currentScriptUrl + '/lib/mars3d/mars3d.js', 'js');
3616
3616
  case 6:
3617
3617
  _context.n = 7;
3618
- return loadResource(baseUrl + 'mars3d/plugins/heatmap/heatmap.js', 'js');
3618
+ return loadResource(currentScriptUrl + '/lib/mars3d/plugins/heatmap/heatmap.js', 'js');
3619
3619
  case 7:
3620
3620
  _context.n = 8;
3621
- return loadResource(baseUrl + 'mars3d/plugins/heatmap/mars3d-heatmap.js', 'js');
3621
+ return loadResource(currentScriptUrl + '/lib/mars3d/plugins/heatmap/mars3d-heatmap.js', 'js');
3622
3622
  case 8:
3623
3623
  return _context.a(3, 14);
3624
3624
  case 9:
@@ -3651,7 +3651,6 @@
3651
3651
  _defineProperty(hnMap, "allowConstruction", false);
3652
3652
  var loadResource = function loadResource(path, type) {
3653
3653
  return new Promise(function (resolve, reject) {
3654
- console.log(path, type, 222222);
3655
3654
  if (type === 'css') {
3656
3655
  var link = document.createElement('link');
3657
3656
  link.rel = 'stylesheet';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hn-map",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "hn-map集成mars3d、高德、思极",
5
5
  "main": "dist/index.js",
6
6
  "author": "庞大仙",
package/src/index.js CHANGED
@@ -61,16 +61,14 @@ export default class hnMap {
61
61
 
62
62
  switch (mapType) {
63
63
  case 'mars3d':
64
-
65
- const baseUrl = './lib/'
66
-
67
- await loadResource(baseUrl + 'Cesium/Widgets/widgets.css', 'css')
68
- await loadResource(baseUrl + 'Cesium/Cesium.js', 'js')
69
- await loadResource(baseUrl + 'turf/turf.min.js', 'js')
70
- await loadResource(baseUrl + 'mars3d/mars3d.css', 'css')
71
- await loadResource(baseUrl + 'mars3d/mars3d.js', 'js')
72
- await loadResource(baseUrl + 'mars3d/plugins/heatmap/heatmap.js', 'js')
73
- await loadResource(baseUrl + 'mars3d/plugins/heatmap/mars3d-heatmap.js', 'js')
64
+ const currentScriptUrl = new URL(import.meta.url).origin;
65
+ await loadResource(currentScriptUrl + '/lib/Cesium/Widgets/widgets.css', 'css')
66
+ await loadResource(currentScriptUrl + '/lib/Cesium/Cesium.js', 'js')
67
+ await loadResource(currentScriptUrl + '/lib/turf/turf.min.js', 'js')
68
+ await loadResource(currentScriptUrl + '/lib/mars3d/mars3d.css', 'css')
69
+ await loadResource(currentScriptUrl + '/lib/mars3d/mars3d.js', 'js')
70
+ await loadResource(currentScriptUrl + '/lib/mars3d/plugins/heatmap/heatmap.js', 'js')
71
+ await loadResource(currentScriptUrl + '/lib/mars3d/plugins/heatmap/mars3d-heatmap.js', 'js')
74
72
 
75
73
  break
76
74
  case 'gaode':
@@ -89,7 +87,6 @@ export default class hnMap {
89
87
  const loadResource = (path, type) => {
90
88
  return new Promise((resolve, reject) => {
91
89
 
92
- console.log(path,type,222222)
93
90
  if (type === 'css') {
94
91
  const link = document.createElement('link')
95
92
  link.rel = 'stylesheet'