From d65c886291f70effd1f73316cd5aee210f26f3d6 Mon Sep 17 00:00:00 2001 From: Jan Hartmann <1107383+janhartmann@users.noreply.github.com> Date: Tue, 24 May 2022 08:48:15 +0400 Subject: [PATCH 1/3] Configurable parameters for build path --- src/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 723c569..3ebdd30 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,18 +10,19 @@ interface VitePluginCesiumOptions { */ rebuildCesium?: boolean; devMinifyCesium?: boolean; + cesiumBuildRootPath?: string; + cesiumBuildPath?: string } function vitePluginCesium( options: VitePluginCesiumOptions = { rebuildCesium: false, - devMinifyCesium: false + devMinifyCesium: false, + cesiumBuildRootPath: 'node_modules/cesium/Build', + cesiumBuildPath: 'node_modules/cesium/Build/Cesium/' } ): Plugin { - const { rebuildCesium, devMinifyCesium } = options; - - const cesiumBuildRootPath = 'node_modules/cesium/Build'; - const cesiumBuildPath = 'node_modules/cesium/Build/Cesium/'; + const { rebuildCesium, devMinifyCesium, cesiumBuildRootPath, cesiumBuildPath } = options; let CESIUM_BASE_URL = 'cesium/'; let outDir = 'dist'; From d26351f1bfb48394250199d963bad711c19a8060 Mon Sep 17 00:00:00 2001 From: Jan Hartmann <1107383+janhartmann@users.noreply.github.com> Date: Tue, 24 May 2022 10:20:36 +0400 Subject: [PATCH 2/3] Fix typings --- src/index.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3ebdd30..c43c335 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,15 +14,13 @@ interface VitePluginCesiumOptions { cesiumBuildPath?: string } -function vitePluginCesium( - options: VitePluginCesiumOptions = { - rebuildCesium: false, - devMinifyCesium: false, - cesiumBuildRootPath: 'node_modules/cesium/Build', - cesiumBuildPath: 'node_modules/cesium/Build/Cesium/' - } -): Plugin { - const { rebuildCesium, devMinifyCesium, cesiumBuildRootPath, cesiumBuildPath } = options; +function vitePluginCesium(options: VitePluginCesiumOptions): Plugin { + const { + rebuildCesium = false, + devMinifyCesium = false, + cesiumBuildRootPath = 'node_modules/cesium/Build', + cesiumBuildPath = 'node_modules/cesium/Build/Cesium/' + } = options; let CESIUM_BASE_URL = 'cesium/'; let outDir = 'dist'; From 0fc7ce0cd079a030db0790a409f581714ae37548 Mon Sep 17 00:00:00 2001 From: Jan Hartmann <1107383+janhartmann@users.noreply.github.com> Date: Tue, 24 May 2022 11:09:21 +0400 Subject: [PATCH 3/3] Ensure default API is preserved --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index c43c335..ee02558 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,7 @@ interface VitePluginCesiumOptions { cesiumBuildPath?: string } -function vitePluginCesium(options: VitePluginCesiumOptions): Plugin { +function vitePluginCesium(options: VitePluginCesiumOptions = {}): Plugin { const { rebuildCesium = false, devMinifyCesium = false,