diff --git a/package.json b/package.json index a14887f..20c217c 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "node >= 18" ], "scripts": { - "build": "microbundle --format cjs,modern --no-compress --define VERSION=$npm_package_version", - "build:watch": "microbundle watch --format cjs,modern --no-compress --define VERSION=$npm_package_version", + "build": "microbundle --format cjs,modern --no-compress --define __CARTO_API_CLIENT_VERSION=$npm_package_version", + "build:watch": "microbundle watch --format cjs,modern --no-compress --define __CARTO_API_CLIENT_VERSION=$npm_package_version", "dev": "concurrently \"yarn build:watch\" \"vite --config examples/vite.config.ts --open\"", "test": "vitest run --typecheck", "test:watch": "vitest watch --typecheck", diff --git a/src/constants.ts b/src/constants.ts index 2dee990..a64d55c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,3 +1,6 @@ +/** Current version of @carto/api-client. */ +export const API_CLIENT_VERSION = __CARTO_API_CLIENT_VERSION; + /** * Defines a comparator used when matching a column's values against given filter values. * diff --git a/src/global.d.ts b/src/global.d.ts new file mode 100644 index 0000000..0e20f71 --- /dev/null +++ b/src/global.d.ts @@ -0,0 +1,6 @@ +/** + * Injected by microbundle. The `@deck.gl/core` checkVersion() + * function will detect globally-defined 'VERSION' variables, and is inlined + * in the client bundle, so the 'VERSION' name should be avoided. + */ +declare const __CARTO_API_CLIENT_VERSION: string; diff --git a/src/models/model.ts b/src/models/model.ts index 2024aed..ab0c00e 100644 --- a/src/models/model.ts +++ b/src/models/model.ts @@ -1,4 +1,3 @@ -import {getClient} from '../client.js'; import { ApiVersion, DEFAULT_GEO_COLUMN,