diff --git a/.travis.yml b/.travis.yml index 6487ac83d..18a2c34cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: node_js before_install: npm install -g grunt-cli +sudo: false node_js: - "0.10" diff --git a/CHANGELOG.md b/CHANGELOG.md index b27e238dd..9b1df668c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,50 @@ -# Changelog +# Change Log -## 1.0.0 +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). + +[Upcoming changes][unreleased] + +## [2.0.0-beta.1](v2.0.0-beta.1) + +This release is the first release that supports [Leaflet 1.0.0-beta.1](http://leafletjs.com/2015/07/15/leaflet-1.0-beta1-released.html). + +### Added + +* New `featureLayer.resetFeatureStyle(id, style)` for reseting the styles on a specific feature to their original style. + +### Changed + +* By default basemap layers `GrayLabels`, `DarkGrayLabels`, `OceansLabels`, `ImageryLabels`, `ImageryTransportation`, `ShadedReliefLabels`, `TerrainLabels` will now be rendered on top of polygons and polylines if the browser supports [CSS Pointer Events](https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events). You can disable this behavior by passing `{pane: "tilePane"}` in the `L.esri.basemapLayer` options. +* Now relies on the [Leaflet 1.0.0-beta.1 release](http://leafletjs.com/2015/07/15/leaflet-1.0-beta1-released.html) +* Rewritten build and test systems to rely on ES 2015 Modules specification +* More build and release automation +* `featureLayer.resetStyle` no longer takes and id and will reset the style of all features. Use the new `featureLayer.resetFeatureStyle(id, style)` method. +* Styling point feature layers using vector markers like `L.circleMarker` should now also use the `style` option to set the styles of the vector markers as opposed to setting it in the `L.circleMarker` options. This enables the `setStyle`, `resetStyle`, `setFeatureStyle` and `resetFeatureStyle` options to work properly. + +```js +L.esri.featureLayer({ + url: 'http://...', + + // define how to convert your point into a layer + pointToLayer: function(latlng, feature){ + return L.circleMarker(latlng); + }, + + // style that vector layer + style: { + radius: 10, + color: 'red' + } +}) +``` + +### Removed + +* All alternate/compact builds have been removed. They will be replaced with a new system for generating custom builds soon. +* `L.esri.Request` has been removed. Please use `L.esri.get`, `L.esri.get.CORS`, `L.esri.get.JSONP`, `L.esri.post` or `L.esri.request` directly. + +## [1.0.0](v1.0.0) This represents the stable release of Esri Leaflet compatible with Leaflet 0.7.3. All future 1.0.X releases will be compatible with Leaflet 0.7.3 and contain only bug fixes. New features will only be added in Esri Leaflet 2.0.0 which will require Leaflet 1.0.0. @@ -8,7 +52,7 @@ As this is a major release there are a number of breaking changes. Also see the [Esri Leaflet 1.0 announcement](https://github.com/Esri/esri-leaflet/wiki/Esri-Leaflet-1.0.0-Announcement). -#### Breaking Changes +### Breaking Changes * `L.esri.Services.FeatureLayer` has been renamed to `L.esri.Services.FeatureLayerService`. It should be initialized with `L.esri.Services.featureLayerService(options)`. * All layers now match services and tasks and now only accept `url` in their options. E.x. `L.esri.featureLayer(url)` should now `L.esri.featureLayer({url: url}})`. This *does not* affect `L.esri.baseMapLayer` which still accepts the `key` as it's first parameter. @@ -35,7 +79,7 @@ L.esri.Services.service({ }); ``` -#### Changes +### Changes * Added support for the `dynamicLayers` option to `L.esri.DynamicMapLayer` https://github.com/Esri/esri-leaflet/issues/566 * Restored `bringToBack` and `bringToFront` to `L.esri.FeatureLayer` https://github.com/Esri/esri-leaflet/issues/479 @@ -43,13 +87,13 @@ L.esri.Services.service({ * `L.esri.DynamicMapLayer` and `L.esri.ImageMapLayer` will now automatically use POST for large requests. https://github.com/Esri/esri-leaflet/issues/574 * `L.esri.ImageMapLayer` now defaults to requesting `json` as opposed to an image to better handle authentication and large requests https://github.com/Esri/esri-leaflet/issues/574. If your Image Service does not support CORS you should set ``{f:'image'}`` in your options. -## Release Candidate 8 +## [Release Candidate 8](v1.0.0-rc.8) -#### Breaking Changes +### Breaking Changes * CDN moved to JS Delivr http://www.jsdelivr.com/#!leaflet.esri -#### Changes +### Changes * Non standard scale levels from tile services published in web mercator are now remapped to the standard scale levels https://github.com/Esri/esri-leaflet/pull/548 https://github.com/Esri/esri-leaflet/issues/530 * Fixed a bug introduced in RC 7 where features would sometimes not draw https://github.com/Esri/esri-leaflet/issues/546 https://github.com/Esri/esri-leaflet/issues/536 @@ -57,13 +101,13 @@ L.esri.Services.service({ * Properly handle using `L.CircleMarker` with `L.esri.Layers.FeatureLayer` https://github.com/Esri/esri-leaflet/issues/534 * New `redraw` method on `L.esri.Layers.FeatureLayer` for programmatically redrawing features with their latest symbology. https://github.com/Esri/esri-leaflet/pull/550 -## Release Candidate 7 +## [Release Candidate 7](v1.0.0-rc.7) -#### Breaking Changes +### Breaking Changes * DynamicMapLayer will now request `json` by default to better expose the authentication process. If you are using ArcGIS Server 10.0 or have disabled CORS on your server you will need to add `useCors: false` to your options. -#### Changes +### Changes * refactor of `FeatureLayer.resetStyle()` behavior. https://github.com/Esri/esri-leaflet/issues/488 * improvement of `DynamicMapLayer` image loading logic. https://github.com/Esri/esri-leaflet/issues/498 * Fixed bug in display of dynamic map services at world scale. https://github.com/Esri/esri-leaflet/issues/450 @@ -78,27 +122,27 @@ L.esri.Services.service({ * DynamicMapLayer will now request `json` by default to better expose authentication helpers * Attribution for basemaps is now always requested with JSONP -## Release Candidate 6 +## [Release Candidate 6](v1.0.0-rc.6) -#### Breaking Changes +### Breaking Changes None -#### Changes +### Changes * `f:'json'` will now be used automatically when a proxy is set for `L.esri.DynamicMapLayer`. https://github.com/Esri/esri-leaflet/issues/464 * Callback functions will now only be run once when there is a CORS error. https://github.com/Esri/esri-leaflet/issues/465 -* Layer ids will now beinlucded with the GeoJSON response from `identify()` and `L.esri.Tasks.Identify`. https://github.com/Esri/esri-leaflet/issues/443 +* Layer ids will now be included with the GeoJSON response from `identify()` and `L.esri.Tasks.Identify`. https://github.com/Esri/esri-leaflet/issues/443 * Bugfix for adding/removing certain basemap layers. https://github.com/Esri/esri-leaflet/issues/455 -## Release Candidate 5 +## [Release Candidate 5](v1.0.0-rc.5) -#### Breaking Changes +### Breaking Changes -* All `Task` and `Service` constructors now accept `url` as a value within options, rather than as a seperate parameter. [#420](https://github.com/Esri/esri-leaflet/issues/420) -* 'Layer' objects continue to expect a `url' string to be supplied as the first parameter, but afterwards, the property is now accessible via Layer.options.url instead of Layer.url +* All `Task` and `Service` constructors now accept `url` as a value within options, rather than as a separate parameter. [#420](https://github.com/Esri/esri-leaflet/issues/420) +* 'Layer' objects continue to expect a `url` string to be supplied as the first parameter, but afterwards, the property is now accessible via Layer.options.url instead of Layer.url -#### Changes +### Changes * Fixed duplicate Esri logo bug [#427](https://github.com/Esri/esri-leaflet/issues/427) * GeoJSON is now requested directly from ArcGIS Online Hosted Feature Services [#418](https://github.com/Esri/esri-leaflet/issues/418) @@ -107,17 +151,17 @@ None * default fill is now specified for multipolygons [#406](https://github.com/Esri/esri-leaflet/issues/406) * dark gray basemap now utilizes our new production service [#399](https://github.com/Esri/esri-leaflet/issues/399) -## Release Candidate 4 +## [Release Candidate 4](v1.0.0-rc.4) -#### Changes +### Changes * Fixed a bug where resetStyle would not work with MultiPolygon and MultiPolyline features [#390](https://github.com/Esri/esri-leaflet/issues/390) * Fixed a display bug when rapidly toggling L.esri.DynamicMapLayer on/off before the image completely loads [#386](https://github.com/Esri/esri-leaflet/issues/386) * Bower installation fixed [#378](https://github.com/Esri/esri-leaflet/issues/378) -## Release Candidate 3 +## [Release Candidate 3](v1.0.0-rc.3) -#### Changes +### Changes * Removed hardcoded http call in `L.esri.Controls.Logo` [#383](https://github.com/Esri/esri-leaflet/issues/383) * `L.esri.TiledMapLayer` now accepts a token option for secured tiles. [#384](https://github.com/Esri/esri-leaflet/issues/384) @@ -126,48 +170,49 @@ None * Fixed setting sr param on `L.esri.Tasks.Find` [#379](https://github.com/Esri/esri-leaflet/issues/379) * `bower install esri-leaflet` now works properly. -## Release Candidate 2 +## [Release Candidate 2](v1.0.0-rc.2) -#### Changes +### Changes * Fixed IE 8 and 9 support that was broken in RC 1. * Fixed sourcemaps by embedding source files inside the maps. * Fix a bug when aborting JSONP requests * Other small fixes for plugin support * Added `contains`, `overlaps` and `intersects` to `L.esri.Tasks.Query`. -* Spatial methods on `L.esri.Tasks.Query` can now accept the follwoing Leaflet types, `L.Marker`, `L.Polygon`, `L.Polyline`, `L.LatLng`, `L.LatLngBounds` and `L.GeoJSON`. It can also accept valid GeoJSON Point, Polyline, Polygon and GeoJSON Feautre objects containing Point, Polyline, Polygon. +* Spatial methods on `L.esri.Tasks.Query` can now accept the following Leaflet types, `L.Marker`, `L.Polygon`, `L.Polyline`, `L.LatLng`, `L.LatLngBounds` and `L.GeoJSON`. It can also accept valid GeoJSON Point, Polyline, Polygon and GeoJSON Feature objects containing Point, Polyline, Polygon. * Most methods that accept `L.LatLng` and `L.LatLngBounds` now accept the simple [lat,lng] or [[lat,lng], [lat,lng]] forms. -## Release Candidate 1 +## [Release Candidate 1](v1.0.0-rc.1) -#### Changes +### Changes * `L.esri.Task` now accepts `proxy` and `useCors` like `L.esri.Service`. https://github.com/Esri/esri-leaflet/pull/359 -* Esri Leaflet can now be used in Common JS (browserify) and AMD (Dojo, RequierJS) module loaders. Examples will be coming soon. +* Esri Leaflet can now be used in Common JS (browserify) and AMD (Dojo, RequireJS) module loaders. Examples will be coming soon. * Source maps are now built and distributed along with the distribution files to aid in debugging. To learn how to use the source maps [Treehouse](http://blog.teamtreehouse.com/introduction-source-maps) and [HTML5Rocks](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/) have excellent resources. * `L.esri.ClusteredFeatureLayer` has been moved to its own repository. https://github.com/Esri/esri-leaflet-clustered-feature-layer * `L.esri.HeatmapFeatureLayer` has been moved to its own repository. https://github.com/Esri/esri-leaflet-heatmap-feature-layer -* An edgecase when converting ArcGIS > GeoJSON has been resolved https://github.com/Esri/esri-leaflet/pull/340 -* `popupOptions` are now properly presvered https://github.com/Esri/esri-leaflet/pull/348 +* An edge case when converting ArcGIS > GeoJSON has been resolved https://github.com/Esri/esri-leaflet/pull/340 +* `popupOptions` are now properly persevered https://github.com/Esri/esri-leaflet/pull/348 * `setStyle` now permanently overrides the style in `options.style`. https://github.com/Esri/esri-leaflet/pull/349 * `setWhere` and `setTimeRange` now take callbacks. https://github.com/Esri/esri-leaflet/pull/354 * You can now abort JSONP requests with request.abort() just like with `XMLHttpRequest`. https://github.com/Esri/esri-leaflet/pull/354 * `returnGeometry` can now be set on `L.esri.Tasks.Query`. https://github.com/Esri/esri-leaflet/pull/358 * a sample.html file was added to help jumpstart debugging local source files. https://github.com/Esri/esri-leaflet/pull/364 -#### Breaking Changes + +### Breaking Changes * Task methods that accept callbacks (like `run` or `bounds`) now return an instance of `XMLHttpRequest` as opposed to the task or service. * `bindPopup` on `L.esri.DynamicMapLayer` now identifies only visible features by default rather then all features. * All API requests inside of layers, tasks and services will now switch between GET and POST automatically when the request size exceeds 2000 characters. This improves IE compatibility but means that for long requests (like complex `where` clauses or long lists of IDs) you may need to setup an instance of https://github.com/Esri/resource-proxy and use the `proxy` option. -#### Changes +### Changes -## Beta 6 +## [Beta 6](v0.0.1-beta.6) -#### Breaking Changes +### Breaking Changes * `L.esri.Tasks.Identify` has been renamed to `L.esri.Tasks.IdentifyFeatures`. This is to reduce confusion with `L.esri.Tasks.IdentifyImage` and to clearly delineate what these 2 classes do. -#### Changes +### Changes * Logo position can now be controlled by using the `logoPosition` option on `L.esri.BasemapLayer` https://github.com/Esri/esri-leaflet/issues/210 * Logo can now be hidden entirely and re-added to the map with the `L.esri.Controls.Logo` class. **If you use Esri map tiles you must display the Esri Logo!** * Fix a regression from Beta 4 where features could not be loaded from ArcGIS Server if they were in non-mercator references. https://github.com/Esri/esri-leaflet/issues/283 https://github.com/Esri/esri-leaflet/pull/322 @@ -179,16 +224,16 @@ None * Support for image services via `L.esri.Layers.ImageMapLayer`. Thanks @rdjurasaj-usgs and @tomwayson * `L.esri.Tasks.IdentifyImage` for identifying images. Thanks @tomwayson. -#### Misc +### Misc * [New example](esri.github.io/esri-leaflet/examples/parse-feature-collection.html) for parsing [Feature Collections](http://resources.arcgis.com/en/help/arcgis-rest-api/#/featureCollection/02r30000003m000000/) from ArcGIS Online. * [New example]() for labeling points with [Leaflet.label](https://github.com/Leaflet/Leaflet.label). * Travis CI is now running tests https://github.com/Esri/esri-leaflet/pull/271 * Build are no longer saved in the `/dist` folder. https://github.com/Esri/esri-leaflet/pull/307 * [Development Roadmap](https://github.com/Esri/esri-leaflet/wiki/Roadmap) has been updated. -## Beta 5 +## [Beta 5](v0.0.1-beta.5) -#### Breaking Changes +### Breaking Changes * `Oceans` no longer contains map labels, labels have been added as another key `OceansLabels`. * `L.esri.FeatureLayer` no longer inherits from `L.GeoJSON` and as a result no longer has `getBounds`, `bringToBack` or `bringToFront` or `addData` methods. @@ -201,12 +246,12 @@ None * You can no longer pass a string for the `layers` option on `L.esri.DynamicMapLayer` you can now only pass an array of layer ids that will be shown like `[0,1,2]`. * The `createMarker` method on `L.esri.ClusteredFeatureLayer` has been renamed to `pointToLayer`. -#### Changes +### Changes * Added `OceansLabels` to `L.esri.BasemapLayer`. * `Oceans` has switched to the new Ocean basemap with out labels. * `L.esri.FeatureLayer` has been refactored into several classes. `L.esri.FeatureGrid` and `L.esri.FeatureManager` now handle loading and querying features from the service. -* `L.esri.ClusteredFeatureLayer` and `L.esri.HeatMapFeatureLayer` now inherit from `L.`L.esri.FeatureManager` so they share many new methods and options. +* `L.esri.ClusteredFeatureLayer` and `L.esri.HeatMapFeatureLayer` now inherit from `L.esri.FeatureManager` so they share many new methods and options. * `L.esri.FeatureLayer`, `L.esri.ClusteredFeatureLayer` and `L.esri.HeatMapFeatureLayer` now support time enabled service via `from`, `to`, `timeFields` and `timeFilterMode` options and `setTimeRange(from, to)` and `getTimeRange()` methods. * `L.esri.FeatureLayer`, `L.esri.ClusteredFeatureLayer` and `L.esri.HeatMapFeatureLayer` now support `where` options and have new methods for `setWhere()` and `getWhere()` to perform filtering. * `L.esri.FeatureLayer` now supports generalizing polygon and polyline features on the service side for performance using the new `simplifyFactor` option. @@ -223,20 +268,20 @@ None * new `L.esri.Tasks.Query` class for interacting with the Feature Layer query API. * new `L.esri.Tasks.Identify` class for interacting with Map Servers that support identify. -## Beta 4 Patch 1 +## [Beta 4 Patch 1](v0.0.1-beta.4-patch-1) -#### Changes +### Changes * Patches a bug with identifying features on DynamicMapLayer * Various updates and fixes to examples -## Beta 4 +## [Beta 4](v0.0.1-beta.4) -#### New Demos +### New Demos * Heat map layer - http://esri.github.io/esri-leaflet/heatmaplayer.html * Geocoder - http://esri.github.io/esri-leaflet/findplaces.html -#### Changes +### Changes * Authentication for ClusteredFeatureLayer https://github.com/Esri/esri-leaflet/commit/d23ddd99ee86bb7255e4d89b6cf3f339a441c88b * Removed Terraformer as a dependency to cut down on build size and complexity. The neccessary Terraformer methods have been ported into L.esri.Util. This cuts a whomping 15kb from the build! @@ -246,10 +291,27 @@ None * Add where and fields options to FeatureLayer and ClusteredFeatureLayer, and HeatmapFeatureLayer * Add bounds property to the metadata event when possible #216 -# Beta 3 +## [Beta 3](v0.0.1-beta.3) * Improve DynamicMapLayer panning and zooming performance. #137 * FeatureLayer and ClusteredFeatureLayer can now load features from map services. Thanks to @odoe and @jgravois. * FeatureLayer, DynamicMapLayer and ClusteredFeatureLayer all accept a token option for accessing services that require authentication and fire a `authenticationrequired` event when they encounter a need for a token. Thanks to @aaronpk for the Oauth demos. #139 * Add DarkGray and DarkGrayLabels to BasemapLayer. #190 * An attributionControl on maps is now required when using BasemapLayer. #159 + +[unreleased]: https://github.com/esri/esri-leaflet/compare/v2.0.0-beta.1...HEAD +[v2.0.0-beta.1]: https://github.com/esri/esri-leaflet/compare/v1.0.0...v2.0.0-beta.1 +[v1.0.0]: https://github.com/esri/esri-leaflet/compare/v1.0.0-rc.8...v1.0.0 +[v1.0.0-rc.8]: https://github.com/esri/esri-leaflet/compare/v1.0.0-rc.7...v1.0.0-rc.8 +[v1.0.0-rc.7]: https://github.com/esri/esri-leaflet/compare/v1.0.0-rc.6...v1.0.0-rc.7 +[v1.0.0-rc.6]: https://github.com/esri/esri-leaflet/compare/v1.0.0-rc.5...v1.0.0-rc.6 +[v1.0.0-rc.5]: https://github.com/esri/esri-leaflet/compare/v1.0.0-rc.4...v1.0.0-rc.5 +[v1.0.0-rc.4]: https://github.com/esri/esri-leaflet/compare/v1.0.0-rc.3...v1.0.0-rc.4 +[v1.0.0-rc.3]: https://github.com/esri/esri-leaflet/compare/v1.0.0-rc.2...v1.0.0-rc.3 +[v1.0.0-rc.2]: https://github.com/esri/esri-leaflet/compare/v1.0.0-rc.1...v1.0.0-rc.2 +[v1.0.0-rc.1]: https://github.com/esri/esri-leaflet/compare/v0.0.1-beta.6...v1.0.0-rc.1 +[v0.0.1-beta.6]: https://github.com/esri/esri-leaflet/compare/v0.0.1-beta.5...v0.0.1-beta.6 +[v0.0.1-beta.5]: https://github.com/esri/esri-leaflet/compare/v0.0.1-beta.4-patch-1...v0.0.1-beta.5 +[v0.0.1-beta.4-patch-1]: https://github.com/esri/esri-leaflet/compare/v0.0.1-beta.4...v0.0.1-beta.4-patch-1 +[v0.0.1-beta.4]: https://github.com/esri/esri-leaflet/compare/v0.0.1-beta.3...v0.0.1-beta.4 +[v0.0.1-beta.3]: https://github.com/esri/esri-leaflet/compare/v0.0.1-beta.2...v0.0.1-beta.3 diff --git a/Gruntfile.js b/Gruntfile.js index 2df7507fa..1df405d33 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,166 +1,10 @@ -var fs = require('fs'); +module.exports = function (grunt) { -module.exports = function(grunt) { - var browsers = grunt.option('browser') ? grunt.option('browser').split(',') : ['PhantomJS']; - - var copyright = '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today(\'yyyy-mm-dd\') %>\n' + - '* Copyright (c) <%= grunt.template.today(\'yyyy\') %> Environmental Systems Research Institute, Inc.\n' + - '* Apache License' + - '*/\n'; - - var umdHeader = '(function (factory) {\n' + - ' //define an AMD module that relies on \'leaflet\'\n' + - ' if (typeof define === \'function\' && define.amd) {\n' + - ' define([\'leaflet\'], function (L) {\n' + - ' return factory(L);\n' + - ' });\n' + - ' //define a common js module that relies on \'leaflet\'\n' + - ' } else if (typeof module === \'object\' && typeof module.exports === \'object\') {\n' + - ' module.exports = factory(require(\'leaflet\'));\n' + - ' }\n\n' + - ' if(typeof window !== \'undefined\' && window.L){\n' + - ' factory(window.L);\n' + - ' }\n' + - '}(function (L) {\n'; - - var umdFooter = '\n\n return EsriLeaflet;\n' + - '}));'; - - var complete = [ - 'src/EsriLeaflet.js', - 'src/Util.js', - 'src/Request.js', - 'src/Services/Service.js', - 'src/Services/FeatureLayerService.js', - 'src/Services/MapService.js', - 'src/Services/ImageService.js', - 'src/Tasks/Task.js', - 'src/Tasks/Query.js', - 'src/Tasks/Find.js', - 'src/Tasks/Identify.js', - 'src/Tasks/IdentifyImage.js', - 'src/Tasks/IdentifyFeatures.js', - 'src/Layers/BasemapLayer.js', - 'src/Layers/RasterLayer.js', - 'src/Layers/DynamicMapLayer.js', - 'src/Layers/ImageMapLayer.js', - 'src/Layers/TiledMapLayer.js', - 'src/Layers/FeatureLayer/FeatureGrid.js', - 'src/Layers/FeatureLayer/FeatureManager.js', - 'src/Layers/FeatureLayer/FeatureLayer.js', - 'src/Controls/Logo.js' - ]; - - var core = [ - 'src/EsriLeaflet.js', - 'src/Util.js', - 'src/Request.js', - 'src/Tasks/Task.js', - 'src/Services/Service.js' - ]; - - var basemaps = [ - 'src/EsriLeaflet.js', - 'src/Request.js', - 'src/Layers/BasemapLayer.js', - 'src/Controls/Logo.js' - ]; - - var mapservice = [ - 'src/EsriLeaflet.js', - 'src/Util.js', - 'src/Request.js', - 'src/Services/Service.js', - 'src/Services/MapService.js', - 'src/Tasks/Task.js', - 'src/Tasks/Identify.js', - 'src/Tasks/IdentifyFeatures.js', - 'src/Tasks/Query.js', - 'src/Tasks/Find.js', - 'src/Layers/RasterLayer.js', - 'src/Layers/DynamicMapLayer.js', - 'src/Layers/TiledMapLayer.js' - ]; - - var imageservice = [ - 'src/EsriLeaflet.js', - 'src/Util.js', - 'src/Request.js', - 'src/Services/Service.js', - 'src/Services/ImageService.js', - 'src/Tasks/Task.js', - 'src/Tasks/Query.js', - 'src/Tasks/Identify.js', - 'src/Tasks/Identify/IdentifyImage.js', - 'src/Layers/RasterLayer.js', - 'src/Layers/ImageMapLayer.js' - ]; - - var featureservice = [ - 'src/EsriLeaflet.js', - 'src/Util.js', - 'src/Request.js', - 'src/Services/Service.js', - 'src/Services/FeatureLayerService.js', - 'src/Tasks/Task.js', - 'src/Tasks/Query.js', - 'src/Layers/FeatureLayer/FeatureGrid.js', - 'src/Layers/FeatureLayer/FeatureManager.js', - 'src/Layers/FeatureLayer/FeatureLayer.js' - ]; - - var customLaunchers = { - sl_chrome: { - base: 'SauceLabs', - browserName: 'chrome', - platform: 'Windows 7', - version: '35' - }, - sl_firefox: { - base: 'SauceLabs', - browserName: 'firefox', - version: '30' - }, - sl_ios_safari: { - base: 'SauceLabs', - browserName: 'iphone', - platform: 'OS X 10.9', - version: '7.1' - }, - sl_ie_11: { - base: 'SauceLabs', - browserName: 'internet explorer', - platform: 'Windows 8.1', - version: '11' - } - }; - - // Project configuration. + // Project configuration grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), - jshint: { - options: { - jshintrc: '.jshintrc' - }, - all: { - src: [ - 'src/**/*.js' - ] - } - }, - watch: { - scripts: { - files: [ - 'src/**/*.js', - 'spec/**/*.js' - ], - tasks: ['jshint'], - options: { - spawn: false - } - }, 'docs-sass': { files: ['site/source/scss/**/*.scss'], tasks: ['sass'], @@ -170,7 +14,7 @@ module.exports = function(grunt) { }, 'docs-js': { files: ['site/source/**/*.js'], - tasks: ['concat', 'uglify', 'copy:assemble'], + tasks: ['copy:assemble'], options: { nospawn: true } @@ -192,103 +36,6 @@ module.exports = function(grunt) { } }, - concurrent: { - options: { - logConcurrentOutput: true - }, - dev: ['watch:scripts', 'karma:watch', 'docs'] - }, - - concat: { - options: { - sourceMap: true, - separator: '\n\n', - banner: copyright + umdHeader, - footer: umdFooter, - }, - complete: { - src: complete, - dest: 'dist/esri-leaflet-src.js' - }, - core: { - src: core, - dest: 'dist/builds/core/esri-leaflet-core-src.js' - }, - basemaps: { - src: basemaps, - dest: 'dist/builds/basemaps/esri-leaflet-basemaps-src.js' - }, - mapservice: { - src: mapservice, - dest: 'dist/builds/map-service/esri-leaflet-map-service-src.js' - }, - imageservice: { - src: imageservice, - dest: 'dist/builds/image-service/esri-leaflet-image-service-src.js' - }, - featureservice: { - src: featureservice, - dest: 'dist/builds/feature-layer/esri-leaflet-feature-layer-src.js' - } - }, - - uglify: { - options: { - sourceMap: true, - sourceMapIncludeSources: true, - wrap: false, - mangle: { - except: ['L'] - }, - preserveComments: 'some', - report: 'gzip', - banner: copyright + umdHeader, - footer: umdFooter, - }, - dist: { - files: { - 'dist/esri-leaflet.js': complete, - 'dist/builds/core/esri-leaflet-core.js': core, - 'dist/builds/basemaps/esri-leaflet-basemaps.js': basemaps, - 'dist/builds/map-service/esri-leaflet-map-service.js': mapservice, - 'dist/builds/image-service/esri-leaflet-image-service.js': imageservice, - 'dist/builds/feature-layer/esri-leaflet-feature-layer.js': featureservice - } - } - }, - - karma: { - options: { - configFile: 'karma.conf.js' - }, - run: { - reporters: ['progress'], - browsers: browsers, - logLevel: 'ERROR' - }, - coverage: { - reporters: ['progress', 'coverage'], - browsers: browsers, - preprocessors: { - 'src/**/*.js': 'coverage' - } - }, - watch: { - singleRun: false, - autoWatch: true, - browsers: browsers - }, - sauce: { - sauceLabs: { - testName: 'Esri Leaflet Unit Tests' - }, - customLaunchers: customLaunchers, - browsers: Object.keys(customLaunchers), - reporters: ['progress', 'saucelabs'], - singleRun: true - } - }, - connect: { server: { options: { @@ -372,33 +119,17 @@ module.exports = function(grunt) { repo: 'git@github.com:Esri/esri-leaflet.git' }, src: ['**'] - }, - - releaseable: { - release: { - options: { - remote: 'upstream', - dryRun: grunt.option('dryRun') ? grunt.option('dryRun') : false, - silent: false - }, - src: [ 'dist/**/*.js','dist/**/*.map' ] - } } }); // Development Tasks - grunt.registerTask('default', ['concurrent:dev']); - grunt.registerTask('build', ['jshint', 'karma:coverage', 'concat', 'uglify']); - grunt.registerTask('test', ['jshint', 'karma:run']); - grunt.registerTask('prepublish', ['concat', 'uglify']); - grunt.registerTask('release', ['releaseable']); - grunt.registerTask('test:sauce', ['karma:sauce']); + grunt.registerTask('default', ['docs']); // Documentation Site Tasks - grunt.registerTask('docs', ['assemble:dev', 'concat', 'uglify', 'sass', 'copy', 'connect:docs', 'watch']); + grunt.registerTask('docs', ['assemble:dev', 'sass', 'copy', 'connect:docs', 'watch']); // Documentation Site Tasks - grunt.registerTask('docs:build', ['assemble:build', 'copy', 'imagemin','sass', 'gh-pages']); + grunt.registerTask('docs:build', ['assemble:build', 'copy', 'imagemin', 'sass', 'gh-pages']); // Require all grunt modules require('load-grunt-tasks')(grunt, {pattern: ['grunt-*', 'assemble']}); diff --git a/bower.json b/bower.json index 006ef5d2d..0da4aaa5e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "esri-leaflet", - "version": "v1.0.0", + "version": "v2.0.0-beta.1", "main": "dist/esri-leaflet.js", "ignore": [ "**/.*", diff --git a/index.js b/index.js new file mode 100644 index 000000000..04e9ae2e6 --- /dev/null +++ b/index.js @@ -0,0 +1,28 @@ +// import base +export { Support, cors, pointerEvents } from './src/Support'; +export { Util, shallowClone, warn, cleanUrl, isArcgisOnline, geojsonTypeToArcGIS, responseToFeatureCollection, geojsonToArcGIS, arcgisToGeojson, boundsToExtent, extentToBounds } from './src/Util'; +export { Request, get, post, request } from './src/Request'; + +// export tasks +export { Task, task } from './src/Tasks/Task'; +export { Query, query } from './src/Tasks/Query'; +export { Find, find } from './src/Tasks/Find'; +export { Identify, identify } from './src/Tasks/Identify'; +export { IdentifyFeatures, identifyFeatures } from './src/Tasks/IdentifyFeatures'; +export { IdentifyImage, identifyImage } from './src/Tasks/IdentifyImage'; + +// export services +export { Service, service } from './src/Services/Service'; +export { MapService, mapService } from './src/Services/MapService'; +export { ImageService, imageService } from './src/Services/ImageService'; +export { FeatureLayerService, featureLayerService } from './src/Services/FeatureLayerService'; + +// export layers +export { BasemapLayer, basemapLayer } from './src/Layers/BasemapLayer'; +export { TiledMapLayer, tiledMapLayer } from './src/Layers/TiledMapLayer'; +export { RasterLayer } from './src/Layers/RasterLayer'; +export { ImageMapLayer, imageMapLayer } from './src/Layers/ImageMapLayer'; +export { DynamicMapLayer, dynamicMapLayer } from './src/Layers/DynamicMapLayer'; +export { FeatureGrid } from './src/Layers/FeatureLayer/FeatureGrid'; +export { FeatureManager } from './src/Layers/FeatureLayer/FeatureManager'; +export { FeatureLayer, featureLayer } from './src/Layers/FeatureLayer/FeatureLayer'; diff --git a/karma.conf.js b/karma.conf.js index 7b34d3276..0c2c7aadf 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,7 +1,7 @@ // Karma configuration // Generated on Fri May 30 2014 15:44:45 GMT-0400 (EDT) -module.exports = function(config) { +module.exports = function (config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) @@ -15,38 +15,8 @@ module.exports = function(config) { files: [ 'node_modules/leaflet/dist/leaflet.css', 'node_modules/leaflet/dist/leaflet-src.js', - 'src/EsriLeaflet.js', - 'src/Util.js', - 'src/Layers/BasemapLayer.js', - 'src/Layers/RasterLayer.js', - 'src/Layers/TiledMapLayer.js', - 'src/Layers/DynamicMapLayer.js', - 'src/Layers/ImageMapLayer.js', - 'src/Layers/FeatureLayer/FeatureGrid.js', - 'src/Layers/FeatureLayer/FeatureManager.js', - 'src/Layers/FeatureLayer/FeatureLayer.js', - 'src/Request.js', - 'src/Services/Service.js', - 'src/Services/FeatureLayerService.js', - 'src/Services/MapService.js', - 'src/Services/ImageService.js', - 'src/Tasks/Task.js', - 'src/Tasks/Query.js', - 'src/Tasks/Identify.js', - 'src/Tasks/IdentifyFeatures.js', - 'src/Tasks/IdentifyImage.js', - 'src/Tasks/Find.js', - 'src/Controls/Logo.js', + 'dist/esri-leaflet-src.js', 'spec/**/*Spec.js' - // 'spec/UtilSpec.js', - // 'spec/RequestSpec.js', - // 'spec/Tasks/*Spec.js', - // 'spec/Services/*Spec.js', - // 'spec/Layers/**/*Spec.js', - - // 'spec/Layers/ImageMapLayerSpec.js', - // 'spec/**/QuerySpec.js', - // 'spec/**/FeatureManagerSpec.js' ], // list of files to exclude @@ -54,12 +24,16 @@ module.exports = function(config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: {}, + // preprocessors: { + // 'dist/**/*.js': ['sourcemap', 'coverage'] + // }, + // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'], + // reporters: ['mocha', 'coverage'], // web server port port: 9876, @@ -77,11 +51,11 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: [ - 'Chrome', + // 'Chrome', // 'ChromeCanary', // 'Firefox', // 'Safari', - // 'PhantomJS' + 'PhantomJS' ], // Continuous Integration mode @@ -89,11 +63,21 @@ module.exports = function(config) { singleRun: true, // Configure the coverage reporters - coverageReporter: { - reporters:[ - {type: 'html', dir:'coverage/'}, - {type: 'text'} - ] - } + // coverageReporter: { + // instrumenters: { + // isparta: require('isparta') + // }, + // instrumenter: { + // 'src/**/*.js': 'isparta' + // }, + // reporters: [ + // { + // type: 'html', + // dir: 'coverage/' + // }, { + // type: 'text' + // } + // ] + // } }); }; diff --git a/package.json b/package.json index c503f3f9a..c329e1a9b 100644 --- a/package.json +++ b/package.json @@ -1,55 +1,90 @@ { "name": "esri-leaflet", - "version": "1.0.0", - "description": "Leaflet plugins for consuming ArcGIS Online and ArcGIS Server services", - "main": "dist/esri-leaflet.js", - "repository": { - "type": "git", - "url": "git@github.com:Esri/esri-leaflet.git" + "description": "Leaflet plugins for consuming ArcGIS Online and ArcGIS Server services.", + "version": "2.0.0-beta.1", + "author": "Patrick Arlt (http://patrickarlt.com)", + "browserify": { + "transform": [ + "babelify" + ] + }, + "bugs": { + "url": "https://github.com/esri/esri-leaflet/issues" + }, + "contributors": [ + "Patrick Arlt (http://patrickarlt.com)", + "John Gravois (http://johngravois.com)" + ], + "dependencies": { + "leaflet": "1.0.0-beta.1" }, "devDependencies": { "assemble": "^0.4.37", + "babelify": "^6.1.3", + "chai": "2.3.0", + "esperanto": "^0.7.3", + "gh-release": "^2.0.0", "grunt": "^0.4.2", "grunt-concurrent": "^0.5.0", - "grunt-contrib-concat": "^0.5.0", "grunt-contrib-connect": "^0.4.1", "grunt-contrib-copy": "^0.5.0", - "grunt-contrib-imagemin": "^0.7.1", - "grunt-contrib-jshint": "^0.10.0", - "grunt-contrib-uglify": "^0.6.0", "grunt-contrib-watch": "^0.6.1", "grunt-gh-pages": "^0.8.1", - "grunt-karma": "^0.8.3", "grunt-newer": "^0.7.0", - "grunt-releaseable": "0.0.16", "grunt-sass": "^1.0.0", "highlight.js": "^8.0.0", + "isparta": "^3.0.3", + "istanbul": "gotwarlost/istanbul.git#source-map", "karma": "^0.12.16", "karma-chai-sinon": "^0.1.3", - "karma-chrome-launcher": "^0.1.3", - "karma-coverage": "^0.1", - "karma-firefox-launcher": "^0.1.3", + "karma-coverage": "douglasduteil/karma-coverage#next", "karma-mocha": "^0.1.0", "karma-mocha-reporter": "^0.2.5", - "karma-phantomjs-launcher": "^0.1.4", - "karma-safari-launcher": "^0.1.1", - "karma-sauce-launcher": "^0.2.10", + "karma-phantomjs-launcher": "^0.2.0", + "karma-sourcemap-loader": "^0.3.5", "load-grunt-tasks": "^0.4.0", - "sinon": "^1.11.1" + "phantomjs": "^1.9.17", + "rollup": "^0.10.0", + "semistandard": "^6.1.2", + "sinon": "^1.11.1", + "sinon-chai": "2.7.0", + "uglify-js": "^2.4.23" }, - "scripts": { - "prepublish": "grunt prepublish", - "start": "grunt dev", - "test": "grunt test" + "homepage": "http://esri.github.io/esri-leaflet", + "jsnext:main": "./index.js", + "jspm": { + "main": "./index.js", + "directories": { + "lib": "./lib" + }, + "registry": "npm", + "format": "es6" }, - "author": "Patrick Arlt (http://patrickarlt.com)", - "contributors": [ - "Patrick Arlt (http://patrickarlt.com)", - "John Gravois (http://johngravois.com)" + "keywords": [ + "arcgis", + "esri", + "esri leaflet", + "gis", + "leaflet plugin", + "mapping" ], "license": "Apache-2.0", + "main": "dist/esri-leaflet.js", "readmeFilename": "README.md", - "dependencies": { - "leaflet": "^0.7.3" + "repository": { + "type": "git", + "url": "git@github.com:Esri/esri-leaflet.git" + }, + "scripts": { + "archive": "zip -r ./dist/esri-leaflet-v$(node --eval \"console.log(require('./package.json').version);\") ./dist/esri-leaflet.js ./dist/esri-leaflet.js.map", + "prerelease": "npm run build", + "release": "gh-release --assets ./dist/esri-leaflet-v$(node --eval \"console.log(require('./package.json').version);\") && npm publish", + "build": "./scripts/build.js", + "postbuild": "npm run archive", + "prepublish": "npm run build", + "start": "grunt", + "lint": "semistandard src/**/*.js", + "pretest": "npm run lint && esperanto -i src/EsriLeaflet.js -o ./dist/esri-leaflet-src.js --skip=leaflet --t umd --strict --name L.esri --bundle", + "test": "karma start" } } diff --git a/scripts/build.js b/scripts/build.js new file mode 100755 index 000000000..a957dbbdf --- /dev/null +++ b/scripts/build.js @@ -0,0 +1,38 @@ +#!/usr/bin/env node + +var esperanto = require('esperanto'); +var path = require('path'); +var minify = require('uglify-js').minify; +var fs = require('fs'); +var pkg = require('../package.json'); + +var copyright = '/*! ' + pkg.name + ' - v' + pkg.version + ' - ' + new Date().toDateString() + '\n' + + '* Copyright (c) ' + new Date().getFullYear() + ' Environmental Systems Research Institute, Inc.\n' + + '* ' + pkg.license + ' ' + + '*/\n'; + +esperanto.bundle({ + entry: path.resolve('src/EsriLeaflet.js'), + skip: ['leaflet'] +}).then(function (bundle) { + var transpiled = bundle.toUmd({ + strict: true, + sourceMap: true, + sourceMapFile: './esri-leaflet-src.js', + name: 'L.esri' + }); + + var compressed = minify(transpiled.code, { + fromString: true, + inSourceMap: JSON.parse(transpiled.map), + outSourceMap: './esri-leaflet.js.map' + }); + + fs.writeFileSync(path.join('dist', 'esri-leaflet.js'), copyright + compressed.code); + fs.writeFileSync(path.join('dist', 'esri-leaflet.js.map'), compressed.map); + process.exit(0); + +}).catch(function (error) { + console.log(error); + process.exit(1); +}); diff --git a/site/source/helpers/param.js b/site/source/helpers/param.js index 7d350aec7..7aa1979b6 100644 --- a/site/source/helpers/param.js +++ b/site/source/helpers/param.js @@ -6,4 +6,4 @@ module.exports.register = function (Handlebars, options) { return '<'+ type +'> ' + name + ''; } }); -}; \ No newline at end of file +}; diff --git a/site/source/helpers/trim.js b/site/source/helpers/trim.js index d144cce4a..f493b52e1 100644 --- a/site/source/helpers/trim.js +++ b/site/source/helpers/trim.js @@ -2,4 +2,4 @@ module.exports.register = function (Handlebars, options) { Handlebars.registerHelper('trim', function (string) { return string.trim(); }); -}; \ No newline at end of file +}; diff --git a/site/source/layouts/example.hbs b/site/source/layouts/example.hbs index d5331aa60..980ed4989 100644 --- a/site/source/layouts/example.hbs +++ b/site/source/layouts/example.hbs @@ -7,7 +7,7 @@ layout: page.hbs

{{ title }}

-

{{{description}}}

+

{{{ description }}}

{{> body }} @@ -21,11 +21,11 @@ layout: page.hbs - - + + - +