Skip to content

Commit 4dbaa9f

Browse files
committed
Revert to dist build type
The dist-custom-elements build doesn't let us bundle everything into a single script the way we want (consumers would still have to use importmaps, and things get weird). The dist build works correctly, but due to a bug (stenciljs/core#4231), we can't build the deck.gl-based COG viewer. This disables the deck.gl viewer for now so that the package can build.
1 parent 19f6d4e commit 4dbaa9f

4 files changed

Lines changed: 7 additions & 13 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "0.2.0",
44
"description": "A web-based viewer for previewing OpenGeoMetadata records",
55
"main": "dist/index.cjs.js",
6-
"module": "dist/components/index.js",
7-
"types": "dist/components/index.d.ts",
6+
"module": "dist/index.js",
7+
"types": "dist/types/index.d.ts",
88
"collection": "dist/collection/collection-manifest.json",
99
"collection:main": "dist/collection/index.js",
1010
"unpkg": "dist/ogm-viewer/ogm-viewer.esm.js",

src/lib/previewers/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import CogSource from '../sources/cog';
21
import GeoJSONSource from '../sources/geojson';
32
import OpenIndexMapSource from '../sources/openindexmap';
43
import PMTilesSource from '../sources/pmtiles';
54
import Source from '../sources/source';
65
import WmsSource from '../sources/wms';
76

87
import RasterSource from '../sources/raster';
9-
import CogPreviewer from './cog';
108
import GeoJSONPreviewer from './geojson';
119
import MapLibrePreviewer from './maplibre';
1210
import OpenIndexMapPreviewer from './openindexmap';
@@ -17,7 +15,7 @@ import WmsPreviewer from './wms';
1715

1816
// Given a list of sources, return a list of previewers that can be used to preview them on a map
1917
export const getMapPreviewers = async (sources: Source[], map: maplibregl.Map, options: any) => {
20-
const previewers = [] as (MapLibrePreviewer | CogPreviewer)[];
18+
const previewers = [] as MapLibrePreviewer[];
2119

2220
for (const source of sources) {
2321
if (source instanceof OpenIndexMapSource) previewers.push(new OpenIndexMapPreviewer(source, map, options));
@@ -26,7 +24,6 @@ export const getMapPreviewers = async (sources: Source[], map: maplibregl.Map, o
2624
if (await source.isVector()) previewers.push(new PMTilesVectorPreviewer(source, map, options));
2725
else previewers.push(new PMTilesRasterPreviewer(source, map, options));
2826
} else if (source instanceof WmsSource) previewers.push(new WmsPreviewer(source, map, options));
29-
else if (source instanceof CogSource) previewers.push(new CogPreviewer(source, map));
3027
else if (source instanceof RasterSource) previewers.push(new RasterPreviewer(source, map, options));
3128
}
3229

stencil.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export const config: Config = {
77
outputTargets: [
88
// This is the build target used by apps that will consume the viewer.
99
{
10-
type: 'dist-custom-elements',
10+
type: 'dist',
11+
esmLoaderPath: '../loader',
1112
isPrimaryPackageOutputTarget: true,
1213
copy: [{ src: '../assets', dest: 'assets' }],
1314
},

vitest-setup.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// Load Stencil components and register them as custom elements.
2-
import { defineCustomElement as defineOgmMetadata } from './dist/components/ogm-metadata.js';
3-
import { defineCustomElement as defineOgmMenubar } from './dist/components/ogm-menubar.js';
4-
5-
defineOgmMetadata();
6-
defineOgmMenubar();
7-
2+
import { defineCustomElements } from './dist/esm/loader.js';
3+
defineCustomElements();
84
export {};
95

106
// Note: you may need `buildDist: true` in your stencil.config

0 commit comments

Comments
 (0)