Every component is now two modules sharing a basename: - src/elements/leaflet-foo.ts -- `export default class LeafletFooElement extends WithProps(...)`, the class only, no customElements.define, no side effects. src/elements/index.ts is an order-free barrel. - src/components/leaflet-foo.ts -- three lines: import the class, define the tag, re-export. Importing this (or src/index.ts) registers the tag. Plugin authors can now import a class without triggering the built-in define, to subclass it or register it under a different tag name. Package subpath exports `leaflet-components/elements`, `leaflet-components/elements/leaflet-foo.js`, and `leaflet-components/components/leaflet-foo.js` map onto dist/; jsr.json gains an `./elements` entry. The load-bearing ordering moves from the export statements in src/index.ts to its `./components/*` side-effect imports (the elements barrel carries no define, so its order is free). Classes are renamed LeafletFoo -> LeafletFooElement, including in the HTMLElementTagNameMap augmentation. Docs (CLAUDE.md, docs/, README.md) updated for the new layout.
62 lines
1.5 KiB
JSON
62 lines
1.5 KiB
JSON
{
|
|
"name": "leaflet-components",
|
|
"version": "0.1.0",
|
|
"description": "LeafletJS as Web Components",
|
|
"main": "dist/index.js",
|
|
"module": "dist/index.js",
|
|
"types": "dist/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"import": "./dist/index.js"
|
|
},
|
|
"./elements": {
|
|
"types": "./dist/elements/index.d.ts",
|
|
"import": "./dist/elements/index.js"
|
|
},
|
|
"./elements/*.js": {
|
|
"types": "./dist/elements/*.d.ts",
|
|
"import": "./dist/elements/*.js"
|
|
},
|
|
"./components/*.js": {
|
|
"types": "./dist/components/*.d.ts",
|
|
"import": "./dist/components/*.js"
|
|
},
|
|
"./dist/*": "./dist/*",
|
|
"./package.json": "./package.json"
|
|
},
|
|
"sideEffects": true,
|
|
"files": [
|
|
"dist",
|
|
"README.md"
|
|
],
|
|
"scripts": {
|
|
"build": "rm -rf dist && tsc --outDir dist",
|
|
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
"lint": "oxlint src test",
|
|
"format": "oxfmt '*.md' 'docs/**/*.md' 'src/**/*.{ts,js,json,md}' 'test/**/*.ts'",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"prepublishOnly": "npm run build"
|
|
},
|
|
"keywords": [
|
|
"leaflet",
|
|
"web-components",
|
|
"maps"
|
|
],
|
|
"author": "buddy",
|
|
"license": "MIT",
|
|
"type": "module",
|
|
"dependencies": {
|
|
"leaflet": "^1.9.4"
|
|
},
|
|
"devDependencies": {
|
|
"@types/leaflet": "^1.9.21",
|
|
"jsdom": "^30.0.1",
|
|
"oxfmt": "^0.66.0",
|
|
"oxlint": "^1.79.0",
|
|
"typescript": "^7.0.2",
|
|
"vitest": "^4.1.11"
|
|
}
|
|
}
|