Skip to content

Commit 0e6ed14

Browse files
committed
1 parent d997740 commit 0e6ed14

File tree

9 files changed

+4579
-10423
lines changed

9 files changed

+4579
-10423
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ bundle.js
22
demo-*/package-lock.json
33
demo-*/dist/
44
dist/*
5-
!dist/Control.Geocoder.css
65
docs/
76
node_modules/

package-lock.json

Lines changed: 4498 additions & 10396 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,37 @@
22
"name": "leaflet-control-geocoder",
33
"version": "2.4.0",
44
"description": "Extendable geocoder with builtin support for OpenStreetMap Nominatim, Bing, Google, Mapbox, MapQuest, What3Words, Photon, Pelias, HERE, Neutrino, Plus codes",
5+
"type": "module",
6+
57
"source": "src/index.ts",
6-
"main": "dist/Control.Geocoder.js",
7-
"module": "dist/Control.Geocoder.modern.js",
8+
"main": "dist/Control.Geocoder.umd.js",
9+
"module": "dist/Control.Geocoder.js",
10+
"exports": {
11+
".": {
12+
"import": {
13+
"types": "./dist/index.d.ts",
14+
"default": "./dist/Control.Geocoder.modern.js"
15+
},
16+
"require": {
17+
"types": "./dist/index.d.ts",
18+
"default": "./dist/Control.Geocoder.cjs"
19+
}
20+
},
21+
"./dist/Control.Geocoder.css": "./dist/leaflet-control-geocoder.css",
22+
"./Control.Geocoder.css": "./dist/leaflet-control-geocoder.css",
23+
"./style.css": "./dist/leaflet-control-geocoder.css"
24+
},
825
"types": "dist/index.d.ts",
926
"scripts": {
1027
"prepare": "npm run build",
11-
"build": "npm run build:1 && npm run build:2 && npm run build:3",
12-
"build:1": "microbundle --no-pkg-main --entry src/index.ts --format iife --globals leaflet=L --output dist/Control.Geocoder.js --no-compress",
13-
"build:2": "microbundle --no-pkg-main --entry src/index.ts --format iife --globals leaflet=L --output dist/Control.Geocoder.min.js",
14-
"build:3": "microbundle --no-pkg-main --entry src/index.ts --format modern --output dist/Control.Geocoder.modern.js --no-compress",
28+
"build": "vite build",
1529
"build:demo": "npm run build:demo-esbuild && npm run build:demo-rollup && npm run build:demo-webpack",
1630
"build:demo-esbuild": "cd demo-esbuild && npm install && npm run build",
1731
"build:demo-rollup": "cd demo-rollup && npm install && npm run build",
1832
"build:demo-webpack": "cd demo-rollup && npm install && npm run build",
1933
"changelog": "conventional-changelog --infile CHANGELOG.md --same-file --output-unreleased",
20-
"doc": "typedoc --mode file --excludePrivate --stripInternal --moduleResolution node --out docs/ src/",
21-
"test": "vitest run --dom",
22-
"lint": "eslint --ext .js,.ts ."
34+
"doc": "typedoc --excludePrivate --exclude node_modules/** --out docs/ src/",
35+
"test": "vitest run --dom"
2336
},
2437
"repository": {
2538
"type": "git",
@@ -63,24 +76,21 @@
6376
},
6477
"devDependencies": {
6578
"@types/leaflet": "^1.5.12",
66-
"@typescript-eslint/eslint-plugin": "^4.8.1",
67-
"@typescript-eslint/parser": "^4.8.1",
6879
"conventional-changelog-cli": "^2.1.0",
69-
"eslint": "^6.8.0",
70-
"eslint-plugin-prettier": "^3.1.2",
7180
"happy-dom": "^15.11.7",
7281
"leaflet": "^1.6.0",
73-
"microbundle": "^0.13.0",
7482
"prettier": "^1.19.1",
75-
"tslib": "^1.11.1",
76-
"typedoc": "^0.19.2",
77-
"typescript": "^3.8.3",
83+
"typedoc": "^0.27.5",
84+
"typescript": "^5.7.2",
85+
"vite": "^6.0.3",
86+
"vite-plugin-dts": "^4.3.0",
7887
"vitest": "^2.1.8"
7988
},
8089
"peerDependencies": {
8190
"leaflet": "^1.6.0"
8291
},
8392
"optionalDependencies": {
8493
"open-location-code": "^1.0.0"
85-
}
94+
},
95+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
8696
}

src/control.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ export class GeocoderControl extends EventedControl {
131131
private _alts: HTMLUListElement;
132132
private _container: HTMLDivElement;
133133
private _errorElement: HTMLDivElement;
134-
private _form: HTMLDivElement;
135134
private _geocodeMarker: L.Marker;
136135
private _input: HTMLInputElement;
137136
private _lastGeocode: string;
@@ -171,11 +170,11 @@ export class GeocoderControl extends EventedControl {
171170
const className = 'leaflet-control-geocoder';
172171
const container = L.DomUtil.create('div', className + ' leaflet-bar') as HTMLDivElement;
173172
const icon = L.DomUtil.create('button', className + '-icon', container) as HTMLButtonElement;
174-
const form = (this._form = L.DomUtil.create(
173+
const form = L.DomUtil.create(
175174
'div',
176175
className + '-form',
177176
container
178-
) as HTMLDivElement);
177+
) as HTMLDivElement;
179178

180179
this._map = map;
181180
this._container = container;

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import * as L from 'leaflet';
1010
import { GeocoderControl as Geocoder, geocoder } from './control';
1111
import * as geocoders from './geocoders/index';
12+
import './style.css';
1213

1314
L.Util.extend(Geocoder, geocoders);
1415
export default Geocoder;
File renamed without changes.

src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

tsconfig.json

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
4-
"module": "es2015",
5-
"esModuleInterop": true,
6-
"strict": false
7-
}
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"isolatedModules": true,
13+
"moduleDetection": "force",
14+
"noEmit": true,
15+
16+
/* Linting */
17+
"strict": false,
18+
"noUnusedLocals": true,
19+
"noUnusedParameters": false,
20+
"noFallthroughCasesInSwitch": true,
21+
"noUncheckedSideEffectImports": true
22+
},
23+
"include": ["src"]
824
}

vite.config.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { defineConfig } from 'vite';
2+
import dts from 'vite-plugin-dts';
3+
4+
// https://vite.dev/guide/build.html#library-mode
5+
export default defineConfig({
6+
build: {
7+
lib: {
8+
entry: 'src/index.ts',
9+
name: 'leaflet-control-geocoder',
10+
formats: ['es', 'umd'],
11+
fileName: format =>
12+
({
13+
es: `Control.Geocoder.modern.js`,
14+
umd: `Control.Geocoder.js`
15+
})[format]
16+
},
17+
sourcemap: true,
18+
rollupOptions: {
19+
external: ['leaflet'],
20+
output: {
21+
globals: {
22+
leaflet: 'L'
23+
}
24+
}
25+
}
26+
},
27+
plugins: [dts()]
28+
});

0 commit comments

Comments
 (0)