From 9132141f5999fa7191755d347c020d8abf0f5773 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 2 Feb 2024 10:01:19 +0100 Subject: [PATCH 1/2] Improve dependencies --- .gitignore | 1 + package-lock.json | 19 +++++++++++-------- package.json | 13 +++++++------ src/MFPEncoder.ts | 4 ++-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 90a29f3..81acaac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ lib/ docs/ +*.tgz diff --git a/package-lock.json b/package-lock.json index cff72d0..1a860e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,22 +8,23 @@ "name": "@geoblocks/mapfishprint", "version": "0.2.1", "license": "BSD-3-Clause", - "dependencies": { - "@babel/parser": "^7.23.9" - }, "devDependencies": { - "@geoblocks/print": "^0.7.4", - "@geoblocks/recast-utils": "^0.1.0", + "@babel/parser": "7.23.9", + "@geoblocks/print": "0.7.4", + "@geoblocks/recast-utils": "0.1.0", "@types/geojson": "7946.0.10", "@typescript-eslint/eslint-plugin": "6.20.0", "eslint": "8.56.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.1.3", - "gh-pages": "^6.1.1", + "gh-pages": "6.1.1", "prettier": "3.2.4", - "typedoc": "^0.25.7", + "typedoc": "0.25.7", "typescript": "5.3.3" }, + "optionalDependencies": { + "@geoblocks/print": "0.7" + }, "peerDependencies": { "ol": "6 || 7 || 8" } @@ -41,6 +42,7 @@ "version": "7.23.9", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "dev": true, "bin": { "parser": "bin/babel-parser.js" }, @@ -2848,7 +2850,8 @@ "@babel/parser": { "version": "7.23.9", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", - "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==" + "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "dev": true }, "@eslint-community/eslint-utils": { "version": "4.4.0", diff --git a/package.json b/package.json index 845d107..6819492 100644 --- a/package.json +++ b/package.json @@ -24,23 +24,24 @@ "start": "npm run prepare && python3 -m http.server --directory demo 12345", "doc": "typedoc --name 'Mapfish Print geoblock' --includeVersion --emit docs --excludeExternals --entryPointStrategy expand ./src" }, - "dependencies": { - "@babel/parser": "^7.23.9" + "optionalDependencies": { + "@geoblocks/print": "0.7" }, "peerDependencies": { "ol": "6 || 7 || 8" }, "devDependencies": { - "@geoblocks/print": "^0.7.4", - "@geoblocks/recast-utils": "^0.1.0", + "@babel/parser": "7.23.9", + "@geoblocks/print": "0.7.4", + "@geoblocks/recast-utils": "0.1.0", "@types/geojson": "7946.0.10", "@typescript-eslint/eslint-plugin": "6.20.0", "eslint": "8.56.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.1.3", - "gh-pages": "^6.1.1", + "gh-pages": "6.1.1", "prettier": "3.2.4", - "typedoc": "^0.25.7", + "typedoc": "0.25.7", "typescript": "5.3.3" } } diff --git a/src/MFPEncoder.ts b/src/MFPEncoder.ts index c7b3f9f..8558618 100644 --- a/src/MFPEncoder.ts +++ b/src/MFPEncoder.ts @@ -28,7 +28,6 @@ import VectorLayer from 'ol/layer/Vector.js'; import VectorEncoder from './VectorEncoder'; import {toContext} from 'ol/render.js'; import VectorSource from 'ol/source/Vector.js'; -import {MVTEncoder} from '@geoblocks/print'; import LayerGroup from 'ol/layer/Group'; import VectorContext from 'ol/render/VectorContext'; @@ -172,7 +171,7 @@ export default class MFPBaseEncoder { const layer = layerState.layer; if (layer instanceof VectorTileLayer) { - return this.encodeMVTLayerState(layerState, printResolution, customizer); + return await this.encodeMVTLayerState(layerState, printResolution, customizer); } if (layer instanceof TileLayer) { @@ -202,6 +201,7 @@ export default class MFPBaseEncoder { customizer: BaseCustomizer, ): Promise { const layer = layerState.layer as VectorTileLayer; + const {MVTEncoder} = await import('@geoblocks/print'); const encoder = new MVTEncoder(); const printExtent = customizer.printExtent; const width = getExtentWidth(printExtent) / printResolution; From ca75e3952197c2b43e354794326d2bc16d9daa3f Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 2 Feb 2024 11:33:28 +0100 Subject: [PATCH 2/2] Remove indirect dependency --- package-lock.json | 1 - package.json | 1 - 2 files changed, 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1a860e8..eab14ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "0.2.1", "license": "BSD-3-Clause", "devDependencies": { - "@babel/parser": "7.23.9", "@geoblocks/print": "0.7.4", "@geoblocks/recast-utils": "0.1.0", "@types/geojson": "7946.0.10", diff --git a/package.json b/package.json index 6819492..c6e4640 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "ol": "6 || 7 || 8" }, "devDependencies": { - "@babel/parser": "7.23.9", "@geoblocks/print": "0.7.4", "@geoblocks/recast-utils": "0.1.0", "@types/geojson": "7946.0.10",