hn-map 1.0.9 → 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 _t;
3592
+ var currentScriptUrl, _t;
3593
3593
  return _regenerator().w(function (_context) {
3594
3594
  while (1) switch (_context.n) {
3595
3595
  case 0:
@@ -3598,26 +3598,27 @@
3598
3598
  _context.n = _t === 'mars3d' ? 1 : _t === 'gaode' ? 9 : _t === 'siji' ? 13 : 14;
3599
3599
  break;
3600
3600
  case 1:
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;
3601
3602
  _context.n = 2;
3602
- return loadResource('/lib/Cesium/Widgets/widgets.css', 'css');
3603
+ return loadResource(currentScriptUrl + '/lib/Cesium/Widgets/widgets.css', 'css');
3603
3604
  case 2:
3604
3605
  _context.n = 3;
3605
- return loadResource('/lib/Cesium/Cesium.js', 'js');
3606
+ return loadResource(currentScriptUrl + '/lib/Cesium/Cesium.js', 'js');
3606
3607
  case 3:
3607
3608
  _context.n = 4;
3608
- return loadResource('/lib/turf/turf.min.js', 'js');
3609
+ return loadResource(currentScriptUrl + '/lib/turf/turf.min.js', 'js');
3609
3610
  case 4:
3610
3611
  _context.n = 5;
3611
- return loadResource('/lib/mars3d/mars3d.css', 'css');
3612
+ return loadResource(currentScriptUrl + '/lib/mars3d/mars3d.css', 'css');
3612
3613
  case 5:
3613
3614
  _context.n = 6;
3614
- return loadResource('/lib/mars3d/mars3d.js', 'js');
3615
+ return loadResource(currentScriptUrl + '/lib/mars3d/mars3d.js', 'js');
3615
3616
  case 6:
3616
3617
  _context.n = 7;
3617
- return loadResource('/lib/mars3d/plugins/heatmap/heatmap.js', 'js');
3618
+ return loadResource(currentScriptUrl + '/lib/mars3d/plugins/heatmap/heatmap.js', 'js');
3618
3619
  case 7:
3619
3620
  _context.n = 8;
3620
- return loadResource('/lib/mars3d/plugins/heatmap/mars3d-heatmap.js', 'js');
3621
+ return loadResource(currentScriptUrl + '/lib/mars3d/plugins/heatmap/mars3d-heatmap.js', 'js');
3621
3622
  case 8:
3622
3623
  return _context.a(3, 14);
3623
3624
  case 9:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hn-map",
3
- "version": "1.0.9",
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,13 +61,14 @@ export default class hnMap {
61
61
 
62
62
  switch (mapType) {
63
63
  case 'mars3d':
64
- await loadResource('/lib/Cesium/Widgets/widgets.css', 'css')
65
- await loadResource('/lib/Cesium/Cesium.js', 'js')
66
- await loadResource('/lib/turf/turf.min.js', 'js')
67
- await loadResource('/lib/mars3d/mars3d.css', 'css')
68
- await loadResource('/lib/mars3d/mars3d.js', 'js')
69
- await loadResource('/lib/mars3d/plugins/heatmap/heatmap.js', 'js')
70
- await loadResource('/lib/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')
71
72
 
72
73
  break
73
74
  case 'gaode':