@india-boundary-corrector/data 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/index.js +15 -0
- package/package.json +1 -1
- package/version.js +1 -1
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -18,6 +18,17 @@ export const layers = {
|
|
|
18
18
|
toDelNe: 'to-del-ne',
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Check if a URL hostname should use CDN fallback.
|
|
23
|
+
* Some CDNs like esm.sh don't host static files, so we need to fall back to unpkg.
|
|
24
|
+
* @param {string} hostname - The hostname to check
|
|
25
|
+
* @returns {boolean} True if CDN fallback should be used
|
|
26
|
+
*/
|
|
27
|
+
export function shouldUseCdnFallback(hostname) {
|
|
28
|
+
// esm.sh doesn't host static files, only transforms JS modules
|
|
29
|
+
return hostname === 'esm.sh';
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
/**
|
|
22
33
|
* Detect the PMTiles URL from various sources:
|
|
23
34
|
* 1. import.meta.url (for ESM bundlers - most reliable)
|
|
@@ -32,6 +43,10 @@ function detectPmtilesUrl() {
|
|
|
32
43
|
try {
|
|
33
44
|
if (typeof import.meta !== 'undefined' && import.meta.url) {
|
|
34
45
|
const moduleUrl = new URL('.', import.meta.url);
|
|
46
|
+
// Some CDNs don't host static files, fall back to unpkg
|
|
47
|
+
if (shouldUseCdnFallback(moduleUrl.hostname)) {
|
|
48
|
+
return DEFAULT_CDN_URL;
|
|
49
|
+
}
|
|
35
50
|
return new URL(PMTILES_FILENAME, moduleUrl).href;
|
|
36
51
|
}
|
|
37
52
|
} catch {
|
package/package.json
CHANGED
package/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated by scripts/generate-version.js - DO NOT EDIT
|
|
2
|
-
export const packageVersion = '0.0.
|
|
2
|
+
export const packageVersion = '0.0.2';
|