Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
349e602ee5 | ||
|
|
9cb10efe4b | ||
|
|
871a283601 | ||
|
|
d1a609e0a3 | ||
|
|
e0c5529878 | ||
|
|
59c3eedbab | ||
|
|
49050063d5 | ||
|
|
11024ad294 | ||
|
|
73f1428701 | ||
|
|
a579b168f7 | ||
|
|
537a21fd48 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
||||
/dist/
|
||||
node_modules/
|
||||
src/index.js
|
||||
src/ol/package.json
|
||||
|
||||
8
changelog/v5.0.1.md
Normal file
8
changelog/v5.0.1.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# 5.0.1
|
||||
|
||||
The v5.0.1 release helps reduce bundle sizes for bundlers that support the `"sideEffects": "false"`option in `package.json`, and fixes website documentation regarding cdn locations and debug build which has been replaced by source maps.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#8341](https://github.com/openlayers/openlayers/pull/8341) - Set sideEffects: false flag ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#8342](https://github.com/openlayers/openlayers/pull/8342) - Fix links and description in quickstart tutorial ([@ahocevar](https://github.com/ahocevar))
|
||||
7
changelog/v5.0.2.md
Normal file
7
changelog/v5.0.2.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# 5.0.2
|
||||
|
||||
The v5.0.1 release updates the package readme with new example projects.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#8332](https://github.com/openlayers/openlayers/pull/8343) - Starter projects ([@tschaub](https://github.com/tschaub))
|
||||
9
changelog/v5.0.3.md
Normal file
9
changelog/v5.0.3.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# 5.0.3
|
||||
|
||||
The v5.0.3 fixes a regression in the vector tile renderer and improves the built examples and release package.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#8364](https://github.com/openlayers/openlayers/pull/8364) - Make examples work in IE11 ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#8363](https://github.com/openlayers/openlayers/pull/8363) - Autogenerate src/ol/package.json ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#8371](https://github.com/openlayers/openlayers/pull/8371) - Skip rendering when there is no replay group ([@ahocevar](https://github.com/ahocevar))
|
||||
@@ -7,6 +7,9 @@ layout: doc.hbs
|
||||
|
||||
This primer shows you how to put a simple map on a web page.
|
||||
|
||||
**For production, we strongly recommend bundling the application together with its dependencies, as explained in the [Building an OpenLayers Application](./tutorials/bundle.html) tutorial.**
|
||||
|
||||
|
||||
## Put a map on a page
|
||||
|
||||
Below you'll find a complete working example. Create a new file, copy in the contents below, and open in a browser:
|
||||
@@ -15,14 +18,14 @@ Below you'll find a complete working example. Create a new file, copy in the co
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://openlayers.org/en/{{ latest }}/css/ol.css" type="text/css">
|
||||
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/{{ latest }}/css/ol.css" type="text/css">
|
||||
<style>
|
||||
.map {
|
||||
height: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<script src="https://openlayers.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
|
||||
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/{{ latest }}/build/ol.js"></script>
|
||||
<title>OpenLayers example</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -56,10 +59,8 @@ To include a map a web page you will need 3 things:
|
||||
|
||||
### Include OpenLayers
|
||||
|
||||
**Caveat:** In production, it is not recommended to include dependencies as script tag. Instead, we recommend bundling the application together with its dependencies, as explained in the [Building an OpenLayers Application](./tutorials/bundle.html) tutorial.
|
||||
|
||||
```xml
|
||||
<script src="https://openlayers.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
|
||||
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/{{ latest }}/build/ol.js"></script>
|
||||
```
|
||||
|
||||
The first part is to include the JavaScript library. For the purpose of this tutorial, here we simply point to the openlayers.org website to get the whole library. In a production environment, we would build a custom version of the library including only the module needed for our application.
|
||||
|
||||
@@ -18,6 +18,18 @@ module.exports = {
|
||||
context: src,
|
||||
target: 'web',
|
||||
entry: entry,
|
||||
module: {
|
||||
rules: [{
|
||||
use: {
|
||||
loader: 'buble-loader'
|
||||
},
|
||||
test: /\.js$/,
|
||||
include: [
|
||||
path.join(__dirname, '..', '..', 'src'),
|
||||
path.join(__dirname, '..')
|
||||
]
|
||||
}]
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: {
|
||||
name: 'common'
|
||||
|
||||
@@ -64,20 +64,20 @@ function createWordIndex(exampleData) {
|
||||
/**
|
||||
* Gets the source for the chunk that matches the jsPath
|
||||
* @param {Object} chunk Chunk.
|
||||
* @param {string} jsPath Path of the file.
|
||||
* @param {string} jsName Name of the file.
|
||||
* @return {string} The source.
|
||||
*/
|
||||
function getJsSource(chunk, jsPath) {
|
||||
function getJsSource(chunk, jsName) {
|
||||
let jsSource;
|
||||
for (let i = 0, ii = chunk.modules.length; i < ii; ++i) {
|
||||
const module = chunk.modules[i];
|
||||
if (module.modules) {
|
||||
jsSource = getJsSource(module, jsPath);
|
||||
jsSource = getJsSource(module, jsName);
|
||||
if (jsSource) {
|
||||
return jsSource;
|
||||
}
|
||||
}
|
||||
if (module.identifier == jsPath) {
|
||||
if (module.identifier.endsWith(jsName)) {
|
||||
return module.source;
|
||||
}
|
||||
}
|
||||
@@ -151,8 +151,7 @@ ExampleBuilder.prototype.render = async function(dir, chunk) {
|
||||
|
||||
// add in script tag
|
||||
const jsName = `${name}.js`;
|
||||
const jsPath = path.join(dir, jsName);
|
||||
let jsSource = getJsSource(chunk, jsPath);
|
||||
let jsSource = getJsSource(chunk, path.join('.', jsName));
|
||||
jsSource = jsSource.replace(/'\.\.\/src\//g, '\'');
|
||||
if (data.cloak) {
|
||||
for (const entry of data.cloak) {
|
||||
|
||||
17
package.json
17
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "openlayers",
|
||||
"version": "5.0.0",
|
||||
"version": "5.0.3",
|
||||
"description": "OpenLayers mapping library",
|
||||
"keywords": [
|
||||
"map",
|
||||
@@ -16,9 +16,9 @@
|
||||
"serve-examples": "webpack-dev-server --config examples/webpack/config.js --mode development --watch",
|
||||
"build-examples": "webpack --config examples/webpack/config.js --mode production",
|
||||
"build-index": "node tasks/generate-index",
|
||||
"set-version": "node tasks/set-version",
|
||||
"prebuild": "npm run set-version && npm run build-index",
|
||||
"prepare": "npm run set-version",
|
||||
"prepare-package": "node tasks/prepare-package",
|
||||
"prebuild": "npm run prepare-package && npm run build-index",
|
||||
"prepare": "npm run prepare-package",
|
||||
"build": "rollup --config config/rollup.js && cleancss --source-map src/ol/ol.css -o build/ol.css",
|
||||
"presrc-closure": "npm run prebuild",
|
||||
"src-closure": "node tasks/transform-types",
|
||||
@@ -35,10 +35,6 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/openlayers/openlayers/issues"
|
||||
},
|
||||
"browser": "dist/ol.js",
|
||||
"style": [
|
||||
"css/ol.css"
|
||||
],
|
||||
"dependencies": {
|
||||
"pbf": "3.1.0",
|
||||
"pixelworks": "1.1.0",
|
||||
@@ -47,6 +43,7 @@
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-plugin-jsdoc-closure": "1.5.1",
|
||||
"buble-loader": "^0.5.1",
|
||||
"chaikin-smooth": "^1.0.4",
|
||||
"clean-css-cli": "4.1.11",
|
||||
"copy-webpack-plugin": "^4.4.1",
|
||||
@@ -86,8 +83,8 @@
|
||||
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||
"url-polyfill": "^1.0.13",
|
||||
"walk": "^2.3.9",
|
||||
"webpack": "4.12.1",
|
||||
"webpack-cli": "^3.0.3",
|
||||
"webpack": "4.15.1",
|
||||
"webpack-cli": "^3.0.8",
|
||||
"webpack-dev-server": "^3.1.4"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
||||
@@ -34,11 +34,9 @@ new Map({
|
||||
|
||||
See the following examples for more detail on bundling OpenLayers with your application:
|
||||
|
||||
* Using [Rollup & Uglify](https://gist.github.com/tschaub/8beb328ea72b36446fc2198d008287de)
|
||||
* Using [Rollup & Closure Compiler](https://gist.github.com/tschaub/32a5692bedac5254da24fa3b12072f35)
|
||||
* Using [Webpack & Uglify](https://gist.github.com/tschaub/79025aef325cd2837364400a105405b8)
|
||||
* Using [Webpack & Closure Compiler](https://gist.github.com/ahocevar/8ceafc6293455ba491dd9be12c15761f)
|
||||
* Using [Browserify & Uglify](https://gist.github.com/tschaub/4bfb209a8f809823f1495b2e4436018e)
|
||||
* Using [Rollup](https://github.com/openlayers/ol-rollup)
|
||||
* Using [Webpack](https://github.com/openlayers/ol-webpack)
|
||||
* Using [Parcel](https://github.com/openlayers/ol-parcel)
|
||||
|
||||
## Module Identifiers
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "ol",
|
||||
"version": "5.0.0",
|
||||
"description": "OpenLayers mapping library",
|
||||
"main": "index.js",
|
||||
"module": "index.js",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"pbf": "3.1.0",
|
||||
"pixelworks": "1.1.0",
|
||||
"rbush": "2.0.2"
|
||||
}
|
||||
}
|
||||
@@ -392,7 +392,9 @@ CanvasVectorTileLayerRenderer.prototype.postCompose = function(context, frameSta
|
||||
continue;
|
||||
}
|
||||
const replayGroup = sourceTile.getReplayGroup(layer, tileCoord.toString());
|
||||
if (renderMode != VectorTileRenderType.VECTOR && !replayGroup.hasReplays(replayTypes)) {
|
||||
if (!replayGroup || !replayGroup.hasReplays(replayTypes)) {
|
||||
// sourceTile was not yet loaded when this.createReplayGroup_() was
|
||||
// called, or it has no replays of the types we want to render
|
||||
continue;
|
||||
}
|
||||
if (!transform) {
|
||||
|
||||
@@ -52,4 +52,4 @@ export function getUid(obj) {
|
||||
* OpenLayers version.
|
||||
* @type {string}
|
||||
*/
|
||||
export const VERSION = '5.0.0';
|
||||
export const VERSION = '5.0.3';
|
||||
|
||||
27
tasks/prepare-package.js
Normal file
27
tasks/prepare-package.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const pkg = require('../package.json');
|
||||
|
||||
const util = require.resolve('../src/ol/util');
|
||||
const lines = fs.readFileSync(util, 'utf-8').split('\n');
|
||||
const versionRegEx = /const VERSION = '(.*)';$/;
|
||||
for (let i = 0, ii = lines.length; i < ii; ++i) {
|
||||
const line = lines[i];
|
||||
if (versionRegEx.test(line)) {
|
||||
lines[i] = line.replace(versionRegEx, `const VERSION = '${pkg.version}';`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(util, lines.join('\n'), 'utf-8');
|
||||
|
||||
const src = path.join('src', 'ol');
|
||||
const packageJson = path.resolve(__dirname, path.join('..', src, 'package.json'));
|
||||
delete pkg.scripts;
|
||||
delete pkg.devDependencies;
|
||||
delete pkg.style;
|
||||
delete pkg.eslintConfig;
|
||||
const main = path.posix.relative(src, require.resolve(path.join('..', pkg.main)));
|
||||
pkg.main = pkg.module = main;
|
||||
pkg.name = 'ol';
|
||||
|
||||
fs.writeFileSync(packageJson, JSON.stringify(pkg, null, 2), 'utf-8');
|
||||
@@ -1,23 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const pkg = require('../package.json');
|
||||
|
||||
const index = require.resolve('../src/ol/util');
|
||||
const lines = fs.readFileSync(index, 'utf-8').split('\n');
|
||||
|
||||
const versionRegEx = /const VERSION = '(.*)';$/;
|
||||
|
||||
for (let i = 0, ii = lines.length; i < ii; ++i) {
|
||||
const line = lines[i];
|
||||
if (versionRegEx.test(line)) {
|
||||
lines[i] = line.replace(versionRegEx, `const VERSION = '${pkg.version}';`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const packageJson = require.resolve('../src/ol/package.json');
|
||||
const packageJsonObj = JSON.parse(fs.readFileSync(packageJson, 'utf-8'));
|
||||
packageJsonObj.version = pkg.version;
|
||||
fs.writeFileSync(packageJson, JSON.stringify(packageJsonObj, null, 2), 'utf-8');
|
||||
|
||||
|
||||
fs.writeFileSync(index, lines.join('\n'), 'utf-8');
|
||||
Reference in New Issue
Block a user