isard 0.7.0 → 1.0.0
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/CHANGELOG.md +76 -0
- package/dist/basemap.worker.d.ts +7 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +8 -7
- package/dist/basemaps.d.ts +3 -3
- package/dist/basemaps.js +2 -14
- package/dist/basemaps.js.map +1 -1
- package/dist/controls.d.ts +4 -3
- package/dist/controls.js +0 -8
- package/dist/controls.js.map +1 -1
- package/dist/decoder.worker.js +4 -4
- package/dist/decoder.worker.js.map +6 -5
- package/dist/engine-loader.d.ts +12 -5
- package/dist/engine-loader.js +36 -5
- package/dist/engine-loader.js.map +1 -1
- package/dist/geoplateforme.d.ts +51 -1
- package/dist/geoplateforme.js +36 -1
- package/dist/geoplateforme.js.map +1 -1
- package/dist/glyphs.js +2 -1
- package/dist/glyphs.js.map +1 -1
- package/dist/icons.js +5 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +2 -0
- package/dist/interaction.js +29 -2
- package/dist/interaction.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/layers.d.ts +5 -2
- package/dist/layers.js +37 -8
- package/dist/layers.js.map +1 -1
- package/dist/loader.d.ts +2 -0
- package/dist/loader.js +10 -0
- package/dist/loader.js.map +1 -1
- package/dist/map.d.ts +116 -4
- package/dist/map.js +245 -13
- package/dist/map.js.map +1 -1
- package/dist/overlay.d.ts +40 -0
- package/dist/overlay.js +119 -0
- package/dist/overlay.js.map +1 -1
- package/dist/panoramas.d.ts +94 -0
- package/dist/panoramas.js +245 -0
- package/dist/panoramas.js.map +1 -0
- package/dist/pmtiles.js +3 -2
- package/dist/pmtiles.js.map +1 -1
- package/dist/pointclouds.js +1 -1
- package/dist/pointclouds.js.map +1 -1
- package/dist/protocol.d.ts +7 -1
- package/dist/protocol.js.map +1 -1
- package/dist/requests.d.ts +14 -0
- package/dist/requests.js +48 -0
- package/dist/requests.js.map +1 -0
- package/dist/resample.js +2 -1
- package/dist/resample.js.map +1 -1
- package/dist/style.js +1 -0
- package/dist/style.js.map +1 -1
- package/dist/terrain.d.ts +0 -5
- package/dist/terrain.js +2 -1
- package/dist/terrain.js.map +1 -1
- package/dist/types.d.ts +40 -8
- package/dist/types.js.map +1 -1
- package/dist/vectortiles.d.ts +2 -2
- package/dist/vectortiles.js +16 -4
- package/dist/vectortiles.js.map +1 -1
- package/dist/wasm/isard.d.ts +79 -5
- package/dist/wasm/isard.js +165 -7
- package/dist/wasm/isard_core.d.ts +38 -0
- package/dist/wasm/isard_core.js +99 -0
- package/dist/wmts.js +2 -1
- package/dist/wmts.js.map +1 -1
- package/package.json +8 -2
- package/vite.d.ts +17 -0
- package/vite.js +64 -0
package/vite.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Vite plugin of isard: its engines and workers served from one folder, nothing to configure.
|
|
3
|
+
*
|
|
4
|
+
* ```js
|
|
5
|
+
* // vite.config.js
|
|
6
|
+
* import isard from 'isard/vite';
|
|
7
|
+
* export default { plugins: [isard()] };
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* In development the package is left out of Vite's dependency pre-bundling, so that its files are found next to it.
|
|
11
|
+
* In a build its five files (the engines `isard_bg.wasm`, `isard_core_bg.wasm`, `isard_points_bg.wasm`, the workers
|
|
12
|
+
* `decoder.worker.js`, `basemap.worker.js`) are copied to `<outDir>/<folder>/`, and the page tells the maps where they
|
|
13
|
+
* are (`globalThis.isardAssetsUrl`, read as `GeoMapOptions.assetsUrl`).
|
|
14
|
+
*/
|
|
15
|
+
import { readFileSync } from 'node:fs';
|
|
16
|
+
import { fileURLToPath } from 'node:url';
|
|
17
|
+
|
|
18
|
+
const FILES = ['isard_bg.wasm', 'isard_core_bg.wasm', 'isard_points_bg.wasm', 'decoder.worker.js', 'basemap.worker.js'];
|
|
19
|
+
|
|
20
|
+
/** @param {{ folder?: string }} [options] */
|
|
21
|
+
export default function isard(options = {}) {
|
|
22
|
+
const folder = (options.folder ?? 'isard').replace(/^\/+|\/+$/g, '');
|
|
23
|
+
let base = '/';
|
|
24
|
+
let building = false;
|
|
25
|
+
return {
|
|
26
|
+
name: 'isard',
|
|
27
|
+
enforce: 'pre',
|
|
28
|
+
config() {
|
|
29
|
+
return { optimizeDeps: { exclude: ['isard'] } };
|
|
30
|
+
},
|
|
31
|
+
configResolved(config) {
|
|
32
|
+
// The development server serves isard's files from where the package is, linked outside the project too (a
|
|
33
|
+
// workspace, `npm link`): its folder allowed besides the others
|
|
34
|
+
const allow = config.server?.fs?.allow;
|
|
35
|
+
if (Array.isArray(allow)) allow.push(fileURLToPath(new URL('.', import.meta.url)));
|
|
36
|
+
base = config.base.endsWith('/') ? config.base : `${config.base}/`;
|
|
37
|
+
building = config.command === 'build';
|
|
38
|
+
},
|
|
39
|
+
// In a build, the files are found in their folder: their URLs next to the modules are not to be bundled (Vite
|
|
40
|
+
// would copy the engines a second time)
|
|
41
|
+
transform(code, id) {
|
|
42
|
+
if (!building || !/[\\/]isard[\\/]/.test(id) || !code.includes('import.meta.url')) return null;
|
|
43
|
+
const next = code.replace(
|
|
44
|
+
/new URL\((["'`])(?:\.\/)?([\w.-]+\.(?:wasm|js))\1,\s*import\.meta\.url\)/g,
|
|
45
|
+
(_, quote, file) => `new URL(${quote}${file}${quote}, globalThis.isardAssetsUrl ?? location.href)`,
|
|
46
|
+
);
|
|
47
|
+
return next === code ? null : { code: next, map: null };
|
|
48
|
+
},
|
|
49
|
+
generateBundle() {
|
|
50
|
+
for (const file of FILES) {
|
|
51
|
+
const source = readFileSync(new URL(`./dist/${file}`, import.meta.url));
|
|
52
|
+
this.emitFile({ type: 'asset', fileName: `${folder}/${file}`, source });
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
transformIndexHtml() {
|
|
56
|
+
if (!building) return [];
|
|
57
|
+
// A relative base (`./`) resolves against the page
|
|
58
|
+
const url = `${base}${folder}/`;
|
|
59
|
+
return [
|
|
60
|
+
{ tag: 'script', children: `globalThis.isardAssetsUrl=${JSON.stringify(url)};`, injectTo: 'head-prepend' },
|
|
61
|
+
];
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|