leaflet-extras / leaflet-map

Leaflet map as web component
https://leaflet-extras.github.io/leaflet-map
116 stars 72 forks source link

Add polymerBehavior annotations for hydrolysis #72

Open naoak opened 8 years ago

naoak commented 8 years ago

Hi, I'm using web-components-shards to separate vulcanized bundles. When I built leaflet-map with it, the following warnings were emitted.

Behavior leafletMap.LeafletPopupContent not found when mixing properties into leaflet-circle!
Behavior leafletMap.LeafletPopupContent not found when mixing properties into leaflet-polyline!
Behavior leafletMap.LeafletPopupContent not found when mixing properties into leaflet-polygon!
Behavior leafletMap.LeafletTileLayer not found when mixing properties into leaflet-tilelayer!
Behavior leafletMap.LeafletTileLayer not found when mixing properties into leaflet-tilelayer-wms!
Behavior leafletMap.LeafletILayer not found when mixing properties into leaflet-geojson!
Behavior leafletMap.LeafletPopupContent not found when mixing properties into leaflet-marker!

This is because hydrolysis often fails to detect definitions of behaviors without @polymerBehavior annotations. If it fails, it emits them.

You can reproduce this in the following way.

$ npm install hydrolysis
$ mkdir -p ../leaflet/dist
$ touch ../leaflet/dist/leaflet.css
$ touch ../leaflet/dist/leaflet.js
// Save as `test.js`
var h = require('hydrolysis');
var imports = [
  'leaflet-control.html',
  'leaflet-core.html',
  'leaflet-draw.html',
  'leaflet-geojson.html',
  'leaflet-geolocation.html',
  'leaflet-import.html',
  'leaflet-layer-group.html',
  'leaflet-layer.html',
  'leaflet-map.html',
  'leaflet-marker.html',
  'leaflet-popup.html'
];

imports.forEach(function(html) {
  h.Analyzer.analyze(html);
});
$ node test.js

If you'd like it, I'll make a PR. Thanks.