From e0c5529878696e42e23fa8384145bcd15619d62a Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Tue, 10 Jul 2018 22:21:48 +0200 Subject: [PATCH 1/5] Merge pull request #8371 from ahocevar/empty-replay-groups Skip rendering when there is no replay group --- src/ol/renderer/canvas/VectorTileLayer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ol/renderer/canvas/VectorTileLayer.js b/src/ol/renderer/canvas/VectorTileLayer.js index b375d83597..afe459dc2a 100644 --- a/src/ol/renderer/canvas/VectorTileLayer.js +++ b/src/ol/renderer/canvas/VectorTileLayer.js @@ -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) { From d1a609e0a388f921ecdd33dda45821d7cc4c0884 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Wed, 11 Jul 2018 09:35:42 +0200 Subject: [PATCH 2/5] Merge pull request #8363 from ahocevar/package-json-autogenerate Autogenerate src/ol/package.json --- .gitignore | 1 + package.json | 10 +++------- src/ol/package.json | 14 -------------- tasks/prepare-package.js | 27 +++++++++++++++++++++++++++ tasks/set-version.js | 23 ----------------------- 5 files changed, 31 insertions(+), 44 deletions(-) delete mode 100644 src/ol/package.json create mode 100644 tasks/prepare-package.js delete mode 100644 tasks/set-version.js diff --git a/.gitignore b/.gitignore index 749803a845..d914ce0fc6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /dist/ node_modules/ src/index.js +src/ol/package.json diff --git a/package.json b/package.json index 4a9d6a27f5..2b2cfd50f7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/ol/package.json b/src/ol/package.json deleted file mode 100644 index c0da2137c2..0000000000 --- a/src/ol/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "ol", - "version": "5.0.2", - "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" - }, - "sideEffects": "false" -} \ No newline at end of file diff --git a/tasks/prepare-package.js b/tasks/prepare-package.js new file mode 100644 index 0000000000..5397b5dc5a --- /dev/null +++ b/tasks/prepare-package.js @@ -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'); diff --git a/tasks/set-version.js b/tasks/set-version.js deleted file mode 100644 index db84c5210a..0000000000 --- a/tasks/set-version.js +++ /dev/null @@ -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'); From 871a28360147001710278142de1170b080ea949f Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Wed, 11 Jul 2018 10:16:45 +0200 Subject: [PATCH 3/5] Merge pull request #8364 from ahocevar/ie-examples Make examples work in IE11 --- examples/webpack/config.js | 12 ++++++++++++ examples/webpack/example-builder.js | 11 +++++------ package.json | 5 +++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/examples/webpack/config.js b/examples/webpack/config.js index 56ec4351e0..d5db5e4ee8 100644 --- a/examples/webpack/config.js +++ b/examples/webpack/config.js @@ -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' diff --git a/examples/webpack/example-builder.js b/examples/webpack/example-builder.js index e4df83ddc8..dd4e299a7e 100644 --- a/examples/webpack/example-builder.js +++ b/examples/webpack/example-builder.js @@ -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) { diff --git a/package.json b/package.json index 2b2cfd50f7..18862958fa 100644 --- a/package.json +++ b/package.json @@ -43,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", @@ -82,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": { From 9cb10efe4bcb7a24d10f05ef2cd7c40484174d4d Mon Sep 17 00:00:00 2001 From: ahocevar Date: Wed, 11 Jul 2018 10:56:05 +0200 Subject: [PATCH 4/5] Changelog for v5.0.3 --- changelog/v5.0.3.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 changelog/v5.0.3.md diff --git a/changelog/v5.0.3.md b/changelog/v5.0.3.md new file mode 100644 index 0000000000..8c4cede69b --- /dev/null +++ b/changelog/v5.0.3.md @@ -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)) From 349e602ee59fa6f8f93a6f869c89a78881b3f51d Mon Sep 17 00:00:00 2001 From: ahocevar Date: Wed, 11 Jul 2018 11:01:34 +0200 Subject: [PATCH 5/5] Update package version to 5.0.3 --- package.json | 2 +- src/ol/util.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 18862958fa..9b28b489a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openlayers", - "version": "5.0.2", + "version": "5.0.3", "description": "OpenLayers mapping library", "keywords": [ "map", diff --git a/src/ol/util.js b/src/ol/util.js index 275da317c6..07395da368 100644 --- a/src/ol/util.js +++ b/src/ol/util.js @@ -52,4 +52,4 @@ export function getUid(obj) { * OpenLayers version. * @type {string} */ -export const VERSION = '5.0.2'; +export const VERSION = '5.0.3';